RFR: 8362515: RISC-V: cleanup NativeFarCall [v3]

Fei Yang fyang at openjdk.org
Tue Jul 22 11:08:26 UTC 2025


On Mon, 21 Jul 2025 08:52:38 GMT, Hamlin Li <mli at openjdk.org> wrote:

>> src/hotspot/cpu/riscv/nativeInst_riscv.cpp line 190:
>> 
>>> 188:   assert(code != nullptr, "Could not find the containing code blob");
>>> 189: 
>>> 190:   address dest = MacroAssembler::target_addr_for_insn(call_addr);
>> 
>> Is this change safe? Seems it modifies the original logic.
>
> Yes, `MacroAssembler::pd_call_destination` only call `MacroAssembler::target_addr_for_insn`.
> And `MacroAssembler::target_addr_for_insn` are used in other places in NativeFarCall, so it's better to use `target_addr_for_insn` only to improve readability.

There seems to be a subtle differnece here. I see `MacroAssembler::pd_call_destination` delegates work to `NativeFarCall::reloc_destination` which calls `MacroAssembler::target_addr_for_insn` under condition `if (stub_addr != nullptr)`. After this change, that condition is gone. I haven't looked into how this may make a difference.

I see this function was introduce by JDK-8332689, maybe @robehn could comment?

[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/nativeInst_riscv.cpp#L112

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26370#discussion_r2222185471


More information about the hotspot-compiler-dev mailing list