-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8343242: RISC-V: Refactor materialization of literal address #21777
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
👋 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 |
Hi, I agree with the sentiment of the CR. Thinking about the is_32bit_offset_from_codecache vs CodeCache::contains change. |
Thanks! Note that I didn't remove this |
Did you run any micro benchmarks? Maybe skynet just to check VTs. I can't find anything that would matter, but I'll look a bit more. |
No obvious change witnessed on Skynet JMH with this change. Let me know if there are others we might want a try.
Good suggestion. I just tried dacapo and renaissance with
Thanks. I merged master. Take your time! |
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.
Looks good, thanks!
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.
It looks much cleaner now. Thank you!
@robehn @feilongjiang : Thanks for the review! I also tried NetBeans and Eclipse. Both IDEs work fine with this change. Let's move on. |
Going to push as commit 37a3398.
Your commit was automatically rebased without conflicts. |
@RealFYang Pushed as commit 37a3398. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Hi, please consider this refactoring work.
Currently, we have both
la(address)
andla(Address)
. They both accept and materialize literal address.While
la(Address)
always emit a movptr sequence,la(address)
is a bit complex: it checks whether the target isreachable from anywhere within the code cache (
is_32bit_offset_from_codecache
) and emits pc-relative auipc+addipair or movptr sequence. This makes it not that obvious at places where we want a more accurate estimation about
the size of code emitted like when we prepare code stubs like C2SafepointPollStub or C2EntryBarrierStub (See: #21732).
I would suggest we keep
la(address)
simple and let it only emit auipc+addi pair, which will be consistent with theRISC-V Assembly Programmer's Handbook
. I think It's more reasonable to move the distance check tola(Address)
.Furthermore, I would also suggest that we make the distance check simpler. The approach taken here is to only check
whether the target is inside the code cache. This way we will be more certain about code emitted with
la(Address)
as well. This will help keep the risk of this change low as all
la(Address)
callsites with literal address outside of codecache won't be affected. And I don't think the original distance check from code cache will benefit us much more.
Eyeballed all
la(Address)
callsites, I think we are fine.Benefits:
la(address)
which is kind of spec compatible;j(Address)
,la(Address)
,ld/st(Address)
andrt_call
;relocate
with lambda for most of the places;Note that there are several places where we want explicit
movptr
sequence:SignatureHandlerGenerator::generate()
where the emitted code is simply copied without relocation [1];movoop
andmov_metadata
where we want patching afterwards;[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/share/interpreter/interpreterRuntime.cpp#L1313
Testing on linux-riscv64:
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/21777/head:pull/21777
$ git checkout pull/21777
Update a local copy of the PR:
$ git checkout pull/21777
$ git pull https://git.openjdk.org/jdk.git pull/21777/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 21777
View PR using the GUI difftool:
$ git pr show -t 21777
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/21777.diff
Using Webrev
Link to Webrev Comment