diff options
author | Bruce Forstall <brucefo@microsoft.com> | 2018-05-30 15:21:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-30 15:21:27 -0700 |
commit | aa100c5945134260010be0d41e95ad5b05eabebf (patch) | |
tree | 7873f370016ae500755603ba7c615653b03b762e /src/vm | |
parent | 86c438de4043359942f3e0f46c55fdaa98dc5b2f (diff) | |
parent | 26f72749eda9bc7f800f09218cc04fe991d65dd9 (diff) | |
download | coreclr-aa100c5945134260010be0d41e95ad5b05eabebf.tar.gz coreclr-aa100c5945134260010be0d41e95ad5b05eabebf.tar.bz2 coreclr-aa100c5945134260010be0d41e95ad5b05eabebf.zip |
Merge pull request #18173 from sdmaclea/PR-FIX-GCSTRESS-ASSERTION
Fix GCStress assertion
Diffstat (limited to 'src/vm')
-rw-r--r-- | src/vm/gccover.cpp | 7 | ||||
-rw-r--r-- | src/vm/threads.h | 8 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/vm/gccover.cpp b/src/vm/gccover.cpp index a604f857df..ed7b037d92 100644 --- a/src/vm/gccover.cpp +++ b/src/vm/gccover.cpp @@ -1728,7 +1728,12 @@ void DoGcStress (PCONTEXT regs, MethodDesc *pMD) // BUG(github #10318) - when not using allocation contexts, the alloc lock // must be acquired here. Until fixed, this assert prevents random heap corruption. assert(GCHeapUtilities::UseThreadAllocationContexts()); - if (!GCHeapUtilities::GetGCHeap()->StressHeap(GetThread()->GetAllocContext())) + GCHeapUtilities::GetGCHeap()->StressHeap(GetThread()->GetAllocContext()); + + // StressHeap can exit early w/o forcing a SuspendEE to trigger the instruction update + // We can not rely on the return code to determine if the instruction update happened + // Use HasPendingGCStressInstructionUpdate() to be certain. + if(pThread->HasPendingGCStressInstructionUpdate()) UpdateGCStressInstructionWithoutGC (); // Must flush instruction cache before returning as instruction has been modified. diff --git a/src/vm/threads.h b/src/vm/threads.h index 637d3baa00..769378338a 100644 --- a/src/vm/threads.h +++ b/src/vm/threads.h @@ -4824,8 +4824,8 @@ public: LIMITED_METHOD_CONTRACT; PRECONDITION(!HasPendingGCStressInstructionUpdate()); - m_pbDestCode = pbDestCode; - m_pbSrcCode = pbSrcCode; + VolatileStoreWithoutBarrier<BYTE*>(&m_pbSrcCode, pbSrcCode); + VolatileStore<BYTE*>(&m_pbDestCode, pbDestCode); } bool HasPendingGCStressInstructionUpdate() { @@ -4838,8 +4838,8 @@ public: LIMITED_METHOD_CONTRACT; PRECONDITION(HasPendingGCStressInstructionUpdate()); - m_pbDestCode = NULL; - m_pbSrcCode = NULL; + VolatileStoreWithoutBarrier<BYTE*>(&m_pbDestCode, NULL); + VolatileStore<BYTE*>(&m_pbSrcCode, NULL); } #if defined(GCCOVER_TOLERATE_SPURIOUS_AV) void SetLastAVAddress(LPVOID address) |