RFR: 8285378: Remove unnecessary nop for C1 exception and deopt handler
Feilong Jiang
fjiang at openjdk.java.net
Thu May 5 01:17:26 UTC 2022
On Thu, 21 Apr 2022 14:09:08 GMT, Boris Ulasevich <bulasevich at openjdk.org> wrote:
> Each C1 method have two nops in the code body. They originally separated the exception/deopt handler block from the code body to fix a "bug 5/14/1999". Now Exception Handler and Deopt Handler are generated in a separate CodeSegment and these nops in the code body don't really help anyone.
>
> I checked jtreg tests on the following platforms:
> - x86
> - ppc
> - arm32
> - aarch64
>
> I would be grateful if someone could check my changes on the riscv and s390 platforms.
>
>
> [Verified Entry Point]
> 0x0000ffff7c749d40: nop
> 0x0000ffff7c749d44: sub x9, sp, #0x20, lsl #12
> 0x0000ffff7c749d48: str xzr, [x9]
> 0x0000ffff7c749d4c: sub sp, sp, #0x40
> 0x0000ffff7c749d50: stp x29, x30, [sp, #48]
> 0x0000ffff7c749d54: and w0, w2, #0x1
> 0x0000ffff7c749d58: strb w0, [x1, #12]
> 0x0000ffff7c749d5c: dmb ishst
> 0x0000ffff7c749d60: ldp x29, x30, [sp, #48]
> 0x0000ffff7c749d64: add sp, sp, #0x40
> 0x0000ffff7c749d68: ldr x8, [x28, #808] ; {poll_return}
> 0x0000ffff7c749d6c: cmp sp, x8
> 0x0000ffff7c749d70: b.hi 0x0000ffff7c749d78 // b.pmore
> 0x0000ffff7c749d74: ret
> # emit_slow_case_stubs
> 0x0000ffff7c749d78: adr x8, 0x0000ffff7c749d68 ; {internal_word}
> 0x0000ffff7c749d7c: str x8, [x28, #832]
> 0x0000ffff7c749d80: b 0x0000ffff7c697480 ; {runtime_call SafepointBlob}
> # Excessive nops: Exception Handler and Deopt Handler prolog
> 0x0000ffff7c749d84: nop <----------------------------------------------------------------
> 0x0000ffff7c749d88: nop <----------------------------------------------------------------
> # Unwind handler: the handler to remove the activation from the stack and dispatch to the caller.
> 0x0000ffff7c749d8c: ldr x0, [x28, #968]
> 0x0000ffff7c749d90: str xzr, [x28, #968]
> 0x0000ffff7c749d94: str xzr, [x28, #976]
> 0x0000ffff7c749d98: ldp x29, x30, [sp, #48]
> 0x0000ffff7c749d9c: add sp, sp, #0x40
> 0x0000ffff7c749da0: b 0x0000ffff7c73e000 ; {runtime_call unwind_exception Runtime1 stub}
> # Stubs alignment
> 0x0000ffff7c749da4: .inst 0x00000000 ; undefined
> 0x0000ffff7c749da8: .inst 0x00000000 ; undefined
> 0x0000ffff7c749dac: .inst 0x00000000 ; undefined
> 0x0000ffff7c749db0: .inst 0x00000000 ; undefined
> 0x0000ffff7c749db4: .inst 0x00000000 ; undefined
> 0x0000ffff7c749db8: .inst 0x00000000 ; undefined
> 0x0000ffff7c749dbc: .inst 0x00000000 ; undefined
> [Exception Handler]
> 0x0000ffff7c749dc0: bl 0x0000ffff7c740d00 ; {no_reloc}
> 0x0000ffff7c749dc4: dcps1 #0xdeae
> 0x0000ffff7c749dc8: .inst 0x853828d8 ; undefined
> 0x0000ffff7c749dcc: .inst 0x0000ffff ; undefined
> [Deopt Handler Code]
> 0x0000ffff7c749dd0: adr x30, 0x0000ffff7c749dd0
> 0x0000ffff7c749dd4: b 0x0000ffff7c6977c0 ; {runtime_call DeoptimizationBlob}
I will test these changes on riscv, the results will be available in about one day.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8341
More information about the hotspot-compiler-dev
mailing list