Introduce MetadataEEType node halfway between Constructed and Necessary#118060
Merged
MichalStrehovsky merged 11 commits intodotnet:mainfrom Aug 6, 2025
Merged
Introduce MetadataEEType node halfway between Constructed and Necessary#118060MichalStrehovsky merged 11 commits intodotnet:mainfrom
MichalStrehovsky merged 11 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new intermediate "MetadataEEType" node type in the native AOT compilation system, positioned between the existing "Necessary" and "Constructed" EEType levels. This change optimizes the type system by providing metadata-enabled types that don't require full construction overhead for reflection scenarios.
Key changes:
- Introduces
MetadataEETypeNodeclass and corresponding infrastructure - Adds
ReadyToRunHelperId.MetadataTypeHandlehelper type for generic lookups - Updates compilation logic to use the new three-tier type system (Necessary → Metadata → Constructed)
Reviewed Changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
DeadCodeElimination.cs |
Adds comprehensive test coverage for metadata method table behavior |
MetadataEETypeNode.cs |
New node type implementing metadata-enabled EETypes without full construction |
NodeFactory.cs |
Adds factory methods and caching for metadata type symbols |
RyuJitCompilation.cs |
Updates compilation logic to use three-tier type system |
Compilation.cs |
Modifies helper selection logic to choose appropriate type handle level |
| Multiple helper nodes | Adds support for MetadataTypeHandle in all target architectures |
GenericLookupResult.cs |
Implements metadata type handle generic lookup results |
| Various other files | Updates references and dependencies to use new metadata type symbols |
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/MetadataEETypeNode.cs
Show resolved
Hide resolved
These are not allocated, one can't call `object.GetType` on them.
Member
Author
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This was referenced Aug 1, 2025
MichalStrehovsky
commented
Aug 1, 2025
src/libraries/Common/tests/System/Security/Cryptography/MLKemCngTests.NotSupported.cs
Show resolved
Hide resolved
MichalStrehovsky
commented
Aug 1, 2025
.../test/Mono.Linker.Tests.Cases/DataFlow/VirtualMethodHierarchyDataflowAnnotationValidation.cs
Show resolved
Hide resolved
Member
Author
|
@jkoritzinsky is this something you'd be comfortable reviewing? We can also do a Teams call. |
Member
Author
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
jkoritzinsky
reviewed
Aug 1, 2025
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs
Outdated
Show resolved
Hide resolved
...r/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericVirtualMethodTableNode.cs
Show resolved
Hide resolved
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ConstructedEETypeNode.cs
Outdated
Show resolved
Hide resolved
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/MetadataEETypeNode.cs
Show resolved
Hide resolved
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NodeFactory.cs
Show resolved
Hide resolved
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/MetadataEETypeNode.cs
Show resolved
Hide resolved
This was referenced Aug 2, 2025
Member
Author
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
davidwrighton
approved these changes
Aug 4, 2025
sbomer
approved these changes
Aug 6, 2025
.../test/Mono.Linker.Tests.Cases/DataFlow/VirtualMethodHierarchyDataflowAnnotationValidation.cs
Show resolved
Hide resolved
3 tasks
Member
Author
|
/ba-g the arm issue is an infra issue tracked in dnceng repo but doesn't pair |
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #116032
Contributes to #116301
This adds a third way of referring to
MethodTableobjects within the compiler:With this just having a
typeofof something within the compiler no longer materializes the vtable of the thing. This aligns us with how ILLinker thinks oftypeof.The size improvements are not too exciting:
However, it kicks in pretty well for Avalonia because of one type with a big closure that is now unused.
I don't look at this as a size improvement PR, but a warning reduction PR since #116032 hit this when ILC was generating trim warnings that ILLink does not.
Cc @dotnet/ilc-contrib