< prev index next >

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

Print this page
rev 54386 : 8221766: Load-reference barriers for Shenandoah


  29 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
  30 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
  31 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
  32 #include "gc/shenandoah/shenandoahTaskqueue.hpp"
  33 #include "utilities/defaultStream.hpp"
  34 
  35 void ShenandoahArguments::initialize() {
  36 #if !(defined AARCH64 || defined AMD64 || defined IA32)
  37   vm_exit_during_initialization("Shenandoah GC is not supported on this platform.");
  38 #endif
  39 
  40 #ifdef IA32
  41   log_warning(gc)("Shenandoah GC is not fully supported on this platform:");
  42   log_warning(gc)("  concurrent modes are not supported, only STW cycles are enabled;");
  43   log_warning(gc)("  arch-specific barrier code is not implemented, disabling barriers;");
  44 
  45   FLAG_SET_DEFAULT(ShenandoahGCHeuristics,           "passive");
  46 
  47   FLAG_SET_DEFAULT(ShenandoahSATBBarrier,            false);
  48   FLAG_SET_DEFAULT(ShenandoahKeepAliveBarrier,       false);
  49   FLAG_SET_DEFAULT(ShenandoahWriteBarrier,           false);
  50   FLAG_SET_DEFAULT(ShenandoahReadBarrier,            false);
  51   FLAG_SET_DEFAULT(ShenandoahStoreValEnqueueBarrier, false);
  52   FLAG_SET_DEFAULT(ShenandoahStoreValReadBarrier,    false);
  53   FLAG_SET_DEFAULT(ShenandoahCASBarrier,             false);
  54   FLAG_SET_DEFAULT(ShenandoahAcmpBarrier,            false);
  55   FLAG_SET_DEFAULT(ShenandoahCloneBarrier,           false);
  56 #endif
  57 
  58 #ifdef _LP64
  59   // The optimized ObjArrayChunkedTask takes some bits away from the full 64 addressable
  60   // bits, fail if we ever attempt to address more than we can. Only valid on 64bit.
  61   if (MaxHeapSize >= ObjArrayChunkedTask::max_addressable()) {
  62     jio_fprintf(defaultStream::error_stream(),
  63                 "Shenandoah GC cannot address more than " SIZE_FORMAT " bytes, and " SIZE_FORMAT " bytes heap requested.",
  64                 ObjArrayChunkedTask::max_addressable(), MaxHeapSize);
  65     vm_exit(1);
  66   }
  67 #endif
  68 
  69   if (UseLargePages && (MaxHeapSize / os::large_page_size()) < ShenandoahHeapRegion::MIN_NUM_REGIONS) {
  70     warning("Large pages size (" SIZE_FORMAT "K) is too large to afford page-sized regions, disabling uncommit",
  71             os::large_page_size() / K);
  72     FLAG_SET_DEFAULT(ShenandoahUncommit, false);
  73   }
  74 


  94 
  95   if (ShenandoahRegionSampling && FLAG_IS_DEFAULT(PerfDataMemorySize)) {
  96     // When sampling is enabled, max out the PerfData memory to get more
  97     // Shenandoah data in, including Matrix.
  98     FLAG_SET_DEFAULT(PerfDataMemorySize, 2048*K);
  99   }
 100 
 101 #ifdef COMPILER2
 102   // Shenandoah cares more about pause times, rather than raw throughput.
 103   if (FLAG_IS_DEFAULT(UseCountedLoopSafepoints)) {
 104     FLAG_SET_DEFAULT(UseCountedLoopSafepoints, true);
 105     if (FLAG_IS_DEFAULT(LoopStripMiningIter)) {
 106       FLAG_SET_DEFAULT(LoopStripMiningIter, 1000);
 107     }
 108   }
 109 #ifdef ASSERT
 110   // C2 barrier verification is only reliable when all default barriers are enabled
 111   if (ShenandoahVerifyOptoBarriers &&
 112           (!FLAG_IS_DEFAULT(ShenandoahSATBBarrier)            ||
 113            !FLAG_IS_DEFAULT(ShenandoahKeepAliveBarrier)       ||
 114            !FLAG_IS_DEFAULT(ShenandoahWriteBarrier)           ||
 115            !FLAG_IS_DEFAULT(ShenandoahReadBarrier)            ||
 116            !FLAG_IS_DEFAULT(ShenandoahStoreValEnqueueBarrier) ||
 117            !FLAG_IS_DEFAULT(ShenandoahStoreValReadBarrier)    ||
 118            !FLAG_IS_DEFAULT(ShenandoahCASBarrier)             ||
 119            !FLAG_IS_DEFAULT(ShenandoahAcmpBarrier)            ||
 120            !FLAG_IS_DEFAULT(ShenandoahCloneBarrier)
 121           )) {
 122     warning("Unusual barrier configuration, disabling C2 barrier verification");
 123     FLAG_SET_DEFAULT(ShenandoahVerifyOptoBarriers, false);
 124   }
 125 #else
 126   guarantee(!ShenandoahVerifyOptoBarriers, "Should be disabled");
 127 #endif // ASSERT
 128 #endif // COMPILER2
 129 
 130   if (AlwaysPreTouch) {
 131     // Shenandoah handles pre-touch on its own. It does not let the
 132     // generic storage code to do the pre-touch before Shenandoah has
 133     // a chance to do it on its own.
 134     FLAG_SET_DEFAULT(AlwaysPreTouch, false);
 135     FLAG_SET_DEFAULT(ShenandoahAlwaysPreTouch, true);
 136   }
 137 
 138   // Record more information about previous cycles for improved debugging pleasure
 139   if (FLAG_IS_DEFAULT(LogEventsBufferEntries)) {


 146     }
 147     FLAG_SET_DEFAULT(ShenandoahUncommit, false);
 148   }
 149 
 150   // If class unloading is disabled, no unloading for concurrent cycles as well.
 151   // If class unloading is enabled, users should opt-in for unloading during
 152   // concurrent cycles.
 153   if (!ClassUnloading || !FLAG_IS_CMDLINE(ClassUnloadingWithConcurrentMark)) {
 154     log_info(gc)("Consider -XX:+ClassUnloadingWithConcurrentMark if large pause times "
 155                  "are observed on class-unloading sensitive workloads");
 156     FLAG_SET_DEFAULT(ClassUnloadingWithConcurrentMark, false);
 157   }
 158 
 159   // AOT is not supported yet
 160   if (UseAOT) {
 161     if (!FLAG_IS_DEFAULT(UseAOT)) {
 162       warning("Shenandoah does not support AOT at this moment, disabling UseAOT");
 163     }
 164     FLAG_SET_DEFAULT(UseAOT, false);
 165   }
 166 
 167   // JNI fast get field stuff is not currently supported by Shenandoah.
 168   // It would introduce another heap memory access for reading the forwarding
 169   // pointer, which would have to be guarded by the signal handler machinery.
 170   // See:
 171   // http://mail.openjdk.java.net/pipermail/hotspot-dev/2018-June/032763.html
 172   FLAG_SET_DEFAULT(UseFastJNIAccessors, false);
 173 
 174   // TLAB sizing policy makes resizing decisions before each GC cycle. It averages
 175   // historical data, assigning more recent data the weight according to TLABAllocationWeight.
 176   // Current default is good for generational collectors that run frequent young GCs.
 177   // With Shenandoah, GC cycles are much less frequent, so we need we need sizing policy
 178   // to converge faster over smaller number of resizing decisions.
 179   if (FLAG_IS_DEFAULT(TLABAllocationWeight)) {
 180     FLAG_SET_DEFAULT(TLABAllocationWeight, 90);
 181   }
 182 
 183   // Shenandoah needs more C2 nodes to compile some methods with lots of barriers.
 184   // NodeLimitFudgeFactor needs to stay the same relative to MaxNodeLimit.
 185 #ifdef COMPILER2
 186   if (FLAG_IS_DEFAULT(MaxNodeLimit)) {
 187     FLAG_SET_DEFAULT(MaxNodeLimit, MaxNodeLimit * 3);
 188     FLAG_SET_DEFAULT(NodeLimitFudgeFactor, NodeLimitFudgeFactor * 3);
 189   }
 190 #endif
 191 
 192   // Make sure safepoint deadlocks are failing predictably. This sets up VM to report




  29 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
  30 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
  31 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
  32 #include "gc/shenandoah/shenandoahTaskqueue.hpp"
  33 #include "utilities/defaultStream.hpp"
  34 
  35 void ShenandoahArguments::initialize() {
  36 #if !(defined AARCH64 || defined AMD64 || defined IA32)
  37   vm_exit_during_initialization("Shenandoah GC is not supported on this platform.");
  38 #endif
  39 
  40 #ifdef IA32
  41   log_warning(gc)("Shenandoah GC is not fully supported on this platform:");
  42   log_warning(gc)("  concurrent modes are not supported, only STW cycles are enabled;");
  43   log_warning(gc)("  arch-specific barrier code is not implemented, disabling barriers;");
  44 
  45   FLAG_SET_DEFAULT(ShenandoahGCHeuristics,           "passive");
  46 
  47   FLAG_SET_DEFAULT(ShenandoahSATBBarrier,            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 #endif
  53 
  54 #ifdef _LP64
  55   // The optimized ObjArrayChunkedTask takes some bits away from the full 64 addressable
  56   // bits, fail if we ever attempt to address more than we can. Only valid on 64bit.
  57   if (MaxHeapSize >= ObjArrayChunkedTask::max_addressable()) {
  58     jio_fprintf(defaultStream::error_stream(),
  59                 "Shenandoah GC cannot address more than " SIZE_FORMAT " bytes, and " SIZE_FORMAT " bytes heap requested.",
  60                 ObjArrayChunkedTask::max_addressable(), MaxHeapSize);
  61     vm_exit(1);
  62   }
  63 #endif
  64 
  65   if (UseLargePages && (MaxHeapSize / os::large_page_size()) < ShenandoahHeapRegion::MIN_NUM_REGIONS) {
  66     warning("Large pages size (" SIZE_FORMAT "K) is too large to afford page-sized regions, disabling uncommit",
  67             os::large_page_size() / K);
  68     FLAG_SET_DEFAULT(ShenandoahUncommit, false);
  69   }
  70 


  90 
  91   if (ShenandoahRegionSampling && FLAG_IS_DEFAULT(PerfDataMemorySize)) {
  92     // When sampling is enabled, max out the PerfData memory to get more
  93     // Shenandoah data in, including Matrix.
  94     FLAG_SET_DEFAULT(PerfDataMemorySize, 2048*K);
  95   }
  96 
  97 #ifdef COMPILER2
  98   // Shenandoah cares more about pause times, rather than raw throughput.
  99   if (FLAG_IS_DEFAULT(UseCountedLoopSafepoints)) {
 100     FLAG_SET_DEFAULT(UseCountedLoopSafepoints, true);
 101     if (FLAG_IS_DEFAULT(LoopStripMiningIter)) {
 102       FLAG_SET_DEFAULT(LoopStripMiningIter, 1000);
 103     }
 104   }
 105 #ifdef ASSERT
 106   // C2 barrier verification is only reliable when all default barriers are enabled
 107   if (ShenandoahVerifyOptoBarriers &&
 108           (!FLAG_IS_DEFAULT(ShenandoahSATBBarrier)            ||
 109            !FLAG_IS_DEFAULT(ShenandoahKeepAliveBarrier)       ||


 110            !FLAG_IS_DEFAULT(ShenandoahStoreValEnqueueBarrier) ||

 111            !FLAG_IS_DEFAULT(ShenandoahCASBarrier)             ||

 112            !FLAG_IS_DEFAULT(ShenandoahCloneBarrier)
 113           )) {
 114     warning("Unusual barrier configuration, disabling C2 barrier verification");
 115     FLAG_SET_DEFAULT(ShenandoahVerifyOptoBarriers, false);
 116   }
 117 #else
 118   guarantee(!ShenandoahVerifyOptoBarriers, "Should be disabled");
 119 #endif // ASSERT
 120 #endif // COMPILER2
 121 
 122   if (AlwaysPreTouch) {
 123     // Shenandoah handles pre-touch on its own. It does not let the
 124     // generic storage code to do the pre-touch before Shenandoah has
 125     // a chance to do it on its own.
 126     FLAG_SET_DEFAULT(AlwaysPreTouch, false);
 127     FLAG_SET_DEFAULT(ShenandoahAlwaysPreTouch, true);
 128   }
 129 
 130   // Record more information about previous cycles for improved debugging pleasure
 131   if (FLAG_IS_DEFAULT(LogEventsBufferEntries)) {


 138     }
 139     FLAG_SET_DEFAULT(ShenandoahUncommit, false);
 140   }
 141 
 142   // If class unloading is disabled, no unloading for concurrent cycles as well.
 143   // If class unloading is enabled, users should opt-in for unloading during
 144   // concurrent cycles.
 145   if (!ClassUnloading || !FLAG_IS_CMDLINE(ClassUnloadingWithConcurrentMark)) {
 146     log_info(gc)("Consider -XX:+ClassUnloadingWithConcurrentMark if large pause times "
 147                  "are observed on class-unloading sensitive workloads");
 148     FLAG_SET_DEFAULT(ClassUnloadingWithConcurrentMark, false);
 149   }
 150 
 151   // AOT is not supported yet
 152   if (UseAOT) {
 153     if (!FLAG_IS_DEFAULT(UseAOT)) {
 154       warning("Shenandoah does not support AOT at this moment, disabling UseAOT");
 155     }
 156     FLAG_SET_DEFAULT(UseAOT, false);
 157   }







 158 
 159   // TLAB sizing policy makes resizing decisions before each GC cycle. It averages
 160   // historical data, assigning more recent data the weight according to TLABAllocationWeight.
 161   // Current default is good for generational collectors that run frequent young GCs.
 162   // With Shenandoah, GC cycles are much less frequent, so we need we need sizing policy
 163   // to converge faster over smaller number of resizing decisions.
 164   if (FLAG_IS_DEFAULT(TLABAllocationWeight)) {
 165     FLAG_SET_DEFAULT(TLABAllocationWeight, 90);
 166   }
 167 
 168   // Shenandoah needs more C2 nodes to compile some methods with lots of barriers.
 169   // NodeLimitFudgeFactor needs to stay the same relative to MaxNodeLimit.
 170 #ifdef COMPILER2
 171   if (FLAG_IS_DEFAULT(MaxNodeLimit)) {
 172     FLAG_SET_DEFAULT(MaxNodeLimit, MaxNodeLimit * 3);
 173     FLAG_SET_DEFAULT(NodeLimitFudgeFactor, NodeLimitFudgeFactor * 3);
 174   }
 175 #endif
 176 
 177   // Make sure safepoint deadlocks are failing predictably. This sets up VM to report


< prev index next >