// 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.
LIMITED_METHOD_CONTRACT;
PRECONDITION(!HasPendingGCStressInstructionUpdate());
- m_pbDestCode = pbDestCode;
- m_pbSrcCode = pbSrcCode;
+ VolatileStoreWithoutBarrier<BYTE*>(&m_pbSrcCode, pbSrcCode);
+ VolatileStore<BYTE*>(&m_pbDestCode, pbDestCode);
}
bool HasPendingGCStressInstructionUpdate()
{
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)