Skip to content

Conversation

MichalStrehovsky
Copy link
Member

@MichalStrehovsky MichalStrehovsky commented Aug 13, 2025

Ever since GVM support was added to native AOT, we were generating the GVM resolution metadata for every type considered allocated. This included GVMs that were never even called: see TypeGVMEntriesNode that simply goes over everything on the type - we were adding a TypeGVMEntriesNode for all allocated types that have something to do with GVMs.

This PR changes it so that we only generate TypeGVMEntries for types that have at least one used GVM. This is a scoped down version of #118632 (that tries to track things per-method) with a lot less risk.

Cc @dotnet/ilc-contrib

Ever since GVM support was added to native AOT, we were generating the GVM resolution metadata for every type considered allocated. This included GVMs that were never even called: see `TypeGVMEntriesNode` that simply goes over everything on the type - we were adding a `TypeGVMEntriesNode` for all allocated types that have something to do with GVMs.

This PR changes it so that we only generate `TypeGVMEntries` for types that have at least one used GVM. This is a scoped down version of dotnet#118632 (that tries to track things per-method) with a lot less risk.
@Copilot Copilot AI review requested due to automatic review settings August 13, 2025 22:03
Copy link
Contributor

@Copilot Copilot AI left a 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 optimizes Generic Virtual Method (GVM) dependency generation in the native AOT compiler by only creating GVM resolution metadata for types that actually have used GVMs, rather than for all allocated types that could potentially have GVMs.

Key changes:

  • Remove eager GVM metadata generation from type allocation
  • Add conditional GVM metadata generation based on actual method usage
  • Track implementation discovery to determine when GVM metadata is needed

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
GVMDependenciesNode.cs Adds conditional TypeGVMEntries dependency generation based on found implementations and tracks inheritance hierarchy
EETypeNode.cs Removes automatic TypeGVMEntries dependency for types with GVM flags
ConstructedEETypeNode.cs Removes automatic TypeGVMEntries dependency for canonical subtypes with GVM flags

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copy link
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

@MichalStrehovsky
Copy link
Member Author

/azp run runtime-nativeaot-outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@MichalStrehovsky
Copy link
Member Author

/ba-g arm32 failures are dotnet/dnceng#6034 but infra doesn't pair it

@MichalStrehovsky MichalStrehovsky merged commit 108fa78 into dotnet:main Aug 14, 2025
109 of 116 checks passed
@MichalStrehovsky MichalStrehovsky deleted the gvmanalyze branch August 14, 2025 04:59
@github-actions github-actions bot locked and limited conversation to collaborators Sep 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants