RFR: 8360000: RISC-V: implement aot
Fei Yang
fyang at openjdk.org
Fri Jul 4 05:53:39 UTC 2025
On Wed, 2 Jul 2025 17:14:26 GMT, Hamlin Li <mli at openjdk.org> wrote:
> Hi,
> Can you help to review this patch?
>
> https://openjdk.org/jeps/483 introduced aot (class loading/linking) and subsequent prs introduced more features related to it, like preserve adapters(c2i/i2c) and runtime blobs in AOT code cache.
>
> Riscv should support these features and resolve relative issues.
>
> ## Test
>
> ### jtreg
>
> run tier1/2/3 and hotspot_cds tests, no new failure found compared to master jdk.
>
> ### Performance
>
> perf command to run the simplest Hello world java program:
> * (perf stat -r 100 ${JAVA_HOME}/bin/java -XX:AOTCache=$AOT_CACHE -cp $CLASS_PATH Hello > /dev/null) 2>&1 | grep elapsed
>
> perf data:
> * (with patch): 0.181730 +- 0.000296 seconds time elapsed ( +- 0.16% )
> * (without patch): 0.196627 +- 0.000227 seconds time elapsed ( +- 0.12% )
>
> Thanks
Hi, Thanks for working on enabling this feature.
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.
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)`
-------------
PR Review: https://git.openjdk.org/jdk/pull/26101#pullrequestreview-2981131967
PR Review Comment: https://git.openjdk.org/jdk/pull/26101#discussion_r2184472508
PR Review Comment: https://git.openjdk.org/jdk/pull/26101#discussion_r2181291531
More information about the hotspot-dev
mailing list