summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mason <davmason@microsoft.com>2018-08-31 03:43:51 -0700
committerGitHub <noreply@github.com>2018-08-31 03:43:51 -0700
commit00a5ee589b565ebcd068c5851315a997848ed98c (patch)
treefab254e167e13c1495642f97f940d99ede11077d
parent6e780ac7dae161bdfd2d561db7995687703d39b2 (diff)
downloadcoreclr-00a5ee589b565ebcd068c5851315a997848ed98c.tar.gz
coreclr-00a5ee589b565ebcd068c5851315a997848ed98c.tar.bz2
coreclr-00a5ee589b565ebcd068c5851315a997848ed98c.zip
[local gc] move DacNotifyGCMarkEnd and AnalyzeSurvivorsRequested to GCToEEInterface (#19774)
-rw-r--r--src/gc/env/gcenv.ee.h3
-rw-r--r--src/gc/gc.cpp40
-rw-r--r--src/gc/gcenv.ee.standalone.inl12
-rw-r--r--src/gc/gcinterface.ee.h6
-rw-r--r--src/gc/sample/gcenv.ee.cpp10
-rw-r--r--src/vm/gcenv.ee.cpp34
-rw-r--r--src/vm/gcenv.ee.h3
-rw-r--r--src/vm/util.cpp2
8 files changed, 71 insertions, 39 deletions
diff --git a/src/gc/env/gcenv.ee.h b/src/gc/env/gcenv.ee.h
index 1fb840d46f..a34d82033d 100644
--- a/src/gc/env/gcenv.ee.h
+++ b/src/gc/env/gcenv.ee.h
@@ -92,6 +92,9 @@ public:
static uint32_t GetIndexOfAppDomainBeingUnloaded();
static uint32_t GetTotalNumSizedRefHandles();
static bool AppDomainIsRudeUnload(void *appDomain);
+
+ static bool AnalyzeSurvivorsRequested(int condemnedGeneration);
+ static void AnalyzeSurvivorsFinished(int condemnedGeneration);
};
#endif // __GCENV_EE_H__
diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp
index edd7d07de0..2f59383ec4 100644
--- a/src/gc/gc.cpp
+++ b/src/gc/gc.cpp
@@ -16293,42 +16293,6 @@ void gc_heap::update_collection_counts ()
}
}
-#ifdef HEAP_ANALYZE
-inline
-BOOL AnalyzeSurvivorsRequested(int condemnedGeneration)
-{
-#ifndef BUILD_AS_STANDALONE
- // Is the list active?
- GcNotifications gn(g_pGcNotificationTable);
- if (gn.IsActive())
- {
- GcEvtArgs gea = { GC_MARK_END, { (1<<condemnedGeneration) } };
- if (gn.GetNotification(gea) != 0)
- {
- return TRUE;
- }
- }
-#endif // BUILD_AS_STANDALONE
- return FALSE;
-}
-
-void DACNotifyGcMarkEnd(int condemnedGeneration)
-{
-#ifndef BUILD_AS_STANDALONE
- // Is the list active?
- GcNotifications gn(g_pGcNotificationTable);
- if (gn.IsActive())
- {
- GcEvtArgs gea = { GC_MARK_END, { (1<<condemnedGeneration) } };
- if (gn.GetNotification(gea) != 0)
- {
- DACNotify::DoGCNotification(gea);
- }
- }
-#endif // BUILD_AS_STANDALONE
-}
-#endif // HEAP_ANALYZE
-
BOOL gc_heap::expand_soh_with_minimal_gc()
{
if ((size_t)(heap_segment_reserved (ephemeral_heap_segment) - heap_segment_allocated (ephemeral_heap_segment)) >= soh_allocation_no_gc)
@@ -16709,7 +16673,7 @@ int gc_heap::garbage_collect (int n)
#ifdef HEAP_ANALYZE
// At this point we've decided what generation is condemned
// See if we've been requested to analyze survivors after the mark phase
- if (AnalyzeSurvivorsRequested(settings.condemned_generation))
+ if (GCToEEInterface::AnalyzeSurvivorsRequested(settings.condemned_generation))
{
heap_analyze_enabled = TRUE;
}
@@ -19729,7 +19693,7 @@ void gc_heap::mark_phase (int condemned_gen_number, BOOL mark_only_p)
{
#ifdef HEAP_ANALYZE
heap_analyze_enabled = FALSE;
- DACNotifyGcMarkEnd(condemned_gen_number);
+ GCToEEInterface::AnalyzeSurvivorsFinished(condemned_gen_number);
#endif // HEAP_ANALYZE
GCToEEInterface::AfterGcScanRoots (condemned_gen_number, max_generation, &sc);
diff --git a/src/gc/gcenv.ee.standalone.inl b/src/gc/gcenv.ee.standalone.inl
index 1aca1dc52c..e2dc2e26b4 100644
--- a/src/gc/gcenv.ee.standalone.inl
+++ b/src/gc/gcenv.ee.standalone.inl
@@ -311,4 +311,16 @@ inline bool GCToEEInterface::AppDomainIsRudeUnload(void *appDomain)
return g_theGCToCLR->AppDomainIsRudeUnload(appDomain);
}
+inline bool GCToEEInterface::AnalyzeSurvivorsRequested(int condemnedGeneration)
+{
+ assert(g_theGCToCLR != nullptr);
+ return g_theGCToCLR->AnalyzeSurvivorsRequested(condemnedGeneration);
+}
+
+inline void GCToEEInterface::AnalyzeSurvivorsFinished(int condemnedGeneration)
+{
+ assert(g_theGCToCLR != nullptr);
+ g_theGCToCLR->AnalyzeSurvivorsFinished(condemnedGeneration);
+}
+
#endif // __GCTOENV_EE_STANDALONE_INL__
diff --git a/src/gc/gcinterface.ee.h b/src/gc/gcinterface.ee.h
index ae887e6f55..ede06a6d21 100644
--- a/src/gc/gcinterface.ee.h
+++ b/src/gc/gcinterface.ee.h
@@ -427,6 +427,12 @@ public:
virtual
bool AppDomainIsRudeUnload(void *appDomain) = 0;
+
+ virtual
+ bool AnalyzeSurvivorsRequested(int condemnedGeneration) = 0;
+
+ virtual
+ void AnalyzeSurvivorsFinished(int condemnedGeneration) = 0;
};
#endif // _GCINTERFACE_EE_H_
diff --git a/src/gc/sample/gcenv.ee.cpp b/src/gc/sample/gcenv.ee.cpp
index a705ae2484..3e9ed3bb23 100644
--- a/src/gc/sample/gcenv.ee.cpp
+++ b/src/gc/sample/gcenv.ee.cpp
@@ -371,3 +371,13 @@ bool GCToEEInterface::AppDomainIsRudeUnload(void *appDomain)
{
return false;
}
+
+inline bool GCToEEInterface::AnalyzeSurvivorsRequested(int condemnedGeneration)
+{
+ return false;
+}
+
+inline void GCToEEInterface::AnalyzeSurvivorsFinished(int condemnedGeneration)
+{
+
+}
diff --git a/src/vm/gcenv.ee.cpp b/src/vm/gcenv.ee.cpp
index 41daaff18f..3dd22dafdf 100644
--- a/src/vm/gcenv.ee.cpp
+++ b/src/vm/gcenv.ee.cpp
@@ -1475,3 +1475,37 @@ bool GCToEEInterface::AppDomainIsRudeUnload(void *appDomain)
AppDomain *realPtr = static_cast<AppDomain *>(appDomain);
return realPtr->IsRudeUnload() != FALSE;
}
+
+bool GCToEEInterface::AnalyzeSurvivorsRequested(int condemnedGeneration)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ // Is the list active?
+ GcNotifications gn(g_pGcNotificationTable);
+ if (gn.IsActive())
+ {
+ GcEvtArgs gea = { GC_MARK_END, { (1<<condemnedGeneration) } };
+ if (gn.GetNotification(gea) != 0)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void GCToEEInterface::AnalyzeSurvivorsFinished(int condemnedGeneration)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ // Is the list active?
+ GcNotifications gn(g_pGcNotificationTable);
+ if (gn.IsActive())
+ {
+ GcEvtArgs gea = { GC_MARK_END, { (1<<condemnedGeneration) } };
+ if (gn.GetNotification(gea) != 0)
+ {
+ DACNotify::DoGCNotification(gea);
+ }
+ }
+}
diff --git a/src/vm/gcenv.ee.h b/src/vm/gcenv.ee.h
index ca32cecf0b..cfeb425ce6 100644
--- a/src/vm/gcenv.ee.h
+++ b/src/vm/gcenv.ee.h
@@ -70,6 +70,9 @@ public:
uint32_t GetIndexOfAppDomainBeingUnloaded();
uint32_t GetTotalNumSizedRefHandles();
bool AppDomainIsRudeUnload(void *appDomain);
+
+ bool AnalyzeSurvivorsRequested(int condemnedGeneration);
+ void AnalyzeSurvivorsFinished(int condemnedGeneration);
};
} // namespace standalone
diff --git a/src/vm/util.cpp b/src/vm/util.cpp
index b4b725e525..9b18764ecc 100644
--- a/src/vm/util.cpp
+++ b/src/vm/util.cpp
@@ -2964,7 +2964,7 @@ void DACNotify::DoGCNotification(const GcEvtArgs& args)
NOTHROW;
GC_NOTRIGGER;
SO_INTOLERANT;
- MODE_PREEMPTIVE;
+ MODE_COOPERATIVE;
}
CONTRACTL_END;