1 /*
   2  * Copyright (c) 2016, Red Hat, Inc. and/or its affiliates.
   3  *
   4  * This code is free software; you can redistribute it and/or modify it
   5  * under the terms of the GNU General Public License version 2 only, as
   6  * published by the Free Software Foundation.
   7  *
   8  * This code is distributed in the hope that it will be useful, but WITHOUT
   9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP
  25 #define SHARE_VM_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP
  26 
  27 #include "runtime/globals.hpp"
  28 
  29 #define SHENANDOAH_FLAGS(develop, \
  30                          develop_pd, \
  31                          product, \
  32                          product_pd, \
  33                          diagnostic, \
  34                          experimental, \
  35                          notproduct, \
  36                          manageable, \
  37                          product_rw, \
  38                          range, \
  39                          constraint, \
  40                          writeable) \
  41                                                                             \
  42   product(bool, UseShenandoahGC, false,                                     \
  43           "Use the Shenandoah garbage collector")                           \
  44                                                                             \
  45   product(bool, ShenandoahOptimizeFinals, true,                             \
  46           "Optimize barriers on final and stable fields/arrays. "           \
  47           "Turn it off for maximum compatibility with reflection or JNI "   \
  48           "code that manipulates final fields."                             \
  49           "Defaults to true. ")                                             \
  50                                                                             \
  51   product(size_t, ShenandoahHeapRegionSize, 0,                              \
  52           "Size of the Shenandoah regions. "                                \
  53           "Determined automatically by default.")                           \
  54                                                                             \
  55   experimental(size_t, ShenandoahMinRegionSize, 1 * M,                      \
  56           "Minimum heap region size. ")                                     \
  57                                                                             \
  58   experimental(size_t, ShenandoahMaxRegionSize, 32 * M,                     \
  59           "Maximum heap region size. ")                                     \
  60                                                                             \
  61   experimental(size_t, ShenandoahTargetNumRegions, 2048,                    \
  62           "Target number of regions. We try to get around that many "       \
  63           "regions, based on ShenandoahMinRegionSize and "                  \
  64           "ShenandoahMaxRegionSizeSize. ")                                  \
  65                                                                             \
  66   product(bool, UseShenandoahMatrix, false,                                 \
  67           "Keep a connection matrix and use this to drive collection sets") \
  68                                                                             \
  69   product(ccstr, ShenandoahGCHeuristics, "adaptive",                        \
  70           "The heuristics to use in Shenandoah GC. Possible values: "       \
  71           "dynamic, adaptive, aggressive."                                  \
  72           "Defaults to adaptive")                                            \
  73                                                                             \
  74   product(uintx, ShenandoahRefProcFrequency, 5,                             \
  75           "How often should (weak, soft, etc) references be processed. "    \
  76           "References get processed at every Nth GC cycle. "                \
  77           "Set to 0 to disable reference processing. "                      \
  78           "Defaults to process references every 5 cycles.")                 \
  79                                                                             \
  80   product(uintx, ShenandoahUnloadClassesFrequency, 5,                       \
  81           "How often should classes get unloaded. "                         \
  82           "Class unloading is performed at every Nth GC cycle. "            \
  83           "Set to 0 to disable concurrent class unloading. "                \
  84           "Defaults to unload classes every 5 cycles.")                     \
  85                                                                             \
  86   experimental(uintx, ShenandoahFullGCThreshold, 3,                         \
  87           "How many cycles in a row to do degenerated marking on "          \
  88           "cancelled GC before triggering a full-gc"                        \
  89           "Defaults to 3")                                                  \
  90           writeable(Always)                                                 \
  91                                                                             \
  92   product_rw(uintx, ShenandoahGarbageThreshold, 60,                         \
  93           "Sets the percentage of garbage a region need to contain before " \
  94           "it can be marked for collection. Applies to "                    \
  95           "Shenandoah GC dynamic Heuristic mode only (ignored otherwise). " \
  96           "Defaults to 60%.")                                               \
  97           range(0,100)                                                      \
  98                                                                             \
  99   product_rw(uintx, ShenandoahFreeThreshold, 10,                            \
 100           "Set the percentage of free heap at which a GC cycle is started. " \
 101           "Applies to Shenandoah GC dynamic Heuristic mode only "           \
 102           "(ignored otherwise). Defaults to 10%.")                          \
 103           range(0,100)                                                      \
 104                                                                             \
 105   product_rw(uintx, ShenandoahCSetThreshold, 40,                            \
 106           "Set the approximate target percentage of the heap for the"       \
 107           "collection set. Defaults to 40%.")                               \
 108           range(0,100)                                                      \
 109                                                                             \
 110   product_rw(uintx, ShenandoahAllocationThreshold, 0,                       \
 111           "Set percentage of memory allocated since last GC cycle before "  \
 112           "a new GC cycle is started. "                                     \
 113           "Applies to Shenandoah GC dynamic Heuristic mode only "           \
 114           "(ignored otherwise). Defauls to 0%.")                            \
 115           range(0,100)                                                      \
 116                                                                             \
 117   experimental(uintx, ShenandoahInitFreeThreshold, 10,                      \
 118                "Initial remaininig free threshold for adaptive heuristics") \
 119           range(0,100)                                                      \
 120                                                                             \
 121   experimental(uintx, ShenandoahMinFreeThreshold, 3,                       \
 122                "Minimum remaininig free threshold for adaptive heuristics") \
 123           range(0,100)                                                      \
 124                                                                             \
 125   experimental(uintx, ShenandoahMaxFreeThreshold, 70,                       \
 126                "Maximum remaininig free threshold for adaptive heuristics") \
 127           range(0,100)                                                      \
 128                                                                             \
 129   experimental(uintx, ShenandoahHappyCyclesThreshold, 5,                    \
 130           "How many successful marking cycles before improving free "       \
 131                "threshold for adaptive heuristics")                    \
 132                                                                             \
 133   experimental(uint, ShenandoahMarkLoopStride, 1000,                        \
 134           "How many items are processed during one marking step")           \
 135                                                                             \
 136   experimental(bool, ShenandoahConcurrentCodeRoots, true,                   \
 137           "Scan code roots concurrently, instead of during a pause")        \
 138                                                                             \
 139   experimental(bool, ShenandoahNoBarriersForConst, true,                    \
 140           "Constant oops don't need barriers")                              \
 141                                                                             \
 142   experimental(bool, ShenandoahDontIncreaseWBFreq, true,                    \
 143           "Common 2 WriteBarriers or WriteBarrier and a ReadBarrier only "  \
 144           "if the resulting WriteBarrier isn't executed more frequently")   \
 145                                                                             \
 146   experimental(bool, ShenandoahNoLivenessFullGC, true,                      \
 147           "Skip liveness counting for mark during full GC.")                \
 148                                                                             \
 149   experimental(bool, ShenandoahWriteBarrierToIR, true,                      \
 150           "Convert write barrier to IR instead of using assembly blob")     \
 151                                                                             \
 152   experimental(bool, ShenandoahWriteBarrierCsetTestInIR, true,              \
 153           "Perform cset test in IR rather than in the stub")                \
 154                                                                             \
 155   experimental(bool, ShenandoahLoopOptsAfterExpansion, true,                \
 156           "Attempt more loop opts after write barrier expansion")           \
 157                                                                             \
 158   experimental(bool, UseShenandoahOWST, true,                               \
 159           "Use Shenandoah work stealing termination protocol")              \
 160                                                                             \
 161   experimental(size_t, ShenandoahSATBBufferSize, 1 * K,                     \
 162           "Number of entries in an SATB log buffer.")                       \
 163           range(1, max_uintx)                                               \
 164                                                                             \
 165   experimental(int, ShenandoahRegionSamplingRate, 40,                       \
 166           "Sampling rate for heap region sampling. "                        \
 167           "Number of milliseconds between samples")                         \
 168            writeable(Always)                                                \
 169                                                                             \
 170   experimental(bool, ShenandoahRegionSampling, false,                       \
 171           "Turns on heap region sampling via JVMStat")                      \
 172            writeable(Always)                                                \
 173                                                                             \
 174   experimental(bool, ShenandoahReduceStoreValBarrier, false,                \
 175           "If true, only execute storeval barrier when updating "           \
 176           "references.")                                                    \
 177                                                                             \
 178   diagnostic(bool, ShenandoahWriteBarrier, true,                            \
 179           "Turn on/off write barriers in Shenandoah")                       \
 180                                                                             \
 181   diagnostic(bool, ShenandoahReadBarrier, true,                             \
 182           "Turn on/off read barriers in Shenandoah")                        \
 183                                                                             \
 184   diagnostic(bool, ShenandoahCASBarrier, true,                              \
 185           "Turn on/off CAS barriers in Shenandoah")                         \
 186                                                                             \
 187   diagnostic(bool, ShenandoahAcmpBarrier, true,                             \
 188           "Turn on/off acmp barriers in Shenandoah")                        \
 189                                                                             \
 190   diagnostic(bool, ShenandoahCloneBarrier, true,                            \
 191           "Turn on/off clone barriers in Shenandoah")                       \
 192                                                                             \
 193   diagnostic(bool, ShenandoahStoreCheck, false,                             \
 194           "Emit additional code that checks objects are written to only"    \
 195           " in to-space")                                                   \
 196                                                                             \
 197   develop(bool, ShenandoahDumpHeapBeforeConcurrentMark, false,              \
 198           "Dump the ShenanodahHeap Before Each ConcurrentMark")             \
 199                                                                             \
 200   develop(bool, ShenandoahDumpHeapAfterConcurrentMark, false,               \
 201           "Dump the ShenanodahHeap After Each Concurrent Mark")             \
 202                                                                             \
 203   develop(bool, ShenandoahVerifyWritesToFromSpace, false,                   \
 204           "Use Memory Protection to signal illegal writes to from space")   \
 205                                                                             \
 206   develop(bool, ShenandoahVerifyReadsToFromSpace, false,                    \
 207           "Use Memory Protection to signal illegal reads to from space")    \
 208                                                                             \
 209   develop(bool, ShenandoahVerify, false,                                    \
 210           "Verify the  Shenandoah garbage collector")                       \
 211                                                                             \
 212   develop(bool, VerifyStrictOopOperations, false,                           \
 213           "Verify that == and != are not used on oops. Only in fastdebug")  \
 214                                                                             \
 215   develop(bool, ShenandoahVerifyOptoBarriers, false,                        \
 216           "Verify no missing barriers in c2")                               \
 217                                                                             \
 218   product(bool, ShenandoahAlwaysPreTouch, false,                            \
 219           "Pre-touch heap memory, overrides global AlwaysPreTouch")         \
 220                                                                             \
 221   experimental(intx, ShenandoahMarkScanPrefetch, 32,                        \
 222           "How many objects to prefetch ahead when traversing mark bitmaps." \
 223           "Set to 0 to disable prefetching.")                               \
 224           range(0, 1024)                                                    \
 225                                                                             \
 226   experimental(intx, ShenandoahFullGCTries, 3,                              \
 227           "How many times to try to do Full GC on allocation failure."      \
 228           "Set to 0 to never try, and fail instead.")                       \
 229           range(0, 16)                                                      \
 230 
 231 
 232 SHENANDOAH_FLAGS(DECLARE_DEVELOPER_FLAG, \
 233                  DECLARE_PD_DEVELOPER_FLAG,     \
 234                  DECLARE_PRODUCT_FLAG,          \
 235                  DECLARE_PD_PRODUCT_FLAG,       \
 236                  DECLARE_DIAGNOSTIC_FLAG,       \
 237                  DECLARE_EXPERIMENTAL_FLAG,     \
 238                  DECLARE_NOTPRODUCT_FLAG,       \
 239                  DECLARE_MANAGEABLE_FLAG,       \
 240                  DECLARE_PRODUCT_RW_FLAG,       \
 241                  IGNORE_RANGE,                  \
 242                  IGNORE_CONSTRAINT, \
 243                  IGNORE_WRITEABLE)
 244 
 245 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP