From f16965aad43eb2b4f4eb819df09dd6d6b8bd22fd Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Thu, 23 Jul 2026 11:13:50 -0700 Subject: [PATCH] Enable R2R runtime lookup for unresolved static virtual calls --- .../JitInterface/CorInfoImpl.ReadyToRun.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 69af35cc9ad8b1..03f28495e42d29 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs @@ -2324,16 +2324,15 @@ private void ceeInfoGetCallInfo( { if (pResult->exactContextNeedsRuntimeLookup) { - throw new RequiresRuntimeJitException("EmbedGenericHandle currently doesn't support propagation of RUNTIME_LOOKUP or pConstrainedResolvedToken from ComputeRuntimeLookupForSharedGenericToken"); - // ComputeRuntimeLookupForSharedGenericToken(DictionaryEntryKind.DispatchStubAddrSlot, ref pResolvedToken, pConstrainedResolvedToken, originalMethod, ref pResult->codePointerOrStubLookup); - // useInstantiatingStub = false; + pResult->kind = CORINFO_CALL_KIND.CORINFO_CALL_CODE_POINTER; + ComputeRuntimeLookupForSharedGenericToken(DictionaryEntryKind.ConstrainedMethodEntrySlot, ref pResolvedToken, pConstrainedResolvedToken, originalMethod, HandleToObject(callerHandle), ref pResult->codePointerOrStubLookup); + useInstantiatingStub = true; } else { throw new RequiresRuntimeJitException("CanInline currently doesn't support propagation of constrained type so that we cannot reliably tell whether a SVM call can be inlined"); // Even if we decided to support SVMs unresolved at compile time, we'd still need to force the use of instantiating stub // as we can't tell in advance whether the method will be runtime-resolved to a canonical representation. - // useInstantiatingStub = true; } } }