src/share/vm/memory/metaspace.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File webrev Sdiff src/share/vm/memory

src/share/vm/memory/metaspace.cpp

Print this page




3213 }
3214 
3215 void Metaspace::global_initialize() {
3216   MetaspaceGC::initialize();
3217 
3218   // Initialize the alignment for shared spaces.
3219   int max_alignment = os::vm_allocation_granularity();
3220   size_t cds_total = 0;
3221 
3222   MetaspaceShared::set_max_alignment(max_alignment);
3223 
3224   if (DumpSharedSpaces) {
3225 #if INCLUDE_CDS
3226     MetaspaceShared::estimate_regions_size();
3227 
3228     SharedReadOnlySize  = align_size_up(SharedReadOnlySize,  max_alignment);
3229     SharedReadWriteSize = align_size_up(SharedReadWriteSize, max_alignment);
3230     SharedMiscDataSize  = align_size_up(SharedMiscDataSize,  max_alignment);
3231     SharedMiscCodeSize  = align_size_up(SharedMiscCodeSize,  max_alignment);
3232 
3233     // make sure SharedReadOnlySize and SharedReadWriteSize are not less than
3234     // the minimum values.
3235     if (SharedReadOnlySize < MetaspaceShared::min_ro_size){
3236       report_out_of_shared_space(SharedReadOnly);
3237     }
3238 
3239     if (SharedReadWriteSize < MetaspaceShared::min_rw_size){
3240       report_out_of_shared_space(SharedReadWrite);
3241     }
3242 
3243     // the min_misc_data_size and min_misc_code_size estimates are based on
3244     // MetaspaceShared::generate_vtable_methods().
3245     // The minimum size only accounts for the vtable methods. Any size less than the
3246     // minimum required size would cause vm crash when allocating the vtable methods.
3247     uint min_misc_data_size = align_size_up(
3248       MetaspaceShared::num_virtuals * MetaspaceShared::vtbl_list_size * sizeof(void*), max_alignment);
3249 
3250     if (SharedMiscDataSize < min_misc_data_size) {
3251       report_out_of_shared_space(SharedMiscData);
3252     }
3253 
3254     uintx min_misc_code_size = align_size_up(
3255       (MetaspaceShared::num_virtuals * MetaspaceShared::vtbl_list_size) *
3256         (sizeof(void*) + MetaspaceShared::vtbl_method_size) + MetaspaceShared::vtbl_common_code_size,
3257           max_alignment);
3258 
3259     if (SharedMiscCodeSize < min_misc_code_size) {
3260       report_out_of_shared_space(SharedMiscCode);
3261     }
3262 
3263     // Initialize with the sum of the shared space sizes.  The read-only
3264     // and read write metaspace chunks will be allocated out of this and the
3265     // remainder is the misc code and data chunks.
3266     cds_total = FileMapInfo::shared_spaces_size();
3267     cds_total = align_size_up(cds_total, _reserve_alignment);
3268     _space_list = new VirtualSpaceList(cds_total/wordSize);
3269     _chunk_manager_metadata = new ChunkManager(SpecializedChunk, SmallChunk, MediumChunk);
3270 
3271     if (!_space_list->initialization_succeeded()) {
3272       vm_exit_during_initialization("Unable to dump shared archive.", NULL);
3273     }
3274 
3275 #ifdef _LP64
3276     if (cds_total + compressed_class_space_size() > UnscaledClassSpaceMax) {
3277       vm_exit_during_initialization("Unable to dump shared archive.",
3278           err_msg("Size of archive (" SIZE_FORMAT ") + compressed class space ("
3279                   SIZE_FORMAT ") == total (" SIZE_FORMAT ") is larger than compressed "
3280                   "klass limit: " UINT64_FORMAT, cds_total, compressed_class_space_size(),
3281                   cds_total + compressed_class_space_size(), UnscaledClassSpaceMax));
3282     }




3213 }
3214 
3215 void Metaspace::global_initialize() {
3216   MetaspaceGC::initialize();
3217 
3218   // Initialize the alignment for shared spaces.
3219   int max_alignment = os::vm_allocation_granularity();
3220   size_t cds_total = 0;
3221 
3222   MetaspaceShared::set_max_alignment(max_alignment);
3223 
3224   if (DumpSharedSpaces) {
3225 #if INCLUDE_CDS
3226     MetaspaceShared::estimate_regions_size();
3227 
3228     SharedReadOnlySize  = align_size_up(SharedReadOnlySize,  max_alignment);
3229     SharedReadWriteSize = align_size_up(SharedReadWriteSize, max_alignment);
3230     SharedMiscDataSize  = align_size_up(SharedMiscDataSize,  max_alignment);
3231     SharedMiscCodeSize  = align_size_up(SharedMiscCodeSize,  max_alignment);
3232 






























3233     // Initialize with the sum of the shared space sizes.  The read-only
3234     // and read write metaspace chunks will be allocated out of this and the
3235     // remainder is the misc code and data chunks.
3236     cds_total = FileMapInfo::shared_spaces_size();
3237     cds_total = align_size_up(cds_total, _reserve_alignment);
3238     _space_list = new VirtualSpaceList(cds_total/wordSize);
3239     _chunk_manager_metadata = new ChunkManager(SpecializedChunk, SmallChunk, MediumChunk);
3240 
3241     if (!_space_list->initialization_succeeded()) {
3242       vm_exit_during_initialization("Unable to dump shared archive.", NULL);
3243     }
3244 
3245 #ifdef _LP64
3246     if (cds_total + compressed_class_space_size() > UnscaledClassSpaceMax) {
3247       vm_exit_during_initialization("Unable to dump shared archive.",
3248           err_msg("Size of archive (" SIZE_FORMAT ") + compressed class space ("
3249                   SIZE_FORMAT ") == total (" SIZE_FORMAT ") is larger than compressed "
3250                   "klass limit: " UINT64_FORMAT, cds_total, compressed_class_space_size(),
3251                   cds_total + compressed_class_space_size(), UnscaledClassSpaceMax));
3252     }


src/share/vm/memory/metaspace.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File