Skip to content

8360000: RISC-V: implement aot #26101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Conversation

Hamlin-Li
Copy link

@Hamlin-Li Hamlin-Li commented Jul 2, 2025

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


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26101/head:pull/26101
$ git checkout pull/26101

Update a local copy of the PR:
$ git checkout pull/26101
$ git pull https://git.openjdk.org/jdk.git pull/26101/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 26101

View PR using the GUI difftool:
$ git pr show -t 26101

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26101.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 2, 2025

👋 Welcome back mli! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Jul 2, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Jul 2, 2025

⚠️ @Hamlin-Li This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 2, 2025
@openjdk
Copy link

openjdk bot commented Jul 2, 2025

@Hamlin-Li The following label will be automatically applied to this pull request:

  • hotspot

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the hotspot hotspot-dev@openjdk.org label Jul 2, 2025
@mlbridge
Copy link

mlbridge bot commented Jul 2, 2025

Webrevs

Copy link
Member

@RealFYang RealFYang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, Thanks for working on enabling this feature.

illegal_instruction(Assembler::csr::time);
emit_int64((uintptr_t)msg);
emit_int64((uintptr_t)str);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that our aarch64 counterpart puts the address of msg into r0 in #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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

2 participants