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

Hamlin Li mli at openjdk.org
Mon Jul 14 10:31:34 UTC 2025


On Mon, 7 Jul 2025 07:31:11 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 800:
> 
>> 798:   push_reg(RegSet::of(t1, xmethod), sp);   // push << t1 & xmethod >> to sp
>> 799:   movptr(t1, RuntimeAddress(entry_point), t0);
>> 800:   jalr(t1);
> 
> This movptr + jalr sequence could be further simplified into `rt_call(entry_point)`, which could help save one add instruction.

Not sure if I understand your suggestion right.
If we use `rt_call` here, it will only call into `movptr1`, whose instructions is one longer than `movptr2`.

> src/hotspot/cpu/riscv/macroAssembler_riscv.cpp line 4930:
> 
>> 4928:   push_reg(saved_regs, sp);
>> 4929: 
>> 4930:   movptr(t1, ExternalAddress(CAST_FROM_FN_PTR(address, Thread::current)));
> 
> It will be more consistent with other places in riscv code where we move an ExternalAddress into a register if we do: `la(t1, ExternalAddress(CAST_FROM_FN_PTR(address, Thread::current)))`.

make sense, will fix it.

> src/hotspot/cpu/riscv/runtime_riscv.cpp line 63:
> 
>> 61: UncommonTrapBlob* OptoRuntime::generate_uncommon_trap_blob() {
>> 62:   // Allocate space for the code
>> 63:   ResourceMark rm;
> 
> Seems more reasonable to move this `ResourceMark rm;` closer to its user `CodeBuffer buffer(name, 2048, 1024);`.
> Similar for other changes in this file and src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp.

make sense, will fix it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26101#discussion_r2204501151
PR Review Comment: https://git.openjdk.org/jdk/pull/26101#discussion_r2204501707
PR Review Comment: https://git.openjdk.org/jdk/pull/26101#discussion_r2204502061


More information about the hotspot-dev mailing list