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

src/share/vm/memory/metaspace.cpp

Print this page
rev 6566 : 8048150: Allow easy configurations for large CDS archives
Summary: Estimate the size of shared archive based on the number of classes in the classlist file
Reviewed-by: iklam, jiangli, minqi, dholmes


3107   }
3108 
3109   MinMetaspaceExpansion = align_size_down_bounded(MinMetaspaceExpansion, _commit_alignment);
3110   MaxMetaspaceExpansion = align_size_down_bounded(MaxMetaspaceExpansion, _commit_alignment);
3111 
3112   CompressedClassSpaceSize = align_size_down_bounded(CompressedClassSpaceSize, _reserve_alignment);
3113   set_compressed_class_space_size(CompressedClassSpaceSize);
3114 }
3115 
3116 void Metaspace::global_initialize() {
3117   MetaspaceGC::initialize();
3118 
3119   // Initialize the alignment for shared spaces.
3120   int max_alignment = os::vm_page_size();
3121   size_t cds_total = 0;
3122 
3123   MetaspaceShared::set_max_alignment(max_alignment);
3124 
3125   if (DumpSharedSpaces) {
3126 #if INCLUDE_CDS


3127     SharedReadOnlySize  = align_size_up(SharedReadOnlySize,  max_alignment);
3128     SharedReadWriteSize = align_size_up(SharedReadWriteSize, max_alignment);
3129     SharedMiscDataSize  = align_size_up(SharedMiscDataSize,  max_alignment);
3130     SharedMiscCodeSize  = align_size_up(SharedMiscCodeSize,  max_alignment);
3131 
3132     // Initialize with the sum of the shared space sizes.  The read-only
3133     // and read write metaspace chunks will be allocated out of this and the
3134     // remainder is the misc code and data chunks.
3135     cds_total = FileMapInfo::shared_spaces_size();
3136     cds_total = align_size_up(cds_total, _reserve_alignment);
3137     _space_list = new VirtualSpaceList(cds_total/wordSize);
3138     _chunk_manager_metadata = new ChunkManager(SpecializedChunk, SmallChunk, MediumChunk);
3139 
3140     if (!_space_list->initialization_succeeded()) {
3141       vm_exit_during_initialization("Unable to dump shared archive.", NULL);
3142     }
3143 
3144 #ifdef _LP64
3145     if (cds_total + compressed_class_space_size() > UnscaledClassSpaceMax) {
3146       vm_exit_during_initialization("Unable to dump shared archive.",




3107   }
3108 
3109   MinMetaspaceExpansion = align_size_down_bounded(MinMetaspaceExpansion, _commit_alignment);
3110   MaxMetaspaceExpansion = align_size_down_bounded(MaxMetaspaceExpansion, _commit_alignment);
3111 
3112   CompressedClassSpaceSize = align_size_down_bounded(CompressedClassSpaceSize, _reserve_alignment);
3113   set_compressed_class_space_size(CompressedClassSpaceSize);
3114 }
3115 
3116 void Metaspace::global_initialize() {
3117   MetaspaceGC::initialize();
3118 
3119   // Initialize the alignment for shared spaces.
3120   int max_alignment = os::vm_page_size();
3121   size_t cds_total = 0;
3122 
3123   MetaspaceShared::set_max_alignment(max_alignment);
3124 
3125   if (DumpSharedSpaces) {
3126 #if INCLUDE_CDS
3127     MetaspaceShared::estimate_regions_size();
3128 
3129     SharedReadOnlySize  = align_size_up(SharedReadOnlySize,  max_alignment);
3130     SharedReadWriteSize = align_size_up(SharedReadWriteSize, max_alignment);
3131     SharedMiscDataSize  = align_size_up(SharedMiscDataSize,  max_alignment);
3132     SharedMiscCodeSize  = align_size_up(SharedMiscCodeSize,  max_alignment);
3133 
3134     // Initialize with the sum of the shared space sizes.  The read-only
3135     // and read write metaspace chunks will be allocated out of this and the
3136     // remainder is the misc code and data chunks.
3137     cds_total = FileMapInfo::shared_spaces_size();
3138     cds_total = align_size_up(cds_total, _reserve_alignment);
3139     _space_list = new VirtualSpaceList(cds_total/wordSize);
3140     _chunk_manager_metadata = new ChunkManager(SpecializedChunk, SmallChunk, MediumChunk);
3141 
3142     if (!_space_list->initialization_succeeded()) {
3143       vm_exit_during_initialization("Unable to dump shared archive.", NULL);
3144     }
3145 
3146 #ifdef _LP64
3147     if (cds_total + compressed_class_space_size() > UnscaledClassSpaceMax) {
3148       vm_exit_during_initialization("Unable to dump shared archive.",


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