RFR: 8344904: Interned strings in old classes are not stored in AOT cache

Ioi Lam iklam at openjdk.org
Sat Nov 23 03:31:03 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.

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

Commit messages:
 - 8344904: Interned strings in old classes are not stored in AOT cache

Changes: https://git.openjdk.org/jdk/pull/22340/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22340&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8344904
  Stats: 153 lines in 5 files changed: 142 ins; 2 del; 9 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