RFR: 8371874: AOTLinkedClassBulkLoader::preload_classes() should not allocate heap objects

Ioi Lam iklam at openjdk.org
Fri Nov 14 18:42:08 UTC 2025


On Fri, 14 Nov 2025 09:45:54 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> `AOTLinkedClassBulkLoader::preload_classes()` indirectly calls `java_lang_Class::restore_archived_mirror()` which can allocate an `int` array for the `init_lock`. However, the `init_lock` has already been allocated during AOT cache assembly :
>> 
>> 
>> java_lang_Class::create_scratch_mirror()
>> -> allocate_mirror()
>>   -> initialize_mirror_fields()
>>     -> set_init_lock()
>> 
>> 
>> So there's no need to allocate it again in the production run.
>
> Marked as reviewed by ayang (Reviewer).

Thanks @albertnetymk @shipilev for the review

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

PR Comment: https://git.openjdk.org/jdk/pull/28315#issuecomment-3534079722


More information about the hotspot-runtime-dev mailing list