< prev index next >

src/share/vm/memory/metaspace.cpp

Print this page


   1 /*
   2  * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


3118   // alignment depends on other flags being parsed.
3119   MaxMetaspaceSize = align_size_down_bounded(MaxMetaspaceSize, _reserve_alignment);
3120 
3121   if (MetaspaceSize > MaxMetaspaceSize) {
3122     MetaspaceSize = MaxMetaspaceSize;
3123   }
3124 
3125   MetaspaceSize = align_size_down_bounded(MetaspaceSize, _commit_alignment);
3126 
3127   assert(MetaspaceSize <= MaxMetaspaceSize, "MetaspaceSize should be limited by MaxMetaspaceSize");
3128 
3129   if (MetaspaceSize < 256*K) {
3130     vm_exit_during_initialization("Too small initial Metaspace size");
3131   }
3132 
3133   MinMetaspaceExpansion = align_size_down_bounded(MinMetaspaceExpansion, _commit_alignment);
3134   MaxMetaspaceExpansion = align_size_down_bounded(MaxMetaspaceExpansion, _commit_alignment);
3135 
3136   CompressedClassSpaceSize = align_size_down_bounded(CompressedClassSpaceSize, _reserve_alignment);
3137   set_compressed_class_space_size(CompressedClassSpaceSize);


















3138 }
3139 
3140 void Metaspace::global_initialize() {
3141   MetaspaceGC::initialize();
3142 
3143   // Initialize the alignment for shared spaces.
3144   int max_alignment = os::vm_allocation_granularity();
3145   size_t cds_total = 0;
3146 
3147   MetaspaceShared::set_max_alignment(max_alignment);
3148 
3149   if (DumpSharedSpaces) {
3150 #if INCLUDE_CDS
3151     MetaspaceShared::estimate_regions_size();
3152 
3153     SharedReadOnlySize  = align_size_up(SharedReadOnlySize,  max_alignment);
3154     SharedReadWriteSize = align_size_up(SharedReadWriteSize, max_alignment);
3155     SharedMiscDataSize  = align_size_up(SharedMiscDataSize,  max_alignment);
3156     SharedMiscCodeSize  = align_size_up(SharedMiscCodeSize,  max_alignment);
3157 


   1 /*
   2  * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


3118   // alignment depends on other flags being parsed.
3119   MaxMetaspaceSize = align_size_down_bounded(MaxMetaspaceSize, _reserve_alignment);
3120 
3121   if (MetaspaceSize > MaxMetaspaceSize) {
3122     MetaspaceSize = MaxMetaspaceSize;
3123   }
3124 
3125   MetaspaceSize = align_size_down_bounded(MetaspaceSize, _commit_alignment);
3126 
3127   assert(MetaspaceSize <= MaxMetaspaceSize, "MetaspaceSize should be limited by MaxMetaspaceSize");
3128 
3129   if (MetaspaceSize < 256*K) {
3130     vm_exit_during_initialization("Too small initial Metaspace size");
3131   }
3132 
3133   MinMetaspaceExpansion = align_size_down_bounded(MinMetaspaceExpansion, _commit_alignment);
3134   MaxMetaspaceExpansion = align_size_down_bounded(MaxMetaspaceExpansion, _commit_alignment);
3135 
3136   CompressedClassSpaceSize = align_size_down_bounded(CompressedClassSpaceSize, _reserve_alignment);
3137   set_compressed_class_space_size(CompressedClassSpaceSize);
3138 
3139   // Initial virtual space size will be calculated at global_initialize()
3140   uintx min_metaspace_sz =
3141       VIRTUALSPACEMULTIPLIER * InitialBootClassLoaderMetaspaceSize;
3142   if (UseCompressedClassPointers) {
3143     if ((min_metaspace_sz + CompressedClassSpaceSize) >  MaxMetaspaceSize) {
3144       if (min_metaspace_sz >= MaxMetaspaceSize) {
3145         vm_exit_during_initialization("MaxMetaspaceSize is too small.");
3146       } else {
3147         FLAG_SET_ERGO(uintx, CompressedClassSpaceSize,
3148                       MaxMetaspaceSize - min_metaspace_sz);
3149       }
3150     }
3151   } else if (min_metaspace_sz >= MaxMetaspaceSize) {
3152     FLAG_SET_ERGO(uintx, InitialBootClassLoaderMetaspaceSize,
3153                   min_metaspace_sz);
3154   }
3155 
3156 }
3157 
3158 void Metaspace::global_initialize() {
3159   MetaspaceGC::initialize();
3160 
3161   // Initialize the alignment for shared spaces.
3162   int max_alignment = os::vm_allocation_granularity();
3163   size_t cds_total = 0;
3164 
3165   MetaspaceShared::set_max_alignment(max_alignment);
3166 
3167   if (DumpSharedSpaces) {
3168 #if INCLUDE_CDS
3169     MetaspaceShared::estimate_regions_size();
3170 
3171     SharedReadOnlySize  = align_size_up(SharedReadOnlySize,  max_alignment);
3172     SharedReadWriteSize = align_size_up(SharedReadWriteSize, max_alignment);
3173     SharedMiscDataSize  = align_size_up(SharedMiscDataSize,  max_alignment);
3174     SharedMiscCodeSize  = align_size_up(SharedMiscCodeSize,  max_alignment);
3175 


< prev index next >