< prev index next >

src/hotspot/share/gc/cms/cmsArguments.cpp

Print this page




   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/cms/cmsArguments.hpp"
  27 #include "gc/cms/cmsCollectorPolicy.hpp"
  28 #include "gc/cms/cmsHeap.hpp"
  29 #include "gc/cms/compactibleFreeListSpace.hpp"

  30 #include "gc/shared/gcArguments.inline.hpp"
  31 #include "gc/shared/genCollectedHeap.hpp"
  32 #include "runtime/arguments.hpp"
  33 #include "runtime/globals.hpp"
  34 #include "runtime/globals_extension.hpp"
  35 #include "runtime/vm_version.hpp"
  36 #include "utilities/defaultStream.hpp"
  37 
  38 size_t CMSArguments::conservative_max_heap_alignment() {
  39   return GenCollectedHeap::conservative_max_heap_alignment();
  40 }
  41 
  42 void CMSArguments::set_parnew_gc_flags() {
  43   assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC,
  44          "control point invariant");
  45   assert(UseConcMarkSweepGC, "CMS is expected to be on here");
  46 
  47   if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
  48     FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
  49     assert(ParallelGCThreads > 0, "We should always have at least one thread by default");


  59   // See CR 6362902.
  60   if (FLAG_IS_DEFAULT(YoungPLABSize)) {
  61     FLAG_SET_DEFAULT(YoungPLABSize, (intx)1024);
  62   }
  63   if (FLAG_IS_DEFAULT(OldPLABSize)) {
  64     FLAG_SET_DEFAULT(OldPLABSize, (intx)1024);
  65   }
  66 
  67   // When using compressed oops, we use local overflow stacks,
  68   // rather than using a global overflow list chained through
  69   // the klass word of the object's pre-image.
  70   if (UseCompressedOops && !ParGCUseLocalOverflow) {
  71     if (!FLAG_IS_DEFAULT(ParGCUseLocalOverflow)) {
  72       warning("Forcing +ParGCUseLocalOverflow: needed if using compressed references");
  73     }
  74     FLAG_SET_DEFAULT(ParGCUseLocalOverflow, true);
  75   }
  76   assert(ParGCUseLocalOverflow || !UseCompressedOops, "Error");
  77 }
  78 








  79 // Adjust some sizes to suit CMS and/or ParNew needs; these work well on
  80 // sparc/solaris for certain applications, but would gain from
  81 // further optimization and tuning efforts, and would almost
  82 // certainly gain from analysis of platform and environment.
  83 void CMSArguments::initialize_flags() {
  84   GCArguments::initialize_flags();
  85   assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC, "Error");
  86   assert(UseConcMarkSweepGC, "CMS is expected to be on here");
  87 
  88   // Set CMS global values
  89   CompactibleFreeListSpace::set_cms_values();
  90 
  91   // Turn off AdaptiveSizePolicy by default for cms until it is complete.
  92   disable_adaptive_size_policy("UseConcMarkSweepGC");
  93 
  94   set_parnew_gc_flags();
  95 
  96   size_t max_heap = align_down(MaxHeapSize,
  97                                CardTableRS::ct_max_alignment_constraint());
  98 


 180   // If either of the static initialization defaults have changed, note this
 181   // modification.
 182   if (!FLAG_IS_DEFAULT(OldPLABSize) || !FLAG_IS_DEFAULT(OldPLABWeight)) {
 183     CompactibleFreeListSpaceLAB::modify_initialization(OldPLABSize, OldPLABWeight);
 184   }
 185 
 186   log_trace(gc)("MarkStackSize: %uk  MarkStackSizeMax: %uk", (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K));
 187 }
 188 
 189 void CMSArguments::disable_adaptive_size_policy(const char* collector_name) {
 190   if (UseAdaptiveSizePolicy) {
 191     if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) {
 192       warning("Disabling UseAdaptiveSizePolicy; it is incompatible with %s.",
 193               collector_name);
 194     }
 195     FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false);
 196   }
 197 }
 198 
 199 CollectedHeap* CMSArguments::create_heap() {
 200   return create_heap_with_policy<CMSHeap, ConcurrentMarkSweepPolicy>();
 201 }


   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/cms/cmsArguments.hpp"

  27 #include "gc/cms/cmsHeap.hpp"
  28 #include "gc/cms/compactibleFreeListSpace.hpp"
  29 #include "gc/shared/cardTableRS.hpp"
  30 #include "gc/shared/gcArguments.inline.hpp"
  31 #include "gc/shared/genCollectedHeap.hpp"
  32 #include "runtime/arguments.hpp"
  33 #include "runtime/globals.hpp"
  34 #include "runtime/globals_extension.hpp"
  35 #include "runtime/vm_version.hpp"
  36 #include "utilities/defaultStream.hpp"
  37 
  38 size_t CMSArguments::conservative_max_heap_alignment() {
  39   return GenCollectedHeap::conservative_max_heap_alignment();
  40 }
  41 
  42 void CMSArguments::set_parnew_gc_flags() {
  43   assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC,
  44          "control point invariant");
  45   assert(UseConcMarkSweepGC, "CMS is expected to be on here");
  46 
  47   if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
  48     FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
  49     assert(ParallelGCThreads > 0, "We should always have at least one thread by default");


  59   // See CR 6362902.
  60   if (FLAG_IS_DEFAULT(YoungPLABSize)) {
  61     FLAG_SET_DEFAULT(YoungPLABSize, (intx)1024);
  62   }
  63   if (FLAG_IS_DEFAULT(OldPLABSize)) {
  64     FLAG_SET_DEFAULT(OldPLABSize, (intx)1024);
  65   }
  66 
  67   // When using compressed oops, we use local overflow stacks,
  68   // rather than using a global overflow list chained through
  69   // the klass word of the object's pre-image.
  70   if (UseCompressedOops && !ParGCUseLocalOverflow) {
  71     if (!FLAG_IS_DEFAULT(ParGCUseLocalOverflow)) {
  72       warning("Forcing +ParGCUseLocalOverflow: needed if using compressed references");
  73     }
  74     FLAG_SET_DEFAULT(ParGCUseLocalOverflow, true);
  75   }
  76   assert(ParGCUseLocalOverflow || !UseCompressedOops, "Error");
  77 }
  78 
  79 CMSSettings CMSArguments::initialize_heap_flags() {
  80   CMSSettings s;
  81 
  82   GenArguments::initialize_heap_flags(s);
  83 
  84   return s;
  85 }
  86 
  87 // Adjust some sizes to suit CMS and/or ParNew needs; these work well on
  88 // sparc/solaris for certain applications, but would gain from
  89 // further optimization and tuning efforts, and would almost
  90 // certainly gain from analysis of platform and environment.
  91 void CMSArguments::initialize_flags() {
  92   GCArguments::initialize_flags();
  93   assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC, "Error");
  94   assert(UseConcMarkSweepGC, "CMS is expected to be on here");
  95 
  96   // Set CMS global values
  97   CompactibleFreeListSpace::set_cms_values();
  98 
  99   // Turn off AdaptiveSizePolicy by default for cms until it is complete.
 100   disable_adaptive_size_policy("UseConcMarkSweepGC");
 101 
 102   set_parnew_gc_flags();
 103 
 104   size_t max_heap = align_down(MaxHeapSize,
 105                                CardTableRS::ct_max_alignment_constraint());
 106 


 188   // If either of the static initialization defaults have changed, note this
 189   // modification.
 190   if (!FLAG_IS_DEFAULT(OldPLABSize) || !FLAG_IS_DEFAULT(OldPLABWeight)) {
 191     CompactibleFreeListSpaceLAB::modify_initialization(OldPLABSize, OldPLABWeight);
 192   }
 193 
 194   log_trace(gc)("MarkStackSize: %uk  MarkStackSizeMax: %uk", (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K));
 195 }
 196 
 197 void CMSArguments::disable_adaptive_size_policy(const char* collector_name) {
 198   if (UseAdaptiveSizePolicy) {
 199     if (FLAG_IS_CMDLINE(UseAdaptiveSizePolicy)) {
 200       warning("Disabling UseAdaptiveSizePolicy; it is incompatible with %s.",
 201               collector_name);
 202     }
 203     FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false);
 204   }
 205 }
 206 
 207 CollectedHeap* CMSArguments::create_heap() {
 208   return new CMSHeap(initialize_heap_flags());
 209 }
< prev index next >