-
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
8297290: Use int indices to reference CDS archived primitive mirrors #11256
8297290: Use int indices to reference CDS archived primitive mirrors #11256
Conversation
👋 Welcome back iklam! A progress list of the required criteria for merging this PR into |
Webrevs
|
@@ -236,29 +234,38 @@ void Universe::metaspace_pointers_do(MetaspaceClosure* it) { | |||
_do_stack_walk_cache->metaspace_pointers_do(it); | |||
} | |||
|
|||
#if INCLUDE_CDS_JAVA_HEAP | |||
void Universe::set_archived_mirror_index(BasicType t, int index) { |
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 it called during dump time only?
If so, maybe add an assert?
assert(DumpSharedSpaces, "dump-time only");
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 as suggested.
@@ -89,6 +89,9 @@ Klass* Universe::_typeArrayKlassObjs[T_LONG+1] = { NULL /*, NULL...*/ }; | |||
Klass* Universe::_objectArrayKlassObj = NULL; | |||
Klass* Universe::_fillerArrayKlassObj = NULL; | |||
OopHandle Universe::_mirrors[T_VOID+1]; | |||
#if INCLUDE_CDS_JAVA_HEAP | |||
int Universe::_archived_mirror_indices[T_VOID+1]; |
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.
a minor suggestion - I feel it would be better to name it as _archived_basic_type_mirror_indices
as it only stores mirrors for primitive types. Same for the other functions accessing _archived_mirror_indices
i.e. set_archived_mirror_index
-> set_archived_basic_type_mirror_index
and update_archived_mirrors
-> update_archived_basic_type_mirrors
.
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 renamed the field/functions as you suggested. Now they are consistent with existing functions like Universe::initialize_basic_type_mirrors()
I think eventually they should be named to primitive_type_mirrors
since we don't use them for the reference types. But there are a few functions that are unrelated to this RFE, so I'll probably do the renaming in a subsequent RFE.
lgtm, thanks for updating the field/function names. |
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.
Updated changes look good.
@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 69 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 |
Thanks @ashu-mehra and @calvinccheung for the review. |
Going to push as commit c7a679f.
Your commit was automatically rebased without conflicts. |
In CDS, when archived class metadata reference an object in the archive heap, it's usually done using an integer index, which can be passed to
HeapShared::get_root(int)
to retrieve the object. This way, we don't need to worry if the archive heap has been relocated. E.g.,However, for the primitive mirror objects (in
Universe::_mirrors[]
, which point to thejava.lang.Class
instances of the Java primitive types such asint
,float
, etc), we are still using a direct oop reference.For consistency, we should change this code to use the same int indices as the rest of the system. This will also make it simpler to optimize the layout of the CDS archive heap (e.g., in JDK-8234679).
Testing: passed tiers 1-4
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11256/head:pull/11256
$ git checkout pull/11256
Update a local copy of the PR:
$ git checkout pull/11256
$ git pull https://git.openjdk.org/jdk pull/11256/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 11256
View PR using the GUI difftool:
$ git pr show -t 11256
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11256.diff