Fix the tiering delay to account for changing IL/native code versions during the...
authorKoundinya Veluri <kouvel@users.noreply.github.com>
Wed, 23 Nov 2022 05:21:28 +0000 (21:21 -0800)
committerGitHub <noreply@github.com>
Wed, 23 Nov 2022 05:21:28 +0000 (21:21 -0800)
- 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

index dcff504..fed0faa 100644 (file)
@@ -639,10 +639,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