RFR: 8343430: RISC-V: C2: Remove old trampoline call [v6]

Fei Yang fyang at openjdk.org
Mon Nov 11 02:35:14 UTC 2024


On Fri, 8 Nov 2024 15:05:44 GMT, Hamlin Li <mli at openjdk.org> wrote:

>> src/hotspot/cpu/riscv/macroAssembler_riscv.cpp line 4227:
>> 
>>> 4225:     auipc(tmp, (int32_t)distance + 0x800);
>>> 4226:     ld(tmp, Address(tmp, ((int32_t)distance << 20) >> 20));
>>> 4227:     jalr(tmp);
>> 
>> Seems we can totally remove the usage of `distance`? could be something like below:
>> 
>> auipc(tmp, 0);
>> ld(tmp, Address(tmp, 0));
>> jalr(tmp);
>
> If the above simplication make sense, then what we're doing here is to load from pc as the destination addr, then jump to the addr? I could be misunderstanding.

Thanks. I removed `distance` and simplified the code as suggested. Note that the use of PC as address here is only temporary. The relocation created while emitting the stub will ensure this call sequence is subsequently patched to call the stub. I have added code comments for to help understand.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21822#discussion_r1835886176


More information about the hotspot-dev mailing list