Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile methods in canon form only #36011

Merged
merged 2 commits into from
May 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<MethodDesc, MethodWithGCInfo> _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<TypeDesc, AllMethodsOnTypeNode> _allMethodsOnType;

public AllMethodsOnTypeNode AllMethodsOnType(TypeDesc type)
{
return _allMethodsOnType.GetOrAdd(type);
return _allMethodsOnType.GetOrAdd(type.ConvertToCanonForm(CanonicalFormKind.Specific));
}

private NodeCache<ReadyToRunGenericHelperKey, ISymbolNode> _genericReadyToRunHelpersFromDict;
Expand Down Expand Up @@ -362,15 +363,16 @@ 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)
{
return new PrecodeMethodImport(
this,
ReadyToRunFixupKind.MethodEntry,
method,
CreateMethodEntrypointNodeHelper(method),
CompiledMethodNode(compilableMethod),
isUnboxingStub,
isInstantiatingStub);
}
Expand All @@ -380,7 +382,7 @@ private IMethodNode CreateMethodEntrypoint(TypeAndMethod key)
this,
ReadyToRunFixupKind.MethodEntry,
method,
CreateMethodEntrypointNodeHelper(method),
CompiledMethodNode(compilableMethod),
isUnboxingStub,
isInstantiatingStub);
}
Expand All @@ -403,15 +405,6 @@ public IMethodNode MethodEntrypoint(MethodWithToken method, bool isUnboxingStub,
return _importMethods.GetOrAdd(key);
}

private NodeCache<MethodDesc, MethodWithGCInfo> _localMethodCache;

private MethodWithGCInfo CreateMethodEntrypointNodeHelper(MethodWithToken targetMethod)
{
Debug.Assert(CompilationModuleGroup.ContainsMethodBody(targetMethod.Method, false));

return _localMethodCache.GetOrAdd(targetMethod.Method);
}

public IEnumerable<MethodWithGCInfo> EnumerateCompiledMethods()
{
return EnumerateCompiledMethods(null, CompiledMethodCategory.All);
Expand Down