< prev index next >

src/hotspot/share/memory/universe.cpp

Print this page

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

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