RFR: 8344904: Interned strings in old classes are not stored in CDS archive [v2]

Ioi Lam iklam at openjdk.org
Tue Nov 26 05:32:44 UTC 2024


> Before this fix, CDS will only archive interned strings that are reachable from `ConstantPool::resolved_references()`, which is created only after a class is linked. However, old classes are not linked, so we didn't archive their interned strings.
> 
> It's possible for the Java mirror of an (unlinked) old class to point to interned strings. E.g.,
> 
> 
> public super class OldClassWithStaticString
>     version 49:0
> {
>     public static final Field s:"Ljava/lang/String;" = String "xxxx123yyyy456";
> 
> 
> The 's' field is initialized during class file parsing, so we must intern the `"xxxx123yyyy456"` string.
> 
> The fix is to collect interned strings from the static fields of unlinked classes.

Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:

  @dholmes-ora comments

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/22340/files
  - new: https://git.openjdk.org/jdk/pull/22340/files/1b07b398..c1a6bc76

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=22340&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=22340&range=00-01

  Stats: 4 lines in 2 files changed: 2 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/22340.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/22340/head:pull/22340

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


More information about the hotspot-dev mailing list