-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8374639: Static archive with AOTClassLinking breaks dynamic archive #29078
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
8374639: Static archive with AOTClassLinking breaks dynamic archive #29078
Conversation
|
👋 Welcome back iklam! A progress list of the required criteria for merging this PR into |
|
@iklam 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 18 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 |
coleenp
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.
So for the static archive, there will still be InstanceKlass::_array_klasses saved, just not for dynamic archive?
This looks really good. It is easy to recreate array classes on demand as they're needed.
matias9927
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.
This change looks good! It will also help in lworld considering we ran into similar problems with the array metadata refactor. Thanks!
After this PR, we can still store some However, we will no longer have an (All the code removed from this PR had to do with setting up such cross-archive pointers). E.g., if you run this app with
|
|
Thanks @coleenp and @matias9927 for the review |
|
Going to push as commit 9fd86e3.
Your commit was automatically rebased without conflicts. |
Bug fix
The assert happens because JDK-8309240 (Array classes should be stored in dynamic CDS archive) is not compatible with
AOTClassLinkingsince JDK 26.Since the benefit of JDK-8309240 is small (obj array classes can be quickly created at run time), we should remove JDK-8309240.
Background
The incompatibility is caused by JDK-8350550 (Preload classes from AOT cache during VM bootstrap) added in JDK 26.
JDK-8309240 adds support for scenarios like this:
Foois in the static archive, butFoo[]is not in the static archiveFoo[]is in the dynamic archiveThere's a pointer from the InstanceKlass of
Footo its array classFoo[](InstanceKlass::_array_klasses). With JDK-8309240, we update this pointer to point toFoo[]right after the CDS archives are mapped. This happens beforevmClasses::resolve_all():jdk/src/hotspot/share/cds/aotMetaspace.cpp
Line 2162 in dd20e91
With JDK-8350550, if the static archive has AOT-linked classes, we will restore all of its classes inside
vmClasses::resolve_all()-- see the callstack in the Description of JDK-8374639.The class restoration requires that all the classes (both instance classes and their array classes) must have a Java mirror. In this example,
Foois from the static archive and has an archived Java mirror, so we are OK. However,Foo[]is from the dynamic archive and doesn't have an archived mirror. Also, we are too early in the bootstrap process so we are unable to allocate a Java mirror from the heap yet. Hence the assert.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/29078/head:pull/29078$ git checkout pull/29078Update a local copy of the PR:
$ git checkout pull/29078$ git pull https://git.openjdk.org/jdk.git pull/29078/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 29078View PR using the GUI difftool:
$ git pr show -t 29078Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/29078.diff
Using Webrev
Link to Webrev Comment