Integrated: 8344904: Interned strings in old classes are not stored in CDS archive

Ioi Lam iklam at openjdk.org
Mon Dec 2 22:58:48 UTC 2024


On Sat, 23 Nov 2024 03:25:44 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: 68b1b94d
Author:    Ioi Lam <iklam at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/68b1b94d1be686037e2aaef57c0d9adc594fac7a
Stats:     155 lines in 5 files changed: 144 ins; 2 del; 9 mod

8344904: Interned strings in old classes are not stored in CDS archive

Reviewed-by: dholmes, ccheung

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

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


More information about the hotspot-dev mailing list