-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add support for pre-compiling interop type maps in crossgen2 #124352
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
Draft
jkoritzinsky
wants to merge
15
commits into
dotnet:main
Choose a base branch
from
jkoritzinsky:typemap-r2r
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d96073b
Add support to the ReadyToRun format for an R2R variant of the type m…
jkoritzinsky f3dd68e
Rename HeaderNode to ReadyToRunHeaderNode to provide better support f…
jkoritzinsky 3f3b5eb
Move TypeMapManager to the shared partition
jkoritzinsky 9de4cad
Use SortableDependencyNode as the base type
jkoritzinsky 89824c8
Hook up support for emitting type map entries in R2R
jkoritzinsky 66ea394
Add support for precaching assembly target lookup and refactor R2R in…
jkoritzinsky 7b64145
Add verification of CallbackContext struct layout
jkoritzinsky 6a19928
Get the code to the point of loading the R2R image.
jkoritzinsky e6ffdeb
Fix inverted logic on assembly target parsing
jkoritzinsky c593f18
Basic PR feedback
jkoritzinsky bd71ab4
Use a new section to store the data for each hash table to avoid issu…
jkoritzinsky 8cf2780
Use the right compressed integer format (we have two)
jkoritzinsky 585b559
Update r2rdump to handle the assembly ref we add now in a non-composi…
jkoritzinsky 9a46b19
zero-initialize returns for the non-r2r case
jkoritzinsky ea59e96
Fix typo
jkoritzinsky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/coreclr/tools/Common/Compiler/INativeFormatTypeReferenceProvider.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
| using ILCompiler.DependencyAnalysisFramework; | ||
| using Internal.NativeFormat; | ||
| using Internal.TypeSystem; | ||
|
|
||
| namespace ILCompiler.DependencyAnalysis | ||
| { | ||
| public interface INativeFormatTypeReferenceProvider | ||
| { | ||
| internal Vertex EncodeReferenceToType(NativeWriter writer, TypeDesc type); | ||
| internal Vertex EncodeReferenceToMethod(NativeWriter writer, MethodDesc method); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using System.Collections; | ||
| using System.Collections.Generic; | ||
| using System.Collections.ObjectModel; | ||
| using System.Diagnostics; | ||
| using System.Reflection.Metadata; | ||
| using ILCompiler.DependencyAnalysis; | ||
| #if READYTORUN | ||
| using ILCompiler.DependencyAnalysis.ReadyToRun; | ||
| #endif | ||
| using ILCompiler.DependencyAnalysisFramework; | ||
| using Internal.Runtime; | ||
| using Internal.TypeSystem; | ||
|
|
||
| namespace ILCompiler | ||
| { | ||
|
|
||
| /// <summary> | ||
| /// This class is responsible for managing emitted data for type maps. | ||
| /// </summary> | ||
| public abstract class TypeMapManager : ICompilationRootProvider | ||
| { | ||
| public virtual void AttachToDependencyGraph(DependencyAnalyzerBase<NodeFactory> graph) | ||
| { | ||
| } | ||
|
|
||
| internal abstract IEnumerable<IExternalTypeMapNode> GetExternalTypeMaps(); | ||
|
|
||
| internal abstract IEnumerable<IProxyTypeMapNode> GetProxyTypeMaps(); | ||
|
|
||
| public abstract void AddCompilationRoots(IRootingServiceProvider rootProvider); | ||
|
|
||
| protected abstract bool IsEmpty { get; } | ||
|
|
||
| public virtual void AddToReadyToRunHeader(ReadyToRunHeaderNode header, NodeFactory nodeFactory, INativeFormatTypeReferenceProvider commonFixupsTableNode) | ||
| { | ||
| if (IsEmpty) | ||
| { | ||
| return; // No type maps to emit | ||
| } | ||
|
|
||
| header.Add(ReadyToRunSectionType.ExternalTypeMaps, new ExternalTypeMapObjectNode(this, commonFixupsTableNode)); | ||
| header.Add(ReadyToRunSectionType.ProxyTypeMaps, new ProxyTypeMapObjectNode(this, commonFixupsTableNode)); | ||
jkoritzinsky marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
INativeFormatTypeReferenceProvideris declared as a public interface, but its members are markedinternalwithout providing default implementations. This won’t compile (interface members without bodies can’t have non-public accessibility). Make the interface itselfinternal, or make the memberspublic(or provide default interface implementations if you intended non-public helpers).