On Wed, 17 Sep 2025 19:05:37 GMT, Ashutosh Mehra <[email protected]> wrote:

>> Ioi Lam has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Added logging about @AOTSafeClassInitializer classes that have not been 
>> initialized
>
> src/hotspot/share/cds/aotClassInitializer.cpp line 53:
> 
>> 51: 
>> 52:   if (ik->force_aot_initialization()) {
>> 53:     assert(ik->is_initialized(), "must have been initialized before this 
>> check");
> 
> Is it not possible for a jdk class to be loaded but not initialized during an 
> application run? If such a jdk class is marked with AOTInitialize annotation, 
> this assert would trigger during the assembly phase.

We come to here only in the assembly phase, after this check:


  if (!CDSConfig::is_initing_classes_at_dump_time()) {
    return false;
  }


In the training run, `is_initing_classes_at_dump_time()` returns false.

Also, in `AOTMetaspace::try_link_class()`, which is called before we enter the 
CDS safepoint, we try to initialize all `force_aot_initialization()` classes in 
this loop:

https://github.com/openjdk/jdk/blob/d21bfb1231bec75bc6eb6eaac33c95ed833565fb/src/hotspot/share/cds/aotMetaspace.cpp#L1262-L1272

When we come to here, we are already in the CDS safepoint, so all classes with  
`force_aot_initialization()` must have been initialized.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27024#discussion_r2361539771

Reply via email to