-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8362515: RISC-V: cleanup NativeFarCall #26370
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
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back mli! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
@Hamlin-Li this pull request can not be integrated into git checkout cleanup-NativeFarCall
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
@Hamlin-Li The following label 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 list. If you would like to change these labels, use the /label pull request command. |
|
||
CodeBlob *code = CodeCache::find_blob(call_addr); | ||
assert(code != nullptr, "Could not find the containing code blob"); | ||
|
||
address dest = MacroAssembler::pd_call_destination(call_addr); | ||
address dest = MacroAssembler::target_addr_for_insn(call_addr); |
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.
Is this change safe? Seems it modifies the original logic.
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.
Yes, MacroAssembler::pd_call_destination
only call MacroAssembler::target_addr_for_insn
.
And MacroAssembler::target_addr_for_insn
are used in other places in NativeFarCall, so it's better to use target_addr_for_insn
only to improve readability.
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.
There seems to be a subtle differnece here. I see MacroAssembler::pd_call_destination
delegates work to NativeFarCall::reloc_destination
which calls MacroAssembler::target_addr_for_insn
under condition if (stub_addr != nullptr)
. After this change, that condition is gone. I haven't looked into how this may make a difference.
I see this function was introduce by JDK-8332689, maybe @robehn could comment?
[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/nativeInst_riscv.cpp#L112
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.
I see
MacroAssembler::pd_call_destination
delegates work toNativeFarCall::reloc_destination
which callsMacroAssembler::target_addr_for_insn
under conditionif (stub_addr != nullptr)
.
Can you clarify "MacroAssembler::pd_call_destination
delegates work to NativeFarCall::reloc_destination
"?
Robbin is on vacation for weeks, so I'm afraid he's not going to reponse in 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.
I don't think this pr changes the logic in NativeFarCall::reloc_destination
, am I right?
Or maybe you're misled by the name change from stub_address
to reloc_destination_without_check
and existing method reloc_destination()
?
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.
I see
MacroAssembler::pd_call_destination
delegates work toNativeFarCall::reloc_destination
which callsMacroAssembler::target_addr_for_insn
under conditionif (stub_addr != nullptr)
.Can you clarify "
MacroAssembler::pd_call_destination
delegates work toNativeFarCall::reloc_destination
"? Robbin is on vacation for weeks, so I'm afraid he's not going to reponse in time.
Sorry for not being clear. Let me clarify. I mean this code snippet at [1]:
74 address Relocation::pd_call_destination(address orig_addr) {
75 assert(is_call(), "should be a call here");
76 if (NativeCall::is_at(addr())) {
77 return nativeCall_at(addr())->reloc_destination(); <======================
78 }
79
80 if (orig_addr != nullptr) {
Before this change, we call MacroAssembler::pd_call_destination
here.
And NativeFarCall::reloc_destination
at L77 will only call MacroAssembler::target_addr_for_insn
under condition if (stub_addr != nullptr)
[2]. But we will always/unconditionally call MacroAssembler::target_addr_for_insn
here after this change. That seems make a difference? Did I miss anything?
[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/relocInfo_riscv.cpp#L77
[2] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/nativeInst_riscv.cpp#L112
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.
The call path was:
Relocation::pd_call_destination(address orig_addr)
=>
NativeCall::reloc_destination()
=>
NativeFarCall::reloc_destination()
After change, it's:
Relocation::pd_call_destination(address orig_addr)
=>
NativeCall::reloc_destination()
=>
RelocCall::reloc_destination()
The code path does not change except that NativeFarCall::reloc_destination
is changed to RelocCall::reloc_destination
and assert(NativeFarCall...
is changed to assert(RelocCall
.
Seems it does not change any logic in this code path, but just names.
Before this change, we call MacroAssembler::pd_call_destination here.
And NativeFarCall::reloc_destination at L77 will only call MacroAssembler::target_addr_for_insn under condition if (stub_addr != nullptr)
The code between NativeFarCall::reloc_destination
and RelocCall::reloc_destination
is almost the same, except of names.
But we will always/unconditionally call MacroAssembler::target_addr_for_insn here after this change.
No. I guess you might have mistoken RelocCall::reloc_destination_without_check()
as RelocCall::reloc_destination()
?
Hi,
Can you help to review this patch?
By https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp#L1270, there are far call, indirect call, reloc call.
NativeFarCall is in fact a reloc call, the name is confusing, better to rename it to RelocCall.
Also add some comments and do some other simple cleanup.
Thanks!
Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26370/head:pull/26370
$ git checkout pull/26370
Update a local copy of the PR:
$ git checkout pull/26370
$ git pull https://git.openjdk.org/jdk.git pull/26370/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 26370
View PR using the GUI difftool:
$ git pr show -t 26370
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26370.diff
Using Webrev
Link to Webrev Comment