RFR: 8330161: RISC-V: Don't use C for Labels jumps

Robbin Ehn rehn at openjdk.org
Mon Apr 15 06:40:41 UTC 2024


On Mon, 15 Apr 2024 06:37:27 GMT, Robbin Ehn <rehn at openjdk.org> wrote:

>> src/hotspot/cpu/riscv/macroAssembler_riscv.cpp line 926:
>> 
>>> 924:     assert_different_registers(Rd, temp);                                             \
>>> 925:     /* We can't patch C, i.e. if Label wasn't bound we need to patch this jump.*/     \
>>> 926:     IncompressibleRegion ir(this);                                                    \
>> 
>> Seems that we rarely uses `jal` with unbound label. Here is what I see it. 
>> For unbound label, we set `dest` to pc() at [1]. So the `distance` calculated at [2] will always be zero for this case. 
>> After that we emit a simple `Assembler::jal(Rd, 0);` at [3] which is there for patching. So no `jalr` involved. 
>> This means that possible future callers of `jal` with unbound label have to ensure that the target is not far. 
>> 
>> [1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp#L947
>> [2] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp#L913
>> [3] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp#L915
>
> Ah, now I understand.

Then I suggest we remove jalr from the method.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18761#discussion_r1565245272


More information about the hotspot-dev mailing list