RFR: 8298075: RISC-V: Implement post-call NOPs [v6]

Xiaolin Zheng xlinzheng at openjdk.org
Tue Dec 6 10:41:59 UTC 2022


> Same as [JDK-8287567](https://bugs.openjdk.org/browse/JDK-8287567), we need to implement post-call NOPs in the RISC-V backend.
> 
> We use `li32` to implement it. `li32` will signed-extend the loaded imm32 to a 64-bit register. However, our reader `NativePostCallNop::displacement()` only needs the low 32 bits value so we are safe.
> 
> The current post-call NOP is like:
> 
> nop                    (always 4-byte, used for deoptimization, please see `NativePostCallNop::make_deopt()`)
> lui zr, <imm20>        (always 4-byte)
> addiw zr, zr, <imm12>  (always 4-byte)
> 
> 
> The code size here is the same as the AArch64 counterpart, 12 bytes.
> 
> The logic of setting the post-call NOP displacement is at `install_post_call_nop_displacement()` [1] when nmethods are being installed, so no one is running post-call NOPs when we are patching them.
> 
> One can check them by directly using `java --enable-preview -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly`.
> 
> Tested hotspot tier1~4 and jdk tier1~4 using fastdebug by force turning on `--enable-preview`; SPECjbb2015 and dacapo were tested without regressions found. Skynet JMH benchmark seems to have an improvement from `8662ms/op -> 8495ms/op`.
> 
> Thanks,
> Xiaolin
> 
> [1] https://github.com/openjdk/jdk/blob/b49fd920b6690a8b828c85e45c10e5c4c54d2022/src/hotspot/share/code/nmethod.cpp#L1078-L1107

Xiaolin Zheng has updated the pull request incrementally with one additional commit since the last revision:

  Plural form...

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/11502/files
  - new: https://git.openjdk.org/jdk/pull/11502/files/bb5e4633..21142c15

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=11502&range=05
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11502&range=04-05

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/11502.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11502/head:pull/11502

PR: https://git.openjdk.org/jdk/pull/11502


More information about the hotspot-dev mailing list