< prev index next >

src/hotspot/share/memory/universe.cpp

Print this page

 551 #if INCLUDE_CDS_JAVA_HEAP
 552     if (CDSConfig::is_using_archive() &&
 553         ArchiveHeapLoader::is_in_use() &&
 554         _basic_type_mirrors[T_INT].resolve() != nullptr) {
 555       assert(ArchiveHeapLoader::can_use(), "Sanity");
 556 
 557       // check that all basic type mirrors are mapped also
 558       for (int i = T_BOOLEAN; i < T_VOID+1; i++) {
 559         if (!is_reference_type((BasicType)i)) {
 560           oop m = _basic_type_mirrors[i].resolve();
 561           assert(m != nullptr, "archived mirrors should not be null");
 562         }
 563       }
 564     } else
 565       // _basic_type_mirrors[T_INT], etc, are null if archived heap is not mapped.
 566 #endif
 567     {
 568       for (int i = T_BOOLEAN; i < T_VOID+1; i++) {
 569         BasicType bt = (BasicType)i;
 570         if (!is_reference_type(bt)) {
 571           oop m = java_lang_Class::create_basic_type_mirror(type2name(bt), bt, CHECK);
 572           _basic_type_mirrors[i] = OopHandle(vm_global(), m);
 573         }
 574         CDS_JAVA_HEAP_ONLY(_archived_basic_type_mirror_indices[i] = -1);
 575       }
 576     }
 577     if (CDSConfig::is_dumping_heap()) {
 578       HeapShared::init_scratch_objects_for_basic_type_mirrors(CHECK);
 579     }
 580 }
 581 
 582 void Universe::fixup_mirrors(TRAPS) {
 583   // Bootstrap problem: all classes gets a mirror (java.lang.Class instance) assigned eagerly,
 584   // but we cannot do that for classes created before java.lang.Class is loaded. Here we simply
 585   // walk over permanent objects created so far (mostly classes) and fixup their mirrors. Note
 586   // that the number of objects allocated at this point is very small.
 587   assert(vmClasses::Class_klass_loaded(), "java.lang.Class should be loaded");
 588   HandleMark hm(THREAD);
 589 
 590   if (!CDSConfig::is_using_archive()) {
 591     // Cache the start of the static fields

 551 #if INCLUDE_CDS_JAVA_HEAP
 552     if (CDSConfig::is_using_archive() &&
 553         ArchiveHeapLoader::is_in_use() &&
 554         _basic_type_mirrors[T_INT].resolve() != nullptr) {
 555       assert(ArchiveHeapLoader::can_use(), "Sanity");
 556 
 557       // check that all basic type mirrors are mapped also
 558       for (int i = T_BOOLEAN; i < T_VOID+1; i++) {
 559         if (!is_reference_type((BasicType)i)) {
 560           oop m = _basic_type_mirrors[i].resolve();
 561           assert(m != nullptr, "archived mirrors should not be null");
 562         }
 563       }
 564     } else
 565       // _basic_type_mirrors[T_INT], etc, are null if archived heap is not mapped.
 566 #endif
 567     {
 568       for (int i = T_BOOLEAN; i < T_VOID+1; i++) {
 569         BasicType bt = (BasicType)i;
 570         if (!is_reference_type(bt)) {
 571           oop m = java_lang_Class::create_basic_type_mirror(type2name(bt), bt, false, CHECK);
 572           _basic_type_mirrors[i] = OopHandle(vm_global(), m);
 573         }
 574         CDS_JAVA_HEAP_ONLY(_archived_basic_type_mirror_indices[i] = -1);
 575       }
 576     }
 577     if (CDSConfig::is_dumping_heap()) {
 578       HeapShared::init_scratch_objects_for_basic_type_mirrors(CHECK);
 579     }
 580 }
 581 
 582 void Universe::fixup_mirrors(TRAPS) {
 583   // Bootstrap problem: all classes gets a mirror (java.lang.Class instance) assigned eagerly,
 584   // but we cannot do that for classes created before java.lang.Class is loaded. Here we simply
 585   // walk over permanent objects created so far (mostly classes) and fixup their mirrors. Note
 586   // that the number of objects allocated at this point is very small.
 587   assert(vmClasses::Class_klass_loaded(), "java.lang.Class should be loaded");
 588   HandleMark hm(THREAD);
 589 
 590   if (!CDSConfig::is_using_archive()) {
 591     // Cache the start of the static fields
< prev index next >