Add support for static default interface methods#72661
Merged
MichalStrehovsky merged 2 commits intodotnet:mainfrom Jul 22, 2022
Merged
Add support for static default interface methods#72661MichalStrehovsky merged 2 commits intodotnet:mainfrom
MichalStrehovsky merged 2 commits intodotnet:mainfrom
Conversation
We were only supporting default interface methods in the sense of non-abstract virtuals. We now also support overrides. What's missing is support for diamond/reabstraction. I thin we need to make throwing stubs that we can dispatch to - it doesn't look like the strategy used in the VM (`callsiteCalloutHelper`) can be used for prejit. I don't want to increase the scope of this pull request, so we invalidate the entire method that has such dispatch.
Comment on lines
+605
to
+607
| // It's difficult to discern what runtime determined form the interface method | ||
| // is on later so fail the resolution if this would be that. | ||
| // This is pretty conservative and can be narrowed down. |
Member
Author
There was a problem hiding this comment.
I went down this rabbit hole and it lead to stuff like:
I really didn't like it and had trouble getting it to work. The problem is that RyuJIT doesn't operate on runtime-determined things and we can't even properly resolve such constrained calls (the support for that was never needed in the type system because only universal shared code needs to resolve constrained calls on runtime determined types otherwise and that was always supported by the STS type system in NUTC).
jkotas
reviewed
Jul 22, 2022
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using System.Runtime.CompilerServices; |
Member
Author
There was a problem hiding this comment.
Yup, Unsafe.NullRef so that users who don't need static method support av if they accidentally pass static methods.
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.
We were only supporting default interface methods in the sense of non-abstract virtuals. We now also support overrides.
What's missing is support for diamond/reabstraction. I think we need to make throwing stubs that we can dispatch to - it doesn't look like the strategy used in the VM (
callsiteCalloutHelper) can be used for prejit. I don't want to increase the scope of this pull request, so I currently just invalidate the entire method that has such dispatch.Cc @dotnet/ilc-contrib
Fixes #70930.