RFR: 8367692: RISC-V: Align post call nop
Fei Yang
fyang at openjdk.org
Thu Sep 25 02:58:39 UTC 2025
On Wed, 24 Sep 2025 11:52:20 GMT, Robbin Ehn <rehn at openjdk.org> wrote:
> Hi please, consider.
>
> As ziccif require instructions to natural aligned to be atomic the 4 byte post call nop must be aligned.
> But I don't want to add a c.nop(2b) to align the nop(4b) which means the jal(r) must also be algined.
> As we have no utility to aligned the end of an instruction sequence the call it self is aligned and uses only 4 byte instructions. Only in the case where we could use an two c-instruction we may loose space.
>
> Thanks, Robbin
Hi, Thanks for finding this. Nice fix! I only have several minor comments.
src/hotspot/cpu/riscv/assembler_riscv.hpp line 859:
> 857: return insn;
> 858: }
> 859:
I am not sure but is it better to place this with friends `encode_jal` and `encode_jalr` at line 928? These all return an instruction encoding instead of writing the code cache and thus are different from other assember routines.
src/hotspot/cpu/riscv/macroAssembler_riscv.cpp line 359:
> 357: void MacroAssembler::post_call_nop() {
> 358: assert(!in_compressible_scope(), "Must be");
> 359: assert_alignment(pc());
Does the first assertion make sense here? Seems to me the second one will just suffice.
src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp line 1007:
> 1005: __ bnez(c_rarg2, call_thaw);
> 1006:
> 1007: address tr_call;
Can you rename this to `call_pc` while you are on it? `tr_call` is named after trampoline call, but we don't have that now.
src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp line 1042:
> 1040: __ bnez(c_rarg2, call_thaw);
> 1041:
> 1042: address tr_call;
Similar here.
-------------
PR Review: https://git.openjdk.org/jdk/pull/27467#pullrequestreview-3263439361
PR Review Comment: https://git.openjdk.org/jdk/pull/27467#discussion_r2377446188
PR Review Comment: https://git.openjdk.org/jdk/pull/27467#discussion_r2376159064
PR Review Comment: https://git.openjdk.org/jdk/pull/27467#discussion_r2377533241
PR Review Comment: https://git.openjdk.org/jdk/pull/27467#discussion_r2377533438
More information about the hotspot-dev
mailing list