RFR: 8344904: Interned strings in old classes are not stored in CDS archive [v2]
Calvin Cheung
ccheung at openjdk.org
Mon Dec 2 19:27:37 UTC 2024
On Tue, 26 Nov 2024 05:32: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.
>
> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
>
> @dholmes-ora comments
LGTM
-------------
Marked as reviewed by ccheung (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/22340#pullrequestreview-2473721717
More information about the hotspot-dev
mailing list