Replace assert in Precode::SetTargetInterlocked (#20007)
authorKoundinya Veluri <kouvel@users.noreply.github.com>
Wed, 19 Sep 2018 10:30:01 +0000 (03:30 -0700)
committerGitHub <noreply@github.com>
Wed, 19 Sep 2018 10:30:01 +0000 (03:30 -0700)
Fixes https://github.com/dotnet/coreclr/issues/19954
- `SetTargetInterlocked` can be soon followed by `ResetTargetInterlocked`, so the assert at the end of `SetTargetInterlocked` is invalid
- Removed the assert and instead just verified that the specified target is not the default prestub target

src/vm/precode.cpp

index e47e7a7..7b4c1de 100644 (file)
@@ -456,6 +456,7 @@ void Precode::ResetTargetInterlocked()
 BOOL Precode::SetTargetInterlocked(PCODE target, BOOL fOnlyRedirectFromPrestub)
 {
     WRAPPER_NO_CONTRACT;
+    _ASSERTE(!IsPointingToPrestub(target));
 
     PCODE expected = GetTarget();
     BOOL ret = FALSE;
@@ -498,7 +499,6 @@ BOOL Precode::SetTargetInterlocked(PCODE target, BOOL fOnlyRedirectFromPrestub)
     // Although executable code is modified on x86/x64, a FlushInstructionCache() is not necessary on those platforms due to the
     // interlocked operation above (see ClrFlushInstructionCache())
 
-    _ASSERTE(!IsPointingToPrestub());
     return ret;
 }