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   diagnostic(bool, ShenandoahWriteBarrier, true,                            \
 115           "Turn on/off write barriers in Shenandoah")                       \
 116                                                                             \
 117   diagnostic(bool, ShenandoahReadBarrier, true,                             \
 118           "Turn on/off read barriers in Shenandoah")                        \
 119                                                                             \
 120   diagnostic(bool, ShenandoahStoreCheck, false,                             \
 121           "Emit additional code that checks objects are written to only"    \
 122           " in to-space")                                                   \
 123                                                                             \
 124   develop(bool, ShenandoahDumpHeapBeforeConcurrentMark, false,              \
 125           "Dump the ShenanodahHeap Before Each ConcurrentMark")             \
 126                                                                             \
 127   develop(bool, ShenandoahDumpHeapAfterConcurrentMark, false,               \
 128           "Dump the ShenanodahHeap After Each Concurrent Mark")             \
 129                                                                             \
 130   develop(bool, ShenandoahVerifyWritesToFromSpace, false,                   \
 131           "Use Memory Protection to signal illegal writes to from space")   \
 132                                                                             \
 133   develop(bool, ShenandoahVerifyReadsToFromSpace, false,                    \
 134           "Use Memory Protection to signal illegal reads to from space")    \
 135                                                                             \
 136   develop(bool, ShenandoahVerify, false,                                    \
 137           "Verify the  Shenandoah garbage collector")                       \
 138                                                                             \
 139   develop(bool, VerifyStrictOopOperations, false,                           \
 140           "Verify that == and != are not used on oops. Only in fastdebug")  \
 141                                                                             \
 142   develop(bool, ShenandoahVerifyOptoBarriers, false,                        \
 143           "Verify no missing barriers in c2")                               \
 144                                                                             \
 145   product(bool, ShenandoahAlwaysPreTouch, false,                            \
 146           "Pre-touch heap memory, overrides global AlwaysPreTouch")         \
 147 
 148 
 149 SHENANDOAH_FLAGS(DECLARE_DEVELOPER_FLAG, \
 150                  DECLARE_PD_DEVELOPER_FLAG,     \
 151                  DECLARE_PRODUCT_FLAG,          \
 152                  DECLARE_PD_PRODUCT_FLAG,       \
 153                  DECLARE_DIAGNOSTIC_FLAG,       \
 154                  DECLARE_EXPERIMENTAL_FLAG,     \
 155                  DECLARE_NOTPRODUCT_FLAG,       \
 156                  DECLARE_MANAGEABLE_FLAG,       \
 157                  DECLARE_PRODUCT_RW_FLAG,       \
 158                  IGNORE_RANGE,                  \
 159                  IGNORE_CONSTRAINT, \
 160                  IGNORE_WRITEABLE)
 161 
 162 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP