-
Notifications
You must be signed in to change notification settings - Fork 34
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
Save/load i2c2i adapters #25
base: premain
Are you sure you want to change the base?
Conversation
Signed-off-by: Ashutosh Mehra <[email protected]>
…ent ranges Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
loading from AOT cache Signed-off-by: Ashutosh Mehra <[email protected]>
…_info() Signed-off-by: Ashutosh Mehra <[email protected]>
👋 Welcome back asmehra! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Webrevs
|
Signed-off-by: Ashutosh Mehra <[email protected]>
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.
Very nice changes. Few comments.
// TODO: how to identify code cache full situation now that the adapter() can be | ||
// non-null if AOT cache is in use | ||
#if 0 |
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 check next (opposite to check in the following assert)?:
if (adapter() != nullptr && !adapter()->is_linked()) {
The assumption is that we have enough CodeCache when we loading adapters from APT cache. Otherwise we should bailout (did you test such case?).
Is is_linked()
is specific for adapters from AOT cache?
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.
is_linked()
is being set for every AdapterHandlerEntry when its code is either generated or loaded from AOT cache.
Regarding the original block of code that this check pertains to:
// If the code cache is full, we may reenter this function for the
// leftover methods that weren't linked.
if (adapter() != nullptr) {
return;
}
The comment seem to indicate that we may reenter this function for a Method* for which adapter code has already been generated. However I am not able to trace the code path that may result in re-entering this function. Can you please explain under what conditions is this possible? @vnkozlov
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
@ashu-mehra this pull request can not be integrated into git checkout premain-save-i2c2i-v3
git fetch https://git.openjdk.org/leyden.git premain
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge premain"
git push |
This is an attempt to save and load i2c2i adapters along with the adapter handler table.
There are mainly two parts to this change:
Adapter handler table is a map from AdapterFingerPrint to AdapterHnadlerEntry. To store them in AOT cache, AdapterFingerPrint and AdapterHandlerEntry are updated to MetaspaceObj. Both these entities are discovered and added to the cache while processing the Method. When storing the adapter handler table, only the entries that have already been archived are considered. This allows pruning of AdapterHnadlerEntry that may be only reachable through a Method that is not eligible to be archived.
An AdapterHandlerEntry has pointer to the adapter code. Because the AdapterHandlerEntry and the adapter code are stored in separate archives, this link between the AdapterHandlerEntry and the adapter code needs to be removed (see AdapterHandlerEntry::remove_unshareable_info()).
During the production run, as the methods in the AOT cache are adopted, the AdapterHandlerEntry is linked back to the adapter code (see AdapterHandlerEntry::restore_unshareable_info).
All this code is guarded by -XX:[+-]ArchiveAdapters option which defaults to false, but is set to true in CDSConfig during the assembly phase.
Other changes worth mentioning:
Thanks to @adinn for providing many of these changes.
Performance:
-Xlog:init shows time taken for linking of Methods and making adapters. An example output is:
Save/load of adapters seem to have improved these stats.
However, testing with Quarkus app, I don't see any noticeable improvement in the startup time.
Progress
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/leyden.git pull/25/head:pull/25
$ git checkout pull/25
Update a local copy of the PR:
$ git checkout pull/25
$ git pull https://git.openjdk.org/leyden.git pull/25/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 25
View PR using the GUI difftool:
$ git pr show -t 25
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/leyden/pull/25.diff
Using Webrev
Link to Webrev Comment