1 /*
   2  * Copyright (c) 1997, 2020, 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_GC_SHARED_GC_GLOBALS_HPP
  26 #define SHARE_GC_SHARED_GC_GLOBALS_HPP
  27 
  28 #include "runtime/globals_shared.hpp"
  29 #include "utilities/macros.hpp"
  30 #if INCLUDE_EPSILONGC
  31 #include "gc/epsilon/epsilon_globals.hpp"
  32 #endif
  33 #if INCLUDE_G1GC
  34 #include "gc/g1/g1_globals.hpp"
  35 #endif
  36 #if INCLUDE_PARALLELGC
  37 #include "gc/parallel/parallel_globals.hpp"
  38 #endif
  39 #if INCLUDE_SERIALGC
  40 #include "gc/serial/serial_globals.hpp"
  41 #endif
  42 #if INCLUDE_SHENANDOAHGC
  43 #include "gc/shenandoah/shenandoah_globals.hpp"
  44 #endif
  45 #if INCLUDE_ZGC
  46 #include "gc/z/z_globals.hpp"
  47 #endif
  48 
  49 #include "runtime/flags/jvmFlag.hpp"
  50 PRODUCT_FLAG(bool,     UseSerialGC, false, JVMFlag::DEFAULT,
  51                        "Use the Serial garbage collector");
  52 
  53 PRODUCT_FLAG(bool,     UseG1GC, false, JVMFlag::DEFAULT,
  54                        "Use the Garbage-First garbage collector");
  55 
  56 PRODUCT_FLAG(bool,     UseParallelGC, false, JVMFlag::DEFAULT,
  57                        "Use the Parallel garbage collector.");
  58 
  59 PRODUCT_FLAG(bool,     UseEpsilonGC, false, JVMFlag::EXPERIMENTAL,
  60                        "Use the Epsilon (no-op) garbage collector");
  61 
  62 PRODUCT_FLAG(bool,     UseZGC, false, JVMFlag::DEFAULT,
  63                        "Use the Z garbage collector");
  64 
  65 PRODUCT_FLAG(bool,     UseShenandoahGC, false, JVMFlag::EXPERIMENTAL,
  66                        "Use the Shenandoah garbage collector");
  67 
  68 PRODUCT_FLAG(uint,     ParallelGCThreads, 0, JVMFlag::CONSTRAINT,
  69                        "Number of parallel threads parallel gc will use");
  70    FLAG_CONSTRAINT(    ParallelGCThreads, (void*)ParallelGCThreadsConstraintFunc, JVMFlag::AfterErgo);
  71 
  72 PRODUCT_FLAG(bool,     UseSemaphoreGCThreadsSynchronization, true, JVMFlag::DIAGNOSTIC,
  73                        "Use semaphore synchronization for the GC Threads, "
  74                        "instead of synchronization based on mutexes");
  75 
  76 PRODUCT_FLAG(bool,     UseDynamicNumberOfGCThreads, true, JVMFlag::DEFAULT,
  77                        "Dynamically choose the number of threads up to a maximum of "
  78                        "ParallelGCThreads parallel collectors will use for garbage "
  79                        "collection work");
  80 
  81 PRODUCT_FLAG(bool,     InjectGCWorkerCreationFailure, false, JVMFlag::DIAGNOSTIC,
  82                        "Inject thread creation failures for "
  83                        "UseDynamicNumberOfGCThreads");
  84 
  85 PRODUCT_FLAG(size_t,   HeapSizePerGCThread, ScaleForWordSize(32*M), JVMFlag::RANGE,
  86                        "Size of heap (bytes) per GC thread used in calculating the "
  87                        "number of GC threads");
  88    FLAG_CUSTOM_RANGE(  HeapSizePerGCThread, VMPageSize);
  89 
  90 PRODUCT_FLAG(uint,     ConcGCThreads, 0, JVMFlag::CONSTRAINT,
  91                        "Number of threads concurrent gc will use");
  92    FLAG_CONSTRAINT(    ConcGCThreads, (void*)ConcGCThreadsConstraintFunc, JVMFlag::AfterErgo);
  93 
  94 PRODUCT_FLAG(bool,     AlwaysTenure, false, JVMFlag::DEFAULT,
  95                        "Always tenure objects in eden (ParallelGC only)");
  96 
  97 PRODUCT_FLAG(bool,     NeverTenure, false, JVMFlag::DEFAULT,
  98                        "Never tenure objects in eden, may tenure on overflow "
  99                        "(ParallelGC only)");
 100 
 101 PRODUCT_FLAG(bool,     ScavengeBeforeFullGC, true, JVMFlag::DEFAULT,
 102                        "Scavenge youngest generation before each full GC.");
 103 
 104 PRODUCT_FLAG(bool,     ExplicitGCInvokesConcurrent, false, JVMFlag::DEFAULT,
 105                        "A System.gc() request invokes a concurrent collection; "
 106                        "(effective only when using concurrent collectors)");
 107 
 108 PRODUCT_FLAG(uintx,    GCLockerEdenExpansionPercent, 5, JVMFlag::RANGE,
 109                        "How much the GC can expand the eden by while the GC locker "
 110                        "is active (as a percentage)");
 111    FLAG_RANGE(         GCLockerEdenExpansionPercent, 0, 100);
 112 
 113 PRODUCT_FLAG(uintx,    GCLockerRetryAllocationCount, 2, JVMFlag::DIAGNOSTIC | JVMFlag::RANGE,
 114                        "Number of times to retry allocations when "
 115                        "blocked by the GC locker");
 116    FLAG_RANGE(         GCLockerRetryAllocationCount, 0, max_uintx);
 117 
 118 PRODUCT_FLAG(uintx,    ParallelGCBufferWastePct, 10, JVMFlag::RANGE,
 119                        "Wasted fraction of parallel allocation buffer");
 120    FLAG_RANGE(         ParallelGCBufferWastePct, 0, 100);
 121 
 122 PRODUCT_FLAG(uintx,    TargetPLABWastePct, 10, JVMFlag::RANGE,
 123                        "Target wasted space in last buffer as percent of overall "
 124                        "allocation");
 125    FLAG_RANGE(         TargetPLABWastePct, 1, 100);
 126 
 127 PRODUCT_FLAG(uintx,    PLABWeight, 75, JVMFlag::RANGE,
 128                        "Percentage (0-100) used to weight the current sample when "
 129                        "computing exponentially decaying average for ResizePLAB");
 130    FLAG_RANGE(         PLABWeight, 0, 100);
 131 
 132 PRODUCT_FLAG(bool,     ResizePLAB, true, JVMFlag::DEFAULT,
 133                        "Dynamically resize (survivor space) promotion LAB's");
 134 
 135 PRODUCT_FLAG(int,      ParGCArrayScanChunk, 50, JVMFlag::RANGE,
 136                        "Scan a subset of object array and push remainder, if array is "
 137                        "bigger than this");
 138    FLAG_RANGE(         ParGCArrayScanChunk, 1, max_jint/3);
 139 
 140 PRODUCT_FLAG(bool,     AlwaysPreTouch, false, JVMFlag::DEFAULT,
 141                        "Force all freshly committed pages to be pre-touched");
 142 
 143 PRODUCT_FLAG(size_t,   PreTouchParallelChunkSize, 1 * G, JVMFlag::RANGE,
 144                        "Per-thread chunk size for parallel memory pre-touch.");
 145    FLAG_RANGE(         PreTouchParallelChunkSize, 1, SIZE_MAX / 2);
 146 
 147 
 148     //  where does the range max value of (max_jint - 1) come from? 
 149 PRODUCT_FLAG(size_t,   MarkStackSizeMax, NOT_LP64(4*M) LP64_ONLY(512*M), JVMFlag::RANGE,
 150                        "Maximum size of marking stack");
 151    FLAG_RANGE(         MarkStackSizeMax, 1, (max_jint - 1));
 152 
 153 PRODUCT_FLAG(size_t,   MarkStackSize, NOT_LP64(32*K) LP64_ONLY(4*M), JVMFlag::RANGE | JVMFlag::CONSTRAINT,
 154                        "Size of marking stack");
 155    FLAG_RANGE(         MarkStackSize, 1, (max_jint - 1));
 156    FLAG_CONSTRAINT(    MarkStackSize, (void*)MarkStackSizeConstraintFunc, JVMFlag::AfterErgo);
 157 
 158 PRODUCT_FLAG(intx,     RefDiscoveryPolicy, 0, JVMFlag::RANGE,
 159                        "Select type of reference discovery policy: "
 160                        "reference-based(0) or referent-based(1)");
 161  //TODO: to avoid circular dependency, the min/max cannot be declared in header file
 162  //FLAG_RANGE(         RefDiscoveryPolicy, ReferenceProcessor::DiscoveryPolicyMin,ReferenceProcessor::DiscoveryPolicyMax);
 163 
 164 PRODUCT_FLAG(bool,     ParallelRefProcEnabled, false, JVMFlag::DEFAULT,
 165                        "Enable parallel reference processing whenever possible");
 166 
 167 PRODUCT_FLAG(bool,     ParallelRefProcBalancingEnabled, true, JVMFlag::DEFAULT,
 168                        "Enable balancing of reference processing queues");
 169 
 170 PRODUCT_FLAG(size_t,   ReferencesPerThread, 1000, JVMFlag::EXPERIMENTAL,
 171                        "Ergonomically start one thread for this amount of "
 172                        "references for reference processing if "
 173                        "ParallelRefProcEnabled is true. Specify 0 to disable and "
 174                        "use all threads.");
 175 
 176 PRODUCT_FLAG(uintx,    InitiatingHeapOccupancyPercent, 45, JVMFlag::RANGE,
 177                        "The percent occupancy (IHOP) of the current old generation "
 178                        "capacity above which a concurrent mark cycle will be initiated "
 179                        "Its value may change over time if adaptive IHOP is enabled, "
 180                        "otherwise the value remains constant. "
 181                        "In the latter case a value of 0 will result as frequent as "
 182                        "possible concurrent marking cycles. A value of 100 disables "
 183                        "concurrent marking. "
 184                        "Fragmentation waste in the old generation is not considered "
 185                        "free space in this calculation. (G1 collector only)");
 186    FLAG_RANGE(         InitiatingHeapOccupancyPercent, 0, 100);
 187 
 188 NOTPROD_FLAG(bool,     ScavengeALot, false, JVMFlag::DEFAULT,
 189                        "Force scavenge at every Nth exit from the runtime system "
 190                        "(N=ScavengeALotInterval)");
 191 
 192 DEVELOP_FLAG(bool,     FullGCALot, false, JVMFlag::DEFAULT,
 193                        "Force full gc at every Nth exit from the runtime system "
 194                        "(N=FullGCALotInterval)");
 195 
 196 NOTPROD_FLAG(bool,     GCALotAtAllSafepoints, false, JVMFlag::DEFAULT,
 197                        "Enforce ScavengeALot/GCALot at all potential safepoints");
 198 
 199 NOTPROD_FLAG(bool,     PromotionFailureALot, false, JVMFlag::DEFAULT,
 200                        "Use promotion failure handling on every youngest generation "
 201                        "collection");
 202 
 203 DEVELOP_FLAG(uintx,    PromotionFailureALotCount, 1000, JVMFlag::DEFAULT,
 204                        "Number of promotion failures occurring at PLAB promotion "
 205                        "attempts at young collectors");
 206 
 207 DEVELOP_FLAG(uintx,    PromotionFailureALotInterval, 5, JVMFlag::DEFAULT,
 208                        "Total collections between promotion failures a lot");
 209 
 210 PRODUCT_FLAG(uintx,    WorkStealingSleepMillis, 1, JVMFlag::EXPERIMENTAL,
 211                        "Sleep time when sleep is used for yields");
 212 
 213 PRODUCT_FLAG(uintx,    WorkStealingYieldsBeforeSleep, 5000, JVMFlag::EXPERIMENTAL,
 214                        "Number of yields before a sleep is done during work stealing");
 215 
 216 PRODUCT_FLAG(uintx,    WorkStealingHardSpins, 4096, JVMFlag::EXPERIMENTAL,
 217                        "Number of iterations in a spin loop between checks on "
 218                        "time out of hard spin");
 219 
 220 PRODUCT_FLAG(uintx,    WorkStealingSpinToYieldRatio, 10, JVMFlag::EXPERIMENTAL,
 221                        "Ratio of hard spins to calls to yield");
 222 
 223 DEVELOP_FLAG(uintx,    ObjArrayMarkingStride, 2048, JVMFlag::DEFAULT,
 224                        "Number of object array elements to push onto the marking stack "
 225                        "before pushing a continuation entry");
 226 
 227 DEVELOP_FLAG(bool,     MetadataAllocationFailALot, false, JVMFlag::DEFAULT,
 228                        "Fail metadata allocations at intervals controlled by "
 229                        "MetadataAllocationFailALotInterval");
 230 
 231 DEVELOP_FLAG(uintx,    MetadataAllocationFailALotInterval, 1000, JVMFlag::DEFAULT,
 232                        "Metadata allocation failure a lot interval");
 233 
 234 PRODUCT_FLAG(bool,     ExecutingUnitTests, false, JVMFlag::DEFAULT,
 235                        "Whether the JVM is running unit tests or not");
 236 
 237 PRODUCT_FLAG_PD(bool,  UseTLAB, JVMFlag::DEFAULT,
 238                        "Use thread-local object allocation");
 239 
 240 PRODUCT_FLAG_PD(bool,  ResizeTLAB, JVMFlag::DEFAULT,
 241                        "Dynamically resize TLAB size for threads");
 242 
 243 PRODUCT_FLAG(bool,     ZeroTLAB, false, JVMFlag::DEFAULT,
 244                        "Zero out the newly created TLAB");
 245 
 246 PRODUCT_FLAG(bool,     TLABStats, true, JVMFlag::DEFAULT,
 247                        "Provide more detailed and expensive TLAB statistics.");
 248 
 249 PRODUCT_FLAG_PD(bool,  NeverActAsServerClassMachine, JVMFlag::DEFAULT,
 250                        "Never act like a server-class machine");
 251 
 252 PRODUCT_FLAG(bool,     AlwaysActAsServerClassMachine, false, JVMFlag::DEFAULT,
 253                        "Always act like a server-class machine");
 254 
 255 PRODUCT_FLAG_PD(uint64_t,    MaxRAM, JVMFlag::RANGE,
 256                        "Real memory size (in bytes) used to set maximum heap size");
 257    FLAG_RANGE(         MaxRAM, 0, 0XFFFFFFFFFFFFFFFF);
 258 
 259 PRODUCT_FLAG(bool,     AggressiveHeap, false, JVMFlag::DEFAULT,
 260                        "Optimize heap options for long-running memory intensive apps");
 261 
 262 PRODUCT_FLAG(size_t,   ErgoHeapSizeLimit, 0, JVMFlag::RANGE,
 263                        "Maximum ergonomically set heap size (in bytes); zero means use "
 264                        "MaxRAM * MaxRAMPercentage / 100");
 265    FLAG_RANGE(         ErgoHeapSizeLimit, 0, max_uintx);
 266 
 267 PRODUCT_FLAG(uintx,    MaxRAMFraction, 4, JVMFlag::RANGE,
 268                        "Maximum fraction (1/n) of real memory used for maximum heap "
 269                        "size. "
 270                        "Deprecated, use MaxRAMPercentage instead");
 271    FLAG_RANGE(         MaxRAMFraction, 1, max_uintx);
 272 
 273 PRODUCT_FLAG(uintx,    MinRAMFraction, 2, JVMFlag::RANGE,
 274                        "Minimum fraction (1/n) of real memory used for maximum heap "
 275                        "size on systems with small physical memory size. "
 276                        "Deprecated, use MinRAMPercentage instead");
 277    FLAG_RANGE(         MinRAMFraction, 1, max_uintx);
 278 
 279 PRODUCT_FLAG(uintx,    InitialRAMFraction, 64, JVMFlag::RANGE,
 280                        "Fraction (1/n) of real memory used for initial heap size. "
 281                        "Deprecated, use InitialRAMPercentage instead");
 282    FLAG_RANGE(         InitialRAMFraction, 1, max_uintx);
 283 
 284 PRODUCT_FLAG(double,   MaxRAMPercentage, 25.0, JVMFlag::RANGE,
 285                        "Maximum percentage of real memory used for maximum heap size");
 286    FLAG_RANGE(         MaxRAMPercentage, 0.0, 100.0);
 287 
 288 PRODUCT_FLAG(double,   MinRAMPercentage, 50.0, JVMFlag::RANGE,
 289                        "Minimum percentage of real memory used for maximum heap"
 290                        "size on systems with small physical memory size");
 291    FLAG_RANGE(         MinRAMPercentage, 0.0, 100.0);
 292 
 293 PRODUCT_FLAG(double,   InitialRAMPercentage, 1.5625, JVMFlag::RANGE,
 294                        "Percentage of real memory used for initial heap size");
 295    FLAG_RANGE(         InitialRAMPercentage, 0.0, 100.0);
 296 
 297 PRODUCT_FLAG(int,      ActiveProcessorCount, -1, JVMFlag::DEFAULT,
 298                        "Specify the CPU count the VM should use and report as active");
 299 
 300 DEVELOP_FLAG(uintx,    MaxVirtMemFraction, 2, JVMFlag::DEFAULT,
 301                        "Maximum fraction (1/n) of virtual memory used for ergonomically "
 302                        "determining maximum heap size");
 303 
 304 PRODUCT_FLAG(bool,     UseAdaptiveSizePolicy, true, JVMFlag::DEFAULT,
 305                        "Use adaptive generation sizing policies");
 306 
 307 PRODUCT_FLAG(bool,     UsePSAdaptiveSurvivorSizePolicy, true, JVMFlag::DEFAULT,
 308                        "Use adaptive survivor sizing policies");
 309 
 310 PRODUCT_FLAG(bool,     UseAdaptiveGenerationSizePolicyAtMinorCollection, true, JVMFlag::DEFAULT,
 311                        "Use adaptive young-old sizing policies at minor collections");
 312 
 313 PRODUCT_FLAG(bool,     UseAdaptiveGenerationSizePolicyAtMajorCollection, true, JVMFlag::DEFAULT,
 314                        "Use adaptive young-old sizing policies at major collections");
 315 
 316 PRODUCT_FLAG(bool,     UseAdaptiveSizePolicyWithSystemGC, false, JVMFlag::DEFAULT,
 317                        "Include statistics from System.gc() for adaptive size policy");
 318 
 319 PRODUCT_FLAG(bool,     UseAdaptiveGCBoundary, false, JVMFlag::DEFAULT,
 320                        "Allow young-old boundary to move");
 321 
 322 DEVELOP_FLAG(intx,     PSAdaptiveSizePolicyResizeVirtualSpaceAlot, -1, JVMFlag::RANGE,
 323                        "Resize the virtual spaces of the young or old generations");
 324    FLAG_RANGE(         PSAdaptiveSizePolicyResizeVirtualSpaceAlot, -1, 1);
 325 
 326 PRODUCT_FLAG(uintx,    AdaptiveSizeThroughPutPolicy, 0, JVMFlag::RANGE,
 327                        "Policy for changing generation size for throughput goals");
 328    FLAG_RANGE(         AdaptiveSizeThroughPutPolicy, 0, 1);
 329 
 330 PRODUCT_FLAG(uintx,    AdaptiveSizePolicyInitializingSteps, 20, JVMFlag::RANGE,
 331                        "Number of steps where heuristics is used before data is used");
 332    FLAG_RANGE(         AdaptiveSizePolicyInitializingSteps, 0, max_uintx);
 333 
 334 DEVELOP_FLAG(uintx,    AdaptiveSizePolicyReadyThreshold, 5, JVMFlag::DEFAULT,
 335                        "Number of collections before the adaptive sizing is started");
 336 
 337 PRODUCT_FLAG(uintx,    AdaptiveSizePolicyOutputInterval, 0, JVMFlag::RANGE,
 338                        "Collection interval for printing information; zero means never");
 339    FLAG_RANGE(         AdaptiveSizePolicyOutputInterval, 0, max_uintx);
 340 
 341 PRODUCT_FLAG(bool,     UseAdaptiveSizePolicyFootprintGoal, true, JVMFlag::DEFAULT,
 342                        "Use adaptive minimum footprint as a goal");
 343 
 344 PRODUCT_FLAG(uintx,    AdaptiveSizePolicyWeight, 10, JVMFlag::RANGE,
 345                        "Weight given to exponential resizing, between 0 and 100");
 346    FLAG_RANGE(         AdaptiveSizePolicyWeight, 0, 100);
 347 
 348 PRODUCT_FLAG(uintx,    AdaptiveTimeWeight, 25, JVMFlag::RANGE,
 349                        "Weight given to time in adaptive policy, between 0 and 100");
 350    FLAG_RANGE(         AdaptiveTimeWeight, 0, 100);
 351 
 352 PRODUCT_FLAG(uintx,    PausePadding, 1, JVMFlag::RANGE,
 353                        "How much buffer to keep for pause time");
 354    FLAG_RANGE(         PausePadding, 0, max_juint);
 355 
 356 PRODUCT_FLAG(uintx,    PromotedPadding, 3, JVMFlag::RANGE,
 357                        "How much buffer to keep for promotion failure");
 358    FLAG_RANGE(         PromotedPadding, 0, max_juint);
 359 
 360 PRODUCT_FLAG(uintx,    SurvivorPadding, 3, JVMFlag::RANGE,
 361                        "How much buffer to keep for survivor overflow");
 362    FLAG_RANGE(         SurvivorPadding, 0, max_juint);
 363 
 364 PRODUCT_FLAG(uintx,    ThresholdTolerance, 10, JVMFlag::RANGE,
 365                        "Allowed collection cost difference between generations");
 366    FLAG_RANGE(         ThresholdTolerance, 0, 100);
 367 
 368 PRODUCT_FLAG(uintx,    AdaptiveSizePolicyCollectionCostMargin, 50, JVMFlag::RANGE,
 369                        "If collection costs are within margin, reduce both by full "
 370                        "delta");
 371    FLAG_RANGE(         AdaptiveSizePolicyCollectionCostMargin, 0, 100);
 372 
 373 PRODUCT_FLAG(uintx,    YoungGenerationSizeIncrement, 20, JVMFlag::RANGE,
 374                        "Adaptive size percentage change in young generation");
 375    FLAG_RANGE(         YoungGenerationSizeIncrement, 0, 100);
 376 
 377 PRODUCT_FLAG(uintx,    YoungGenerationSizeSupplement, 80, JVMFlag::RANGE,
 378                        "Supplement to YoungedGenerationSizeIncrement used at startup");
 379    FLAG_RANGE(         YoungGenerationSizeSupplement, 0, 100);
 380 
 381 PRODUCT_FLAG(uintx,    YoungGenerationSizeSupplementDecay, 8, JVMFlag::RANGE,
 382                        "Decay factor to YoungedGenerationSizeSupplement");
 383    FLAG_RANGE(         YoungGenerationSizeSupplementDecay, 1, max_uintx);
 384 
 385 PRODUCT_FLAG(uintx,    TenuredGenerationSizeIncrement, 20, JVMFlag::RANGE,
 386                        "Adaptive size percentage change in tenured generation");
 387    FLAG_RANGE(         TenuredGenerationSizeIncrement, 0, 100);
 388 
 389 PRODUCT_FLAG(uintx,    TenuredGenerationSizeSupplement, 80, JVMFlag::RANGE,
 390                        "Supplement to TenuredGenerationSizeIncrement used at startup");
 391    FLAG_RANGE(         TenuredGenerationSizeSupplement, 0, 100);
 392 
 393 PRODUCT_FLAG(uintx,    TenuredGenerationSizeSupplementDecay, 2, JVMFlag::RANGE,
 394                        "Decay factor to TenuredGenerationSizeIncrement");
 395    FLAG_RANGE(         TenuredGenerationSizeSupplementDecay, 1, max_uintx);
 396 
 397 PRODUCT_FLAG(uintx,    MaxGCPauseMillis, max_uintx - 1, JVMFlag::RANGE | JVMFlag::CONSTRAINT,
 398                        "Adaptive size policy maximum GC pause time goal in millisecond, "
 399                        "or (G1 Only) the maximum GC time per MMU time slice");
 400    FLAG_RANGE(         MaxGCPauseMillis, 1, max_uintx - 1);
 401    FLAG_CONSTRAINT(    MaxGCPauseMillis, (void*)MaxGCPauseMillisConstraintFunc, JVMFlag::AfterErgo);
 402 
 403 PRODUCT_FLAG(uintx,    GCPauseIntervalMillis, 0, JVMFlag::CONSTRAINT,
 404                        "Time slice for MMU specification");
 405    FLAG_CONSTRAINT(    GCPauseIntervalMillis, (void*)GCPauseIntervalMillisConstraintFunc, JVMFlag::AfterErgo);
 406 
 407 PRODUCT_FLAG(uintx,    MaxGCMinorPauseMillis, max_uintx, JVMFlag::RANGE,
 408                        "Adaptive size policy maximum GC minor pause time goal "
 409                        "in millisecond");
 410    FLAG_RANGE(         MaxGCMinorPauseMillis, 0, max_uintx);
 411 
 412 PRODUCT_FLAG(uintx,    GCTimeRatio, 99, JVMFlag::RANGE,
 413                        "Adaptive size policy application time to GC time ratio");
 414    FLAG_RANGE(         GCTimeRatio, 0, max_juint);
 415 
 416 PRODUCT_FLAG(uintx,    AdaptiveSizeDecrementScaleFactor, 4, JVMFlag::RANGE,
 417                        "Adaptive size scale down factor for shrinking");
 418    FLAG_RANGE(         AdaptiveSizeDecrementScaleFactor, 1, max_uintx);
 419 
 420 PRODUCT_FLAG(bool,     UseAdaptiveSizeDecayMajorGCCost, true, JVMFlag::DEFAULT,
 421                        "Adaptive size decays the major cost for long major intervals");
 422 
 423 PRODUCT_FLAG(uintx,    AdaptiveSizeMajorGCDecayTimeScale, 10, JVMFlag::RANGE,
 424                        "Time scale over which major costs decay");
 425    FLAG_RANGE(         AdaptiveSizeMajorGCDecayTimeScale, 0, max_uintx);
 426 
 427 PRODUCT_FLAG(uintx,    MinSurvivorRatio, 3, JVMFlag::RANGE,
 428                        "Minimum ratio of young generation/survivor space size");
 429    FLAG_RANGE(         MinSurvivorRatio, 3, max_uintx);
 430 
 431 PRODUCT_FLAG(uintx,    InitialSurvivorRatio, 8, JVMFlag::RANGE,
 432                        "Initial ratio of young generation/survivor space size");
 433    FLAG_RANGE(         InitialSurvivorRatio, 0, max_uintx);
 434 
 435 PRODUCT_FLAG(size_t,   BaseFootPrintEstimate, 256*M, JVMFlag::RANGE,
 436                        "Estimate of footprint other than Java Heap");
 437    FLAG_RANGE(         BaseFootPrintEstimate, 0, max_uintx);
 438 
 439 PRODUCT_FLAG(bool,     UseGCOverheadLimit, true, JVMFlag::DEFAULT,
 440                        "Use policy to limit of proportion of time spent in GC "
 441                        "before an OutOfMemory error is thrown");
 442 
 443 PRODUCT_FLAG(uintx,    GCTimeLimit, 98, JVMFlag::RANGE,
 444                        "Limit of the proportion of time spent in GC before "
 445                        "an OutOfMemoryError is thrown (used with GCHeapFreeLimit)");
 446    FLAG_RANGE(         GCTimeLimit, 0, 100);
 447 
 448 PRODUCT_FLAG(uintx,    GCHeapFreeLimit, 2, JVMFlag::RANGE,
 449                        "Minimum percentage of free space after a full GC before an "
 450                        "OutOfMemoryError is thrown (used with GCTimeLimit)");
 451    FLAG_RANGE(         GCHeapFreeLimit, 0, 100);
 452 
 453 DEVELOP_FLAG(uintx,    GCOverheadLimitThreshold, 5, JVMFlag::RANGE,
 454                        "Number of consecutive collections before gc time limit fires");
 455    FLAG_RANGE(         GCOverheadLimitThreshold, 1, max_uintx);
 456 
 457 PRODUCT_FLAG(intx,     PrefetchCopyIntervalInBytes, -1, JVMFlag::RANGE,
 458                        "How far ahead to prefetch destination area (<= 0 means off)");
 459    FLAG_RANGE(         PrefetchCopyIntervalInBytes, -1, max_jint);
 460 
 461 PRODUCT_FLAG(intx,     PrefetchScanIntervalInBytes, -1, JVMFlag::RANGE,
 462                        "How far ahead to prefetch scan area (<= 0 means off)");
 463    FLAG_RANGE(         PrefetchScanIntervalInBytes, -1, max_jint);
 464 
 465 PRODUCT_FLAG(intx,     PrefetchFieldsAhead, -1, JVMFlag::RANGE,
 466                        "How many fields ahead to prefetch in oop scan (<= 0 means off)");
 467    FLAG_RANGE(         PrefetchFieldsAhead, -1, max_jint);
 468 
 469 PRODUCT_FLAG(bool,     VerifyDuringStartup, false, JVMFlag::DIAGNOSTIC,
 470                        "Verify memory system before executing any Java code "
 471                        "during VM initialization");
 472 
 473 PRODUCT_FLAG(bool,     VerifyBeforeExit, trueInDebug, JVMFlag::DIAGNOSTIC,
 474                        "Verify system before exiting");
 475 
 476 PRODUCT_FLAG(bool,     VerifyBeforeGC, false, JVMFlag::DIAGNOSTIC,
 477                        "Verify memory system before GC");
 478 
 479 PRODUCT_FLAG(bool,     VerifyAfterGC, false, JVMFlag::DIAGNOSTIC,
 480                        "Verify memory system after GC");
 481 
 482 PRODUCT_FLAG(bool,     VerifyDuringGC, false, JVMFlag::DIAGNOSTIC,
 483                        "Verify memory system during GC (between phases)");
 484 
 485 PRODUCT_FLAG(ccstr,    VerifyGCType, "", JVMFlag::DIAGNOSTIC | JVMFlag::STRINGLIST,
 486                        "GC type(s) to verify when Verify*GC is enabled."
 487                        "Available types are collector specific.");
 488 
 489 PRODUCT_FLAG(ccstr,    VerifySubSet, "", JVMFlag::DIAGNOSTIC | JVMFlag::STRINGLIST,
 490                        "Memory sub-systems to verify when Verify*GC flag(s) "
 491                        "are enabled. One or more sub-systems can be specified "
 492                        "in a comma separated string. Sub-systems are: "
 493                        "threads, heap, symbol_table, string_table, codecache, "
 494                        "dictionary, classloader_data_graph, metaspace, jni_handles, "
 495                        "codecache_oops");
 496 
 497 PRODUCT_FLAG(bool,     GCParallelVerificationEnabled, true, JVMFlag::DIAGNOSTIC,
 498                        "Enable parallel memory system verification");
 499 
 500 PRODUCT_FLAG(bool,     DeferInitialCardMark, false, JVMFlag::DIAGNOSTIC,
 501                        "When +ReduceInitialCardMarks, explicitly defer any that "
 502                        "may arise from new_pre_store_barrier");
 503 
 504 PRODUCT_FLAG(bool,     UseCondCardMark, false, JVMFlag::DEFAULT,
 505                        "Check for already marked card before updating card table");
 506 
 507 PRODUCT_FLAG(bool,     VerifyRememberedSets, false, JVMFlag::DIAGNOSTIC,
 508                        "Verify GC remembered sets");
 509 
 510 PRODUCT_FLAG(bool,     VerifyObjectStartArray, true, JVMFlag::DIAGNOSTIC,
 511                        "Verify GC object start array if verify before/after");
 512 
 513 PRODUCT_FLAG(bool,     DisableExplicitGC, false, JVMFlag::DEFAULT,
 514                        "Ignore calls to System.gc()");
 515 
 516 PRODUCT_FLAG(bool,     PrintGC, false, JVMFlag::DEFAULT,
 517                        "Print message at garbage collection. "
 518                        "Deprecated, use -Xlog:gc instead.");
 519 
 520 PRODUCT_FLAG(bool,     PrintGCDetails, false, JVMFlag::DEFAULT,
 521                        "Print more details at garbage collection. "
 522                        "Deprecated, use -Xlog:gc* instead.");
 523 
 524 DEVELOP_FLAG(intx,     ConcGCYieldTimeout, 0, JVMFlag::RANGE,
 525                        "If non-zero, assert that GC threads yield within this "
 526                        "number of milliseconds");
 527    FLAG_RANGE(         ConcGCYieldTimeout, 0, max_intx);
 528 
 529 NOTPROD_FLAG(intx,     ScavengeALotInterval, 1, JVMFlag::DEFAULT,
 530                        "Interval between which scavenge will occur with +ScavengeALot");
 531 
 532 NOTPROD_FLAG(intx,     FullGCALotInterval, 1, JVMFlag::DEFAULT,
 533                        "Interval between which full gc will occur with +FullGCALot");
 534 
 535 NOTPROD_FLAG(intx,     FullGCALotStart, 0, JVMFlag::DEFAULT,
 536                        "For which invocation to start FullGCAlot");
 537 
 538 NOTPROD_FLAG(intx,     FullGCALotDummies, 32*K, JVMFlag::DEFAULT,
 539                        "Dummy object allocated with +FullGCALot, forcing all objects "
 540                        "to move");
 541 
 542 
 543     //  gc parameters 
 544 PRODUCT_FLAG(size_t,   MinHeapSize, 0, JVMFlag::CONSTRAINT,
 545                        "Minimum heap size (in bytes); zero means use ergonomics");
 546    FLAG_CONSTRAINT(    MinHeapSize, (void*)MinHeapSizeConstraintFunc, JVMFlag::AfterErgo);
 547 
 548 PRODUCT_FLAG(size_t,   InitialHeapSize, 0, JVMFlag::CONSTRAINT,
 549                        "Initial heap size (in bytes); zero means use ergonomics");
 550    FLAG_CONSTRAINT(    InitialHeapSize, (void*)InitialHeapSizeConstraintFunc, JVMFlag::AfterErgo);
 551 
 552 PRODUCT_FLAG(size_t,   MaxHeapSize, ScaleForWordSize(96*M), JVMFlag::CONSTRAINT,
 553                        "Maximum heap size (in bytes)");
 554    FLAG_CONSTRAINT(    MaxHeapSize, (void*)MaxHeapSizeConstraintFunc, JVMFlag::AfterErgo);
 555 
 556 PRODUCT_FLAG(size_t,   SoftMaxHeapSize, 0, JVMFlag::MANAGEABLE | JVMFlag::CONSTRAINT,
 557                        "Soft limit for maximum heap size (in bytes)");
 558    FLAG_CONSTRAINT(    SoftMaxHeapSize, (void*)SoftMaxHeapSizeConstraintFunc, JVMFlag::AfterMemoryInit);
 559 
 560 PRODUCT_FLAG(size_t,   OldSize, ScaleForWordSize(4*M), JVMFlag::RANGE,
 561                        "Initial tenured generation size (in bytes)");
 562    FLAG_RANGE(         OldSize, 0, max_uintx);
 563 
 564 PRODUCT_FLAG(size_t,   NewSize, ScaleForWordSize(1*M), JVMFlag::CONSTRAINT,
 565                        "Initial new generation size (in bytes)");
 566    FLAG_CONSTRAINT(    NewSize, (void*)NewSizeConstraintFunc, JVMFlag::AfterErgo);
 567 
 568 PRODUCT_FLAG(size_t,   MaxNewSize, max_uintx, JVMFlag::RANGE,
 569                        "Maximum new generation size (in bytes), max_uintx means set "
 570                        "ergonomically");
 571    FLAG_RANGE(         MaxNewSize, 0, max_uintx);
 572 
 573 PRODUCT_FLAG_PD(size_t,  HeapBaseMinAddress, JVMFlag::CONSTRAINT,
 574                        "OS specific low limit for heap base address");
 575    FLAG_CONSTRAINT(    HeapBaseMinAddress, (void*)HeapBaseMinAddressConstraintFunc, JVMFlag::AfterErgo);
 576 
 577 PRODUCT_FLAG(size_t,   PretenureSizeThreshold, 0, JVMFlag::RANGE,
 578                        "Maximum size in bytes of objects allocated in DefNew "
 579                        "generation; zero means no maximum");
 580    FLAG_RANGE(         PretenureSizeThreshold, 0, max_uintx);
 581 
 582 PRODUCT_FLAG(size_t,   MinTLABSize, 2*K, JVMFlag::RANGE | JVMFlag::CONSTRAINT,
 583                        "Minimum allowed TLAB size (in bytes)");
 584    FLAG_RANGE(         MinTLABSize, 1, max_uintx/2);
 585    FLAG_CONSTRAINT(    MinTLABSize, (void*)MinTLABSizeConstraintFunc, JVMFlag::AfterMemoryInit);
 586 
 587 PRODUCT_FLAG(size_t,   TLABSize, 0, JVMFlag::CONSTRAINT,
 588                        "Starting TLAB size (in bytes); zero means set ergonomically");
 589    FLAG_CONSTRAINT(    TLABSize, (void*)TLABSizeConstraintFunc, JVMFlag::AfterMemoryInit);
 590 
 591 PRODUCT_FLAG(size_t,   YoungPLABSize, 4096, JVMFlag::CONSTRAINT,
 592                        "Size of young gen promotion LAB's (in HeapWords)");
 593    FLAG_CONSTRAINT(    YoungPLABSize, (void*)YoungPLABSizeConstraintFunc, JVMFlag::AfterMemoryInit);
 594 
 595 PRODUCT_FLAG(size_t,   OldPLABSize, 1024, JVMFlag::CONSTRAINT,
 596                        "Size of old gen promotion LAB's (in HeapWords)");
 597    FLAG_CONSTRAINT(    OldPLABSize, (void*)OldPLABSizeConstraintFunc, JVMFlag::AfterMemoryInit);
 598 
 599 PRODUCT_FLAG(uintx,    TLABAllocationWeight, 35, JVMFlag::RANGE,
 600                        "Allocation averaging weight");
 601    FLAG_RANGE(         TLABAllocationWeight, 0, 100);
 602 
 603 
 604     //  Limit the lower bound of this flag to 1 as it is used  
 605     //  in a division expression.                              
 606 PRODUCT_FLAG(uintx,    TLABWasteTargetPercent, 1, JVMFlag::RANGE,
 607                        "Percentage of Eden that can be wasted");
 608    FLAG_RANGE(         TLABWasteTargetPercent, 1, 100);
 609 
 610 PRODUCT_FLAG(uintx,    TLABRefillWasteFraction, 64, JVMFlag::RANGE,
 611                        "Maximum TLAB waste at a refill (internal fragmentation)");
 612    FLAG_RANGE(         TLABRefillWasteFraction, 1, max_juint);
 613 
 614 PRODUCT_FLAG(uintx,    TLABWasteIncrement, 4, JVMFlag::RANGE | JVMFlag::CONSTRAINT,
 615                        "Increment allowed waste at slow allocation");
 616    FLAG_RANGE(         TLABWasteIncrement, 0, max_jint);
 617    FLAG_CONSTRAINT(    TLABWasteIncrement, (void*)TLABWasteIncrementConstraintFunc, JVMFlag::AfterMemoryInit);
 618 
 619 PRODUCT_FLAG(uintx,    SurvivorRatio, 8, JVMFlag::RANGE | JVMFlag::CONSTRAINT,
 620                        "Ratio of eden/survivor space size");
 621    FLAG_RANGE(         SurvivorRatio, 1, max_uintx-2);
 622    FLAG_CONSTRAINT(    SurvivorRatio, (void*)SurvivorRatioConstraintFunc, JVMFlag::AfterMemoryInit);
 623 
 624 PRODUCT_FLAG(uintx,    NewRatio, 2, JVMFlag::RANGE,
 625                        "Ratio of old/new generation sizes");
 626    FLAG_RANGE(         NewRatio, 0, max_uintx-1);
 627 
 628 PRODUCT_FLAG_PD(size_t,  NewSizeThreadIncrease, JVMFlag::RANGE,
 629                        "Additional size added to desired new generation size per "
 630                        "non-daemon thread (in bytes)");
 631    FLAG_RANGE(         NewSizeThreadIncrease, 0, max_uintx);
 632 
 633 PRODUCT_FLAG(uintx,    QueuedAllocationWarningCount, 0, JVMFlag::RANGE,
 634                        "Number of times an allocation that queues behind a GC "
 635                        "will retry before printing a warning");
 636    FLAG_RANGE(         QueuedAllocationWarningCount, 0, max_uintx);
 637 
 638 PRODUCT_FLAG(uintx,    VerifyGCStartAt, 0, JVMFlag::DIAGNOSTIC | JVMFlag::RANGE,
 639                        "GC invoke count where +VerifyBefore/AfterGC kicks in");
 640    FLAG_RANGE(         VerifyGCStartAt, 0, max_uintx);
 641 
 642 PRODUCT_FLAG(intx,     VerifyGCLevel, 0, JVMFlag::DIAGNOSTIC | JVMFlag::RANGE,
 643                        "Generation level at which to start +VerifyBefore/AfterGC");
 644    FLAG_RANGE(         VerifyGCLevel, 0, 1);
 645 
 646 PRODUCT_FLAG(uintx,    MaxTenuringThreshold, 15, JVMFlag::RANGE | JVMFlag::CONSTRAINT,
 647                        "Maximum value for tenuring threshold");
 648  //TODO: to avoid circular dependency, the min/max cannot be declared in header file
 649  //FLAG_RANGE(         MaxTenuringThreshold, 0, markWord::max_age + 1);
 650    FLAG_CONSTRAINT(    MaxTenuringThreshold, (void*)MaxTenuringThresholdConstraintFunc, JVMFlag::AfterErgo);
 651 
 652 PRODUCT_FLAG(uintx,    InitialTenuringThreshold, 7, JVMFlag::RANGE | JVMFlag::CONSTRAINT,
 653                        "Initial value for tenuring threshold");
 654  //TODO: to avoid circular dependency, the min/max cannot be declared in header file
 655  //FLAG_RANGE(         InitialTenuringThreshold, 0, markWord::max_age + 1);
 656    FLAG_CONSTRAINT(    InitialTenuringThreshold, (void*)InitialTenuringThresholdConstraintFunc, JVMFlag::AfterErgo);
 657 
 658 PRODUCT_FLAG(uintx,    TargetSurvivorRatio, 50, JVMFlag::RANGE,
 659                        "Desired percentage of survivor space used after scavenge");
 660    FLAG_RANGE(         TargetSurvivorRatio, 0, 100);
 661 
 662 PRODUCT_FLAG(uintx,    MarkSweepDeadRatio, 5, JVMFlag::RANGE,
 663                        "Percentage (0-100) of the old gen allowed as dead wood. "
 664                        "Serial mark sweep treats this as both the minimum and maximum "
 665                        "value. "
 666                        "Par compact uses a variable scale based on the density of the "
 667                        "generation and treats this as the maximum value when the heap "
 668                        "is either completely full or completely empty.  Par compact "
 669                        "also has a smaller default value; see arguments.cpp.");
 670    FLAG_RANGE(         MarkSweepDeadRatio, 0, 100);
 671 
 672 PRODUCT_FLAG(uint,     MarkSweepAlwaysCompactCount, 4, JVMFlag::RANGE,
 673                        "How often should we fully compact the heap (ignoring the dead "
 674                        "space parameters)");
 675    FLAG_RANGE(         MarkSweepAlwaysCompactCount, 1, max_juint);
 676 
 677 DEVELOP_FLAG(uintx,    GCExpandToAllocateDelayMillis, 0, JVMFlag::DEFAULT,
 678                        "Delay between expansion and allocation (in milliseconds)");
 679 
 680 PRODUCT_FLAG(uintx,    GCDrainStackTargetSize, 64, JVMFlag::RANGE,
 681                        "Number of entries we will try to leave on the stack "
 682                        "during parallel gc");
 683    FLAG_RANGE(         GCDrainStackTargetSize, 0, max_juint);
 684 
 685 #endif // SHARE_GC_SHARED_GC_GLOBALS_HPP