RFR: 8360000: RISC-V: implement aot [v2]

Hamlin Li mli at openjdk.org
Fri Jul 4 13:50:05 UTC 2025


On Fri, 4 Jul 2025 05:48:26 GMT, Fei Yang <fyang at openjdk.org> wrote:

>> Hamlin Li has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - pass msg via a0 in stop
>>  - comment
>
> src/hotspot/cpu/riscv/macroAssembler_riscv.cpp line 766:
> 
>> 764:   BLOCK_COMMENT(str);
>> 765:   illegal_instruction(Assembler::csr::time);
>> 766:   emit_int64((uintptr_t)str);
> 
> I noticed that our aarch64 counterpart puts the address of msg into `r0` in https://github.com/openjdk/jdk/pull/24740.
> 
>   // load msg into r0 so we can access it from the signal handler
>   // ExternalAddress enables saving and restoring via the code cache
>   lea(c_rarg0, ExternalAddress((address) str));
> 
> 
> And fetches the address from `r0` in `PosixSignals::pd_hotspot_signal_handler`:
> 
>         // A pointer to the message will have been placed in `r0`
>         const char *detail_msg = (const char *)(uc->uc_mcontext.regs[0]);
> 
> 
> I am not sure but I guess this is needed for the correct working of aot? Maybe we should do similar things.

My test shows that it's fine to keep the current way to pass the stop message to sig handler, in both dump and use time. Seems currently both ways work.
But to keep the consistency with other platforms, I'll change it too.

> src/hotspot/share/code/aotCodeCache.cpp line 131:
> 
>> 129: // and does final AOT state and flags settings.
>> 130: void AOTCodeCache::initialize() {
>> 131: #if defined(ZERO) || !(defined(AMD64) || defined(AARCH64) || defined(RISCV64))
> 
> Nit: You might want to mention `RISCV64` in code comment for the corresponding #endif at L199.
> `#endif // defined(AMD64) || defined(AARCH64)`

fixed, thanks!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26101#discussion_r2185419585
PR Review Comment: https://git.openjdk.org/jdk/pull/26101#discussion_r2185425398


More information about the hotspot-dev mailing list