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 #define GC_SHENANDOAH_FLAGS(develop, \ 28 develop_pd, \ 29 product, \ 30 product_pd, \ 31 diagnostic, \ 32 diagnostic_pd, \ 33 experimental, \ 34 notproduct, \ 35 manageable, \ 36 product_rw, \ 37 lp64_product, \ 38 range, \ 39 constraint, \ 40 writeable) \ 41 \ 42 product(bool, ShenandoahOptimizeStaticFinals, true, \ 43 "Optimize barriers on static final fields. " \ 44 "Turn it off for maximum compatibility with reflection or JNI " \ 45 "code that manipulates final fields.") \ 46 \ 47 product(bool, ShenandoahOptimizeInstanceFinals, false, \ 48 "Optimize barriers on final instance fields." \ 49 "Turn it off for maximum compatibility with reflection or JNI " \ 50 "code that manipulates final fields.") \ 51 \ 52 product(bool, ShenandoahOptimizeStableFinals, false, \ 53 "Optimize barriers on stable fields." \ 54 "Turn it off for maximum compatibility with reflection or JNI " \ 55 "code that manipulates final fields.") \ 56 \ 57 product(size_t, ShenandoahHeapRegionSize, 0, \ 58 "Size of the Shenandoah regions. " \ 59 "Determined automatically by default.") \ 60 \ 61 experimental(size_t, ShenandoahMinRegionSize, 256 * K, \ 62 "Minimum heap region size. ") \ 63 \ 64 experimental(size_t, ShenandoahMaxRegionSize, 32 * M, \ 65 "Maximum heap region size. ") \ 66 \ 67 experimental(intx, ShenandoahHumongousThreshold, 100, \ 68 "How large should the object be to get allocated in humongous " \ 69 "region, in percents of heap region size. This also caps the " \ 70 "maximum TLAB size.") \ 71 range(1, 100) \ 72 \ 73 experimental(size_t, ShenandoahTargetNumRegions, 2048, \ 74 "Target number of regions. We try to get around that many " \ 75 "regions, based on ShenandoahMinRegionSize and " \ 76 "ShenandoahMaxRegionSizeSize. ") \ 77 \ 78 product(ccstr, ShenandoahGCHeuristics, "adaptive", \ 79 "The heuristics to use in Shenandoah GC. Possible values:" \ 80 " *) adaptive - adapt to maintain the given amount of free heap;" \ 81 " *) static - start concurrent GC when static free heap " \ 82 " threshold and static allocation threshold are " \ 83 " tripped;" \ 84 " *) passive - do not start concurrent GC, wait for Full GC; " \ 85 " *) aggressive - run concurrent GC continuously, evacuate " \ 86 " everything;" \ 87 " *) compact - run GC with lower footprint target, may end up " \ 88 " doing continuous GC, evacuate lots of live " \ 89 " objects, uncommit heap aggressively;" \ 90 " *) connected - run partial cycles focusing on least connected " \ 91 " regions, along with adaptive concurrent GC;" \ 92 " *) generational - run partial cycles focusing on young regions,"\ 93 " along with adaptive concurrent GC), " \ 94 " *) LRU - run partial cycles focusing on old regions, along" \ 95 " with adaptive concurrent GC." \ 96 "Defaults to adaptive") \ 97 \ 98 experimental(ccstr, ShenandoahUpdateRefsEarly, "adaptive", \ 99 "Run a separate concurrent reference updating phase after" \ 100 "concurrent evacuation. Possible values: 'on', 'off', 'adaptive'")\ 101 \ 102 product(uintx, ShenandoahRefProcFrequency, 5, \ 103 "How often should (weak, soft, etc) references be processed. " \ 104 "References get processed at every Nth GC cycle. " \ 105 "Set to 0 to disable reference processing. " \ 106 "Defaults to process references every 5 cycles.") \ 107 \ 108 product(uintx, ShenandoahUnloadClassesFrequency, 5, \ 109 "How often should classes get unloaded. " \ 110 "Class unloading is performed at every Nth GC cycle. " \ 111 "Set to 0 to disable concurrent class unloading. " \ 112 "Defaults to unload classes every 5 cycles.") \ 113 \ 114 experimental(uintx, ShenandoahFullGCThreshold, 3, \ 115 "How many back-to-back Degenerated GCs to do before triggering " \ 116 "a Full GC. Defaults to 3.") \ 117 writeable(Always) \ 118 \ 119 product_rw(uintx, ShenandoahGarbageThreshold, 60, \ 120 "Sets the percentage of garbage a region need to contain before " \ 121 "it can be marked for collection. Applies to " \ 122 "Shenandoah GC dynamic Heuristic mode only (ignored otherwise). " \ 123 "Defaults to 60%.") \ 124 range(0,100) \ 125 \ 126 product_rw(uintx, ShenandoahFreeThreshold, 10, \ 127 "Set the percentage of free heap at which a GC cycle is started. " \ 128 "Applies to Shenandoah GC dynamic Heuristic mode only " \ 129 "(ignored otherwise). Defaults to 10%.") \ 130 range(0,100) \ 131 \ 132 product_rw(uintx, ShenandoahAllocationThreshold, 0, \ 133 "Set percentage of memory allocated since last GC cycle before " \ 134 "a new GC cycle is started. " \ 135 "Applies to Shenandoah GC dynamic Heuristic mode only " \ 136 "(ignored otherwise). Defauls to 0%.") \ 137 range(0,100) \ 138 \ 139 product_rw(uintx, ShenandoahGenerationalYoungGenPercentage, 20, \ 140 "Percentage of the heap designated as young") \ 141 range(0,100) \ 142 \ 143 product_rw(uintx, ShenandoahLRUOldGenPercentage, 20, \ 144 "Percentage of the heap designated as old") \ 145 range(0,100) \ 146 \ 147 product_rw(uintx, ShenandoahConnectednessPercentage, 20, \ 148 "Percentage of the heap designated for connectedness") \ 149 range(0,100) \ 150 \ 151 experimental(uintx, ShenandoahMergeUpdateRefsMinGap, 100, \ 152 "If GC is currently running in separate update-refs mode " \ 153 "this numbers gives the threshold when to switch to " \ 154 "merged update-refs mode. Number is percentage relative to" \ 155 "duration(marking)+duration(update-refs).") \ 156 writeable(Always) \ 157 \ 158 experimental(uintx, ShenandoahMergeUpdateRefsMaxGap, 200, \ 159 "If GC is currently running in merged update-refs mode " \ 160 "this numbers gives the threshold when to switch to " \ 161 "separate update-refs mode. Number is percentage relative " \ 162 "to duration(marking)+duration(update-refs).") \ 163 writeable(Always) \ 164 \ 165 experimental(uintx, ShenandoahInitFreeThreshold, 30, \ 166 "Initial remaining free threshold for adaptive heuristics") \ 167 range(0,100) \ 168 \ 169 experimental(uintx, ShenandoahMinFreeThreshold, 10, \ 170 "Minimum remaining free threshold for adaptive heuristics") \ 171 range(0,100) \ 172 \ 173 experimental(uintx, ShenandoahMaxFreeThreshold, 70, \ 174 "Maximum remaining free threshold for adaptive heuristics") \ 175 range(0,100) \ 176 \ 177 experimental(uintx, ShenandoahImmediateThreshold, 90, \ 178 "If mark identifies more than this much immediate garbage " \ 179 "regions, it shall recycle them, and shall not continue the "\ 180 "rest of the GC cycle. The value is in percents of total " \ 181 "number of candidates for collection set. Setting this " \ 182 "threshold to 100% effectively disables this shortcut.") \ 183 range(0,100) \ 184 \ 185 experimental(uintx, ShenandoahGuaranteedGCInterval, 5*60*1000, \ 186 "Adaptive and dynamic heuristics would guarantee a GC cycle "\ 187 "at least with this interval. This is useful when large idle"\ 188 " intervals are present, where GC can run without stealing " \ 189 "time from active application. Time is in milliseconds.") \ 190 \ 191 experimental(uintx, ShenandoahHappyCyclesThreshold, 3, \ 192 "How many successful marking cycles before improving free " \ 193 "threshold for adaptive heuristics") \ 194 \ 195 experimental(uintx, ShenandoahPartialInboundThreshold, 10, \ 196 "Specifies how many inbound regions a region can have maximum " \ 197 "to be considered for collection set in partial collections.") \ 198 writeable(Always) \ 199 \ 200 experimental(uintx, ShenandoahMarkLoopStride, 1000, \ 201 "How many items are processed during one marking step") \ 202 \ 203 experimental(bool, ShenandoahConcurrentScanCodeRoots, true, \ 204 "Scan code roots concurrently, instead of during a pause") \ 205 \ 206 experimental(uintx, ShenandoahCodeRootsStyle, 2, \ 207 "Use this style to scan code cache:" \ 208 " 0 - sequential iterator;" \ 209 " 1 - parallel iterator;" \ 210 " 2 - parallel iterator with cset filters;") \ 211 \ 212 experimental(bool, ShenandoahUncommit, true, \ 213 "Allow Shenandoah to uncommit unused memory.") \ 214 \ 215 experimental(uintx, ShenandoahUncommitDelay, 5*60*1000, \ 216 "Shenandoah would start to uncommit memory for regions that were"\ 217 " not used for more than this time. First use after that would " \ 218 "incur allocation stalls. Actively used regions would never be " \ 219 "uncommitted, because they never decay. Time is in milliseconds."\ 220 "Setting this delay to 0 effectively makes Shenandoah to " \ 221 "uncommit the regions almost immediately.") \ 222 \ 223 experimental(bool, ShenandoahUncommitWithIdle, false, \ 224 "Uncommit memory using MADV_DONTNEED.") \ 225 \ 226 experimental(bool, ShenandoahDontIncreaseWBFreq, true, \ 227 "Common 2 WriteBarriers or WriteBarrier and a ReadBarrier only " \ 228 "if the resulting WriteBarrier isn't executed more frequently") \ 229 \ 230 experimental(bool, ShenandoahWriteBarrierCsetTestInIR, true, \ 231 "Perform cset test in IR rather than in the stub") \ 232 \ 233 experimental(bool, ShenandoahLoopOptsAfterExpansion, true, \ 234 "Attempt more loop opts after write barrier expansion") \ 235 \ 236 experimental(bool, UseShenandoahOWST, true, \ 237 "Use Shenandoah work stealing termination protocol") \ 238 \ 239 experimental(size_t, ShenandoahSATBBufferSize, 1 * K, \ 240 "Number of entries in an SATB log buffer.") \ 241 range(1, max_uintx) \ 242 \ 243 experimental(int, ShenandoahRegionSamplingRate, 40, \ 244 "Sampling rate for heap region sampling. " \ 245 "Number of milliseconds between samples") \ 246 writeable(Always) \ 247 \ 248 experimental(bool, ShenandoahRegionSampling, false, \ 249 "Turns on heap region sampling via JVMStat") \ 250 writeable(Always) \ 251 \ 252 experimental(bool, ShenandoahFastSyncRoots, true, \ 253 "Enable fast synchronizer roots scanning") \ 254 \ 255 experimental(bool, ShenandoahMergeSafepointCleanup, false, \ 256 "Do safepoint cleanup piggy-backed on thread scans") \ 257 \ 258 experimental(uint, ParallelSafepointCleanupThreads, 0, \ 259 "Number of parallel threads used for safepoint cleanup") \ 260 \ 261 experimental(bool, ShenandoahPreclean, true, \ 262 "Do preclean phase before final mark") \ 263 \ 264 experimental(bool, ShenandoahSuspendibleWorkers, false, \ 265 "Suspend concurrent GC worker threads at safepoints") \ 266 \ 267 experimental(uintx, ShenandoahControlIntervalMin, 1, \ 268 "The minumum sleep interval for control loop that drives " \ 269 "the cycles. Lower values would increase GC responsiveness " \ 270 "to changing heap conditions, at the expense of higher perf " \ 271 "overhead. Time is in milliseconds.") \ 272 \ 273 experimental(uintx, ShenandoahControlIntervalMax, 10, \ 274 "The maximum sleep interval for control loop that drives " \ 275 "the cycles. Lower values would increase GC responsiveness " \ 276 "to changing heap conditions, at the expense of higher perf " \ 277 "overhead. Time is in milliseconds.") \ 278 \ 279 experimental(uintx, ShenandoahControlIntervalAdjustPeriod, 1000, \ 280 "The time period for one step in control loop interval " \ 281 "adjustment. Lower values make adjustments faster, at the " \ 282 "expense of higher perf overhead. Time is in milliseconds.") \ 283 \ 284 diagnostic(bool, ShenandoahSATBBarrier, true, \ 285 "Turn on/off SATB barriers in Shenandoah") \ 286 \ 287 diagnostic(bool, ShenandoahKeepAliveBarrier, true, \ 288 "Turn on/off keep alive barriers in Shenandoah") \ 289 \ 290 diagnostic(bool, ShenandoahWriteBarrier, true, \ 291 "Turn on/off write barriers in Shenandoah") \ 292 \ 293 diagnostic(bool, ShenandoahWriteBarrierRB, true, \ 294 "Turn on/off RB on WB fastpath in Shenandoah.") \ 295 \ 296 diagnostic(bool, ShenandoahReadBarrier, true, \ 297 "Turn on/off read barriers in Shenandoah") \ 298 \ 299 diagnostic(bool, ShenandoahStoreValEnqueueBarrier, false, \ 300 "Turn on/off enqueuing of oops for storeval barriers") \ 301 \ 302 diagnostic(bool, ShenandoahStoreValReadBarrier, true, \ 303 "Turn on/off store val read barriers in Shenandoah") \ 304 \ 305 diagnostic(bool, ShenandoahCASBarrier, true, \ 306 "Turn on/off CAS barriers in Shenandoah") \ 307 \ 308 diagnostic(bool, ShenandoahAcmpBarrier, true, \ 309 "Turn on/off acmp barriers in Shenandoah") \ 310 \ 311 diagnostic(bool, ShenandoahCloneBarrier, true, \ 312 "Turn on/off clone barriers in Shenandoah") \ 313 \ 314 diagnostic(bool, UseShenandoahMatrix, false, \ 315 "Turn on/off Shenandoah connection matrix collection") \ 316 \ 317 diagnostic(bool, PrintShenandoahMatrix, false, \ 318 "Print connection matrix after marking") \ 319 \ 320 diagnostic(bool, ShenandoahStoreCheck, false, \ 321 "Emit additional code that checks objects are written to only" \ 322 " in to-space") \ 323 \ 324 diagnostic(bool, ShenandoahVerify, false, \ 325 "Verify the Shenandoah garbage collector") \ 326 \ 327 diagnostic(intx, ShenandoahVerifyLevel, 4, \ 328 "Shenandoah verification level: " \ 329 "0 = basic heap checks; " \ 330 "1 = previous level, plus basic region checks; " \ 331 "2 = previous level, plus all roots; " \ 332 "3 = previous level, plus all reachable objects; " \ 333 "4 = previous level, plus all marked objects") \ 334 \ 335 diagnostic(bool, ShenandoahAllocationTrace, false, \ 336 "Trace allocation latencies and stalls. Can be expensive when " \ 337 "lots of allocations happen, and may introduce scalability " \ 338 "bottlenecks.") \ 339 \ 340 diagnostic(intx, ShenandoahAllocationStallThreshold, 10000, \ 341 "When allocation tracing is enabled, the allocation stalls " \ 342 "larger than this threshold would be reported as warnings. " \ 343 "Time is in microseconds.") \ 344 \ 345 experimental(bool, ShenandoahCommonGCStateLoads, false, \ 346 "Enable commonning for GC state loads in generated code.") \ 347 \ 348 develop(bool, VerifyStrictOopOperations, false, \ 349 "Verify that == and != are not used on oops. Only in fastdebug") \ 350 \ 351 develop(bool, ShenandoahVerifyOptoBarriers, false, \ 352 "Verify no missing barriers in c2") \ 353 \ 354 develop(int, ShenandoahFailHeapExpansionAfter, -1, \ 355 "Artificially fails heap expansion after specified times." \ 356 "Used to verify allocation handling. Default -1 to disable it.") \ 357 \ 358 product(bool, ShenandoahAlwaysPreTouch, false, \ 359 "Pre-touch heap memory, overrides global AlwaysPreTouch") \ 360 \ 361 experimental(intx, ShenandoahMarkScanPrefetch, 32, \ 362 "How many objects to prefetch ahead when traversing mark bitmaps." \ 363 "Set to 0 to disable prefetching.") \ 364 range(0, 256) \ 365 \ 366 experimental(bool, ShenandoahHumongousMoves, true, \ 367 "Allow moving humongous regions. This makes GC more resistant " \ 368 "to external fragmentation that may otherwise fail other " \ 369 "humongous allocations, at the expense of higher GC copying " \ 370 "costs.") \ 371 \ 372 diagnostic(bool, ShenandoahOOMDuringEvacALot, false, \ 373 "Simulate OOM during evacuation frequently.") \ 374 \ 375 diagnostic(bool, ShenandoahAllocFailureALot, false, \ 376 "Make lots of artificial allocation failures.") \ 377 \ 378 diagnostic(bool, ShenandoahDegeneratedGC, true, \ 379 "Use Degenerated GC.") \ 380 \ 381 experimental(bool, ShenandoahPacing, true, \ 382 "Pace application allocations to give GC chance to start " \ 383 "and complete.") \ 384 \ 385 experimental(uintx, ShenandoahPacingMaxDelay, 10, \ 386 "Max delay for pacing application allocations. " \ 387 "Time is in milliseconds.") \ 388 \ 389 experimental(uintx, ShenandoahPacingIdleSlack, 2, \ 390 "Percent of heap counted as non-taxable allocations during idle. "\ 391 "Larger value makes the pacing milder during idle phases, " \ 392 "requiring less rendezvous with control thread. Lower value " \ 393 "makes the pacing control less responsive to out-of-cycle allocs.")\ 394 range(0, 100) \ 395 \ 396 experimental(uintx, ShenandoahPacingCycleSlack, 10, \ 397 "Percent of free space taken as non-taxable allocations during " \ 398 "the GC cycle. Larger value makes the pacing milder at the " \ 399 "beginning of the GC cycle. Lower value makes the pacing less " \ 400 "uniform during the cycle.") \ 401 range(0, 100) \ 402 \ 403 experimental(uintx, ShenandoahCriticalFreeThreshold, 1, \ 404 "Percent of heap that needs to be free after recovery cycles, " \ 405 "either Degenerated or Full GC. If this much space is not " \ 406 "available, next recovery step would triggered.") \ 407 range(0, 100) \ 408 \ 409 experimental(uintx, ShenandoahSATBBufferFlushInterval, 100, \ 410 "Forcefully flush non-empty SATB buffers at this interval. " \ 411 "Time is in milliseconds.") \ 412 \ 413 diagnostic(bool, ShenandoahAllowMixedAllocs, true, \ 414 "Allow mixing mutator and collector allocations in a single " \ 415 "region") \ 416 \ 417 diagnostic(bool, ShenandoahRecycleClearsBitmap, false, \ 418 "Recycling a region also clears the marking bitmap") \ 419 \ 420 diagnostic(size_t, ShenandoahEnqueueArrayCopyThreshold, 32, \ 421 "Arrays and objects are enqueued instead of processed in-place" \ 422 "when their size exceed this threshold") \ 423 \ 424 diagnostic(bool, ShenandoahTerminationTrace, false, \ 425 "Tracing task termination timings") \ 426 \ 427 diagnostic(bool, ShenandoahElasticTLAB, true, \ 428 "Use Elastic TLABs with Shenandoah") \ 429 \ 430 diagnostic(bool, ShenandoahCompileCheck, trueInDebug, \ 431 "Assert that methods are successfully compilable") \ 432 433 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP