summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2015-10-13 00:55:35 +0200
committerJan Vorlicek <janvorli@microsoft.com>2015-10-13 00:55:35 +0200
commit1f43da21666a3310b478917e0e1d888913dfcca3 (patch)
tree17944be448b0b4dac5018c44d172b2327a64f51e /src
parent9237f3722e767c282981990be8bd47ef188cc917 (diff)
parentd6a18e3e12074fad765ed1ba055ef3861f85efaf (diff)
downloadcoreclr-1f43da21666a3310b478917e0e1d888913dfcca3.tar.gz
coreclr-1f43da21666a3310b478917e0e1d888913dfcca3.tar.bz2
coreclr-1f43da21666a3310b478917e0e1d888913dfcca3.zip
Merge pull request #1749 from janvorli/improve-frame-destructor
Improve frame destructor performance
Diffstat (limited to 'src')
-rw-r--r--src/vm/frames.cpp18
-rw-r--r--src/vm/frames.h1
2 files changed, 12 insertions, 7 deletions
diff --git a/src/vm/frames.cpp b/src/vm/frames.cpp
index dca4fe2ee7..1c7f2f4348 100644
--- a/src/vm/frames.cpp
+++ b/src/vm/frames.cpp
@@ -477,18 +477,22 @@ VOID Frame::Pop(Thread *pThread)
(*m_Next->GetGSCookiePtr() == GetProcessGSCookie()));
pThread->SetFrame(m_Next);
+ m_Next = NULL;
}
#ifdef FEATURE_PAL
Frame::~Frame()
{
- // When the frame is destroyed, make sure it is no longer in the
- // frame chain managed by the Thread.
- Thread* pThread = GetThread();
- if (pThread != NULL && pThread->GetFrame() == this)
- {
- Pop(pThread);
- }
+ if (m_Next != NULL)
+ {
+ // When the frame is destroyed, make sure it is no longer in the
+ // frame chain managed by the Thread.
+ Thread* pThread = GetThread();
+ if (pThread != NULL && pThread->GetFrame() == this)
+ {
+ Pop(pThread);
+ }
+ }
}
#endif // FEATURE_PAL
diff --git a/src/vm/frames.h b/src/vm/frames.h
index 32bd3188af..4c4331403b 100644
--- a/src/vm/frames.h
+++ b/src/vm/frames.h
@@ -845,6 +845,7 @@ protected:
// Frame is considered an abstract class: this protected constructor
// causes any attempt to instantiate one to fail at compile-time.
Frame()
+ : m_Next(dac_cast<PTR_Frame>(nullptr))
{
LIMITED_METHOD_CONTRACT;
}