-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Compute precise generic context after de-virtualization #38477
Comments
Context #38229 (comment) |
Think we should fix this in .NET 6, as part of removing barriers to efficient generic composition. |
Is this just a matter of updating the context (and the exact context) to either the method context (like we do now) or the object class context...? Seems to work on this simple example anyways, though the codegen creates a frame it doesn't use: ; Assembly listing for method Program:Main():int
; Emitting BLENDED_CODE for X64 CPU with AVX - Windows
; optimized code
; rsp based frame
; partially interruptible
; Final local variable assignments
;
; V00 OutArgs [V00 ] ( 1, 1 ) lclBlk (32) [rsp+0x00] "OutgoingArgSpace"
;* V01 tmp1 [V01,T00] ( 0, 0 ) ref -> zero-ref class-hnd exact "NewObj constructor temp"
;
; Lcl frame size = 40
G_M24375_IG01: ;; offset=0000H
4883EC28 sub rsp, 40
;; bbWeight=1 PerfScore 0.25
G_M24375_IG02: ;; offset=0004H
B801000000 mov eax, 1
;; bbWeight=1 PerfScore 0.25
G_M24375_IG03: ;; offset=0009H
4883C428 add rsp, 40
C3 ret
;; bbWeight=1 PerfScore 1.25
This is currently keying off what kind of context gets passed in, so a method context leads to an updated method context, and likewise for class contexts. I wonder if this is sufficiently general. |
If we devirtualize to a method on a generic class, try and obtain the exact class. Pass this back to the jit to unblock some types of inlines. Also refactor how information is passed during devirtualization in anticipation of follow on work to devirtualize default interface methods. Because there are now multiple inputs and outputs, convey everthing using a struct. Resolves dotnet#38477.
If we devirtualize to a method on a generic class, try and obtain the exact class. Pass this back to the jit to unblock some types of inlines. Also refactor how information is passed during devirtualization in anticipation of follow on work to devirtualize default interface methods. Because there are now multiple inputs and outputs, convey everything using a struct. Resolves #38477.
Compile with optimizations on:
Expected result (disassembly of Main method):
Actual result:
category:cq
theme:devirtualization
skill-level:expert
cost:medium
The text was updated successfully, but these errors were encountered: