< prev index next >

src/share/vm/memory/metaspace.cpp

Print this page




3081       }
3082     }
3083   }
3084 
3085   // If we got here then the metaspace got allocated.
3086   MemTracker::record_virtual_memory_type((address)metaspace_rs.base(), mtClass);
3087 
3088 #if INCLUDE_CDS
3089   // Verify that we can use shared spaces.  Otherwise, turn off CDS.
3090   if (UseSharedSpaces && !can_use_cds_with_metaspace_addr(metaspace_rs.base(), cds_base)) {
3091     FileMapInfo::stop_sharing_and_unmap(
3092         "Could not allocate metaspace at a compatible address");
3093   }
3094 #endif
3095   set_narrow_klass_base_and_shift((address)metaspace_rs.base(),
3096                                   UseSharedSpaces ? (address)cds_base : 0);
3097 
3098   initialize_class_space(metaspace_rs);
3099 
3100   if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) {
3101     gclog_or_tty->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: " SIZE_FORMAT,
3102                             Universe::narrow_klass_base(), Universe::narrow_klass_shift());
3103     gclog_or_tty->print_cr("Compressed class space size: " SIZE_FORMAT " Address: " PTR_FORMAT " Req Addr: " PTR_FORMAT,
3104                            compressed_class_space_size(), metaspace_rs.base(), requested_addr);
3105   }
3106 }














3107 
3108 // For UseCompressedClassPointers the class space is reserved above the top of
3109 // the Java heap.  The argument passed in is at the base of the compressed space.
3110 void Metaspace::initialize_class_space(ReservedSpace rs) {
3111   // The reserved space size may be bigger because of alignment, esp with UseLargePages
3112   assert(rs.size() >= CompressedClassSpaceSize,
3113          err_msg(SIZE_FORMAT " != " UINTX_FORMAT, rs.size(), CompressedClassSpaceSize));
3114   assert(using_class_space(), "Must be using class space");
3115   _class_space_list = new VirtualSpaceList(rs);
3116   _chunk_manager_class = new ChunkManager(ClassSpecializedChunk, ClassSmallChunk, ClassMediumChunk);
3117 
3118   if (!_class_space_list->initialization_succeeded()) {
3119     vm_exit_during_initialization("Failed to setup compressed class space virtual space list.");
3120   }
3121 }
3122 
3123 #endif
3124 
3125 void Metaspace::ergo_initialize() {
3126   if (DumpSharedSpaces) {




3081       }
3082     }
3083   }
3084 
3085   // If we got here then the metaspace got allocated.
3086   MemTracker::record_virtual_memory_type((address)metaspace_rs.base(), mtClass);
3087 
3088 #if INCLUDE_CDS
3089   // Verify that we can use shared spaces.  Otherwise, turn off CDS.
3090   if (UseSharedSpaces && !can_use_cds_with_metaspace_addr(metaspace_rs.base(), cds_base)) {
3091     FileMapInfo::stop_sharing_and_unmap(
3092         "Could not allocate metaspace at a compatible address");
3093   }
3094 #endif
3095   set_narrow_klass_base_and_shift((address)metaspace_rs.base(),
3096                                   UseSharedSpaces ? (address)cds_base : 0);
3097 
3098   initialize_class_space(metaspace_rs);
3099 
3100   if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) {
3101       print_compressed_class_space(gclog_or_tty, requested_addr);



3102   }
3103 }
3104 
3105 void Metaspace::print_compressed_class_space(outputStream* st, const char* requested_addr) {
3106   st->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: %d",
3107                p2i(Universe::narrow_klass_base()), Universe::narrow_klass_shift());
3108   if (_class_space_list != NULL) {
3109     address base = (address)_class_space_list->current_virtual_space()->bottom();
3110     st->print("Compressed class space size: " SIZE_FORMAT " Address: " PTR_FORMAT,
3111                  compressed_class_space_size(), p2i(base));
3112     if (requested_addr != 0) {
3113       st->print(" Req Addr: " PTR_FORMAT, p2i(requested_addr));
3114     }
3115     st->cr();
3116    }
3117  }
3118 
3119 // For UseCompressedClassPointers the class space is reserved above the top of
3120 // the Java heap.  The argument passed in is at the base of the compressed space.
3121 void Metaspace::initialize_class_space(ReservedSpace rs) {
3122   // The reserved space size may be bigger because of alignment, esp with UseLargePages
3123   assert(rs.size() >= CompressedClassSpaceSize,
3124          err_msg(SIZE_FORMAT " != " UINTX_FORMAT, rs.size(), CompressedClassSpaceSize));
3125   assert(using_class_space(), "Must be using class space");
3126   _class_space_list = new VirtualSpaceList(rs);
3127   _chunk_manager_class = new ChunkManager(ClassSpecializedChunk, ClassSmallChunk, ClassMediumChunk);
3128 
3129   if (!_class_space_list->initialization_succeeded()) {
3130     vm_exit_during_initialization("Failed to setup compressed class space virtual space list.");
3131   }
3132 }
3133 
3134 #endif
3135 
3136 void Metaspace::ergo_initialize() {
3137   if (DumpSharedSpaces) {


< prev index next >