diff options
author | Sergey <shallowstack@gmail.com> | 2017-09-30 02:16:44 +0300 |
---|---|---|
committer | Sean Gillespie <segilles@microsoft.com> | 2017-09-29 16:16:44 -0700 |
commit | 5b10f0eb85d8e8ccdcf9b5e38e5dd372e241e24e (patch) | |
tree | 33cc1ab7a1ad56da4cc11ce983e0f0a379f9766a /src/vm/arm | |
parent | 32c46737c396afa05ab748fbcc243de7512c11ec (diff) | |
download | coreclr-5b10f0eb85d8e8ccdcf9b5e38e5dd372e241e24e.tar.gz coreclr-5b10f0eb85d8e8ccdcf9b5e38e5dd372e241e24e.tar.bz2 coreclr-5b10f0eb85d8e8ccdcf9b5e38e5dd372e241e24e.zip |
StompWriteBarrier initialization path refactoring (#14105)
* refactored arm, arm64, amd64 and x86 to signal about icache flush and ee restarts
* refactored gc init stage to stomp write barrier (hence flush icache) only once
* review fixes, care taken of icache invalidation during StompResize
* fixed heap boundaries initialization bug introduced after refactoring gc.cpp
* stylistic review fixe
* global variable rename
* global variable rename once more
Diffstat (limited to 'src/vm/arm')
-rw-r--r-- | src/vm/arm/stubs.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/vm/arm/stubs.cpp b/src/vm/arm/stubs.cpp index 4bc1b2c1ea..6d9b3d0dca 100644 --- a/src/vm/arm/stubs.cpp +++ b/src/vm/arm/stubs.cpp @@ -442,15 +442,9 @@ void UpdateGCWriteBarriers(bool postGrow = false) pDesc++; } - - // We've changed code so we must flush the instruction cache. - BYTE *pbAlteredRange; - DWORD cbAlteredRange; - ComputeWriteBarrierRange(&pbAlteredRange, &cbAlteredRange); - FlushInstructionCache(GetCurrentProcess(), pbAlteredRange, cbAlteredRange); } -void StompWriteBarrierResize(bool isRuntimeSuspended, bool bReqUpperBoundsCheck) +int StompWriteBarrierResize(bool isRuntimeSuspended, bool bReqUpperBoundsCheck) { // The runtime is not always suspended when this is called (unlike StompWriteBarrierEphemeral) but we have // no way to update the barrier code atomically on ARM since each 32-bit value we change is loaded over @@ -462,26 +456,36 @@ void StompWriteBarrierResize(bool isRuntimeSuspended, bool bReqUpperBoundsCheck) // suspend/resuming the EE under GC stress will trigger a GC and if we're holding the // GC lock due to allocating a LOH segment it will cause a deadlock so disable it here. GCStressPolicy::InhibitHolder iholder; + int stompWBCompleteActions = SWB_ICACHE_FLUSH; - bool fSuspended = false; if (!isRuntimeSuspended) { ThreadSuspend::SuspendEE(ThreadSuspend::SUSPEND_OTHER); - fSuspended = true; + stompWBCompleteActions |= SWB_EE_RESTART; } UpdateGCWriteBarriers(bReqUpperBoundsCheck); - if (fSuspended) - ThreadSuspend::RestartEE(FALSE, TRUE); + return stompWBCompleteActions; } -void StompWriteBarrierEphemeral(bool isRuntimeSuspended) +int StompWriteBarrierEphemeral(bool isRuntimeSuspended) { UNREFERENCED_PARAMETER(isRuntimeSuspended); _ASSERTE(isRuntimeSuspended); UpdateGCWriteBarriers(); + return SWB_ICACHE_FLUSH; } + +void FlushWriteBarrierInstructionCache() +{ + // We've changed code so we must flush the instruction cache. + BYTE *pbAlteredRange; + DWORD cbAlteredRange; + ComputeWriteBarrierRange(&pbAlteredRange, &cbAlteredRange); + FlushInstructionCache(GetCurrentProcess(), pbAlteredRange, cbAlteredRange); +} + #endif // CROSSGEN_COMPILE #endif // !DACCESS_COMPILE |