RFR: 8354887: Preserve runtime blobs in AOT code cache [v2]
Ashutosh Mehra
asmehra at openjdk.org
Wed May 7 03:54:13 UTC 2025
On Tue, 6 May 2025 14:11:54 GMT, Ashutosh Mehra <asmehra at openjdk.org> wrote:
> I can recreate this test locally. Looking into it.
Looks like the code for C2 blobs generated in assembly phase is not correct.
For example, code for new_instance blob is:
[0.141s][550409][aot,codecache,stubs] Decoding CodeBlob, name: C2 Runtime new_instance, at [0x00007fed0f904260, 0x00007fed0f9042b8] 88 bytes
[0.141s][550409][aot,codecache,stubs] ;; N1: # out( B1 ) <- in( B3 B2 ) Freq: 1
[0.141s][550409][aot,codecache,stubs] ;; B1: # out( B3 B2 ) <- BLOCK HEAD IS JUNK Freq: 1
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f904260: sub $0x8,%rsp
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f904267: mov %rbp,(%rsp)
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f90426b: mov %rsp,0x3e8(%r15)
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f904272: mov %rsi,%rdi
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f904275: mov %r15,%rsi
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f904278: movabs $0x7fed28908982,%r10
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f904282: call *%r10
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f904285: nopl 0x0(%rax,%rax,1)
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f90428d: mov %r12,0x3e8(%r15)
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f904294: mov %r12,0x3f0(%r15)
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f90429b: mov 0x440(%r15),%rax
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f9042a2: mov %r12,0x440(%r15)
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f9042a9: cmp 0x8(%r15),%r12
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f9042ad: jne 0x00007fed0f9042b1
[0.141s][550409][aot,codecache,stubs] ;; B2: # out( N1 ) <- in( B1 ) Freq: 0.999999
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f9042af: pop %rbp
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f9042b0: ret
[0.141s][550409][aot,codecache,stubs] ;; B3: # out( N1 ) <- in( B1 ) Freq: 1e-06
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f9042b1: pop %rbp
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f9042b2: jmp Stub::forward_exception
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f9042b7: hlt
Look at the instructions generated after the call to runtime method:
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f90428d: mov %r12,0x3e8(%r15)
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f904294: mov %r12,0x3f0(%r15)
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f90429b: mov 0x440(%r15),%rax
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f9042a2: mov %r12,0x440(%r15)
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f9042a9: cmp 0x8(%r15),%r12
[0.141s][550409][aot,codecache,stubs] 0x00007fed0f9042ad: jne 0x00007fed0f9042b1
Comparing it with the case when AOT code cache is not used:
0x7fffdef07c8d: movq $0x0,0x3e8(%r15)
0x7fffdef07c98: movq $0x0,0x3f0(%r15)
0x7fffdef07ca3: mov 0x440(%r15),%rax
0x7fffdef07caa: movq $0x0,0x440(%r15)
0x7fffdef07cb5: mov 0x8(%r15),%r10
0x7fffdef07cb9: test %r10,%r10
0x7fffdef07cbc: jne 0x7fffdef07cc0
For some reason r12 is used instead of null (0x0). r12 is the CompressedOop::base address.
C2 code that generates this is https://github.com/openjdk/jdk/blob/762423d64d10dcdb37800767d2b2f1b7757c804a/src/hotspot/share/opto/generateOptoStub.cpp#L222
I suspect I missed porting a change from premain. @adinn @vnkozlov any idea what that could be?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25019#issuecomment-2856943220
More information about the hotspot-runtime-dev
mailing list