diff options
author | David Mason <davmason@microsoft.com> | 2018-03-13 01:24:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-13 01:24:20 -0700 |
commit | 8edb3ef2529cc0beb0c034482fdb32fa4c95c606 (patch) | |
tree | 369d8ecf4ca45f42341fc50b750ca7fe13086834 /src/vm/threadsuspend.cpp | |
parent | 0c4344f5a999d817b431b9e3934600ccb97d0e4b (diff) | |
download | coreclr-8edb3ef2529cc0beb0c034482fdb32fa4c95c606.tar.gz coreclr-8edb3ef2529cc0beb0c034482fdb32fa4c95c606.tar.bz2 coreclr-8edb3ef2529cc0beb0c034482fdb32fa4c95c606.zip |
[local gc] refactor apis for threading and suspension to avoid redundant calls in to the runtime (#16765)
* [Local GC] Refactor calls involving thread modes, suspension, and alloc contexts to always operate on current thread
* BOOL -> bool for enable/disable preemptive routines, also remove an unused call to GetThread
* avoid one indirection by having GCToEEInterface::EnablePreemptiveGC return a bool indicating whether the mode was changed
* Callback on IGCHeap for the runtime to notify the GC when it is trapping threads
* use g_fSuspensionPending instead of GCToEEInterface::CatchAtSafePoint for allow_fgc
* Remove CatchAtSafePoint
* Remove GetThread from WaitLongerNoInstru
* code review feedback
* code review feedback
* change BOOL to bool
Diffstat (limited to 'src/vm/threadsuspend.cpp')
-rw-r--r-- | src/vm/threadsuspend.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vm/threadsuspend.cpp b/src/vm/threadsuspend.cpp index 821b6a9c20..12fbc901a9 100644 --- a/src/vm/threadsuspend.cpp +++ b/src/vm/threadsuspend.cpp @@ -3572,6 +3572,7 @@ void ThreadStore::TrapReturningThreads(BOOL yes) FastInterlockIncrement(&g_trtChgStamp); #endif + GCHeapUtilities::GetGCHeap()->SetSuspensionPending(true); FastInterlockIncrement (&g_TrapReturningThreads); #ifdef ENABLE_FAST_GCPOLL_HELPER EnableJitGCPoll(); @@ -3585,10 +3586,15 @@ void ThreadStore::TrapReturningThreads(BOOL yes) else { FastInterlockDecrement (&g_TrapReturningThreads); + GCHeapUtilities::GetGCHeap()->SetSuspensionPending(false); + #ifdef ENABLE_FAST_GCPOLL_HELPER if (0 == g_TrapReturningThreads) + { DisableJitGCPoll(); + } #endif + _ASSERTE(g_TrapReturningThreads >= 0); } #ifdef ENABLE_FAST_GCPOLL_HELPER |