-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8342283: CDS cannot handle a large number of classes #24877
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 shade! A progress list of the required criteria for merging this PR into |
|
@shipilev 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 27 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 |
|
@iklam -- I think neither of our previous solutions were as cute as this one :) No messing with |
Webrevs
|
iklam
left a comment
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.
LGTM. This does look a cleaner fix.
lmesnik
left a comment
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.
Test changes looks good for me.
calvinccheung
left a comment
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.
LGTM.
| * | ||
| * @implNote This is done while the JVM is running in single-threaded mode, | ||
| * and at the very end of Java bytecode execution. We know that no more classes | ||
| * will be loaded and none of the fields modified by this method will be used again. |
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 is a tiny technical debt here. If future AOT code generation uses a future aggressive constant folding of object fields (cf. TrustFinalNonStaticFields) and a constant CL reference ends up in optimized code and there is a constant-folded reference (and.. and…) it is remotely possible that the old value of the field will get wrongly embedded in AOT code.
If we arrange AOT code generation to occur after all of these fixups (in Java code) are done, then the problem will not occur. It's a delicate set of invariants. Your expanded comment is a good start at calling them out, but this is a long string we are pulling on.
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 borrowed this comment from the initial @iklam's PR, so I need to credit him as contributor.)
Yes, CDS does awkward state manipulations at dump time. Resetting the states of final/@Stable objects can run into issues that you described. I think this is one of the reasons why Leyden generates AOT code with -XX:-FoldStableValues:
I would guess we need to do the same with TrustFinalNonStaticFields. The awkward part of current trust_final_non_static_fields() code is that it implicitly trusts things in java/lang, even with -TrustFinalNonStaticFields. That sounds like something we need to rectify for Leyden AOT code.
test/hotspot/jtreg/runtime/cds/appcds/LotsOfSyntheticClasses.java
Outdated
Show resolved
Hide resolved
|
/contributor add @iklam |
|
@shipilev |
|
Are we still good with this? Integration need a re-review :) |
iklam
left a comment
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.
LGTM
|
Thank you! I am running final |
|
Testing is green. I am integrating. /integrate |
|
Going to push as commit ead6757.
Your commit was automatically rebased without conflicts. |
CDS cannot handle large number of classes, because
ClassLoaderdata structures get too large for CDS archival. The new test captures such an occasion. We doclear()-s, but that is not enough to trim the backing storages for the affected collections.In contrast with previous attempts to fix this (#21797 and my VM-side field overwrite), we can just reinitialize the fields using
Unsafe, which bypasses normalfinalfield write restriction.ClassLoaderalready does a similar thing nearby! This allows us to stay fully in Java, and makes the patch fairly straightforward.Additional testing:
runtime/cdsProgress
Issue
Reviewers
Contributors
<[email protected]>Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24877/head:pull/24877$ git checkout pull/24877Update a local copy of the PR:
$ git checkout pull/24877$ git pull https://git.openjdk.org/jdk.git pull/24877/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24877View PR using the GUI difftool:
$ git pr show -t 24877Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24877.diff
Using Webrev
Link to Webrev Comment