3115 } 3116 } 3117 } 3118 3119 // If we got here then the metaspace got allocated. 3120 MemTracker::record_virtual_memory_type((address)metaspace_rs.base(), mtClass); 3121 3122 #if INCLUDE_CDS 3123 // Verify that we can use shared spaces. Otherwise, turn off CDS. 3124 if (UseSharedSpaces && !can_use_cds_with_metaspace_addr(metaspace_rs.base(), cds_base)) { 3125 FileMapInfo::stop_sharing_and_unmap( 3126 "Could not allocate metaspace at a compatible address"); 3127 } 3128 #endif 3129 set_narrow_klass_base_and_shift((address)metaspace_rs.base(), 3130 UseSharedSpaces ? (address)cds_base : 0); 3131 3132 initialize_class_space(metaspace_rs); 3133 3134 if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) { 3135 gclog_or_tty->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: %d", 3136 p2i(Universe::narrow_klass_base()), Universe::narrow_klass_shift()); 3137 gclog_or_tty->print_cr("Compressed class space size: " SIZE_FORMAT " Address: " PTR_FORMAT " Req Addr: " PTR_FORMAT, 3138 compressed_class_space_size(), p2i(metaspace_rs.base()), p2i(requested_addr)); 3139 } 3140 } 3141 3142 // For UseCompressedClassPointers the class space is reserved above the top of 3143 // the Java heap. The argument passed in is at the base of the compressed space. 3144 void Metaspace::initialize_class_space(ReservedSpace rs) { 3145 // The reserved space size may be bigger because of alignment, esp with UseLargePages 3146 assert(rs.size() >= CompressedClassSpaceSize, 3147 err_msg(SIZE_FORMAT " != " SIZE_FORMAT, rs.size(), CompressedClassSpaceSize)); 3148 assert(using_class_space(), "Must be using class space"); 3149 _class_space_list = new VirtualSpaceList(rs); 3150 _chunk_manager_class = new ChunkManager(SpecializedChunk, ClassSmallChunk, ClassMediumChunk); 3151 3152 if (!_class_space_list->initialization_succeeded()) { 3153 vm_exit_during_initialization("Failed to setup compressed class space virtual space list."); 3154 } 3155 } 3156 3157 #endif 3158 | 3115 } 3116 } 3117 } 3118 3119 // If we got here then the metaspace got allocated. 3120 MemTracker::record_virtual_memory_type((address)metaspace_rs.base(), mtClass); 3121 3122 #if INCLUDE_CDS 3123 // Verify that we can use shared spaces. Otherwise, turn off CDS. 3124 if (UseSharedSpaces && !can_use_cds_with_metaspace_addr(metaspace_rs.base(), cds_base)) { 3125 FileMapInfo::stop_sharing_and_unmap( 3126 "Could not allocate metaspace at a compatible address"); 3127 } 3128 #endif 3129 set_narrow_klass_base_and_shift((address)metaspace_rs.base(), 3130 UseSharedSpaces ? (address)cds_base : 0); 3131 3132 initialize_class_space(metaspace_rs); 3133 3134 if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) { 3135 print_compressed_class_space(gclog_or_tty, requested_addr); 3136 } 3137 } 3138 3139 void Metaspace::print_compressed_class_space(outputStream* st, const char* requested_addr) { 3140 st->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: %d", 3141 p2i(Universe::narrow_klass_base()), Universe::narrow_klass_shift()); 3142 if (_class_space_list != NULL) { 3143 address base = (address)_class_space_list->current_virtual_space()->bottom(); 3144 st->print("Compressed class space size: " SIZE_FORMAT " Address: " PTR_FORMAT, 3145 compressed_class_space_size(), p2i(base)); 3146 if (requested_addr != 0) { 3147 st->print(" Req Addr: " PTR_FORMAT, p2i(requested_addr)); 3148 } 3149 st->cr(); 3150 } 3151 } 3152 3153 // For UseCompressedClassPointers the class space is reserved above the top of 3154 // the Java heap. The argument passed in is at the base of the compressed space. 3155 void Metaspace::initialize_class_space(ReservedSpace rs) { 3156 // The reserved space size may be bigger because of alignment, esp with UseLargePages 3157 assert(rs.size() >= CompressedClassSpaceSize, 3158 err_msg(SIZE_FORMAT " != " SIZE_FORMAT, rs.size(), CompressedClassSpaceSize)); 3159 assert(using_class_space(), "Must be using class space"); 3160 _class_space_list = new VirtualSpaceList(rs); 3161 _chunk_manager_class = new ChunkManager(SpecializedChunk, ClassSmallChunk, ClassMediumChunk); 3162 3163 if (!_class_space_list->initialization_succeeded()) { 3164 vm_exit_during_initialization("Failed to setup compressed class space virtual space list."); 3165 } 3166 } 3167 3168 #endif 3169 |