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

Robbin Ehn rehn at openjdk.org
Mon Apr 15 07:39:44 UTC 2024


On Mon, 15 Apr 2024 07:24:03 GMT, Fei Yang <fyang at openjdk.org> wrote:

>>> Then I suggest we remove jalr from the method.
>> 
>> I think we still need the `jalr` which is emitted by the else block of the method. The reason is that we have calls to `void jal(const address dest, Register temp = t0);` where we need to check whether `dest` is far or not [1][2].
>> 
>> [1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp#L1815
>> [2] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp#L3532
>
>> Note, I notice this when I enable c_jal, if we ever want c_jal we need to either eanble patching of C or turn off C when we need patching.
> 
> The current approach is to turn off C on sites where patching could happen. There are two `relocate` assembler functions for that purpose [1]. They will turn off C on those patching sites. We don't think it worth the complexity to enable patching of C.
> 
> [1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/assembler_riscv.hpp#L2083-L2093

Those two plain jal don't use Labels, so they are unaffected.

In this case, instead of turn off C we have no C switch for jal.
So we don't have one approach. Turn off C would be inline with what you are saying.

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

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


More information about the hotspot-dev mailing list