[local gc] move DacNotifyGCMarkEnd and AnalyzeSurvivorsRequested to GCToEEInterface...
authorDavid Mason <davmason@microsoft.com>
Fri, 31 Aug 2018 10:43:51 +0000 (03:43 -0700)
committerGitHub <noreply@github.com>
Fri, 31 Aug 2018 10:43:51 +0000 (03:43 -0700)
src/gc/env/gcenv.ee.h
src/gc/gc.cpp
src/gc/gcenv.ee.standalone.inl
src/gc/gcinterface.ee.h
src/gc/sample/gcenv.ee.cpp
src/vm/gcenv.ee.cpp
src/vm/gcenv.ee.h
src/vm/util.cpp

index 1fb840d..a34d820 100644 (file)
@@ -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__
index edd7d07..2f59383 100644 (file)
@@ -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);
 
index 1aca1dc..e2dc2e2 100644 (file)
@@ -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__
index ae887e6..ede06a6 100644 (file)
@@ -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_
index a705ae2..3e9ed3b 100644 (file)
@@ -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)
+{
+    
+}
index 41daaff..3dd22da 100644 (file)
@@ -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);
+        }
+    }
+}
index ca32cec..cfeb425 100644 (file)
@@ -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
index b4b725e..9b18764 100644 (file)
@@ -2964,7 +2964,7 @@ void DACNotify::DoGCNotification(const GcEvtArgs& args)
         NOTHROW;
         GC_NOTRIGGER;
         SO_INTOLERANT;
-        MODE_PREEMPTIVE;
+        MODE_COOPERATIVE;
     }
     CONTRACTL_END;