diff --git a/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.Intrinsics.cs b/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.Intrinsics.cs index a0538e9063fdf..30bc7f772362b 100644 --- a/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.Intrinsics.cs +++ b/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.Intrinsics.cs @@ -164,7 +164,7 @@ static IntrinsicHashtable InitializeIntrinsicHashtable() table.Add(CorInfoIntrinsics.CORINFO_INTRINSIC_GetRawHandle, "AllocatorOf", "System", "Activator"); // If this assert fails, make sure to add the new intrinsics to the table above and update the expected count below. - Debug.Assert((int)CorInfoIntrinsics.CORINFO_INTRINSIC_Count == 55, "Please update intrinsic hash table"); + Debug.Assert((int)CorInfoIntrinsics.CORINFO_INTRINSIC_Count == 56, "Please update intrinsic hash table"); return table; } diff --git a/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRunCodegenNodeFactory.cs b/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRunCodegenNodeFactory.cs index e4b76f79f6278..94d23c81d8e8b 100644 --- a/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRunCodegenNodeFactory.cs +++ b/src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRunCodegenNodeFactory.cs @@ -67,19 +67,20 @@ public void SetMarkingComplete() _markingComplete = true; } - public IMethodNode CompiledMethodNode(MethodDesc method) - { - EcmaModule module = ((EcmaMethod)method.GetTypicalMethodDefinition()).Module; - ModuleToken moduleToken = Resolver.GetModuleTokenForMethod(method, throwIfNotFound: true); + private NodeCache _localMethodCache; - return CreateMethodEntrypointNodeHelper(new MethodWithToken(method, moduleToken, constrainedType: null)); + public MethodWithGCInfo CompiledMethodNode(MethodDesc method) + { + Debug.Assert(CompilationModuleGroup.ContainsMethodBody(method, false)); + Debug.Assert(method == method.GetCanonMethodTarget(CanonicalFormKind.Specific)); + return _localMethodCache.GetOrAdd(method); } private NodeCache _allMethodsOnType; public AllMethodsOnTypeNode AllMethodsOnType(TypeDesc type) { - return _allMethodsOnType.GetOrAdd(type); + return _allMethodsOnType.GetOrAdd(type.ConvertToCanonForm(CanonicalFormKind.Specific)); } private NodeCache _genericReadyToRunHelpersFromDict; @@ -362,7 +363,8 @@ private IMethodNode CreateMethodEntrypoint(TypeAndMethod key) bool isUnboxingStub = key.IsUnboxingStub; bool isInstantiatingStub = key.IsInstantiatingStub; bool isPrecodeImportRequired = key.IsPrecodeImportRequired; - if (CompilationModuleGroup.ContainsMethodBody(method.Method, false)) + MethodDesc compilableMethod = method.Method.GetCanonMethodTarget(CanonicalFormKind.Specific); + if (CompilationModuleGroup.ContainsMethodBody(compilableMethod, false)) { if (isPrecodeImportRequired) { @@ -370,7 +372,7 @@ private IMethodNode CreateMethodEntrypoint(TypeAndMethod key) this, ReadyToRunFixupKind.MethodEntry, method, - CreateMethodEntrypointNodeHelper(method), + CompiledMethodNode(compilableMethod), isUnboxingStub, isInstantiatingStub); } @@ -380,7 +382,7 @@ private IMethodNode CreateMethodEntrypoint(TypeAndMethod key) this, ReadyToRunFixupKind.MethodEntry, method, - CreateMethodEntrypointNodeHelper(method), + CompiledMethodNode(compilableMethod), isUnboxingStub, isInstantiatingStub); } @@ -403,15 +405,6 @@ public IMethodNode MethodEntrypoint(MethodWithToken method, bool isUnboxingStub, return _importMethods.GetOrAdd(key); } - private NodeCache _localMethodCache; - - private MethodWithGCInfo CreateMethodEntrypointNodeHelper(MethodWithToken targetMethod) - { - Debug.Assert(CompilationModuleGroup.ContainsMethodBody(targetMethod.Method, false)); - - return _localMethodCache.GetOrAdd(targetMethod.Method); - } - public IEnumerable EnumerateCompiledMethods() { return EnumerateCompiledMethods(null, CompiledMethodCategory.All);