RFR: 8297914: Remove java_lang_Class::process_archived_mirror() [v4]

Ioi Lam iklam at openjdk.org
Sat Jan 14 07:23:43 UTC 2023


> This is another prerequisite for [JDK-8296344](https://bugs.openjdk.org/browse/JDK-8296344).
> 
> Before this PR, when archiving mirror objects (i.e., instances of `java.lang.Class`):
> - We first allocate a copy of the mirror inside a safepoint. 
> - We then reinitialize the contents of the copy to the desired state (so that it can be used by `Klass::restore_unshareable_info()`
> 
> This copy-and-modify operation inside the safepoint makes it difficult to implement [JDK-8296344](https://bugs.openjdk.org/browse/JDK-8296344). It violates the requirements [1] and [2] as stated in [JDK-8298600](https://bugs.openjdk.org/browse/JDK-8298600). Also, the reinitialization code is complicated.
> 
> After this PR:
> - During the creation of each regular mirror object, we allocate a "scratch mirror" object, which has the states as expected by `Klass::restore_unshareable_info()`. See `java_lang_Class::create_scratch_mirror()`.
> - When the archive heap is dumped inside a safepoint, we use the scratch mirror, so we can avoid the copy-and-modify operation. See `HeapShared::archive_java_mirrors()`.
> 
> Testing: tiers 1-4

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' into 8297914-remove-java-lang-class-process-archived-mirror
 - @calvinccheung comment - removed unnecessary ObjArrayKlass::deallocate_contents
 - review comments from @ashu-mehra and @dholmes-ora
 - fixed repo
 - tmp
 - refactored KlassToOopHandleTable
 - refactor java_lang_Class::allocate_mirror (step2)
 - refactor java_lang_Class::allocate_mirror (step1)
 - 8297914: Remove java_lang_Class::process_archived_mirror()

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/11853/files
  - new: https://git.openjdk.org/jdk/pull/11853/files/c1460a4c..70e6a86d

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=11853&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=11853&range=02-03

  Stats: 10724 lines in 514 files changed: 6587 ins; 2244 del; 1893 mod
  Patch: https://git.openjdk.org/jdk/pull/11853.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11853/head:pull/11853

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


More information about the hotspot-dev mailing list