< prev index next >

src/hotspot/share/memory/metaspace.cpp

Print this page


1066     // that fails then OOM doom.  At this point we cannot try allocating the
1067     // metaspace as if UseCompressedClassPointers is off because too much
1068     // initialization has happened that depends on UseCompressedClassPointers.
1069     // So, UseCompressedClassPointers cannot be turned off at this point.
1070     if (!metaspace_rs.is_reserved()) {
1071       metaspace_rs = ReservedSpace(compressed_class_space_size(),
1072                                    _reserve_alignment, large_pages);
1073       if (!metaspace_rs.is_reserved()) {
1074         vm_exit_during_initialization(err_msg("Could not allocate metaspace: " SIZE_FORMAT " bytes",
1075                                               compressed_class_space_size()));
1076       }
1077     }
1078   }
1079 
1080   // If we got here then the metaspace got allocated.
1081   MemTracker::record_virtual_memory_type((address)metaspace_rs.base(), mtClass);
1082 
1083 #if INCLUDE_CDS
1084   // Verify that we can use shared spaces.  Otherwise, turn off CDS.
1085   if (UseSharedSpaces && !can_use_cds_with_metaspace_addr(metaspace_rs.base(), cds_base)) {
1086     FileMapInfo::stop_sharing_and_unmap(
1087         "Could not allocate metaspace at a compatible address");
1088   }
1089 #endif
1090   set_narrow_klass_base_and_shift((address)metaspace_rs.base(),
1091                                   UseSharedSpaces ? (address)cds_base : 0);
1092 
1093   initialize_class_space(metaspace_rs);
1094 
1095   LogTarget(Trace, gc, metaspace) lt;
1096   if (lt.is_enabled()) {
1097     ResourceMark rm;
1098     LogStream ls(lt);
1099     print_compressed_class_space(&ls, requested_addr);
1100   }
1101 }
1102 
1103 void Metaspace::print_compressed_class_space(outputStream* st, const char* requested_addr) {
1104   st->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: %d",
1105                p2i(Universe::narrow_klass_base()), Universe::narrow_klass_shift());
1106   if (_class_space_list != NULL) {




1066     // that fails then OOM doom.  At this point we cannot try allocating the
1067     // metaspace as if UseCompressedClassPointers is off because too much
1068     // initialization has happened that depends on UseCompressedClassPointers.
1069     // So, UseCompressedClassPointers cannot be turned off at this point.
1070     if (!metaspace_rs.is_reserved()) {
1071       metaspace_rs = ReservedSpace(compressed_class_space_size(),
1072                                    _reserve_alignment, large_pages);
1073       if (!metaspace_rs.is_reserved()) {
1074         vm_exit_during_initialization(err_msg("Could not allocate metaspace: " SIZE_FORMAT " bytes",
1075                                               compressed_class_space_size()));
1076       }
1077     }
1078   }
1079 
1080   // If we got here then the metaspace got allocated.
1081   MemTracker::record_virtual_memory_type((address)metaspace_rs.base(), mtClass);
1082 
1083 #if INCLUDE_CDS
1084   // Verify that we can use shared spaces.  Otherwise, turn off CDS.
1085   if (UseSharedSpaces && !can_use_cds_with_metaspace_addr(metaspace_rs.base(), cds_base)) {
1086     MetaspaceShared::stop_sharing_and_unmap(
1087         "Could not allocate metaspace at a compatible address");
1088   }
1089 #endif
1090   set_narrow_klass_base_and_shift((address)metaspace_rs.base(),
1091                                   UseSharedSpaces ? (address)cds_base : 0);
1092 
1093   initialize_class_space(metaspace_rs);
1094 
1095   LogTarget(Trace, gc, metaspace) lt;
1096   if (lt.is_enabled()) {
1097     ResourceMark rm;
1098     LogStream ls(lt);
1099     print_compressed_class_space(&ls, requested_addr);
1100   }
1101 }
1102 
1103 void Metaspace::print_compressed_class_space(outputStream* st, const char* requested_addr) {
1104   st->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: %d",
1105                p2i(Universe::narrow_klass_base()), Universe::narrow_klass_shift());
1106   if (_class_space_list != NULL) {


< prev index next >