Integrated: 8298075: RISC-V: Implement post-call NOPs
Xiaolin Zheng
xlinzheng at openjdk.org
Thu Dec 8 02:23:29 UTC 2022
On Mon, 5 Dec 2022 04:22:49 GMT, Xiaolin Zheng <xlinzheng at openjdk.org> wrote:
> 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
This pull request has now been integrated.
Changeset: 74f346b3
Author: Xiaolin Zheng <xlinzheng at openjdk.org>
Committer: Fei Yang <fyang at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/74f346b33f7fa053ad5c99ef85baa32b7fb12fa6
Stats: 37 lines in 6 files changed: 30 ins; 0 del; 7 mod
8298075: RISC-V: Implement post-call NOPs
Reviewed-by: fyang, luhenry
-------------
PR: https://git.openjdk.org/jdk/pull/11502
More information about the hotspot-dev
mailing list