Skip to content
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

8301996: Move field resolution information out of the cpCache #14129

Closed
wants to merge 15 commits into from

Conversation

matias9927
Copy link
Contributor

@matias9927 matias9927 commented May 24, 2023

The current structure used to store the resolution information for fields, ConstantPoolCacheEntry, is difficult to interpret due to its ambigious fields f1 and f2. This structure can hold information for fields and methods and each of its fields can hold different types of values depending on the entry type.

This enhancement introduces a new data structure that stores the necessary resolution data in an intuitive an extensible manner. These resolved entries are stored in an array inside the constant pool cache in a very similar manner to invokedynamic entries in JDK-8301995.

Instances of ConstantPoolCache entry related to field resolution have been replaced with the new ResolvedFieldEntry. Verified with tier 1-9 tests.

This change supports the following platforms: x86, aarch64, PPC. and RISCV


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

  • JDK-8301996: Move field resolution information out of the cpCache (Sub-task - P4)

Reviewers

Contributors

  • Gui Cao <gcao@openjdk.org>
  • Dingli Zhang <dzhang@openjdk.org>
  • Martin Doerr <mdoerr@openjdk.org>

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 14129

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 24, 2023

👋 Welcome back matsaave! 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 May 24, 2023

@matias9927 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 May 24, 2023
@openjdk
Copy link

openjdk bot commented Jun 9, 2023

@matias9927 this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout field_entry_8301996
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

@openjdk openjdk bot added merge-conflict Pull request has merge conflict with target branch and removed merge-conflict Pull request has merge conflict with target branch labels Jun 9, 2023
@openjdk
Copy link

openjdk bot commented Jun 15, 2023

⚠️ @matias9927 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).

@matias9927 matias9927 changed the title Field entry 8301996 8301996: Move field resolution information out of the cpCache Jun 23, 2023
@matias9927 matias9927 marked this pull request as ready for review June 23, 2023 20:57
@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 23, 2023
@mlbridge
Copy link

mlbridge bot commented Jun 23, 2023

Copy link
Contributor

@coleenp coleenp left a 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 have a couple of very minor comments but the rewriter thing I noted should be fixed.

src/hotspot/cpu/x86/interp_masm_x86.cpp Outdated Show resolved Hide resolved
src/hotspot/share/interpreter/interpreterRuntime.hpp Outdated Show resolved Hide resolved
src/hotspot/share/interpreter/rewriter.cpp Outdated Show resolved Hide resolved
src/hotspot/share/interpreter/rewriter.cpp Outdated Show resolved Hide resolved
src/hotspot/share/oops/cpCache.cpp Outdated Show resolved Hide resolved
src/hotspot/share/oops/resolvedFieldEntry.cpp Outdated Show resolved Hide resolved
src/hotspot/share/oops/resolvedFieldEntry.hpp Outdated Show resolved Hide resolved
src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp Outdated Show resolved Hide resolved
@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Jun 29, 2023
Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

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

Looks great!

Copy link
Member

@DingliZhang DingliZhang left a comment

Choose a reason for hiding this comment

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

From the cursory review, with some comments.

src/hotspot/cpu/aarch64/templateTable_aarch64.cpp Outdated Show resolved Hide resolved
src/hotspot/cpu/aarch64/templateTable_aarch64.cpp Outdated Show resolved Hide resolved
src/hotspot/cpu/aarch64/templateTable_aarch64.cpp Outdated Show resolved Hide resolved
@TheRealMDoerr
Copy link
Contributor

I'll take a closer look once the aarch64 code is in a good shape and see if I can provide a PPC64 implementation. I hope to find time for it in 2 weeks.

@openjdk
Copy link

openjdk bot commented Jul 5, 2023

@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:

8301996: Move field resolution information out of the cpCache

Co-authored-by: Gui Cao <gcao@openjdk.org>
Co-authored-by: Dingli Zhang <dzhang@openjdk.org>
Co-authored-by: Martin Doerr <mdoerr@openjdk.org>
Reviewed-by: coleenp, fparain

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 181 new commits pushed to the master branch:

  • 5362ec9: 8312492: Remove THP sanity checks at VM startup
  • e47a84f: 8312489: Increase jdk.jar.maxSignatureFileSize default which is too low for JARs such as WhiteSource/Mend unified agent jar
  • 78f6799: 8293972: runtime/NMT/NMTInitializationTest.java#default_long-off failed with "Suspiciously long bucket chains in lookup table."
  • 97b6883: 8295059: test/langtools/tools/javap 12 test classes use com.sun.tools.classfile library
  • 3671d83: 8313252: Java_sun_awt_windows_ThemeReader_paintBackground release resources in early returns
  • b60e0ad: 8313207: Remove MetaspaceShared::_has_error_classes
  • 408987e: 8313307: java/util/Formatter/Padding.java fails on some Locales
  • 6fca289: 8313023: Return value corrupted when using CCS + isTrivial (mainline)
  • f8c2b7f: 8313231: Redundant if statement in ZoneInfoFile
  • 807ca2d: 8313316: Disable runtime/ErrorHandling/MachCodeFramesInErrorFile.java on ppc64le
  • ... and 171 more: https://git.openjdk.org/jdk/compare/af7f95e24ad5981c5de4b5dbf37da6f4f5e42129...master

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed merge-conflict Pull request has merge conflict with target branch labels Jul 5, 2023
@DingliZhang
Copy link
Member

It looks like I misunderstood what tbz does! I believe you are correct in suggesting that the andr is not necessary.

Hi, @matias9927,
Thanks for update! We have already done the adaptation for RISC-V locally and we are currently testing. I will update the test results and give the corresponding patch later.

Copy link
Contributor

