Introduce MetadataEEType node halfway between Constructed and Necessary#118060
Introduce MetadataEEType node halfway between Constructed and Necessary#118060MichalStrehovsky merged 11 commits intodotnet:mainfrom
Conversation
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.
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
src/libraries/Common/tests/System/Security/Cryptography/MLKemCngTests.NotSupported.cs
Show resolved
Hide resolved
.../test/Mono.Linker.Tests.Cases/DataFlow/VirtualMethodHierarchyDataflowAnnotationValidation.cs
Show resolved
Hide resolved
|
@jkoritzinsky is this something you'd be comfortable reviewing? We can also do a Teams call. |
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
.../test/Mono.Linker.Tests.Cases/DataFlow/VirtualMethodHierarchyDataflowAnnotationValidation.cs
Show resolved
Hide resolved
|
/ba-g the arm issue is an infra issue tracked in dnceng repo but doesn't pair |
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