RFR: 8340241: RISC-V: Returns mispredicted [v15]
Robbin Ehn
rehn at openjdk.org
Wed Oct 16 12:25:13 UTC 2024
On Wed, 16 Oct 2024 11:40:57 GMT, Fei Yang <fyang at openjdk.org> wrote:
> Thanks for the update. Seems that we missed the jump_link in `MacroAssembler::trampoline_call` [1]? I also witnessed another place where we missed killing the rflags after this change. See comment for details.
>
> [1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp#L4272
>
> (PS: Ignore this as I just noticed that it's a `jal` instead of `jalr` by the `jump_link`)
For C2 calls, i.e. when compiler is doing a deliberate call, RFLAG is SOC.
Which means calls do not need to kill CR, it is implicitly killed AFIACT.
C2 should have saved RFLAG register before doing the call if it needs that value after the call.
> src/hotspot/cpu/riscv/macroAssembler_riscv.cpp line 4082:
>
>> 4080: Register tmp2,
>> 4081: Register tmp3) {
>> 4082: assert_different_registers(r_sub_klass, r_super_klass, tmp1, tmp2, tmp3, result, t0, t1);
>
> This `MacroAssembler::verify_secondary_supers_table` is used by `MacroAssembler::lookup_secondary_supers_table` which is called by C2 `instruct partialSubtypeCheckConstSuper` in riscv.ad. We should list the rflags (aka t1) as being killed for this instruct as well. As this is not obvious, we need to double check if there are other similar occurrences like this.
Same anwser here actual call do not need to kill CR as RFLAG is SOC.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21406#issuecomment-2416673932
PR Review Comment: https://git.openjdk.org/jdk/pull/21406#discussion_r1803002374
More information about the hotspot-dev
mailing list