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(uintx, ShenandoahHeapRegionSize, 0,                               \
  52           "Size of the Shenandoah regions. "                                \
  53           "Determined automatically by default.")                           \
  54                                                                             \
  55   product(ccstr, ShenandoahGCHeuristics, "dynamic",                         \
  56           "The heuristics to use in Shenandoah GC. Possible values: "       \
  57           "dynamic, adaptive, aggressive."                                  \
  58           "Defauls to dynamic")                                             \
  59                                                                             \
  60   product(uintx, ShenandoahAllocReserveRegions, 10,                         \
  61           "How many regions should be kept as allocation reserve, before "  \
  62           "Shenandoah attempts to grow the heap. Defaults to 10.")          \
  63                                                                             \
  64   product(uintx, ShenandoahRefProcFrequency, 5,                             \
  65           "How often should (weak, soft, etc) references be processed. "    \
  66           "References get processed at every Nth GC cycle. "                \
  67           "Set to 0 to disable reference processing. "                      \
  68           "Defaults to process references every 5 cycles.")                 \
  69                                                                             \
  70   product(uintx, ShenandoahUnloadClassesFrequency, 5,                       \
  71           "How often should classes get unloaded. "                         \
  72           "Class unloading is performed at every Nth GC cycle. "            \
  73           "Set to 0 to disable concurrent class unloading. "                \
  74           "Defaults to unload classes every 5 cycles.")                     \
  75                                                                             \
  76   product_rw(uintx, ShenandoahGarbageThreshold, 60,                         \
  77           "Sets the percentage of garbage a region need to contain before " \
  78           "it can be marked for collection. Applies to "                    \
  79           "Shenandoah GC dynamic Heuristic mode only (ignored otherwise). " \
  80           "Defaults to 60%.")                                               \
  81           range(0,100)                                                      \
  82                                                                             \
  83   product_rw(uintx, ShenandoahFreeThreshold, 25,                            \
  84           "Set the percentage of free heap at which a GC cycle is started. " \
  85           "Applies to Shenandoah GC dynamic Heuristic mode only "           \
  86           "(ignored otherwise). Defaults to 25%.")                          \
  87           range(0,100)                                                      \
  88                                                                             \
  89   product_rw(uintx, ShenandoahInitialFreeThreshold, 50,                     \
  90           "Set the percentage of free heap at which an initial GC cycle "   \
  91           "is started. An initial GC cycle is the first one after VM "      \
  92           "start or after a full GC."                                       \
  93           "Applies to Shenandoah GC dynamic Heuristic mode only "           \
  94           "(ignored otherwise). Defaults to 50%.")                          \
  95           range(0,100)                                                      \
  96                                                                             \
  97   product_rw(uintx, ShenandoahAllocationThreshold, 0,                       \
  98           "Set percentage of memory allocated since last GC cycle before "  \
  99           "a new GC cycle is started. "                                     \
 100           "Applies to Shenandoah GC dynamic Heuristic mode only "           \
 101           "(ignored otherwise). Defauls to 0%.")                            \
 102           range(0,100)                                                      \
 103                                                                             \
 104   experimental(bool, ShenandoahConcurrentCodeRoots, false,                  \
 105           "Scan code roots concurrently, instead of during a pause")        \
 106                                                                             \
 107   experimental(bool, ShenandoahNoBarriersForConst, true,                    \
 108           "Constant oops don't need barriers")                              \
 109                                                                             \
 110   experimental(bool, ShenandoahDontIncreaseWBFreq, true,                    \
 111           "Common 2 WriteBarriers or WriteBarrier and a ReadBarrier only "  \
 112           "if the resulting WriteBarrier isn't executed more frequently")   \
 113                                                                             \
 114   experimental(bool, ShenandoahNoLivenessFullGC, true,                      \
 115           "Skip liveness counting for mark during full GC.")                \
 116                                                                             \
 117   experimental(bool, ShenandoahWriteBarrierToIR, true,                      \
 118           "Convert write barrier to IR instead of using assembly blob")     \
 119                                                                             \
 120   experimental(bool, UseShenandoahOWST, false,                              \
 121           "Use ShenandoahTaskTerminator")                                   \
 122                                                                             \
 123   diagnostic(bool, ShenandoahWriteBarrier, true,                            \
 124           "Turn on/off write barriers in Shenandoah")                       \
 125                                                                             \
 126   diagnostic(bool, ShenandoahReadBarrier, true,                             \
 127           "Turn on/off read barriers in Shenandoah")                        \
 128                                                                             \
 129   diagnostic(bool, ShenandoahStoreCheck, false,                             \
 130           "Emit additional code that checks objects are written to only"    \
 131           " in to-space")                                                   \
 132                                                                             \
 133   develop(bool, ShenandoahDumpHeapBeforeConcurrentMark, false,              \
 134           "Dump the ShenanodahHeap Before Each ConcurrentMark")             \
 135                                                                             \
 136   develop(bool, ShenandoahDumpHeapAfterConcurrentMark, false,               \
 137           "Dump the ShenanodahHeap After Each Concurrent Mark")             \
 138                                                                             \
 139   develop(bool, ShenandoahVerifyWritesToFromSpace, false,                   \
 140           "Use Memory Protection to signal illegal writes to from space")   \
 141                                                                             \
 142   develop(bool, ShenandoahVerifyReadsToFromSpace, false,                    \
 143           "Use Memory Protection to signal illegal reads to from space")    \
 144                                                                             \
 145   develop(bool, ShenandoahVerify, false,                                    \
 146           "Verify the  Shenandoah garbage collector")                       \
 147                                                                             \
 148   develop(bool, VerifyStrictOopOperations, false,                           \
 149           "Verify that == and != are not used on oops. Only in fastdebug")  \
 150                                                                             \
 151   develop(bool, ShenandoahVerifyOptoBarriers, false,                        \
 152           "Verify no missing barriers in c2")                               \
 153                                                                             \
 154   product(bool, ShenandoahAlwaysPreTouch, false,                            \
 155           "Pre-touch heap memory, overrides global AlwaysPreTouch")         \
 156                                                                             \
 157   experimental(intx, ShenandoahMarkScanPrefetch, 32,                        \
 158           "How many objects to prefetch ahead when traversing mark bitmaps." \
 159           "Set to 0 to disable prefetching.")                               \
 160           range(0, 1024)                                                    \
 161 
 162 
 163 SHENANDOAH_FLAGS(DECLARE_DEVELOPER_FLAG, \
 164                  DECLARE_PD_DEVELOPER_FLAG,     \
 165                  DECLARE_PRODUCT_FLAG,          \
 166                  DECLARE_PD_PRODUCT_FLAG,       \
 167                  DECLARE_DIAGNOSTIC_FLAG,       \
 168                  DECLARE_EXPERIMENTAL_FLAG,     \
 169                  DECLARE_NOTPRODUCT_FLAG,       \
 170                  DECLARE_MANAGEABLE_FLAG,       \
 171                  DECLARE_PRODUCT_RW_FLAG,       \
 172                  IGNORE_RANGE,                  \
 173                  IGNORE_CONSTRAINT, \
 174                  IGNORE_WRITEABLE)
 175 
 176 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP