Skip to content
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

[Mono] implement static virtual methods in interfaces support #49904

Open
16 of 20 tasks
lambdageek opened this issue Mar 19, 2021 · 7 comments
Open
16 of 20 tasks

[Mono] implement static virtual methods in interfaces support #49904

lambdageek opened this issue Mar 19, 2021 · 7 comments
Assignees
Labels
area-Codegen-meta-mono Bottom Up Work Not part of a theme, epic, or user story
Milestone

Comments

@lambdageek
Copy link
Member

lambdageek commented Mar 19, 2021

Implement support for static interface methods (csharp design: dotnet/csharplang#4436)

Known issues for .NET 7

Work items completed in .net 6:

  • metadata updates
    • allow virtual on static methods in interfaces (can borrow this and JIT from partydonk prototype)
    • implement implements-all-static-interface-methods-of relation
    • possibly implement a static vtable for MonoClass (partydonk just puts static methods into the instance vtable and also does matching by name)
  • unconditionally enable JIT support
    • constrained.call
  • unconditionally enable interpreter support
    • constrained.call
    • constrained.ldftn
  • support for the RuntimeFeature flag System.Runtime.CompilerServices.RuntimeFeature.VirtualStaticsInInterfaces #49905 for statics in interfaces.

Related CoreCLR work items over at #50129

@lambdageek lambdageek added area-Codegen-meta-mono Bottom Up Work Not part of a theme, epic, or user story labels Mar 19, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Mar 19, 2021
@lambdageek lambdageek added this to the 6.0.0 milestone Mar 19, 2021
@lambdageek lambdageek removed the untriaged New issue has not been triaged by the area owner label Mar 19, 2021
@lambdageek
Copy link
Member Author

@vargaz I think we're probably going to need static vtables. The ecma spec addendum says the static interface methods are going to be in the methodimpl table. The partydonk prototype completely ignores that and does matching by name. But we should just add a PROP_STATIC_VTABLE to InfrequentDataKind and just write down the impls from the MethodImpl in there when setting up the class. It can be completely separate from instance vtable layout. What do you think?

@davidwrighton
Copy link
Member

There is now a working implmentation of all of this for CoreCLR checked in. Tests are disabled for mono, but otherwise it should be ready for implementation work to begin in Mono.

@lambdageek lambdageek changed the title [Mono] implement static methods in interfaces support [Mono] implement static virtual methods in interfaces support Jun 1, 2021
@lambdageek
Copy link
Member Author

Zoltan implemented the initial version in #53465

Notably generic sharing does not work correctly, so the AOT support isn't quite there yet.

@lambdageek
Copy link
Member Author

Remaining work pushed back to .net 7

@lambdageek
Copy link
Member Author

@tannergooding @stephentoub I think in general Mono is in good shape to use static virtual methods in libraries. There may be bugs, but the only remaining completely unimplemented functionality that I'm aware of is the constrained . ldftn opcode - ie &T.StaticMethod and creation of delegates from static virtual methods from inside another generic method.

@SamMonoRT
Copy link
Member

@lambdageek @BrzVlad - There are a couple unchecked ones. Are these required for 7.0 or can this be moved to 8.0.0 ?

@BrzVlad
Copy link
Member

BrzVlad commented Aug 8, 2022

Moving to 8.0 since only corner cases from runtime tests are left implementing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Codegen-meta-mono Bottom Up Work Not part of a theme, epic, or user story
Projects
None yet
Development

No branches or pull requests

6 participants