RFR: 8301106 allow cds interned strings to be moved by gc [v5]

Ioi Lam iklam at openjdk.org
Wed Mar 29 16:58:51 UTC 2023


> **Background:**
> 
> Currently, the archived java strings are mapped in the G1 "[closed archive](https://github.com/openjdk/jdk/blob/574b48c6925ebfb31345fc46c7d23aa4153f99b0/src/hotspot/share/gc/g1/heapRegionType.hpp#L80-L92)" region. This essentially pins all the strings in memory.
> 
> As a prerequisite for  ([JDK-8296263](https://bugs.openjdk.org/browse/JDK-8296263)), this PR removes the requirement of pinning the archived strings. This will allow the CDS archive heap to be mapped in garbage collectors that do not support object pinning.
> 
> **Code changes:**
> 
> - The archived strings are referenced through an objArray (`_shared_strings_array`) to keep them alive. As a result, it's no longer necessary to pin them.
> - Since it's possible for the GC to move these strings, the `_shared_table` in stringTable.cpp is modified to store a 32-bit index for each archived string. This index is used to retrieve the archived string from `_shared_strings_array` at runtime.
> 
> Note that CDS has a limit on the size of archived objArrays. When there's a large number of strings, we use a two-level table. See the comments around  `_shared_strings_array` in the header file.
> 
> **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 10 additional commits since the last revision:

 - fixed merge
 - Merge branch 'master' into 8301106-allow-cds-interned-strings-to-be-moved-by-gc
 - fixed "optimized" build
 - @ashu-mehra and @dholmes-ora review -- better assert and error checking for large objects; added StringTable::verify_secondary_array_index_bits()
 - @dholmes-ora comments
 - renamed obsolete functions to ArchiveHeapLoader::is_in_use()
 - fixed typos in comment
 - cleanup2
 - cleanup
 - 8301106: Allow archived Java strings to be moved by the collector

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/12607/files
  - new: https://git.openjdk.org/jdk/pull/12607/files/1ea3dde0..934d67f7

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

  Stats: 375841 lines in 3206 files changed: 225901 ins; 124148 del; 25792 mod
  Patch: https://git.openjdk.org/jdk/pull/12607.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/12607/head:pull/12607

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


More information about the hotspot-runtime-dev mailing list