< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp

Print this page




  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/shared/gcArguments.hpp"
  27 #include "gc/shared/workerPolicy.hpp"
  28 #include "gc/shenandoah/shenandoahArguments.hpp"
  29 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
  30 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
  31 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
  32 #include "utilities/defaultStream.hpp"
  33 
  34 void ShenandoahArguments::initialize() {
  35 #if !(defined AARCH64 || defined AMD64 || defined IA32)
  36   vm_exit_during_initialization("Shenandoah GC is not supported on this platform.");
  37 #endif
  38 
  39 #if 0 // leave this block as stepping stone for future platforms
  40   log_warning(gc)("Shenandoah GC is not fully supported on this platform:");
  41   log_warning(gc)("  concurrent modes are not supported, only STW cycles are enabled;");
  42   log_warning(gc)("  arch-specific barrier code is not implemented, disabling barriers;");
  43 
  44   FLAG_SET_DEFAULT(ShenandoahGCHeuristics,           "passive");
  45 
  46   FLAG_SET_DEFAULT(ShenandoahSATBBarrier,            false);
  47   FLAG_SET_DEFAULT(ShenandoahLoadRefBarrier,         false);
  48   FLAG_SET_DEFAULT(ShenandoahKeepAliveBarrier,       false);
  49   FLAG_SET_DEFAULT(ShenandoahStoreValEnqueueBarrier, false);
  50   FLAG_SET_DEFAULT(ShenandoahCASBarrier,             false);
  51   FLAG_SET_DEFAULT(ShenandoahCloneBarrier,           false);
  52 
  53   FLAG_SET_DEFAULT(ShenandoahVerifyOptoBarriers,     false);
  54 #endif
  55 
  56   if (UseLargePages && (MaxHeapSize / os::large_page_size()) < ShenandoahHeapRegion::MIN_NUM_REGIONS) {
  57     warning("Large pages size (" SIZE_FORMAT "K) is too large to afford page-sized regions, disabling uncommit",
  58             os::large_page_size() / K);
  59     FLAG_SET_DEFAULT(ShenandoahUncommit, false);
  60   }
  61 
  62   // Enable NUMA by default. While Shenandoah is not NUMA-aware, enabling NUMA makes
  63   // storage allocation code NUMA-aware, and NUMA interleaving makes the storage
  64   // allocated in consistent manner (interleaving) to minimize run-to-run variance.
  65   if (FLAG_IS_DEFAULT(UseNUMA)) {
  66     FLAG_SET_DEFAULT(UseNUMA, true);
  67     FLAG_SET_DEFAULT(UseNUMAInterleaving, true);
  68   }
  69 
  70   // Set up default number of concurrent threads. We want to have cycles complete fast
  71   // enough, but we also do not want to steal too much CPU from the concurrently running
  72   // application. Using 1/4 of available threads for concurrent GC seems a good
  73   // compromise here.
  74   if (FLAG_IS_DEFAULT(ConcGCThreads)) {
  75     FLAG_SET_DEFAULT(ConcGCThreads, MAX2(1, os::processor_count() / 4));
  76   }
  77 
  78   if (ConcGCThreads == 0) {
  79     vm_exit_during_initialization("Shenandoah expects ConcGCThreads > 0, check -XX:ConcGCThreads=#");
  80   }
  81 
  82   // Set up default number of parallel threads. We want to have decent pauses performance
  83   // which would use parallel threads, but we also do not want to do too many threads
  84   // that will overwhelm the OS scheduler. Using 1/2 of available threads seems to be a fair
  85   // compromise here. Due to implementation constraints, it should not be lower than
  86   // the number of concurrent threads.
  87   if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
  88     FLAG_SET_DEFAULT(ParallelGCThreads, MAX2(1, os::processor_count() / 2));
  89   }
  90 
  91   if (ParallelGCThreads == 0) {
  92     vm_exit_during_initialization("Shenandoah expects ParallelGCThreads > 0, check -XX:ParallelGCThreads=#");
  93   }
  94 
  95   if (ParallelGCThreads < ConcGCThreads) {
  96     warning("Shenandoah expects ConcGCThreads <= ParallelGCThreads, adjusting ParallelGCThreads automatically");
  97     FLAG_SET_DEFAULT(ParallelGCThreads, ConcGCThreads);
  98   }
  99 
 100   if (FLAG_IS_DEFAULT(ParallelRefProcEnabled)) {
 101     FLAG_SET_DEFAULT(ParallelRefProcEnabled, true);
 102   }
 103 
 104   if (ShenandoahRegionSampling && FLAG_IS_DEFAULT(PerfDataMemorySize)) {
 105     // When sampling is enabled, max out the PerfData memory to get more
 106     // Shenandoah data in, including Matrix.
 107     FLAG_SET_DEFAULT(PerfDataMemorySize, 2048*K);
 108   }
 109 
 110 #ifdef COMPILER2
 111   // Shenandoah cares more about pause times, rather than raw throughput.
 112   if (FLAG_IS_DEFAULT(UseCountedLoopSafepoints)) {
 113     FLAG_SET_DEFAULT(UseCountedLoopSafepoints, true);
 114     if (FLAG_IS_DEFAULT(LoopStripMiningIter)) {
 115       FLAG_SET_DEFAULT(LoopStripMiningIter, 1000);
 116     }
 117   }




  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/shared/gcArguments.hpp"
  27 #include "gc/shared/workerPolicy.hpp"
  28 #include "gc/shenandoah/shenandoahArguments.hpp"
  29 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
  30 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
  31 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
  32 #include "utilities/defaultStream.hpp"
  33 
  34 void ShenandoahArguments::initialize() {
  35 #if !(defined AARCH64 || defined AMD64 || defined IA32)
  36   vm_exit_during_initialization("Shenandoah GC is not supported on this platform.");
  37 #endif
  38 
  39 #ifdef IA32
  40   log_warning(gc)("Shenandoah GC is not fully supported on this platform:");
  41   log_warning(gc)("  concurrent modes are not supported, only STW cycles are enabled;");
  42   log_warning(gc)("  arch-specific barrier code is not implemented, disabling barriers;");
  43 
  44   FLAG_SET_DEFAULT(ShenandoahGCHeuristics,           "passive");
  45 
  46   FLAG_SET_DEFAULT(ShenandoahSATBBarrier,            false);
  47   FLAG_SET_DEFAULT(ShenandoahLoadRefBarrier,         false);
  48   FLAG_SET_DEFAULT(ShenandoahKeepAliveBarrier,       false);
  49   FLAG_SET_DEFAULT(ShenandoahStoreValEnqueueBarrier, false);
  50   FLAG_SET_DEFAULT(ShenandoahCASBarrier,             false);
  51   FLAG_SET_DEFAULT(ShenandoahCloneBarrier,           false);
  52 
  53   FLAG_SET_DEFAULT(ShenandoahVerifyOptoBarriers,     false);
  54 #endif
  55 
  56   if (UseLargePages && (MaxHeapSize / os::large_page_size()) < ShenandoahHeapRegion::MIN_NUM_REGIONS) {
  57     warning("Large pages size (" SIZE_FORMAT "K) is too large to afford page-sized regions, disabling uncommit",
  58             os::large_page_size() / K);
  59     FLAG_SET_DEFAULT(ShenandoahUncommit, false);
  60   }
  61 
  62   // Enable NUMA by default. While Shenandoah is not NUMA-aware, enabling NUMA makes
  63   // storage allocation code NUMA-aware, and NUMA interleaving makes the storage
  64   // allocated in consistent manner (interleaving) to minimize run-to-run variance.
  65   if (FLAG_IS_DEFAULT(UseNUMA)) {
  66     FLAG_SET_DEFAULT(UseNUMA, true);
  67     FLAG_SET_DEFAULT(UseNUMAInterleaving, true);
  68   }
  69 
  70   FLAG_SET_DEFAULT(ParallelGCThreads,
  71                    WorkerPolicy::parallel_worker_threads());





  72 
  73   if (FLAG_IS_DEFAULT(ConcGCThreads)) {
  74     uint conc_threads = MAX2((uint) 1, ParallelGCThreads);
  75     FLAG_SET_DEFAULT(ConcGCThreads, conc_threads);

















  76   }
  77 
  78   if (FLAG_IS_DEFAULT(ParallelRefProcEnabled)) {
  79     FLAG_SET_DEFAULT(ParallelRefProcEnabled, true);
  80   }
  81 
  82   if (ShenandoahRegionSampling && FLAG_IS_DEFAULT(PerfDataMemorySize)) {
  83     // When sampling is enabled, max out the PerfData memory to get more
  84     // Shenandoah data in, including Matrix.
  85     FLAG_SET_DEFAULT(PerfDataMemorySize, 2048*K);
  86   }
  87 
  88 #ifdef COMPILER2
  89   // Shenandoah cares more about pause times, rather than raw throughput.
  90   if (FLAG_IS_DEFAULT(UseCountedLoopSafepoints)) {
  91     FLAG_SET_DEFAULT(UseCountedLoopSafepoints, true);
  92     if (FLAG_IS_DEFAULT(LoopStripMiningIter)) {
  93       FLAG_SET_DEFAULT(LoopStripMiningIter, 1000);
  94     }
  95   }


< prev index next >