-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Resolve generic virtual methods in managed type system #80035
Merged
Merged
Conversation
This file contains 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
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue Detailsnull
|
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
jkotas
approved these changes
Dec 30, 2022
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.
LGTM!
...der/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.ConstructedGenericMethodsLookup.cs
Outdated
Show resolved
Hide resolved
...der/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.ConstructedGenericMethodsLookup.cs
Outdated
Show resolved
Hide resolved
...der/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.ConstructedGenericMethodsLookup.cs
Outdated
Show resolved
Hide resolved
...der/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.ConstructedGenericMethodsLookup.cs
Show resolved
Hide resolved
5 tasks
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Generic virtual method resolution currently happens on top of
RuntimeTypeHandle
s (i.e. the runtime type system). This works as long as we only need to do generic virtual method resolution on top of types that exist in the runtime.In order to lay foundation for fixing #77070, we need to be able to resolve not just with types that have a type handle, but also for types that we're in the process of building (e.g. due to MakeGeneric, or due to another generic virtual method dispatch).
This pull request rewrites generic virtual method dispatch to happen on top of the managed type system, instead of the runtime type system. It's a bit more than just a mechanical replacement because the existing algorithm was set up in a confusing way, with
ref
parameters that were changing what we were resolving and an oddslotChanged
logic that I don't fully understand. I replaced theslotChanged
with the straightforward thing (if we resolve interface method to a virtual method on a type, find the implementation of the virtual method on the current type). Tests seem to be passing. Also instead of a bunch ofref
parameters we now just pass aMethodDesc
.This also includes a compiler change, because in order for the managed type system's casting logic to work, we need to be able to find out the variance of parameters on generic definitions. The compiler change is about generating this info.
Cc @dotnet/ilc-contrib