summaryrefslogtreecommitdiff
path: root/src/vm
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2015-12-08 17:14:16 -0800
committerJan Kotas <jkotas@microsoft.com>2015-12-08 17:14:16 -0800
commit8058b6ab287d6b93b975d951384209b5fd0173eb (patch)
tree9f8249cce7ac1c6c7a08182cd6fc075f50e119ea /src/vm
parent81a569b456cb74c491bbfd18d882ddc00ab6ecd9 (diff)
downloadcoreclr-8058b6ab287d6b93b975d951384209b5fd0173eb.tar.gz
coreclr-8058b6ab287d6b93b975d951384209b5fd0173eb.tar.bz2
coreclr-8058b6ab287d6b93b975d951384209b5fd0173eb.zip
Fix build breaks after GC update
Diffstat (limited to 'src/vm')
-rw-r--r--src/vm/gcenv.cpp64
-rw-r--r--src/vm/gcenv.h9
2 files changed, 52 insertions, 21 deletions
diff --git a/src/vm/gcenv.cpp b/src/vm/gcenv.cpp
index 5188e424e8..99880b54a1 100644
--- a/src/vm/gcenv.cpp
+++ b/src/vm/gcenv.cpp
@@ -466,23 +466,11 @@ VOID GCToEEInterface::AfterGcScanRoots (int condemned, int max_gen,
#endif // FEATURE_COMINTEROP
}
-void GCToEEInterface::ScanStaticGCRefsOpportunistically(promote_func* fn, ScanContext* sc)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- SystemDomain::EnumAllStaticGCRefs(fn, sc);
-}
-
/*
* Scan all stack roots
*/
-VOID GCToEEInterface::ScanStackRoots(Thread * pThread, promote_func* fn, ScanContext* sc)
+static void ScanStackRoots(Thread * pThread, promote_func* fn, ScanContext* sc)
{
GCCONTEXT gcctx;
@@ -557,6 +545,40 @@ VOID GCToEEInterface::ScanStackRoots(Thread * pThread, promote_func* fn, ScanCon
}
}
+void GCToEEInterface::GcScanRoots(promote_func* fn, int condemned, int max_gen, ScanContext* sc)
+{
+ STRESS_LOG1(LF_GCROOTS, LL_INFO10, "GCScan: Promotion Phase = %d\n", sc->promotion);
+
+ // In server GC, we should be competing for marking the statics
+ if (GCHeap::MarkShouldCompeteForStatics())
+ {
+ if (condemned == max_gen && sc->promotion)
+ {
+ SystemDomain::EnumAllStaticGCRefs(fn, sc);
+ }
+ }
+
+ Thread* pThread = NULL;
+ while ((pThread = ThreadStore::GetThreadList(pThread)) != NULL)
+ {
+ STRESS_LOG2(LF_GC | LF_GCROOTS, LL_INFO100, "{ Starting scan of Thread %p ID = %x\n", pThread, pThread->GetThreadId());
+
+ if (GCHeap::GetGCHeap()->IsThreadUsingAllocationContextHeap(
+ GCToEEInterface::GetAllocContext(pThread), sc->thread_number))
+ {
+ sc->thread_under_crawl = pThread;
+#ifdef FEATURE_EVENT_TRACE
+ sc->dwEtwRootKind = kEtwGCRootKindStack;
+#endif // FEATURE_EVENT_TRACE
+ ScanStackRoots(pThread, fn, sc);
+#ifdef FEATURE_EVENT_TRACE
+ sc->dwEtwRootKind = kEtwGCRootKindOther;
+#endif // FEATURE_EVENT_TRACE
+ }
+ STRESS_LOG2(LF_GC | LF_GCROOTS, LL_INFO100, "Ending scan of Thread %p ID = 0x%x }\n", pThread, pThread->GetThreadId());
+ }
+}
+
void GCToEEInterface::GcStartWork (int condemned, int max_gen)
{
CONTRACTL
@@ -689,8 +711,18 @@ bool GCToEEInterface::CatchAtSafePoint(Thread * pThread)
return !!pThread->CatchAtSafePoint();
}
-Thread * GCToEEInterface::GetThreadList(Thread * pThread)
+void GCToEEInterface::GcEnumAllocContexts(enum_alloc_context_func* fn, void* param)
{
- WRAPPER_NO_CONTRACT;
- return ThreadStore::GetThreadList(pThread);
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ Thread * pThread = NULL;
+ while ((pThread = ThreadStore::GetThreadList(pThread)) != NULL)
+ {
+ fn(pThread->GetAllocContext(), param);
+ }
}
diff --git a/src/vm/gcenv.h b/src/vm/gcenv.h
index 93d41850a7..73e65852a7 100644
--- a/src/vm/gcenv.h
+++ b/src/vm/gcenv.h
@@ -51,6 +51,8 @@ class CrawlFrame;
typedef void promote_func(PTR_PTR_Object, ScanContext*, uint32_t);
+typedef void enum_alloc_context_func(alloc_context*, void*);
+
typedef struct
{
promote_func* f;
@@ -77,10 +79,7 @@ public:
//
// The GC roots enumeration callback
//
- static void ScanStackRoots(Thread * pThread, promote_func* fn, ScanContext* sc);
-
- // Optional static GC refs scanning for better parallelization of server GC marking
- static void ScanStaticGCRefsOpportunistically(promote_func* fn, ScanContext* sc);
+ static void GcScanRoots(promote_func* fn, int condemned, int max_gen, ScanContext* sc);
//
// Callbacks issues during GC that the execution engine can do its own bookeeping
@@ -130,7 +129,7 @@ public:
static alloc_context * GetAllocContext(Thread * pThread);
static bool CatchAtSafePoint(Thread * pThread);
- static Thread * GetThreadList(Thread * pThread);
+ static void GcEnumAllocContexts(enum_alloc_context_func* fn, void* param);
};
#define GCMemoryStatus MEMORYSTATUSEX