RFR: 8293291: Simplify relocation of native pointers in archive heap [v6]

Ioi Lam iklam at openjdk.org
Wed Oct 19 01:00:10 UTC 2022


> 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).

Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains ten additional commits since the last revision:

 - Merge branch 'master' of https://github.com/openjdk/jdk into 8293291-simplify-archive-heap-native-ptr-relocation
 - Fixed windows test failure
 - cleaned up code; fixed test that failed on windows because archive heap is not supported there
 - Merge branch 'master' into 8293291-simplify-archive-heap-native-ptr-relocation
 - Merge branch 'master' into 8293291-simplify-archive-heap-native-ptr-relocation
 - Merge branch 'master' into 8293291-simplify-archive-heap-native-ptr-relocation
 - @calvinccheung comments
 - clean up
 - 8293291: Simplify relocation of native pointers in archive heap

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/10296/files
  - new: https://git.openjdk.org/jdk/pull/10296/files/810289f7..a39ca652

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10296&range=05
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10296&range=04-05

  Stats: 3347 lines in 575 files changed: 1740 ins; 114 del; 1493 mod
  Patch: https://git.openjdk.org/jdk/pull/10296.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10296/head:pull/10296

PR: https://git.openjdk.org/jdk/pull/10296


More information about the hotspot-runtime-dev mailing list