-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[Crossgen2] Deduplicate identical IL method bodies in R2R composite image #126047
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
Changes from all commits
7f9f268
13e5ad0
27a15ce
c235831
28021fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -355,11 +355,6 @@ private void CreateNodeCaches() | |
| return new CopiedMetadataBlobNode(module); | ||
| }); | ||
|
|
||
| _copiedMethodIL = new NodeCache<MethodDesc, CopiedMethodILNode>(method => | ||
| { | ||
| return new CopiedMethodILNode((EcmaMethod)method); | ||
| }); | ||
|
|
||
| _copiedFieldRvas = new NodeCache<ModuleAndIntValueKey, CopiedFieldRvaNode>(key => | ||
| { | ||
| return new CopiedFieldRvaNode(key.Module, key.IntValue); | ||
|
|
@@ -1148,11 +1143,12 @@ public CopiedMetadataBlobNode CopiedMetadataBlob(EcmaModule module) | |
| return _copiedMetadataBlobs.GetOrAdd(module); | ||
| } | ||
|
|
||
| private NodeCache<MethodDesc, CopiedMethodILNode> _copiedMethodIL; | ||
| private readonly ConcurrentDictionary<byte[], CopiedMethodILNode> _copiedMethodIL = new(ByteArrayComparer.Instance); | ||
|
|
||
| public CopiedMethodILNode CopiedMethodIL(EcmaMethod method) | ||
| { | ||
| return _copiedMethodIL.GetOrAdd(method); | ||
| byte[] bodyBytes = CopiedMethodILNode.ReadBodyBytes(method, OptimizationFlags); | ||
| return _copiedMethodIL.GetOrAdd(bodyBytes, _ => new CopiedMethodILNode(method)); | ||
|
Comment on lines
+1150
to
+1151
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This may not work. If first time someone asks for If this is not a concern, we should remove the question mark from If it is a concern, there are ways to address this. Probably the easiest would be to delete the |
||
| } | ||
|
kotlarmilos marked this conversation as resolved.
kotlarmilos marked this conversation as resolved.
kotlarmilos marked this conversation as resolved.
|
||
|
|
||
| private NodeCache<ModuleAndIntValueKey, CopiedFieldRvaNode> _copiedFieldRvas; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.