Uh oh!
There was an error while loading. Please reload this page.
[R2R] Add discovery of generic virtual methods - #128369
Conversation
Called methods are obtained from MethodFixupSignature and are stored into GVMDependenciesNode. These will be nodes that HasDynamicDependencies so the dependency analysis will do additional iterations for these nodes on the newly added nodes that are InterestingForDynamicDependencyAnalysis. These will be InheritedVirtualMethodsNode added as part of TypeFixupSignature, which represent types used by the application. We resolve the target method for calling the virtual/interface method on the existing types. GVMDependenciesNode is moved from NativeAOT sources so that it is shared with ReadyToRun, with just a few minor tweaks guarded by ReadyToRun define (we don't report back via NoteOverridingMethod and we don't need to add TypeGVMEntries).
BrzVlad
commented
May 19, 2026
/azp run runtime-coreclr crossgen2 outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR extends Crossgen2/ReadyToRun dependency analysis to discover and compile implementations of generic virtual method (GVM) calls by introducing a dynamic dependency node (GVMDependenciesNode) that iterates over newly-marked “type usage” marker nodes (InheritedVirtualMethodsNode). It also moves GVMDependenciesNode into the shared Common compiler sources so it can be used by both NativeAOT and ReadyToRun (with READYTORUN-guarded behavior differences).
Changes:
- Move
GVMDependenciesNodeintosrc/coreclr/tools/Commonand adjust it to support ReadyToRun (including compiling method bodies when appropriate). - Add
InheritedVirtualMethodsNodeplus new NodeFactory caches/APIs to surface “interesting” type markers for dynamic dependency scanning. - Add ReadyToRun fixup dependencies to seed GVM discovery: type fixups mark relevant types, and virtual-entry method fixups create GVM dependency nodes for qualifying generic virtual calls.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/tools/Common/Compiler/DependencyAnalysis/GVMDependenciesNode.cs | Shared implementation; adds READYTORUN-specific discovery inputs and method-body node selection logic. |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj | Links the shared GVMDependenciesNode and includes the new InheritedVirtualMethodsNode. |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRunCodegenNodeFactory.cs | Adds caches and factory entrypoints for InheritedVirtualMethods and GVMDependencies. |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/TypeFixupSignature.cs | Seeds type marker nodes for later GVM implementation discovery. |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodFixupSignature.cs | Adds GVM dependency node creation for qualifying generic virtual call fixups. |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/InheritedVirtualMethodsNode.cs | New “interesting” marker node consumed by GVMDependenciesNode during dynamic dependency iterations. |
| src/coreclr/tools/aot/ILCompiler.Compiler/ILCompiler.Compiler.csproj | Switches NativeAOT to link the shared GVMDependenciesNode instead of compiling its own copy. |
Uh oh!
There was an error while loading. Please reload this page.
BrzVlad
commented
May 20, 2026
crossgen2 looks green. There are a few failures that are present on other runs as well. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Called methods are obtained from MethodFixupSignature and are stored into GVMDependenciesNode. These will be nodes that HasDynamicDependencies so the dependency analysis will do additional iterations for these nodes on the newly added nodes that are InterestingForDynamicDependencyAnalysis. These will be InheritedVirtualMethodsNode added as part of TypeFixupSignature, which represent types used by the application. We resolve the target method for calling the virtual/interface method on the existing types.
GVMDependenciesNode is moved from NativeAOT sources so that it is shared with ReadyToRun, with just a few minor tweaks guarded by ReadyToRun define (we don't report back via NoteOverridingMethod and we don't need to add TypeGVMEntries).