Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve getExactClasses to support classes as base types#92440

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jkotas merged 1 commit intodotnet:mainfromMichalStrehovsky:moredevirt
Sep 22, 2023

Conversation

@MichalStrehovsky
Copy link
Member

@MichalStrehovskyMichalStrehovsky commentedSep 21, 2023
edited by EgorBo
Loading

Fixes#88547

usingSystem.Runtime.CompilerServices;publicclassClassA{publicvirtualintGetValue()=>42;}publicclassClassB:ClassA{// we don't even need to override GetValue here}classMyClass{staticvoidMain(){Test(newClassB());}[MethodImpl(MethodImplOptions.NoInlining)]staticintTest(ClassAc)=>c.GetValue();}

Old codegen:

; Method MyClass:Test(ClassA):int (FullOpts)subrsp,40movrax, qword ptr[rcx]call[rax+30H]ClassA:GetValue():int:thisnopaddrsp,40ret; Total bytes of code: 16

New codegen:

00007FF66DD8AFB0cmp         dword ptr[rcx],ecx00007FF66DD8AFB2moveax,2Ah00007FF66DD8AFB7ret

Cc @dotnet/ilc-contrib@EgorBo

EgorBo and am11 reacted with hooray emoji
Fixesdotnet#88547```csharpusing 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],ecx00007FF66DD8AFB2  mov         eax,2Ah00007FF66DD8AFB7  ret```
@ghost
Copy link

Tagging subscribers to this area:@agocke,@MichalStrehovsky,@jkotas
See info inarea-owners.md if you want to be subscribed.

Issue Details

Fixes#88547

usingSystem.Runtime.CompilerServices;publicclassClassA{publicvirtualintGetValue()=>42;}publicclassClassB:ClassA{// we don't even need to override GetValue here}classMyClass{staticvoidMain(){Test(newClassB());}[MethodImpl(MethodImplOptions.NoInlining)]staticintTest(ClassAc)=>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],ecx00007FF66DD8AFB2  mov         eax,2Ah00007FF66DD8AFB7  ret

Cc @dotnet/ilc-contrib@EgorBo

Author:MichalStrehovsky
Assignees:-
Labels:

area-NativeAOT-coreclr

Milestone:-

@MichalStrehovsky
Copy link
MemberAuthor

/azp run runtime-nativeaot-outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@EgorBo
Copy link
Member

Love it! It should also pick up other jit opts likeif (obj is Class1) or multiple-guesses GDV, etc which currently only kick in for interfaces. LGTM if CI passes 🙂

Copy link
Member

@jkotasjkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks

@jkotasjkotas merged commite0a4bdd intodotnet:mainSep 22, 2023
@MichalStrehovskyMichalStrehovsky deleted the moredevirt branchSeptember 22, 2023 07:03
@ghostghost locked asresolvedand limited conversation to collaboratorsOct 22, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@jkotasjkotasjkotas approved these changes

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

NativeAOT: improve getExactClasses to support classes as base types

3 participants

@MichalStrehovsky@EgorBo@jkotas

[8]ページ先頭

©2009-2025 Movatter.jp