Make EnumAllVirtualSlots return slots for interfaces#121438
Merged
MichalStrehovsky merged 1 commit intodotnet:mainfrom Nov 7, 2025
Merged
Make EnumAllVirtualSlots return slots for interfaces#121438MichalStrehovsky merged 1 commit intodotnet:mainfrom
EnumAllVirtualSlots return slots for interfaces#121438MichalStrehovsky merged 1 commit intodotnet:mainfrom
Conversation
Calling `EnumAllVirtualSlots` on classes returns all `newslot` methods that exist in the class hierarchy. Calling this on interfaces produced an empty enumeration. For runtime-async, it would be convenient if this returned the logical slots on interfaces. While interfaces don't have physical slots, they still have logical slots, so it's not a big stretch. Doing this now simplifies things in some places, and requires an extra `if` check in other places. But it will be really convenient for runtime-async.
Contributor
|
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR modifies EnumAllVirtualSlots to return virtual method slots for interfaces, whereas previously it returned an empty enumeration. For interfaces, it now delegates to GetAllVirtualMethods(), while for classes it continues to enumerate slots through the class hierarchy.
Key changes:
EnumAllVirtualSlotsnow returns interface methods when called on interface types- Code previously branching between interfaces and classes now uniformly calls
EnumAllVirtualSlots - New guard conditions added where interface-specific behavior should be excluded
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| MetadataVirtualMethodAlgorithm.cs | Modified EnumAllVirtualSlots to handle interfaces by delegating to GetAllVirtualMethods() |
| VTableSliceNode.cs | Removed interface check and conditional logic, now uniformly uses EnumAllVirtualSlots |
| EETypeNode.cs | Added interface guard and replaced GetAllVirtualMethods() calls with EnumAllVirtualSlots() |
| TypeValidationChecker.cs | Added interface guard to skip validation logic that only applies to classes |
| TypeGVMEntriesNode.cs | Added assertion to document that interfaces are not supported |
| NativeLayoutVertexNode.cs | Removed unused helper method EnumVirtualSlotsDeclaredOnType |
This was referenced Nov 7, 2025
Open
MichalStrehovsky
added a commit
to MichalStrehovsky/runtime
that referenced
this pull request
Nov 7, 2025
This makes virtual methods work with runtime async. Depends on dotnet#121438. Runtime async methods can be virtually called two ways: as Task-returning, or as runtime-async. We can even end up in situation where Task-returning non-runtime-async virtual methods get called as runtime-async. The easiest way to solve this is to give each Task-returning method two separate virtual slots. We still track the slot use so unused slots will not get generated. The `VirtualMethodAlgorithm` abstraction that we added for universal shared generics comes in handy because it lets us centralize where all of this work happens. As a result, we don't need to teach pretty much any node dealing with virtuals about runtime async, it just falls out. This doesn't make generic virtual methods yet, those need more fixes.
jkotas
approved these changes
Nov 7, 2025
Member
Author
|
/ba-g android timeouts |
MichalStrehovsky
added a commit
that referenced
this pull request
Nov 8, 2025
This makes virtual methods work with runtime async. Depends on #121438. Runtime async methods can be virtually called two ways: as Task-returning, or as runtime-async. We can even end up in situation where Task-returning non-runtime-async virtual methods get called as runtime-async. The easiest way to solve this is to give each Task-returning method two separate virtual slots. We still track the slot use so unused slots will not get generated. The `VirtualMethodAlgorithm` abstraction that we added for universal shared generics comes in handy because it lets us centralize where all of this work happens. As a result, we don't need to teach pretty much any node dealing with virtuals about runtime async, it just falls out. This doesn't make generic virtual methods yet, those need more fixes.
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.
(Review with whitespace changes off, this is not a big diff.)
Calling
EnumAllVirtualSlotson classes returns allnewslotmethods that exist in the class hierarchy. Calling this on interfaces produced an empty enumeration.For runtime-async, it would be convenient if this returned the logical slots on interfaces. While interfaces don't have physical slots, they still have logical slots, so it's not a big stretch.
Doing this now simplifies things in some places, and requires an extra
ifcheck in other places. But it will be really convenient for runtime-async.Cc @dotnet/ilc-contrib