From 9e1963c7db086d50d2a653ad5883c134ed1cbedd Mon Sep 17 00:00:00 2001 From: Koundinya Veluri Date: Mon, 21 Nov 2022 15:51:12 -0800 Subject: [PATCH] [7.0] Fix the tiering delay to account for changing IL/native code versions during the delay - Port of https://github.com/dotnet/runtime/pull/78668 - Added a check to see if the currently active native code version has a code entry point Fixes https://github.com/dotnet/runtime/issues/77973 --- src/coreclr/vm/tieredcompilation.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/coreclr/vm/tieredcompilation.cpp b/src/coreclr/vm/tieredcompilation.cpp index 4e4da913e8664..cf93435a07160 100644 --- a/src/coreclr/vm/tieredcompilation.cpp +++ b/src/coreclr/vm/tieredcompilation.cpp @@ -593,10 +593,17 @@ bool TieredCompilationManager::TryDeactivateTieringDelay() continue; } + PCODE codeEntryPoint = activeCodeVersion.GetNativeCode(); + if (codeEntryPoint == NULL) + { + // The active IL/native code version has changed since the method was queued, and the currently active version + // doesn't have a code entry point yet + continue; + } + EX_TRY { - bool wasSet = - CallCountingManager::SetCodeEntryPoint(activeCodeVersion, activeCodeVersion.GetNativeCode(), false, nullptr); + bool wasSet = CallCountingManager::SetCodeEntryPoint(activeCodeVersion, codeEntryPoint, false, nullptr); _ASSERTE(wasSet); } EX_CATCH