1 /*
   2  * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_G1_G1_GLOBALS_HPP
  26 #define SHARE_VM_GC_G1_G1_GLOBALS_HPP
  27 
  28 #include "runtime/globals.hpp"
  29 #include <float.h> // for DBL_MAX
  30 //
  31 // Defines all globals flags used by the garbage-first compiler.
  32 //
  33 
  34 #define G1_FLAGS(develop, \
  35                  develop_pd, \
  36                  product, \
  37                  product_pd, \
  38                  diagnostic, \
  39                  experimental, \
  40                  notproduct, \
  41                  manageable, \
  42                  product_rw, \
  43                  range, \
  44                  constraint, \
  45                  writeable) \
  46                                                                             \
  47   product(bool, G1UseAdaptiveIHOP, true,                                    \
  48           "Adaptively adjust the initiating heap occupancy from the "       \
  49           "initial value of InitiatingHeapOccupancyPercent. The policy "    \
  50           "attempts to start marking in time based on application "         \
  51           "behavior.")                                                      \
  52                                                                             \
  53   experimental(size_t, G1AdaptiveIHOPNumInitialSamples, 3,                  \
  54           "How many completed time periods from initial mark to first "     \
  55           "mixed gc are required to use the input values for prediction "   \
  56           "of the optimal occupancy to start marking.")                     \
  57           range(1, max_intx)                                                \
  58                                                                             \
  59   product(uintx, G1ConfidencePercent, 50,                                   \
  60           "Confidence level for MMU/pause predictions")                     \
  61           range(0, 100)                                                     \
  62                                                                             \
  63   develop(intx, G1MarkingOverheadPercent, 0,                                \
  64           "Overhead of concurrent marking")                                 \
  65           range(0, 100)                                                     \
  66                                                                             \
  67   diagnostic(intx, G1SummarizeRSetStatsPeriod, 0,                           \
  68           "The period (in number of GCs) at which we will generate "        \
  69           "update buffer processing info "                                  \
  70           "(0 means do not periodically generate this info); "              \
  71           "it also requires that logging is enabled on the trace"           \
  72           "level for gc+remset")                                            \
  73           range(0, max_intx)                                                \
  74                                                                             \
  75   product(double, G1ConcMarkStepDurationMillis, 10.0,                       \
  76           "Target duration of individual concurrent marking steps "         \
  77           "in milliseconds.")                                               \
  78           range(1.0, DBL_MAX)                                               \
  79                                                                             \
  80   product(intx, G1RefProcDrainInterval, 10,                                 \
  81           "The number of discovered reference objects to process before "   \
  82           "draining concurrent marking work queues.")                       \
  83           range(1, max_intx)                                                \
  84                                                                             \
  85   experimental(double, G1LastPLABAverageOccupancy, 50.0,                    \
  86                "The expected average occupancy of the last PLAB in "        \
  87                "percent.")                                                  \
  88                range(0.001, 100.0)                                          \
  89                                                                             \
  90   product(size_t, G1SATBBufferSize, 1*K,                                    \
  91           "Number of entries in an SATB log buffer.")                       \
  92           range(1, max_uintx)                                               \
  93                                                                             \
  94   develop(intx, G1SATBProcessCompletedThreshold, 20,                        \
  95           "Number of completed buffers that triggers log processing.")      \
  96           range(0, max_jint)                                                \
  97                                                                             \
  98   product(uintx, G1SATBBufferEnqueueingThresholdPercent, 60,                \
  99           "Before enqueueing them, each mutator thread tries to do some "   \
 100           "filtering on the SATB buffers it generates. If post-filtering "  \
 101           "the percentage of retained entries is over this threshold "      \
 102           "the buffer will be enqueued for processing. A value of 0 "       \
 103           "specifies that mutator threads should not do such filtering.")   \
 104           range(0, 100)                                                     \
 105                                                                             \
 106   experimental(intx, G1ExpandByPercentOfAvailable, 20,                      \
 107           "When expanding, % of uncommitted space to claim.")               \
 108           range(0, 100)                                                     \
 109                                                                             \
 110   develop(bool, G1RSBarrierRegionFilter, true,                              \
 111           "If true, generate region filtering code in RS barrier")          \
 112                                                                             \
 113   product(size_t, G1UpdateBufferSize, 256,                                  \
 114           "Size of an update buffer")                                       \
 115           range(1, NOT_LP64(32*M) LP64_ONLY(1*G))                           \
 116                                                                             \
 117   product(size_t, G1ConcRefinementYellowZone, 0,                            \
 118           "Number of enqueued update buffers that will "                    \
 119           "trigger concurrent processing. Will be selected ergonomically "  \
 120           "by default.")                                                    \
 121           range(0, max_intx)                                                \
 122                                                                             \
 123   product(size_t, G1ConcRefinementRedZone, 0,                               \
 124           "Maximum number of enqueued update buffers before mutator "       \
 125           "threads start processing new ones instead of enqueueing them. "  \
 126           "Will be selected ergonomically by default.")                     \
 127           range(0, max_intx)                                                \
 128                                                                             \
 129   product(size_t, G1ConcRefinementGreenZone, 0,                             \
 130           "The number of update buffers that are left in the queue by the " \
 131           "concurrent processing threads. Will be selected ergonomically "  \
 132           "by default.")                                                    \
 133           range(0, max_intx)                                                \
 134                                                                             \
 135   product(uintx, G1ConcRefinementServiceIntervalMillis, 300,                \
 136           "The last concurrent refinement thread wakes up every "           \
 137           "specified number of milliseconds to do miscellaneous work.")     \
 138           range(0, max_jint)                                                \
 139                                                                             \
 140   product(size_t, G1ConcRefinementThresholdStep, 2,                         \
 141           "Each time the rset update queue increases by this amount "       \
 142           "activate the next refinement thread if available. "              \
 143           "The actual step size will be selected ergonomically by "         \
 144           "default, with this value used to determine a lower bound.")      \
 145           range(1, SIZE_MAX)                                                \
 146                                                                             \
 147   product(intx, G1RSetUpdatingPauseTimePercent, 10,                         \
 148           "A target percentage of time that is allowed to be spend on "     \
 149           "process RS update buffers during the collection pause.")         \
 150           range(0, 100)                                                     \
 151                                                                             \
 152   product(bool, G1UseAdaptiveConcRefinement, true,                          \
 153           "Select green, yellow and red zones adaptively to meet the "      \
 154           "the pause requirements.")                                        \
 155                                                                             \
 156   product(size_t, G1ConcRSLogCacheSize, 10,                                 \
 157           "Log base 2 of the length of conc RS hot-card cache.")            \
 158           range(0, 27)                                                      \
 159                                                                             \
 160   product(uintx, G1ConcRSHotCardLimit, 4,                                   \
 161           "The threshold that defines (>=) a hot card.")                    \
 162           range(0, max_jubyte)                                              \
 163                                                                             \
 164   develop(intx, G1RSetRegionEntriesBase, 256,                               \
 165           "Max number of regions in a fine-grain table per MB.")            \
 166           range(1, max_jint/wordSize)                                       \
 167                                                                             \
 168   product(intx, G1RSetRegionEntries, 0,                                     \
 169           "Max number of regions for which we keep bitmaps."                \
 170           "Will be set ergonomically by default")                           \
 171           range(0, max_jint/wordSize)                                       \
 172           constraint(G1RSetRegionEntriesConstraintFunc,AfterErgo)           \
 173                                                                             \
 174   develop(intx, G1RSetSparseRegionEntriesBase, 4,                           \
 175           "Max number of entries per region in a sparse table "             \
 176           "per MB.")                                                        \
 177           range(1, max_jint/wordSize)                                       \
 178                                                                             \
 179   product(intx, G1RSetSparseRegionEntries, 0,                               \
 180           "Max number of entries per region in a sparse table."             \
 181           "Will be set ergonomically by default.")                          \
 182           range(0, max_jint/wordSize)                                       \
 183           constraint(G1RSetSparseRegionEntriesConstraintFunc,AfterErgo)     \
 184                                                                             \
 185   develop(intx, G1MaxVerifyFailures, -1,                                    \
 186           "The maximum number of verification failures to print.  "         \
 187           "-1 means print all.")                                            \
 188           range(-1, max_jint)                                               \
 189                                                                             \
 190   develop(bool, G1ScrubRemSets, true,                                       \
 191           "When true, do RS scrubbing after cleanup.")                      \
 192                                                                             \
 193   product(uintx, G1ReservePercent, 10,                                      \
 194           "It determines the minimum reserve we should have in the heap "   \
 195           "to minimize the probability of promotion failure.")              \
 196           range(0, 50)                                                      \
 197                                                                             \
 198   develop(bool, G1HRRSUseSparseTable, true,                                 \
 199           "When true, use sparse table to save space.")                     \
 200                                                                             \
 201   develop(bool, G1HRRSFlushLogBuffersOnVerify, false,                       \
 202           "Forces flushing of log buffers before verification.")            \
 203                                                                             \
 204   product(size_t, G1HeapRegionSize, 0,                                      \
 205           "Size of the G1 regions.")                                        \
 206           range(0, 32*M)                                                    \
 207           constraint(G1HeapRegionSizeConstraintFunc,AfterMemoryInit)        \
 208                                                                             \
 209   product(uint, G1ConcRefinementThreads, 0,                                 \
 210           "The number of parallel rem set update threads. "                 \
 211           "Will be set ergonomically by default.")                          \
 212           range(0, (max_jint-1)/wordSize)                                   \
 213                                                                             \
 214   develop(bool, G1VerifyCTCleanup, false,                                   \
 215           "Verify card table cleanup.")                                     \
 216                                                                             \
 217   product(size_t, G1RSetScanBlockSize, 64,                                  \
 218           "Size of a work unit of cards claimed by a worker thread"         \
 219           "during RSet scanning.")                                          \
 220           range(1, max_uintx)                                               \
 221                                                                             \
 222   develop(uintx, G1SecondaryFreeListAppendLength, 5,                        \
 223           "The number of regions we will add to the secondary free list "   \
 224           "at every append operation")                                      \
 225                                                                             \
 226   develop(bool, G1StressConcRegionFreeing, false,                           \
 227           "It stresses the concurrent region freeing operation")            \
 228                                                                             \
 229   develop(uintx, G1StressConcRegionFreeingDelayMillis, 0,                   \
 230           "Artificial delay during concurrent region freeing")              \
 231                                                                             \
 232   develop(uintx, G1DummyRegionsPerGC, 0,                                    \
 233           "The number of dummy regions G1 will allocate at the end of "     \
 234           "each evacuation pause in order to artificially fill up the "     \
 235           "heap and stress the marking implementation.")                    \
 236                                                                             \
 237   develop(bool, G1ExitOnExpansionFailure, false,                            \
 238           "Raise a fatal VM exit out of memory failure in the event "       \
 239           " that heap expansion fails due to running out of swap.")         \
 240                                                                             \
 241   experimental(uintx, G1MaxNewSizePercent, 60,                              \
 242           "Percentage (0-100) of the heap size to use as default "          \
 243           " maximum young gen size.")                                       \
 244           range(0, 100)                                                     \
 245           constraint(G1MaxNewSizePercentConstraintFunc,AfterErgo)           \
 246                                                                             \
 247   experimental(uintx, G1NewSizePercent, 5,                                  \
 248           "Percentage (0-100) of the heap size to use as default "          \
 249           "minimum young gen size.")                                        \
 250           range(0, 100)                                                     \
 251           constraint(G1NewSizePercentConstraintFunc,AfterErgo)              \
 252                                                                             \
 253   experimental(uintx, G1MixedGCLiveThresholdPercent, 85,                    \
 254           "Threshold for regions to be considered for inclusion in the "    \
 255           "collection set of mixed GCs. "                                   \
 256           "Regions with live bytes exceeding this will not be collected.")  \
 257           range(0, 100)                                                     \
 258                                                                             \
 259   product(uintx, G1HeapWastePercent, 5,                                     \
 260           "Amount of space, expressed as a percentage of the heap size, "   \
 261           "that G1 is willing not to collect to avoid expensive GCs.")      \
 262           range(0, 100)                                                     \
 263                                                                             \
 264   product(uintx, G1MixedGCCountTarget, 8,                                   \
 265           "The target number of mixed GCs after a marking cycle.")          \
 266           range(0, max_uintx)                                               \
 267                                                                             \
 268   experimental(bool, G1PretouchAuxiliaryMemory, false,                      \
 269           "Pre-touch large auxiliary data structures used by the GC.")      \
 270                                                                             \
 271   experimental(bool, G1EagerReclaimHumongousObjects, true,                  \
 272           "Try to reclaim dead large objects at every young GC.")           \
 273                                                                             \
 274   experimental(bool, G1EagerReclaimHumongousObjectsWithStaleRefs, true,     \
 275           "Try to reclaim dead large objects that have a few stale "        \
 276           "references at every young GC.")                                  \
 277                                                                             \
 278   experimental(uintx, G1OldCSetRegionThresholdPercent, 10,                  \
 279           "An upper bound for the number of old CSet regions expressed "    \
 280           "as a percentage of the heap size.")                              \
 281           range(0, 100)                                                     \
 282                                                                             \
 283   notproduct(bool, G1EvacuationFailureALot, false,                          \
 284           "Force use of evacuation failure handling during certain "        \
 285           "evacuation pauses")                                              \
 286                                                                             \
 287   develop(uintx, G1EvacuationFailureALotCount, 1000,                        \
 288           "Number of successful evacuations between evacuation failures "   \
 289           "occurring at object copying")                                    \
 290                                                                             \
 291   develop(uintx, G1EvacuationFailureALotInterval, 5,                        \
 292           "Total collections between forced triggering of evacuation "      \
 293           "failures")                                                       \
 294                                                                             \
 295   develop(bool, G1EvacuationFailureALotDuringConcMark, true,                \
 296           "Force use of evacuation failure handling during evacuation "     \
 297           "pauses when marking is in progress")                             \
 298                                                                             \
 299   develop(bool, G1EvacuationFailureALotDuringInitialMark, true,             \
 300           "Force use of evacuation failure handling during initial mark "   \
 301           "evacuation pauses")                                              \
 302                                                                             \
 303   develop(bool, G1EvacuationFailureALotDuringYoungGC, true,                 \
 304           "Force use of evacuation failure handling during young "          \
 305           "evacuation pauses")                                              \
 306                                                                             \
 307   develop(bool, G1EvacuationFailureALotDuringMixedGC, true,                 \
 308           "Force use of evacuation failure handling during mixed "          \
 309           "evacuation pauses")                                              \
 310                                                                             \
 311   diagnostic(bool, G1VerifyRSetsDuringFullGC, false,                        \
 312           "If true, perform verification of each heap region's "            \
 313           "remembered set when verifying the heap during a full GC.")       \
 314                                                                             \
 315   diagnostic(bool, G1VerifyHeapRegionCodeRoots, false,                      \
 316           "Verify the code root lists attached to each heap region.")       \
 317                                                                             \
 318   develop(bool, G1VerifyBitmaps, false,                                     \
 319           "Verifies the consistency of the marking bitmaps")
 320 
 321 G1_FLAGS(DECLARE_DEVELOPER_FLAG, \
 322          DECLARE_PD_DEVELOPER_FLAG, \
 323          DECLARE_PRODUCT_FLAG, \
 324          DECLARE_PD_PRODUCT_FLAG, \
 325          DECLARE_DIAGNOSTIC_FLAG, \
 326          DECLARE_EXPERIMENTAL_FLAG, \
 327          DECLARE_NOTPRODUCT_FLAG, \
 328          DECLARE_MANAGEABLE_FLAG, \
 329          DECLARE_PRODUCT_RW_FLAG, \
 330          IGNORE_RANGE, \
 331          IGNORE_CONSTRAINT, \
 332          IGNORE_WRITEABLE)
 333 
 334 #endif // SHARE_VM_GC_G1_G1_GLOBALS_HPP