BitCast<TYP_REF>(TypeHandleToRuntimeTypeHandle(clsHandle)) => nongc obj#97955
BitCast<TYP_REF>(TypeHandleToRuntimeTypeHandle(clsHandle)) => nongc obj#97955EgorBo merged 8 commits intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsImproves codegen for #97949, new codegen for ; Assembly listing for method LdtokenRepro:Test():System.Type (FullOpts)
G_M57559_IG01:
sub rsp, 40
G_M57559_IG02:
mov rax, 0x1FA00005580 ; 'System.Int32'
G_M57559_IG03:
add rsp, 40
ret
; Total bytes of code 19
|
|
@dotnet/jit-contrib PTAL, simple change. Suprisingly, there were some diffs. Basically, it optimizes: into: |
0ba2dd0 to
c3b1ad1
Compare
|
Does the same optimization kick in for native AOT that uses different representation of RuntimeTypeHandle? |
Oh, I forgot that RuntimeType objects are already frozen in NAOT. Currently the function in question emits this on NAOT: ; Assembly listing for method LdtokenRepro:Test():System.Type (FullOpts)
G_M57559_IG01:
sub rsp, 40
G_M57559_IG02:
lea rcx, [(reloc 0x40000000004224d0)] ; System.Int32
call CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPEHANDLE
mov rcx, rax
call System.Type:GetTypeFromHandle(System.RuntimeTypeHandle):System.Type
nop
G_M57559_IG03:
add rsp, 40
ret
; Total bytes of code 30since |
This comment was marked as outdated.
This comment was marked as outdated.
|
Ah, nvm, @SingleAccretion pointed to an issue on my side |
897ef3c to
4f78bdd
Compare
|
@SingleAccretion can you take a look? |
|
@SingleAccretion I've addressed your feedback, can you give it another look? thanks |
SingleAccretion
left a comment
There was a problem hiding this comment.
Code changes LGTM!
| #if defined(LATE_DISASM) | ||
| node = new (this, LargeOpOpcode()) GenTreeIntCon(TYP_I_IMPL, value, fields DEBUGARG(/*largeNode*/ true)); | ||
| node = new (this, LargeOpOpcode()) | ||
| GenTreeIntCon(gtGetTypeForIconFlags(flags), value, fields DEBUGARG(/*largeNode*/ true)); | ||
| #else | ||
| node = new (this, GT_CNS_INT) GenTreeIntCon(TYP_I_IMPL, value, fields); | ||
| node = new (this, GT_CNS_INT) GenTreeIntCon(gtGetTypeForIconFlags(flags), value, fields); |
There was a problem hiding this comment.
Unrelated, but any idea why this needs a large node for LATE_DISASM?
There was a problem hiding this comment.
Pretty sure it's dead code.
There was a problem hiding this comment.
We revived LATE_DISASM for use in SVE emitter unit tests in #96286, so it's not dead anymore.
There was a problem hiding this comment.
Yes, but I don't think this large opcode ifdefing is still needed. It seems in the past gtCompileTimeHandle was part of the requirement for a "large" node:
runtime/src/coreclr/jit/morph.cpp
Lines 12663 to 12669 in 24d149c
|
CI failure is #97049 |
|
@EgorBo This PR seems to lead to an assert during JitDump: Here's the test case I'm using: |
|
@BruceForstall yeah 🙁 I've fixed it in #98337 (ready for final review) |
|
Ah, wait, it should be fixed in main after https://github.com/dotnet/runtime/pull/98273/files already. I just added |
Improves codegen for #97949, new codegen for
GetIntType: