-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8353597: Refactor handling VM options for AOT cache input and output #24401
8353597: Refactor handling VM options for AOT cache input and output #24401
Conversation
CDSConfig::disable_dumping_dynamic_archive(); | ||
} | ||
} | ||
|
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.
Moved to CDSConfig::prepare_for_dumping()
👋 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 19 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 |
void MetaspaceShared::prepare_for_dumping() { | ||
assert(CDSConfig::is_dumping_archive(), "sanity"); | ||
CDSConfig::check_unsupported_dumping_module_options(); | ||
} |
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.
Moved to CDSConfig::prepare_for_dumping()
@iklam 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. |
Webrevs
|
@iklam one annoying thing in current ergonomic setting for AOTCode flags in mainline is checking which phase we are executing. We agreed before that we should only save/load AOT code when I have to do next checks to enable AOTCode in
First, I am not sure these conditions are correct. Second, it would be nice to have simple checks instead: May be also consider it is error if both conditions are true (we don't support updating archive yet). |
@veresov has also complex checks in his PR: |
There are a lot of dependencies between different AOT capabilities, and it's hard to control that using global variables. At the point of In the handling of such "AOT capability flags", I have been using the following pattern: In
However, the values of these flags are just advisory. Even if a flag is enabled, the underlying capability may be disabled. For example, Because the dependencies are complex, it's difficult to resolve them statically and set a global boolean variable for each capability. Instead, I have been expressing the dependencies programmatically using accessor functions:
I would suggest doing something like this for storing AOT code:
For loading AOT code, it's simpler. We can do a definite check immediately after the AOT cache has been mapped. This also makes the run-time check efficient (whereas the assembly-time checks can take their time).
|
Thank you @iklam for explanation. I can do final adjustment to
The question: at this place are all CDS AOT flags are final (flags compatibility and cache presence are verified)? Note, |
Yes, at this point all configuration related to AOT should be final. You can set the final values for the
|
// - SharedArchiveFile points to an archive that has failed CRC check | ||
// - SharedArchiveFile is not specified and the VM doesn't have a compatible default archive | ||
|
||
#define __THEMSG " is unsupported when base CDS archive is not loaded. Run with -Xlog:cds for more info." |
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.
Do we want to start transitioning existing -Xlog:cds
options to be :aot
options? I think making the switch would match out long term direction
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, but I think we should do it only if AOTClassLinking
is enabled. For legacy CDS we should continue use -Xlog:cds
.
I am using -Xlog:aot+codecache
in AOT code caching.
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 created JDK-8354055 - Change "cds" logging tag to "aot". There are documentation/compatibility issues so we need to do some planning.
This particular block of code is moved from dynamicArchive.cpp to cdsConfig.cpp and I kept the logging tag the same.
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.
Thanks @iklam. I agree with the approach of doing this in a separate issue.
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 to me.
The parent pull request that this pull request depends on has now been integrated and the target branch of this pull request has been updated. This means that changes from the dependent pull request can start to show up as belonging to this pull request, which may be confusing for reviewers. To remedy this situation, simply merge the latest changes from the new target branch into this pull request by running commands similar to these in the local repository for your personal fork: git checkout 8353597-refactor-aot-cache-input-output
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# if there are conflicts, follow the instructions given by git merge
git commit -m "Merge master"
git push |
@iklam this pull request can not be integrated into git checkout 8353597-refactor-aot-cache-input-output
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 |
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
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.
Re-approved.
Thanks @vnkozlov @ashu-mehra @DanHeidinga @lmesnik for the review |
Going to push as commit 567c688.
Your commit was automatically rebased without conflicts. |
Since JEP 483: Ahead-of-Time Class Loading & Linking, VM options such as
-XX:AOTCache
are implemented as aliases of "classical" CDS options such as-XX:SharedArchiveFile
.In anticipation of the JEP: Ahead-of-time Command Line Ergonomics, we should refactor the code that deals with the AOT options. Specifically, as we expect the JVM to be able to load from an "input AOT cache" and write to an "output AOT cache", we should clearly identify the input and output caches in separate APIs:
This PR also cleans up the code by:
There's also a behavioral bug fix: before this PR,
-XX:AOTCache
was handled by theergo_init_classic_archive_paths()
function, which allows two files to be specified. E.g.,java -XX:AOTCache=static.jsa:dynamic.jsa
. That's because-XX:AOTCache
was implemented as an alias of-XX:SharedArchiveFile
, and the latter allows this usage.However, this behavior is not specified in JEP 483. Allowing two files in -XX:AOTCache will cause unnecessary complexity when we implement JDK-8353598: Allow AOT cache to be used in training run. Therefore, I added new test cases to disallow the use of two files. This also means that we don't need to modify the already over-complicated
ergo_init_classic_archive_paths()
for the AOT use casesProgress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24401/head:pull/24401
$ git checkout pull/24401
Update a local copy of the PR:
$ git checkout pull/24401
$ git pull https://git.openjdk.org/jdk.git pull/24401/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24401
View PR using the GUI difftool:
$ git pr show -t 24401
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24401.diff
Using Webrev
Link to Webrev Comment