-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8359270: C2: alignment check should consider base offset when emitting arraycopy runtime call #25765
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
Conversation
…g arraycopy runtime call
|
👋 Welcome back fyang! A progress list of the required criteria for merging this PR into |
|
@RealFYang This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 15 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
|
@RealFYang The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
|
/label remove graal |
|
@RealFYang |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to add an IR Framework test for this, checking that the right stub is selected?
Hi Tobias, |
|
But |
Yes. I missed that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding a test! I'll run some testing on our side and report back once it passed.
|
|
Hi Tobias, I improved the test a bit and added some warmup to it. Now I see it is passing on three different platforms with these extra VM options. Could you please give it another try? Thanks. |
test/hotspot/jtreg/compiler/c2/irTests/stringopts/TestArrayCopySelect.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing passed. This looks good to me but needs a second review.
Thanks for the review and suggestions. Sure, I'll wait for another review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good.
Thanks for the review! |
|
/integrate |
|
Going to push as commit 6b43939.
Your commit was automatically rebased without conflicts. |
|
@RealFYang Pushed as commit 6b43939. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Hi, please consider this change fixing alignment check when emitting arraycopy runtime call.
There are currently four callsites of
StubRoutines::select_arraycopy_functionin hotspot C2 shared code where we emit arraycopy runtime calls [1-4]. Three of them [2-4] missed base offset when calculation alignment for both source and destination array addresses. Seems they assume a base offset of 8 bytes, which is not always true. Base offset becomes 4 bytes under either-XX:+UseCompactObjectHeadersor-XX:-UseCompressedClassPointers.And
StubRoutines::select_arraycopy_functionselects the right arraycopy runtime call based on this alignment. As a result, it could see an incorrectalignedparam about the array addresses and thus a wrong arraycopy runtime call is selected. This is causing performance regressions (like Dacapo Spring) on some linux-riscv64 platforms like Sifive Unmatched or Premier P550 SBCs where misaligned memory access is very slow.Proposed change fixes this issue by taking base offset into account when checking the alignment, which is very similar to [1].
Testing:
-XX:+UseCompactObjectHeaders/-XX:-UseCompressedClassPointers)[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/macroArrayCopy.cpp#L341
[2] https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/library_call.cpp#L1584
[3] https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/library_call.cpp#L1666
[4] https://github.com/openjdk/jdk/blob/master/src/hotspot/share/opto/stringopts.cpp#L1481
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25765/head:pull/25765$ git checkout pull/25765Update a local copy of the PR:
$ git checkout pull/25765$ git pull https://git.openjdk.org/jdk.git pull/25765/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 25765View PR using the GUI difftool:
$ git pr show -t 25765Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25765.diff
Using Webrev
Link to Webrev Comment