RFR: 8298612: Refactor archiving of java String objects

Ioi Lam iklam at openjdk.org
Tue Jan 24 22:05:42 UTC 2023


This is the last prerequisite PR for [JDK-8296344](https://bugs.openjdk.org/browse/JDK-8296344) (Remove dependency on G1 for writing the CDS archive heap).

The old `StringTable::write_to_archive()` violates requirements [1] and [2] as stated in [JDK-8298600](https://bugs.openjdk.org/browse/JDK-8298600).

In the new implementation, copying of strings into the archive has been moved inside of heapShared.cpp. Now we no longer expose the `HeapShared::archive_object()` API. This addresses requirement [1].

Also, we no longer hand-assemble the String object and its internal `value` array. Instead, we use `HeapShared::archive_reachable_objects_from` to recursively copy the `value`.  This addresses requirement [2].

Test: tiers 1-4.

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

Commit messages:
 - added set_deduplication_forbidden back
 - renamed functions
 - changed NULL to nullptr
 - refactored the writing of interned strings

Changes: https://git.openjdk.org/jdk/pull/12173/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12173&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8298612
  Stats: 78 lines in 4 files changed: 27 ins; 30 del; 21 mod
  Patch: https://git.openjdk.org/jdk/pull/12173.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12173/head:pull/12173

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


More information about the hotspot-runtime-dev mailing list