From: Steve MacLean Date: Tue, 29 May 2018 17:35:03 +0000 (-0400) Subject: Fix GCStress assertion X-Git-Tag: accepted/tizen/unified/20190422.045933~2047^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=26f72749eda9bc7f800f09218cc04fe991d65dd9;p=platform%2Fupstream%2Fcoreclr.git Fix GCStress assertion --- diff --git a/src/vm/gccover.cpp b/src/vm/gccover.cpp index a604f85..ed7b037 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 70fcb52..16b0334 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(&m_pbSrcCode, pbSrcCode); + VolatileStore(&m_pbDestCode, pbDestCode); } bool HasPendingGCStressInstructionUpdate() { @@ -4838,8 +4838,8 @@ public: LIMITED_METHOD_CONTRACT; PRECONDITION(HasPendingGCStressInstructionUpdate()); - m_pbDestCode = NULL; - m_pbSrcCode = NULL; + VolatileStoreWithoutBarrier(&m_pbDestCode, NULL); + VolatileStore(&m_pbSrcCode, NULL); } #if defined(GCCOVER_TOLERATE_SPURIOUS_AV) void SetLastAVAddress(LPVOID address)