-
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
Make casting helpers look more like in CoreCLR #86029
Conversation
Speeds up casting to interfaces by about 50%. Speeds up casting to classes by about 20%. There are small differences compared to CoreCLR: * NativeAOT runtime considers interfaces implementable by arrays to be variant. We don't need to special case casting arrays to non-variant (in IL sense) interfaces because those naturally take the variant paths. * The base type field on arrays holds the array element type so we need to check for the array case before starting to chase the base hierarchy. Otherwise the top level helpers now look mostly the same as the CoreCLR ones.
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsSpeeds up casting to interfaces by about 50%. Speeds up casting to classes by about 20%. There are small differences compared to CoreCLR:
Otherwise the top level helpers now look mostly the same as the CoreCLR ones. Cc @dotnet/ilc-contrib
|
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
...clr/nativeaot/System.Private.CoreLib/src/Internal/Reflection/Core/Execution/MethodInvoker.cs
Outdated
Show resolved
Hide resolved
...clr/nativeaot/System.Private.CoreLib/src/Internal/Reflection/Core/Execution/MethodInvoker.cs
Outdated
Show resolved
Hide resolved
src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/TypeCast.cs
Outdated
Show resolved
Hide resolved
return null; | ||
} | ||
[RuntimeExport("RhTypeCast_CheckCastClassSpecial")] | ||
private static unsafe object CheckCastClassSpecial(MethodTable* pTargetType, object obj) |
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.
It would be nice to unify the names with CoreCLR impl (Check vs. Chk) so that the implementations are easy to match (and eventually share). It can be separate rename-only PR.
I think this PR will resolve #84464 |
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.
Thanks!
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.
Thanks!
Speeds up casting to interfaces by about 50%. Speeds up casting to classes by about 20%.
There are small differences compared to CoreCLR:
Otherwise the top level helpers now look mostly the same as the CoreCLR ones.
Cc @dotnet/ilc-contrib