< prev index next >

src/hotspot/share/cds/aotLinkedClassBulkLoader.cpp

Print this page

359         ik->link_class(CHECK);
360       }
361     }
362   }
363 
364   HeapShared::init_classes_for_special_subgraph(class_loader, CHECK);
365 }
366 
367 bool AOTLinkedClassBulkLoader::is_pending_aot_linked_class(Klass* k) {
368   if (!CDSConfig::is_using_aot_linked_classes()) {
369     return false;
370   }
371 
372   if (_all_completed) { // no more pending aot-linked classes
373     return false;
374   }
375 
376   if (k->is_objArray_klass()) {
377     k = ObjArrayKlass::cast(k)->bottom_klass();
378   }

379   if (!k->is_instance_klass()) {
380     // type array klasses (and their higher dimensions),
381     // must have been loaded before a GC can ever happen.
382     return false;
383   }
384 
385   // There's a small window during VM start-up where a not-yet loaded aot-linked
386   // class k may be discovered by the GC during VM initialization. This can happen
387   // when the heap contains an aot-cached instance of k, but k is not ready to be
388   // loaded yet. (TODO: JDK-8342429 eliminates this possibility)
389   //
390   // The following checks try to limit this window as much as possible for each of
391   // the four AOTLinkedClassCategory of classes that can be aot-linked.
392 
393   InstanceKlass* ik = InstanceKlass::cast(k);
394   if (ik->defined_by_boot_loader()) {
395     if (ik->module() != nullptr && ik->in_javabase_module()) {
396       // AOTLinkedClassCategory::BOOT1 -- all aot-linked classes in
397       // java.base must have been loaded before a GC can ever happen.
398       return false;

359         ik->link_class(CHECK);
360       }
361     }
362   }
363 
364   HeapShared::init_classes_for_special_subgraph(class_loader, CHECK);
365 }
366 
367 bool AOTLinkedClassBulkLoader::is_pending_aot_linked_class(Klass* k) {
368   if (!CDSConfig::is_using_aot_linked_classes()) {
369     return false;
370   }
371 
372   if (_all_completed) { // no more pending aot-linked classes
373     return false;
374   }
375 
376   if (k->is_objArray_klass()) {
377     k = ObjArrayKlass::cast(k)->bottom_klass();
378   }
379 
380   if (!k->is_instance_klass()) {
381     // type array klasses (and their higher dimensions),
382     // must have been loaded before a GC can ever happen.
383     return false;
384   }
385 
386   // There's a small window during VM start-up where a not-yet loaded aot-linked
387   // class k may be discovered by the GC during VM initialization. This can happen
388   // when the heap contains an aot-cached instance of k, but k is not ready to be
389   // loaded yet. (TODO: JDK-8342429 eliminates this possibility)
390   //
391   // The following checks try to limit this window as much as possible for each of
392   // the four AOTLinkedClassCategory of classes that can be aot-linked.
393 
394   InstanceKlass* ik = InstanceKlass::cast(k);
395   if (ik->defined_by_boot_loader()) {
396     if (ik->module() != nullptr && ik->in_javabase_module()) {
397       // AOTLinkedClassCategory::BOOT1 -- all aot-linked classes in
398       // java.base must have been loaded before a GC can ever happen.
399       return false;
< prev index next >