From 0d16d2456a19eea6129324f4308a3904ec12df49 Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Thu, 22 Jul 2021 12:09:07 -0700 Subject: [PATCH] Report that allocations may have side effects for all types outside of the version bubble Fixes #45628 --- .../JitInterface/CorInfoImpl.ReadyToRun.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs index e3da2dc734fef..6a325a5844c81 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs @@ -1142,6 +1142,10 @@ private CorInfoHelpFunc getNewHelper(ref CORINFO_RESOLVED_TOKEN pResolvedToken, pHasSideEffects = type.HasFinalizer; + // If the type isn't within the version bubble, it could gain a finalizer. Always treat it as if it has a finalizer + if (!pHasSideEffects && !_compilation.NodeFactory.CompilationModuleGroup.VersionsWithType(type)) + pHasSideEffects = true; + return CorInfoHelpFunc.CORINFO_HELP_NEWFAST; }