-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
8301995: Move invokedynamic resolution information out of ConstantPoolCacheEntry #12778
Conversation
👋 Welcome back matsaave! A progress list of the required criteria for merging this PR into |
@matias9927 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. |
35bcaf8
to
829517d
Compare
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.
This looks really good. I noted a few changes and questions.
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ResolvedIndyArray.java
Show resolved
Hide resolved
...nternal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.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.
I have a couple of very minor comments. This change is great. Thank you!
void TemplateTable::load_invoke_cp_cache_entry(int byte_no, | ||
Register method, | ||
Register itable_index, | ||
Register flags, | ||
bool is_invokevirtual, | ||
bool is_invokevfinal, /*unused*/ | ||
bool is_invokedynamic) { | ||
bool is_invokedynamic /*unused*/) { |
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.
Can you remove the parameter since the s390 port is here?
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.
Ok, never mind, I saw s390 port but it doesn't seem to be in these changes (?)
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.
Ok, never mind, I saw s390 port but it doesn't seem to be in these changes (?)
It is not in these changes.
@offamitkumar is working on s390x. It is not yet finished though.
(I wasn't aware that putting the URL of this PR into a comment somewhere else adds a comment to this PR)
@matias9927 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 176 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 |
@dougxc Can you have a look at the jvmci changes in this PR also? |
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.
As communicated to Matias earlier via email, the JVMCI changes in this PR look fine.
@matias9927 can I ask you to merge master? There seem to be conflicts (at least I see a message "This branch has conflicts that must be resolved"). |
Hi, @RealFYang @DingliZhang Please help review the RISCV port code. |
I saw that merge error but nothing came up when I tried to merge locally. The branch is updated nonetheless, so you should be able to test it now @reinrich ! |
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. Just a few minor comments.
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ResolvedIndyArray.java
Outdated
Show resolved
Hide resolved
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ResolvedIndyEntry.java
Outdated
Show resolved
Hide resolved
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithCPIndex.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.
AArch64 looks good. Thank you.
More changes for RISC-V which resolve @RealFYang's review comments. @matias9927 Please help integrate this |
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.
Updated RISC-V part looks good.
Hi Matias, s390x port is almost complete. All builds are successful & tier1 test for fast debug are complete. For other builds, tests are in progress. Please don't integrate, Wait for us 🙂 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.
{tier1, tier2} X {fast debug, slow debug, release}
testing done for s390x. PR seems clean.
@matias9927 please include port for s390x from this commit:
offamitkumar@a582f32
Thanks
__ get_cache_index_at_bcp(size, 1, index_size); // Load index. | ||
// Get address of invokedynamic array | ||
__ ld_ptr(cache, in_bytes(ConstantPoolCache::invokedynamic_entries_offset()), R27_constPoolCache); | ||
// Scale the index to be the entry index * sizeof(ResolvedInvokeDynamicInfo) | ||
__ sldi(size, size, log2i_exact(sizeof(ResolvedIndyEntry))); | ||
__ add(cache, cache, size); |
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.
@reinrich Is there any specific reason, why you're not calling load_resolved_indy_entry() method here. On s390x build/changes are stable even with calling that helper method.
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 should work if we move the addition of Array<ResolvedIndyEntry>::base_offset_in_bytes()
into the other caller.
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.
@reinrich Is there any specific reason, why you're not calling load_resolved_indy_entry() method here. On s390x build/changes are stable even with calling that helper method.
Looks like this was changed on x86_64 after I ported it to ppc. Thanks for making me aware of it.
/contributor add @offamitkumar |
@matias9927 |
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.
s390 changes look good.
Thank you, Amit, for working hard to get this done.
Thank you to all the reviewers for the detailed feedback, corrections, and improvements! Also, thank you very much for completing the ports @reinrich, @DingliZhang, @zifeihan, and @offamitkumar! |
Going to push as commit 3fbbfd1.
Your commit was automatically rebased without conflicts. |
@matias9927 Pushed as commit 3fbbfd1. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This obviously breaks arm, since its implementation is missing. I opened https://bugs.openjdk.org/browse/JDK-8305387 to track this. This is unfortunate since it holds work on arm in other areas, in my case for #10907.
I wonder about the explicit exclusion of arm. Every other CPU seems to be taken care of, even those Oracle does not maintain. Just curious, was there a special reason for excluding arm? |
It has also broken GraalVM Native Image. I'll open a JBS issue with a reproducer soon but here's hs-err from a slowdebug JDK build showing the problem: |
There is no special reason ARM32 was excluded other than the fact no porter has picked it up yet. Fortunately I was able to get in contact with porters for the other platforms, but nobody took on the ARM port until now. Thank you for opening the issue! |
I lack the time to do this atm; let's see if one of the porters can help. @bulasevich @snazarkin ? |
For future reference, we maintain a list of people working on ports: https://wiki.openjdk.org/display/HotSpot/Ports and we do have a mailing list for porters as well: porters-dev@openjdk.org . This makes it easier to find out who to contact. Cheers, Thomas |
Label resolved; | ||
|
||
__ load_resolved_indy_entry(cache, index); | ||
__ membar(MacroAssembler::AnyAny); |
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.
Why is the AnyAny barrier used here?
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.
Hi @sunny868, I'm working on removing these unnecessary barriers. RISC-V port uses more conservative barriers like this for some reasons (e.g.: [1][2][3]), we can just remove them.
jdk/src/hotspot/cpu/riscv/templateTable_riscv.cpp
Lines 3438 to 3443 in 36ec05d
const int tags_offset = Array<u1>::base_offset_in_bytes(); __ add(t0, x10, x13); __ la(t0, Address(t0, tags_offset)); __ membar(MacroAssembler::AnyAny); __ lbu(t0, t0); __ membar(MacroAssembler::LoadLoad | MacroAssembler::LoadStore); jdk/src/hotspot/cpu/riscv/templateTable_riscv.cpp
Lines 3558 to 3563 in 36ec05d
// See if bytecode has already been quicked __ add(t0, x13, Array<u1>::base_offset_in_bytes()); __ add(x11, t0, x9); __ membar(MacroAssembler::AnyAny); __ lbu(x11, x11); __ membar(MacroAssembler::LoadLoad | MacroAssembler::LoadStore); jdk/src/hotspot/cpu/riscv/templateTable_riscv.cpp
Lines 3614 to 3619 in 36ec05d
// See if bytecode has already been quicked __ add(t0, x13, Array<u1>::base_offset_in_bytes()); __ add(x11, t0, x9); __ membar(MacroAssembler::AnyAny); __ lbu(x11, x11); __ membar(MacroAssembler::LoadLoad | MacroAssembler::LoadStore);
The current structure used to store the resolution information for invokedynamic, ConstantPoolCacheEntry, is difficult to interpret due to its ambigious fields f1 and f2. This structure can hold information for fields, methods, and invokedynamics and each of its fields can hold different types of values depending on the entry.
This enhancement proposes a new structure to exclusively contain invokedynamic information in a manner that is easy to interpret and easy to extend. Resolved invokedynamic entries will be stored in an array in the constant pool cache and the operand of the invokedynamic bytecode will be rewritten to be the index into this array.
Any areas that previously accessed invokedynamic data from ConstantPoolCacheEntry will be replaced with accesses to this new array and structure. Verified with tier1-9 tests.
The PPC port was provided by @reinrich, RISCV was provided by @DingliZhang and @zifeihan, and S390x by @offamitkumar.
This change supports the following platforms: x86, aarch64, PPC, RISCV, and S390x
Progress
Issue
Reviewers
Contributors
<rrich@openjdk.org>
<dzhang@openjdk.org>
<gcao@openjdk.org>
<amitkumar@openjdk.org>
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/12778/head:pull/12778
$ git checkout pull/12778
Update a local copy of the PR:
$ git checkout pull/12778
$ git pull https://git.openjdk.org/jdk.git pull/12778/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 12778
View PR using the GUI difftool:
$ git pr show -t 12778
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12778.diff