@fparain fparain left a comment

Choose a reason for hiding this comment

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

Thank you for addressing the issues that were spotted.
Looks good to me now.

@DingliZhang
Copy link
Member

It looks like I misunderstood what tbz does! I believe you are correct in suggesting that the andr is not necessary.

Hi, @matias9927, Thanks for update! We have already done the adaptation for RISC-V locally and we are currently testing. I will update the test results and give the corresponding patch later.

Hi,
@zifeihan and I have finished the RISC-V part and tier1-3 looks good.
Please help us to add the RISC-V part, thanks a lot!
DingliZhang@a14433d on this branch: https://github.com/DingliZhang/jdk/tree/pr-14129-rebase

@matias9927
Copy link
Contributor Author

It looks like I misunderstood what tbz does! I believe you are correct in suggesting that the andr is not necessary.

Hi, @matias9927, Thanks for update! We have already done the adaptation for RISC-V locally and we are currently testing. I will update the test results and give the corresponding patch later.

Hi, @zifeihan and I have finished the RISC-V part and tier1-3 looks good. Please help us to add the RISC-V part, thanks a lot! DingliZhang@a14433d on this branch: https://github.com/DingliZhang/jdk/tree/pr-14129-rebase

Thank you for your contribution! I really appreciate the help.

/contributor add @zifeihan
/contributor add @DingliZhang

@openjdk
Copy link

openjdk bot commented Jul 12, 2023

@matias9927
Contributor Gui Cao <gcao@openjdk.org> successfully added.

@openjdk
Copy link

openjdk bot commented Jul 12, 2023

@matias9927
Contributor Dingli Zhang <dzhang@openjdk.org> successfully added.

@DingliZhang
Copy link
Member

Thank you for your update!
Similar to aarch64, it would be better to add tos_state in putfield_or_static as well on RISC-V.
Please help us to add the patch, thanks a lot!
DingliZhang@1fd29d6 on branch https://github.com/DingliZhang/jdk/tree/pr-14129-putfield_or_static

__ la(temp_reg, Address(temp_reg, in_bytes(ResolvedFieldEntry::put_code_offset())));
}
// Load-acquire the bytecode to match store-release in ResolvedFieldEntry::fill_in()
__ membar(MacroAssembler::AnyAny);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need this membar?

Copy link
Member

Choose a reason for hiding this comment

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

I am referencing the mapping from ARM memory operations onto RISC-V memory instructions in riscv-spec [1]:

Since RISC-V does not currently have plain load and store opcodes with aq or rl annotations, ARM load-acquire and store-release operations should be mapped using fences instead. Furthermore, in order to enforce store-release-to-load-acquire ordering, there must be a FENCE RW,RW between the store-release and load-acquire;

So I am trying to be conservative here and added this membar to enforce store-release-to-load-acquire ordering. I can remove that if we are sure this is not necessary here.

[1] https://github.com/riscv/riscv-isa-manual/blob/riscv-isa-release-1239329-2023-05-23/src/mm-eplan.adoc#armmappings

__ la(temp, Address(Rcache, in_bytes(ResolvedFieldEntry::put_code_offset())));
}
// Load-acquire the bytecode to match store-release in ResolvedFieldEntry::fill_in()
__ membar(MacroAssembler::AnyAny);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.

@TheRealMDoerr
Copy link
Contributor

Thanks for improving readability! An initial PPC64 part is here: TheRealMDoerr@612ee9d.

@matias9927
Copy link
Contributor Author

Thank you for the PPC port!
/contributor add @TheRealMDoerr

@matias9927
Copy link
Contributor Author

Thank you for the excellent reviews, comments, and suggestions @fparain, @coleenp, @offamitkumar, and @dholmes-ora!
Once again, thank you to @DingliZhang, @RealFYang, and @TheRealMDoerr for contributing the ports for this change.

Github actions and tier tests show no issues so I believe this change is safe to integrate.
/integrate

@openjdk
Copy link

openjdk bot commented Jul 31, 2023

@matias9927
Contributor Martin Doerr <mdoerr@openjdk.org> successfully added.

@openjdk
Copy link

openjdk bot commented Jul 31, 2023

Going to push as commit 86783b9.
Since your change was applied there have been 181 commits pushed to the master branch:

  • 5362ec9: 8312492: Remove THP sanity checks at VM startup
  • e47a84f: 8312489: Increase jdk.jar.maxSignatureFileSize default which is too low for JARs such as WhiteSource/Mend unified agent jar
  • 78f6799: 8293972: runtime/NMT/NMTInitializationTest.java#default_long-off failed with "Suspiciously long bucket chains in lookup table."
  • 97b6883: 8295059: test/langtools/tools/javap 12 test classes use com.sun.tools.classfile library
  • 3671d83: 8313252: Java_sun_awt_windows_ThemeReader_paintBackground release resources in early returns
  • b60e0ad: 8313207: Remove MetaspaceShared::_has_error_classes
  • 408987e: 8313307: java/util/Formatter/Padding.java fails on some Locales
  • 6fca289: 8313023: Return value corrupted when using CCS + isTrivial (mainline)
  • f8c2b7f: 8313231: Redundant if statement in ZoneInfoFile
  • 807ca2d: 8313316: Disable runtime/ErrorHandling/MachCodeFramesInErrorFile.java on ppc64le
  • ... and 171 more: https://git.openjdk.org/jdk/compare/af7f95e24ad5981c5de4b5dbf37da6f4f5e42129...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 31, 2023
@openjdk openjdk bot closed this Jul 31, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 31, 2023
@openjdk
Copy link

openjdk bot commented Jul 31, 2023

@matias9927 Pushed as commit 86783b9.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated
8 participants