-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Remove INodeWithSize interface, use IMAGE_REL_SYMBOL_SIZE relocation, and restructure ModuleInfoRow #124202
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
base: main
Are you sure you want to change the base?
Conversation
…SIZE reloc Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
|
Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib |
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReadyToRunHeaderNode.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
|
@copilot please remove the HasEndPointer flag and the Flags field it goes in. Then, update the native ModuleInfoRow type to have a Start field and a Length field instead of Start and End and remove the Flags type there as well. Finally, update the code in ReadyToRunHeaderNode to require alignment before emitting each entry. |
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Done. Removed HasEndPointer flag and ModuleInfoFlags enum. Updated ModuleInfoRow to have Start and Length fields instead of Start, End, and Flags. Added alignment requirement before emitting each entry. (5b50167) |
jkoritzinsky
left a comment
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.
@copilot please address this feedback
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ProxyTypeMapObjectNode.cs
Show resolved
Hide resolved
...reclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ExternalTypeMapObjectNode.cs
Show resolved
Hide resolved
Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
…or all symbols for NAOT as well as R2R.
…otnet/runtime into copilot/remove-inodewithsize-interface
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.
Pull request overview
This PR removes the INodeWithSize mechanism for tracking emitted node sizes and switches NativeAOT module section size reporting to use RelocType.IMAGE_REL_SYMBOL_SIZE, alongside restructuring the NativeAOT ModuleInfoRow ABI to store a resolved Length directly.
Changes:
- Removed
INodeWithSizeimplementations and per-node manual size tracking (_size/Sizeproperties) across many dependency analysis nodes. - Updated
ReadyToRunHeaderNodeto emit section entries as{ SectionId, Length (IMAGE_REL_SYMBOL_SIZE), Start }and adjustedEntrySizeaccordingly. - Updated the NativeAOT runtime to consume the new
ModuleInfoRowlayout and removed the old flags/end-pointer length computation.
Reviewed changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TypeMetadataMapNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StructMarshallingStubMapNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StaticsInfoHashtableNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StackTraceMethodMappingNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StackTraceLineNumbersNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/StackTraceDocumentsNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ResourceIndexNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ResourceDataNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionVirtualInvokeMapNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionInvokeMapNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReflectionFieldMapNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ReadyToRunHeaderNode.cs | Emits IMAGE_REL_SYMBOL_SIZE for section lengths; updates EntrySize; removes INodeWithSize definition and old end-pointer logic. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ProxyTypeMapObjectNode.cs | Removes INodeWithSize/Size property and assignment. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/PointerTypeMapNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NativeLayoutInfoNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ModuleInitializerListNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/MetadataNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/InterfaceGenericVirtualMethodTableNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericVirtualMethodTableNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericTypesTemplateMap.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericTypesHashtableNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericMethodsTemplateMap.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericMethodsHashtableNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FunctionPointerMapNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ExternalTypeMapObjectNode.cs | Removes INodeWithSize/Size property and assignment. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ExternalReferencesTableNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ExactMethodInstantiationsNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DelegateMarshallingStubMapNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/DehydratedDataNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ClassConstructorContextMap.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ByRefTypeMapNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ArrayOfFrozenObjectsNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ArrayOfEmbeddedDataNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ArrayMapNode.cs | Removes INodeWithSize and manual _size tracking. |
| src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs | Removes managed ModuleInfoFlags enum. |
| src/coreclr/tools/Common/Compiler/ObjectWriter/ObjectWriter.cs | Always records symbol sizes for offset-0 symbols (enables IMAGE_REL_SYMBOL_SIZE resolution in NativeAOT builds). |
| src/coreclr/nativeaot/Runtime/inc/ModuleHeaders.h | Removes native ModuleInfoFlags enum. |
| src/coreclr/nativeaot/Runtime/TypeManager.h | Updates ModuleInfoRow layout to { SectionId, Length, Start }. |
| src/coreclr/nativeaot/Runtime/TypeManager.cpp | Consumes ModuleInfoRow.Length directly; removes old flag/end-pointer length computation. |
Description
The
INodeWithSizeinterface was previously used to track and expose node sizes via aSizeproperty, calculated during data emission. This interface has been completely removed, and all nodes now useIMAGE_REL_SYMBOL_SIZErelocations, allowing the object writer to resolve symbol sizes at link time.Additionally, the
ModuleInfoRowstructure has been restructured to store the resolved length directly instead of using flags and end pointers, and the ReadyToRun header now requires alignment before each entry.Changes
ReadyToRunHeaderNode.cs: Removed the
INodeWithSizeinterface definition and all conditional logic. Now always emitsIMAGE_REL_SYMBOL_SIZErelocation for all nodes. RemovedHasEndPointerflag emission. Added alignment requirement before emitting each entry. UpdatedEntrySizecalculation to reflect new structure (SectionId + Length + Start instead of SectionId + Flags + Start + End).33 node classes: Removed
INodeWithSizeinterface implementation from all classes (no longer needed as marker interface)ModuleInfoFlags enum: Removed from both managed code (
ModuleHeaders.cs) and native code (ModuleHeaders.h)ModuleInfoRow structure: Changed from having
SectionId,Flags,Start, andEndfields to havingSectionId,Length, andStartfields. The length is now resolved at link time viaIMAGE_REL_SYMBOL_SIZErelocation and stored directly in the structure.TypeManager.h: Updated
ModuleInfoRowstructure definition. RemovedHasEndPointer()andGetLength()methods - theLengthfield is now accessed directly.TypeManager.cpp: Updated
GetModuleSectionto access theLengthfield directly instead of calling a getter method.ProxyTypeMapObjectNode.cs and ExternalTypeMapObjectNode.cs: Removed
Sizeproperties that were previously used to track node sizes, as sizes are now resolved viaIMAGE_REL_SYMBOL_SIZErelocations.Before:
After:
The
IMAGE_REL_SYMBOL_SIZErelocation type (0x1000) is already used in the ReadyToRun compiler for the same purpose. This change simplifies the code by removing the interface abstraction, eliminating the flags mechanism, removing unnecessary getter methods, and storing resolved sizes directly in the module info structure.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.