RFR: 8340241: RISC-V: Returns mispredicted [v2]
Robbin Ehn
rehn at openjdk.org
Mon Oct 14 10:17:12 UTC 2024
On Fri, 11 Oct 2024 15:23:04 GMT, Fei Yang <fyang at openjdk.org> wrote:
>> src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp line 299:
>>
>>> 297: }
>>> 298: if (entry_point != nullptr) {
>>> 299: __ mv(t1, continuation);
>>
>> I see `continuation` will be changed into `x9` for some switch cases, so maybe we can let `continuation` alias `x9` and unconditionallly move `ra` into `x9` on entry. That would save the update of `continuation` for these cases and avoid use of `t1`, which I think will be cleaner.
>
> Hmm ... I don't understand why we would prefer `t1` here. It's actually a RET here, right? So I think that we should prefer `ra` for `jr` instead which indicates a RAS Pop. I mean something like this:
>
> if (continuation != ra) {
> __ mv(ra, continuation);
> }
> __ jr(ra);
I was fooled by the use of Jump Register mnemonic, which is a **jump** and cannot be used with **ra**.
So yes this is a return and should use the **ret** mnemonic.
Fixed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21406#discussion_r1799135868
More information about the hotspot-dev
mailing list