RFR: 8345159: RISCV: Fix -Wzero-as-null-pointer-constant warning in emit_static_call_stub

Robbin Ehn rehn at openjdk.org
Tue Dec 3 06:44:38 UTC 2024


On Tue, 3 Dec 2024 03:40:42 GMT, Fei Yang <fyang at openjdk.org> wrote:

>> src/hotspot/cpu/riscv/macroAssembler_riscv.cpp line 788:
>> 
>>> 786:   // Jump to the entry point of the c2i stub.
>>> 787:   int32_t offset = 0;
>>> 788:   movptr2(t1, 0, offset, t0); // lui + lui + slli + add
>> 
>> How about something like this?
>> Suggestion:
>> 
>>   address placeholder = pc(); // correct value will be patched in later
>>   movptr2(t1, placeholder, offset, t0); // lui + lui + slli + add
>
> That seems OK to me. Then we can still use `movptr` here.
> 
>   address placeholder = pc(); // correct value will be patched in later
>   movptr(t1, placeholder, offset, t0); // lui + lui + slli + add

When looking at the disassembly it much easier to find uninitialized call stubs when we use 0.
Also if something would go wrong, it much nicer with a crash than a loop.
So for debuggability I prefer address 0.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22435#discussion_r1867134766


More information about the hotspot-compiler-dev mailing list