On Fri, 5 Jun 2026 12:45:22 GMT, Casper Norrbin <[email protected]> wrote:

>> Hi everyone,
>> 
>> This change removes the remaining mandatory preloading path for 
>> null-restricted instance fields when loading classes from CDS. 
>> [JDK-8380053](https://bugs.openjdk.org/browse/JDK-8380053) already changed 
>> normal class loading so null-restricted field types are no longer loaded 
>> just because the field is null-restriced. Instead, the preloading is 
>> speculative and driven by the `LoadableDescriptor` attribute. The CDS path 
>> still had the older special case in 
>> `SystemDictionary::preload_from_null_free_field`, which could force loading 
>> of null-restricted field types.
>> 
>> This fix removes that CDS-only preload helper and routes non-static field 
>> signatures through the existing `LoadableDescriptor` path instead. This 
>> makes loading follow the same model as in 
>> `ClassFileParser::fetch_field_classes()` with speculative loading.
>> 
>> Testing:
>> - Tier 1-3
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Casper Norrbin has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains seven commits:
> 
>  - static null-restricted check, new test, other feedback
>  - Merge branch 'lworld' into systemdict-nullrestricted-loading
>  - create symbol only when logging
>  - Merge branch 'lworld' into systemdict-nullrestricted-loading
>  - Validate archived inline field dependencies without LoadableDescriptors
>  - re-add failed marker
>  - removed forced loading for nullrestricted

src/hotspot/share/classfile/systemDictionary.cpp line 1109:

> 1107: }
> 1108: 
> 1109: // Pre-load class referred to in non-static fields with archived inline 
> field metadata. These fields

Suggestion:

// Pre-load class referred to in fields with archived inline field metadata. 
These fields


This is called for both inline instance fields and also for null-free static 
fields

src/hotspot/share/classfile/systemDictionary.cpp line 1148:

> 1146: }
> 1147: 
> 1148: // Tries to pre-load classes referred to in non-static instance fields 
> if they are found in the

Suggestion:

// Tries to pre-load classes referred to in instance fields if they are found 
in the


non-static instance is redundent

src/hotspot/share/classfile/systemDictionary.cpp line 1162:

> 1160:     }
> 1161: 
> 1162:     InstanceKlass* k = 
> ik->get_inline_type_field_klass_or_null(field_index);

Shouldn't this function be using the `check_shared_class_dependency` helper as 
well?  It's doing basically the same thing - validating that the current view 
of `real_k` matches the view of `k` from CDS

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2409#discussion_r3364776545
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2409#discussion_r3364797567
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2409#discussion_r3364914814

Reply via email to