-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Improve getExactClasses to support classes as base types #92440
Conversation
Fixes dotnet#88547 ```csharp using System.Runtime.CompilerServices; public class ClassA { public virtual int GetValue() => 42; } public class ClassB : ClassA { // we don't even need to override GetValue here } class MyClass { static void Main() { Test(new ClassB()); } [MethodImpl(MethodImplOptions.NoInlining)] static int Test(ClassA c) => c.GetValue(); } ``` Old codegen: ``` ; Method MyClass:Test(ClassA):int (FullOpts) sub rsp, 40 mov rax, qword ptr [rcx] call [rax+30H]ClassA:GetValue():int:this nop add rsp, 40 ret ; Total bytes of code: 16 ``` New codegen: ``` 00007FF66DD8AFB0 cmp dword ptr [rcx],ecx 00007FF66DD8AFB2 mov eax,2Ah 00007FF66DD8AFB7 ret ```
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsFixes #88547 using System.Runtime.CompilerServices;
public class ClassA
{
public virtual int GetValue() => 42;
}
public class ClassB : ClassA
{
// we don't even need to override GetValue here
}
class MyClass
{
static void Main()
{
Test(new ClassB());
}
[MethodImpl(MethodImplOptions.NoInlining)]
static int Test(ClassA c) => c.GetValue();
} Old codegen:
New codegen:
Cc @dotnet/ilc-contrib @EgorBo
|
/azp run runtime-nativeaot-outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
Love it! It should also pick up other jit opts like |
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
Fixes #88547
Old codegen:
New codegen:
Cc @dotnet/ilc-contrib @EgorBo