-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8293291: Simplify relocation of native pointers in archive heap #10296
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
8293291: Simplify relocation of native pointers in archive heap #10296
Conversation
👋 Welcome back iklam! A progress list of the required criteria for merging this PR into |
Webrevs
|
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've a few minor comments. Thanks.
src/hotspot/share/include/cds.h
Outdated
@@ -55,8 +55,12 @@ typedef struct CDSFileMapRegion { | |||
// - for heap regions, the base address is the compressed oop encoding base | |||
size_t _used; // Number of bytes actually used by this region (excluding padding bytes added | |||
// for alignment purposed. | |||
size_t _oopmap_offset; // Bitmap for relocating embedded oops (offset from SharedBaseAddress). | |||
size_t _oopmap_offset; // Bitmap for relocating oop fields in archived heap objects. | |||
// (The base address is the botom of the BM region) |
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: botom -> bottom
src/hotspot/share/include/cds.h
Outdated
size_t _oopmap_size_in_bits; | ||
size_t _ptrmap_offset; // Bitmap for relocating native pointer fields in archived heap objects. | ||
// (The base address is the botom of the BM region). |
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: botom -> bottom
src/hotspot/share/cds/heapShared.cpp
Outdated
} | ||
} | ||
|
||
log_info(cds, heap)("calculate_ptrmap: marked %d non-null native pointers our of " |
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: our -> out
src/hotspot/share/cds/filemap.cpp
Outdated
int oopmap_idx = i * 2; | ||
int ptrmap_idx = i * 2 + 1; | ||
space_at(region_idx)->init_bitmaps(bitmaps->at(i*2), bitmaps->at(i*2 + 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.
Please add some comment on oopmap_idx and ptrmap_idx.
Line 1693 could be:
space_at(region_idx)->init_bitmaps(bitmaps->at(oopmap_idx), bitmaps->at(ptrmap_idx));
for (int i=0; i<regions->length(); i++) { | ||
ResourceBitMap oopmap = HeapShared::calculate_oopmap(regions->at(i)); |
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.
Pre-existing: line 908.
While you're touching this code, please add a space before and after the '=' and '<'.
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.
@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 |
…ap is not supported there
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 makes sense and does seem cleaner.
…simplify-archive-heap-native-ptr-relocation
Thanks @calvinccheung and @coleenp for the review. I have merged with latest repo (after CPU sync) and retested with tiers 1-4. All passed. |
Going to push as commit 3f4964f. |
Some objects in the archive heap contain native pointers. E.g., archived
java.lang.Class
objects contain a pointer to itsKlass*
.At runtime, if the archived metadata are mapped at an alternative address, all of the
Klass*
pointers must be relocated. Instead of doing this in an ad-hoc way, this PR uses a bitmap,FileMapRegion::ptrmap_view()
, to track the position of all the native pointers.This PR is done in preparation for supporting new types of archived heap objects that have native pointers. E.g.,
java.lang.invoke.ResolvedMethodName
has a pointer to aMethod*
.Notes for reviewers:
HeapShared::mark_native_pointers()
.ArchiveHeapLoader::patch_native_pointers()
.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10296/head:pull/10296
$ git checkout pull/10296
Update a local copy of the PR:
$ git checkout pull/10296
$ git pull https://git.openjdk.org/jdk pull/10296/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10296
View PR using the GUI difftool:
$ git pr show -t 10296
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10296.diff