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, 256 * K,                    \
  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(bool, PrintShenandoahMatrix, false,                               \
  70           "Print connection matrix after marking")                          \
  71                                                                             \
  72   product(bool, VerifyShenandoahMatrix, false,                              \
  73           "Verify connection matrix after marking")                         \
  74                                                                             \
  75   product(ccstr, ShenandoahGCHeuristics, "adaptive",                        \
  76           "The heuristics to use in Shenandoah GC. Possible values: "       \
  77           "dynamic, adaptive, aggressive."                                  \
  78           "Defaults to adaptive")                                            \
  79                                                                             \
  80   product(uintx, ShenandoahRefProcFrequency, 5,                             \
  81           "How often should (weak, soft, etc) references be processed. "    \
  82           "References get processed at every Nth GC cycle. "                \
  83           "Set to 0 to disable reference processing. "                      \
  84           "Defaults to process references every 5 cycles.")                 \
  85                                                                             \
  86   product(uintx, ShenandoahUnloadClassesFrequency, 5,                       \
  87           "How often should classes get unloaded. "                         \
  88           "Class unloading is performed at every Nth GC cycle. "            \
  89           "Set to 0 to disable concurrent class unloading. "                \
  90           "Defaults to unload classes every 5 cycles.")                     \
  91                                                                             \
  92   experimental(uintx, ShenandoahFullGCThreshold, 3,                         \
  93           "How many cycles in a row to do degenerated marking on "          \
  94           "cancelled GC before triggering a full-gc"                        \
  95           "Defaults to 3")                                                  \
  96           writeable(Always)                                                 \
  97                                                                             \
  98   product_rw(uintx, ShenandoahGarbageThreshold, 60,                         \
  99           "Sets the percentage of garbage a region need to contain before " \
 100           "it can be marked for collection. Applies to "                    \
 101           "Shenandoah GC dynamic Heuristic mode only (ignored otherwise). " \
 102           "Defaults to 60%.")                                               \
 103           range(0,100)                                                      \
 104                                                                             \
 105   product_rw(uintx, ShenandoahFreeThreshold, 10,                            \
 106           "Set the percentage of free heap at which a GC cycle is started. " \
 107           "Applies to Shenandoah GC dynamic Heuristic mode only "           \
 108           "(ignored otherwise). Defaults to 10%.")                          \
 109           range(0,100)                                                      \
 110                                                                             \
 111   product_rw(uintx, ShenandoahCSetThreshold, 40,                            \
 112           "Set the approximate target percentage of the heap for the"       \
 113           "collection set. Defaults to 40%.")                               \
 114           range(0,100)                                                      \
 115                                                                             \
 116   product_rw(uintx, ShenandoahAllocationThreshold, 0,                       \
 117           "Set percentage of memory allocated since last GC cycle before "  \
 118           "a new GC cycle is started. "                                     \
 119           "Applies to Shenandoah GC dynamic Heuristic mode only "           \
 120           "(ignored otherwise). Defauls to 0%.")                            \
 121           range(0,100)                                                      \
 122                                                                             \
 123   experimental(uintx, ShenandoahInitFreeThreshold, 10,                      \
 124                "Initial remaininig free threshold for adaptive heuristics") \
 125           range(0,100)                                                      \
 126                                                                             \
 127   experimental(uintx, ShenandoahMinFreeThreshold, 3,                       \
 128                "Minimum remaininig free threshold for adaptive heuristics") \
 129           range(0,100)                                                      \
 130                                                                             \
 131   experimental(uintx, ShenandoahMaxFreeThreshold, 70,                       \
 132                "Maximum remaininig free threshold for adaptive heuristics") \
 133           range(0,100)                                                      \
 134                                                                             \
 135   experimental(uintx, ShenandoahHappyCyclesThreshold, 5,                    \
 136           "How many successful marking cycles before improving free "       \
 137                "threshold for adaptive heuristics")                    \
 138                                                                             \
 139   experimental(uint, ShenandoahMarkLoopStride, 1000,                        \
 140           "How many items are processed during one marking step")           \
 141                                                                             \
 142   experimental(bool, ShenandoahConcurrentCodeRoots, true,                   \
 143           "Scan code roots concurrently, instead of during a pause")        \
 144                                                                             \
 145   experimental(bool, ShenandoahNoBarriersForConst, true,                    \
 146           "Constant oops don't need barriers")                              \
 147                                                                             \
 148   experimental(bool, ShenandoahDontIncreaseWBFreq, true,                    \
 149           "Common 2 WriteBarriers or WriteBarrier and a ReadBarrier only "  \
 150           "if the resulting WriteBarrier isn't executed more frequently")   \
 151                                                                             \
 152   experimental(bool, ShenandoahNoLivenessFullGC, true,                      \
 153           "Skip liveness counting for mark during full GC.")                \
 154                                                                             \
 155   experimental(bool, ShenandoahWriteBarrierToIR, true,                      \
 156           "Convert write barrier to IR instead of using assembly blob")     \
 157                                                                             \
 158   experimental(bool, ShenandoahWriteBarrierCsetTestInIR, true,              \
 159           "Perform cset test in IR rather than in the stub")                \
 160                                                                             \
 161   experimental(bool, ShenandoahLoopOptsAfterExpansion, true,                \
 162           "Attempt more loop opts after write barrier expansion")           \
 163                                                                             \
 164   experimental(bool, UseShenandoahOWST, true,                               \
 165           "Use Shenandoah work stealing termination protocol")              \
 166                                                                             \
 167   experimental(size_t, ShenandoahSATBBufferSize, 1 * K,                     \
 168           "Number of entries in an SATB log buffer.")                       \
 169           range(1, max_uintx)                                               \
 170                                                                             \
 171   experimental(int, ShenandoahRegionSamplingRate, 40,                       \
 172           "Sampling rate for heap region sampling. "                        \
 173           "Number of milliseconds between samples")                         \
 174            writeable(Always)                                                \
 175                                                                             \
 176   experimental(bool, ShenandoahRegionSampling, false,                       \
 177           "Turns on heap region sampling via JVMStat")                      \
 178            writeable(Always)                                                \
 179                                                                             \
 180   experimental(bool, ShenandoahReduceStoreValBarrier, false,                \
 181           "If true, only execute storeval barrier when updating "           \
 182           "references.")                                                    \
 183                                                                             \
 184   diagnostic(bool, ShenandoahWriteBarrier, true,                            \
 185           "Turn on/off write barriers in Shenandoah")                       \
 186                                                                             \
 187   diagnostic(bool, ShenandoahReadBarrier, true,                             \
 188           "Turn on/off read barriers in Shenandoah")                        \
 189                                                                             \
 190   diagnostic(bool, ShenandoahCASBarrier, true,                              \
 191           "Turn on/off CAS barriers in Shenandoah")                         \
 192                                                                             \
 193   diagnostic(bool, ShenandoahAcmpBarrier, true,                             \
 194           "Turn on/off acmp barriers in Shenandoah")                        \
 195                                                                             \
 196   diagnostic(bool, ShenandoahCloneBarrier, true,                            \
 197           "Turn on/off clone barriers in Shenandoah")                       \
 198                                                                             \
 199   diagnostic(bool, ShenandoahStoreCheck, false,                             \
 200           "Emit additional code that checks objects are written to only"    \
 201           " in to-space")                                                   \
 202                                                                             \
 203   develop(bool, ShenandoahDumpHeapBeforeConcurrentMark, false,              \
 204           "Dump the ShenanodahHeap Before Each ConcurrentMark")             \
 205                                                                             \
 206   develop(bool, ShenandoahDumpHeapAfterConcurrentMark, false,               \
 207           "Dump the ShenanodahHeap After Each Concurrent Mark")             \
 208                                                                             \
 209   develop(bool, ShenandoahVerifyWritesToFromSpace, false,                   \
 210           "Use Memory Protection to signal illegal writes to from space")   \
 211                                                                             \
 212   develop(bool, ShenandoahVerifyReadsToFromSpace, false,                    \
 213           "Use Memory Protection to signal illegal reads to from space")    \
 214                                                                             \
 215   develop(bool, ShenandoahVerify, false,                                    \
 216           "Verify the  Shenandoah garbage collector")                       \
 217                                                                             \
 218   develop(bool, VerifyStrictOopOperations, false,                           \
 219           "Verify that == and != are not used on oops. Only in fastdebug")  \
 220                                                                             \
 221   develop(bool, ShenandoahVerifyOptoBarriers, false,                        \
 222           "Verify no missing barriers in c2")                               \
 223                                                                             \
 224   product(bool, ShenandoahAlwaysPreTouch, false,                            \
 225           "Pre-touch heap memory, overrides global AlwaysPreTouch")         \
 226                                                                             \
 227   experimental(intx, ShenandoahMarkScanPrefetch, 32,                        \
 228           "How many objects to prefetch ahead when traversing mark bitmaps." \
 229           "Set to 0 to disable prefetching.")                               \
 230           range(0, 1024)                                                    \
 231                                                                             \
 232   experimental(intx, ShenandoahFullGCTries, 3,                              \
 233           "How many times to try to do Full GC on allocation failure."      \
 234           "Set to 0 to never try, and fail instead.")                       \
 235           range(0, 16)                                                      \
 236 
 237 
 238 SHENANDOAH_FLAGS(DECLARE_DEVELOPER_FLAG, \
 239                  DECLARE_PD_DEVELOPER_FLAG,     \
 240                  DECLARE_PRODUCT_FLAG,          \
 241                  DECLARE_PD_PRODUCT_FLAG,       \
 242                  DECLARE_DIAGNOSTIC_FLAG,       \
 243                  DECLARE_EXPERIMENTAL_FLAG,     \
 244                  DECLARE_NOTPRODUCT_FLAG,       \
 245                  DECLARE_MANAGEABLE_FLAG,       \
 246                  DECLARE_PRODUCT_RW_FLAG,       \
 247                  IGNORE_RANGE,                  \
 248                  IGNORE_CONSTRAINT, \
 249                  IGNORE_WRITEABLE)
 250 
 251 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP