summaryrefslogtreecommitdiff
path: root/src/vm/gcenv.ee.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vm/gcenv.ee.cpp')
-rw-r--r--src/vm/gcenv.ee.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/vm/gcenv.ee.cpp b/src/vm/gcenv.ee.cpp
index 5fe51738d5..8e47caee94 100644
--- a/src/vm/gcenv.ee.cpp
+++ b/src/vm/gcenv.ee.cpp
@@ -454,7 +454,9 @@ DWORD WINAPI BackgroundThreadStub(void* arg)
//
#if defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE)
-inline BOOL ShouldTrackMovementForProfilerOrEtw()
+
+// Tracks all surviving objects (moved or otherwise).
+inline bool ShouldTrackSurvivorsForProfilerOrEtw()
{
#ifdef GC_PROFILING
if (CORProfilerTrackGC())
@@ -468,6 +470,16 @@ inline BOOL ShouldTrackMovementForProfilerOrEtw()
return false;
}
+
+// Only tracks surviving objects in compacting GCs (moved or otherwise).
+inline bool ShouldTrackSurvivorsInCompactingGCsForProfiler()
+{
+#ifdef GC_PROFILING
+ if (CORProfilerTrackGCMovedObjects())
+ return true;
+#endif
+ return false;
+}
#endif // defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE)
void ProfScanRootsHelper(Object** ppObject, ScanContext *pSC, uint32_t dwFlags)
@@ -788,10 +800,11 @@ void WalkMovedReferences(uint8_t* begin, uint8_t* end,
!fBGC);
}
-void GCToEEInterface::DiagWalkSurvivors(void* gcContext)
+void GCToEEInterface::DiagWalkSurvivors(void* gcContext, bool fCompacting)
{
#if defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE)
- if (ShouldTrackMovementForProfilerOrEtw())
+ if (ShouldTrackSurvivorsForProfilerOrEtw() ||
+ (fCompacting && ShouldTrackSurvivorsInCompactingGCsForProfiler()))
{
size_t context = 0;
ETW::GCLog::BeginMovedReferences(&context);
@@ -804,7 +817,7 @@ void GCToEEInterface::DiagWalkSurvivors(void* gcContext)
void GCToEEInterface::DiagWalkLOHSurvivors(void* gcContext)
{
#if defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE)
- if (ShouldTrackMovementForProfilerOrEtw())
+ if (ShouldTrackSurvivorsForProfilerOrEtw())
{
size_t context = 0;
ETW::GCLog::BeginMovedReferences(&context);
@@ -817,7 +830,7 @@ void GCToEEInterface::DiagWalkLOHSurvivors(void* gcContext)
void GCToEEInterface::DiagWalkBGCSurvivors(void* gcContext)
{
#if defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE)
- if (ShouldTrackMovementForProfilerOrEtw())
+ if (ShouldTrackSurvivorsForProfilerOrEtw())
{
size_t context = 0;
ETW::GCLog::BeginMovedReferences(&context);