jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8293291: Simplify relocation of native pointers in archive heap

Open iklam opened this issue 3 years ago • 4 comments

Some objects in the archive heap contain native pointers. E.g., archived java.lang.Class objects contain a pointer to its Klass*.

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 a Method*.

Notes for reviewers:

  • At dump time, the native pointers are remembered in HeapShared::mark_native_pointers().
  • At runtime, the native pointers are patched in ArchiveHeapLoader::patch_native_pointers().
  • The ad-hoc relocation code has been removed from javaClasses.cpp and systemDictionaryShared.cpp
  • Many of the changes are for renaming from "oopmaps" to "bitmaps": the old code handled only a single type of pointers (oop references). The new code handles two types of bitmaps ("oopmap" is for oop references, "ptrmap" is for native pointers).

Progress

  • [x] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue

Issue

  • JDK-8293291: Simplify relocation of native pointers in archive heap

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

iklam avatar Sep 15 '22 20:09 iklam

:wave: Welcome back iklam! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

bridgekeeper[bot] avatar Sep 15 '22 20:09 bridgekeeper[bot]

@iklam The following label will be automatically applied to this pull request:

  • hotspot-runtime

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

openjdk[bot] avatar Sep 15 '22 20:09 openjdk[bot]

@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:

8293291: Simplify relocation of native pointers in archive heap

Reviewed-by: ccheung, coleenp

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 master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

openjdk[bot] avatar Oct 13 '22 04:10 openjdk[bot]

Thanks @calvinccheung and @coleenp for the review. I have merged with latest repo (after CPU sync) and retested with tiers 1-4. All passed. /integrate

iklam avatar Oct 19 '22 04:10 iklam

Going to push as commit 3f4964f83d6f03efbee2fb34aa8258d4fc923efb.

openjdk[bot] avatar Oct 19 '22 04:10 openjdk[bot]

@iklam Pushed as commit 3f4964f83d6f03efbee2fb34aa8258d4fc923efb.

:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

openjdk[bot] avatar Oct 19 '22 04:10 openjdk[bot]