-
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
8344140: Refactor the discovery of AOT cache artifacts #22291
8344140: Refactor the discovery of AOT cache artifacts #22291
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 no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
…consolidate-aot-artifact-gathering-discovery
@iklam This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@iklam nice refactoring/cleanup! The comments and the logic in AOTArtifactFinder makes it a lot easier to understand the algorithm now. |
Comment in
And this comment at line 263 in
|
@@ -543,6 +544,7 @@ class StaticArchiveBuilder : public ArchiveBuilder { | |||
|
|||
virtual void iterate_roots(MetaspaceClosure* it) { | |||
FileMapInfo::metaspace_pointers_do(it); | |||
AOTArtifactFinder::all_cached_classes_do(it); | |||
SystemDictionaryShared::dumptime_classes_do(it); |
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 some duplicatoin of work in AOTArtifactFinder::all_cached_classes_do()
and SystemDictionaryShared::dumptime_classes_do()
. all_cached_classes_do() operates on _all_cached_classes
which is built using SystemDictionaryShared::_dumptime_table
. So the iteration over _dumptime_table
in SystemDictionaryShared::dumptime_classes_do()
seems redundant.
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.
The call to SystemDictionaryShared::dumptime_classes_do()
is still necessary. It does more than just discovering the classes. It also walks the DumpTimeClassInfo
with
info.metaspace_pointers_do(it);
which will walk the loader constraints, etc.
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.
Right, missed that. Thanks for pointing that out.
I fixed the comments and removed the entry for |
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.
Some minor comments below.
// | ||
// Note1: See TODO comments in HeapShared::archive_object() for exceptions to this rule. | ||
// | ||
// Note2: The scanning of Java objects is done in heapShared.cpp. Please see calls into the HeapShared class |
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.
Note2 isn't referenced by the comment above. Perhaps line 62 should reference it?
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.
Fixed.
src/hotspot/share/cds/heapShared.cpp
Outdated
Klass* k = obj->klass(); | ||
if (k->is_instance_klass()) { | ||
// Whenever we see a non-array Java object of type X, we mark X to be aot-initialized. | ||
// This ensures that during the production run, whenever Java code seens a cached object |
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.
typo: s/seens/sees
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.
Fixed.
src/hotspot/share/cds/heapShared.cpp
Outdated
// We can't rerun <clinit> of enum classes (see cdsEnumKlass.cpp) so | ||
// we must store them as AOT-initialized. | ||
AOTArtifactFinder::add_aot_inited_class(InstanceKlass::cast(k)); | ||
} else if (subgraph_info == _dump_time_special_subgraph) { |
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 this be an "or" condition rather than "else if" since the same function is called for either on of the conditions?
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.
Fixed.
// Don't add the Klass containing the sub-graph to it's own klass | ||
// initialization list. | ||
return; | ||
} | ||
|
||
if (buffered_k->is_instance_klass()) { | ||
if (orig_k->is_instance_klass()) { | ||
InstanceKlass* ik = InstanceKlass::cast(orig_k); |
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.
Should this be inside a "#if ASSERT" since ik
is used only in the assert
statements?
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.
Fixed.
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.
Updates look good.
Thanks @ashu-mehra and @calvinccheung for the review. |
Going to push as commit be1cdd9.
Your commit was automatically rebased without conflicts. |
This is a clean up after the initial integration for JEP 483
Note to reviewers:
One consequence of this refactoring is that archived oops are now discovered (by heapShared.cpp) before the metadata are copied (by ArchiveBuilder). There are some functions that depend on the old order (metadata were copied before oop discovery), so I had to shuffle them around. Examples are
Modules::check_archived_module_oop()
, or the new code inKlass::remove_java_mirror()
.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22291/head:pull/22291
$ git checkout pull/22291
Update a local copy of the PR:
$ git checkout pull/22291
$ git pull https://git.openjdk.org/jdk.git pull/22291/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 22291
View PR using the GUI difftool:
$ git pr show -t 22291
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22291.diff
Using Webrev
Link to Webrev Comment