-
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
Add type loader support for resolving static virtuals #80601
Conversation
The implementation of static virtuals was limited to compile-time resolution in .NET 7. I erroneously believed runtime resolution can only happen with `MakeGenericType`/`MakeGenericMethod` and therefore falls into the general "don't do dynamic code" bucket. But this is also reachable from generic instance virtual method resolution that is also dynamic-like (we don't attempt to precompute all runtime artifacts, only canonical code). This contains compiler changes to start tracking static virtual method use within type loader templates the same way how we track instance generic virtual method use (i.e. those static virtual uses that happen at compile time are not tracked in this - only the dynamic ones). We also make sure the computed targets get generated into the appropriate table. The other part of the change is a type loader change to call into the generic virtual method resolution logic when needed.
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsFixes #77070. The implementation of static virtuals was limited to compile-time resolution in .NET 7. I erroneously believed runtime resolution can only happen with This contains compiler changes to start tracking static virtual method use within type loader templates the same way how we track instance generic virtual method use (i.e. those static virtual uses that happen at compile time are not tracked in this - only the dynamic ones). We also make sure the computed targets get generated into the appropriate table. The other part of the change is a type loader change to call into the generic virtual method resolution logic when needed. Cc @dotnet/ilc-contrib
|
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GVMDependenciesNode.cs
Outdated
Show resolved
Hide resolved
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NativeLayoutVertexNode.cs
Outdated
Show resolved
Hide resolved
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.
Nice!
...nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/GenericDictionaryCell.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Jan Kotas <[email protected]>
/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). |
Fixes #77070.
The implementation of static virtuals was limited to compile-time resolution in .NET 7. I erroneously believed runtime resolution can only happen with
MakeGenericType
/MakeGenericMethod
and therefore falls into the general "don't do dynamic code" bucket. But this is also reachable from generic instance virtual method resolution that is also dynamic-like (we don't attempt to precompute all runtime artifacts, only canonical code).This contains compiler changes to start tracking static virtual method use within type loader templates the same way how we track instance generic virtual method use (i.e. those static virtual uses that happen at compile time are not tracked in this - only the dynamic ones). We also make sure the computed targets get generated into the appropriate table.
The other part of the change is a type loader change to call into the generic virtual method resolution logic when needed.
Cc @dotnet/ilc-contrib