src/share/vm/memory/universe.cpp

Print this page




 211         assert(i >= T_BOOLEAN, "checking");
 212         f->do_ptr((void**)&_typeArrayKlassObjs[i]);
 213       } else if (do_all) {
 214         f->do_ptr((void**)&_typeArrayKlassObjs[i]);
 215       }
 216     }
 217   }
 218 
 219   f->do_ptr((void**)&_the_array_interfaces_array);
 220   f->do_ptr((void**)&_the_empty_int_array);
 221   f->do_ptr((void**)&_the_empty_short_array);
 222   f->do_ptr((void**)&_the_empty_method_array);
 223   f->do_ptr((void**)&_the_empty_klass_array);
 224   _finalizer_register_cache->serialize(f);
 225   _loader_addClass_cache->serialize(f);
 226   _reflect_invoke_cache->serialize(f);
 227 }
 228 
 229 void Universe::check_alignment(uintx size, uintx alignment, const char* name) {
 230   if (size < alignment || size % alignment != 0) {
 231     ResourceMark rm;
 232     stringStream st;
 233     st.print("Size of %s (" UINTX_FORMAT " bytes) must be aligned to " UINTX_FORMAT " bytes", name, size, alignment);
 234     char* error = st.as_string();
 235     vm_exit_during_initialization(error);
 236   }
 237 }
 238 
 239 void initialize_basic_type_klass(Klass* k, TRAPS) {
 240   Klass* ok = SystemDictionary::Object_klass();
 241   if (UseSharedSpaces) {
 242     assert(k->super() == ok, "u3");
 243     k->restore_unshareable_info(CHECK);
 244   } else {
 245     k->initialize_supers(ok, CHECK);
 246   }
 247   k->append_to_sibling_list();
 248 }
 249 
 250 void Universe::genesis(TRAPS) {
 251   ResourceMark rm;
 252 
 253   { FlagSetting fs(_bootstrapping, true);
 254 
 255     { MutexLocker mc(Compile_lock);


 899       addr = Universe::preferred_heap_base(total_reserved, Universe::ZeroBasedNarrowOop);
 900 
 901       ReservedHeapSpace total_rs0(total_reserved, alignment,
 902                                   UseLargePages, addr);
 903 
 904       if (addr != NULL && !total_rs0.is_reserved()) {
 905         // Failed to reserve at specified address again - give up.
 906         addr = Universe::preferred_heap_base(total_reserved, Universe::HeapBasedNarrowOop);
 907         assert(addr == NULL, "");
 908 
 909         ReservedHeapSpace total_rs1(total_reserved, alignment,
 910                                     UseLargePages, addr);
 911         total_rs = total_rs1;
 912       } else {
 913         total_rs = total_rs0;
 914       }
 915     }
 916   }
 917 
 918   if (!total_rs.is_reserved()) {
 919     vm_exit_during_initialization(err_msg("Could not reserve enough space for object heap %d bytes", total_reserved));
 920     return total_rs;
 921   }
 922 
 923   // Split the reserved space into main Java heap and a space for
 924   // classes so that they can be compressed using the same algorithm
 925   // as compressed oops. If compress oops and compress klass ptrs are
 926   // used we need the meta space first: if the alignment used for
 927   // compressed oops is greater than the one used for compressed klass
 928   // ptrs, a metadata space on top of the heap could become
 929   // unreachable.
 930   ReservedSpace class_rs = total_rs.first_part(Universe::class_metaspace_size());
 931   ReservedSpace heap_rs = total_rs.last_part(Universe::class_metaspace_size(), alignment);
 932   Metaspace::initialize_class_space(class_rs);
 933 
 934   if (UseCompressedOops) {
 935     // Universe::initialize_heap() will reset this to NULL if unscaled
 936     // or zero-based narrow oops are actually used.
 937     address base = (address)(total_rs.base() - os::vm_page_size());
 938     Universe::set_narrow_oop_base(base);
 939   }




 211         assert(i >= T_BOOLEAN, "checking");
 212         f->do_ptr((void**)&_typeArrayKlassObjs[i]);
 213       } else if (do_all) {
 214         f->do_ptr((void**)&_typeArrayKlassObjs[i]);
 215       }
 216     }
 217   }
 218 
 219   f->do_ptr((void**)&_the_array_interfaces_array);
 220   f->do_ptr((void**)&_the_empty_int_array);
 221   f->do_ptr((void**)&_the_empty_short_array);
 222   f->do_ptr((void**)&_the_empty_method_array);
 223   f->do_ptr((void**)&_the_empty_klass_array);
 224   _finalizer_register_cache->serialize(f);
 225   _loader_addClass_cache->serialize(f);
 226   _reflect_invoke_cache->serialize(f);
 227 }
 228 
 229 void Universe::check_alignment(uintx size, uintx alignment, const char* name) {
 230   if (size < alignment || size % alignment != 0) {
 231     vm_exit_during_initialization(
 232       err_msg("Size of %s (" UINTX_FORMAT " bytes) must be aligned to " UINTX_FORMAT " bytes", name, size, alignment));



 233   }
 234 }
 235 
 236 void initialize_basic_type_klass(Klass* k, TRAPS) {
 237   Klass* ok = SystemDictionary::Object_klass();
 238   if (UseSharedSpaces) {
 239     assert(k->super() == ok, "u3");
 240     k->restore_unshareable_info(CHECK);
 241   } else {
 242     k->initialize_supers(ok, CHECK);
 243   }
 244   k->append_to_sibling_list();
 245 }
 246 
 247 void Universe::genesis(TRAPS) {
 248   ResourceMark rm;
 249 
 250   { FlagSetting fs(_bootstrapping, true);
 251 
 252     { MutexLocker mc(Compile_lock);


 896       addr = Universe::preferred_heap_base(total_reserved, Universe::ZeroBasedNarrowOop);
 897 
 898       ReservedHeapSpace total_rs0(total_reserved, alignment,
 899                                   UseLargePages, addr);
 900 
 901       if (addr != NULL && !total_rs0.is_reserved()) {
 902         // Failed to reserve at specified address again - give up.
 903         addr = Universe::preferred_heap_base(total_reserved, Universe::HeapBasedNarrowOop);
 904         assert(addr == NULL, "");
 905 
 906         ReservedHeapSpace total_rs1(total_reserved, alignment,
 907                                     UseLargePages, addr);
 908         total_rs = total_rs1;
 909       } else {
 910         total_rs = total_rs0;
 911       }
 912     }
 913   }
 914 
 915   if (!total_rs.is_reserved()) {
 916     vm_exit_during_initialization(err_msg("Could not reserve enough space for " SIZE_FORMAT "KB object heap", total_reserved/K));
 917     return total_rs;
 918   }
 919 
 920   // Split the reserved space into main Java heap and a space for
 921   // classes so that they can be compressed using the same algorithm
 922   // as compressed oops. If compress oops and compress klass ptrs are
 923   // used we need the meta space first: if the alignment used for
 924   // compressed oops is greater than the one used for compressed klass
 925   // ptrs, a metadata space on top of the heap could become
 926   // unreachable.
 927   ReservedSpace class_rs = total_rs.first_part(Universe::class_metaspace_size());
 928   ReservedSpace heap_rs = total_rs.last_part(Universe::class_metaspace_size(), alignment);
 929   Metaspace::initialize_class_space(class_rs);
 930 
 931   if (UseCompressedOops) {
 932     // Universe::initialize_heap() will reset this to NULL if unscaled
 933     // or zero-based narrow oops are actually used.
 934     address base = (address)(total_rs.base() - os::vm_page_size());
 935     Universe::set_narrow_oop_base(base);
 936   }