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 cycles in a row to do degenerated marking on " \ 116 "cancelled GC before triggering a full-gc" \ 117 "Defaults to 3") \ 118 writeable(Always) \ 119 \ 120 product_rw(uintx, ShenandoahGarbageThreshold, 60, \ 121 "Sets the percentage of garbage a region need to contain before " \ 122 "it can be marked for collection. Applies to " \ 123 "Shenandoah GC dynamic Heuristic mode only (ignored otherwise). " \ 124 "Defaults to 60%.") \ 125 range(0,100) \ 126 \ 127 product_rw(uintx, ShenandoahFreeThreshold, 10, \ 128 "Set the percentage of free heap at which a GC cycle is started. " \ 129 "Applies to Shenandoah GC dynamic Heuristic mode only " \ 130 "(ignored otherwise). Defaults to 10%.") \ 131 range(0,100) \ 132 \ 133 product_rw(uintx, ShenandoahAllocationThreshold, 0, \ 134 "Set percentage of memory allocated since last GC cycle before " \ 135 "a new GC cycle is started. " \ 136 "Applies to Shenandoah GC dynamic Heuristic mode only " \ 137 "(ignored otherwise). Defauls to 0%.") \ 138 range(0,100) \ 139 \ 140 product_rw(uintx, ShenandoahGenerationalYoungGenPercentage, 20, \ 141 "Percentage of the heap designated as young") \ 142 range(0,100) \ 143 \ 144 product_rw(uintx, ShenandoahLRUOldGenPercentage, 20, \ 145 "Percentage of the heap designated as old") \ 146 range(0,100) \ 147 \ 148 product_rw(uintx, ShenandoahConnectednessPercentage, 20, \ 149 "Percentage of the heap designated for connectedness") \ 150 range(0,100) \ 151 \ 152 experimental(uintx, ShenandoahMergeUpdateRefsMinGap, 100, \ 153 "If GC is currently running in separate update-refs mode " \ 154 "this numbers gives the threshold when to switch to " \ 155 "merged update-refs mode. Number is percentage relative to" \ 156 "duration(marking)+duration(update-refs).") \ 157 writeable(Always) \ 158 \ 159 experimental(uintx, ShenandoahMergeUpdateRefsMaxGap, 200, \ 160 "If GC is currently running in merged update-refs mode " \ 161 "this numbers gives the threshold when to switch to " \ 162 "separate update-refs mode. Number is percentage relative " \ 163 "to duration(marking)+duration(update-refs).") \ 164 writeable(Always) \ 165 \ 166 experimental(uintx, ShenandoahInitFreeThreshold, 30, \ 167 "Initial remaining free threshold for adaptive heuristics") \ 168 range(0,100) \ 169 \ 170 experimental(uintx, ShenandoahMinFreeThreshold, 3, \ 171 "Minimum remaining free threshold for adaptive heuristics") \ 172 range(0,100) \ 173 \ 174 experimental(uintx, ShenandoahMaxFreeThreshold, 70, \ 175 "Maximum remaining free threshold for adaptive heuristics") \ 176 range(0,100) \ 177 \ 178 experimental(uintx, ShenandoahImmediateThreshold, 90, \ 179 "If mark identifies more than this much immediate garbage " \ 180 "regions, it shall recycle them, and shall not continue the "\ 181 "rest of the GC cycle. The value is in percents of total " \ 182 "number of candidates for collection set. Setting this " \ 183 "threshold to 100% effectively disables this shortcut.") \ 184 range(0,100) \ 185 \ 186 experimental(uintx, ShenandoahGuaranteedGCInterval, 5*60*1000, \ 187 "Adaptive and dynamic heuristics would guarantee a GC cycle "\ 188 "at least with this interval. This is useful when large idle"\ 189 " intervals are present, where GC can run without stealing " \ 190 "time from active application. Time is in milliseconds.") \ 191 \ 192 experimental(uintx, ShenandoahHappyCyclesThreshold, 3, \ 193 "How many successful marking cycles before improving free " \ 194 "threshold for adaptive heuristics") \ 195 \ 196 experimental(uintx, ShenandoahPartialInboundThreshold, 10, \ 197 "Specifies how many inbound regions a region can have maximum " \ 198 "to be considered for collection set in partial collections.") \ 199 writeable(Always) \ 200 \ 201 experimental(uintx, ShenandoahMarkLoopStride, 1000, \ 202 "How many items are processed during one marking step") \ 203 \ 204 experimental(bool, ShenandoahConcurrentScanCodeRoots, true, \ 205 "Scan code roots concurrently, instead of during a pause") \ 206 \ 207 experimental(bool, ShenandoahConcurrentEvacCodeRoots, false, \ 208 "Evacuate code roots concurrently, instead of during a pause. " \ 209 "This requires ShenandoahBarriersForConst to be enabled.") \ 210 \ 211 experimental(uintx, ShenandoahCodeRootsStyle, 1, \ 212 "Use this style to scan code cache:" \ 213 " 0 - sequential iterator;" \ 214 " 1 - parallel iterator;" \ 215 " 2 - parallel iterator with filters;") \ 216 \ 217 experimental(bool, ShenandoahUncommit, true, \ 218 "Allow Shenandoah to uncommit unused memory.") \ 219 \ 220 experimental(uintx, ShenandoahUncommitDelay, 5*60*1000, \ 221 "Shenandoah would start to uncommit memory for regions that were"\ 222 " not used for more than this time. First use after that would " \ 223 "incur allocation stalls. Actively used regions would never be " \ 224 "uncommitted, because they never decay. Time is in milliseconds."\ 225 "Setting this delay to 0 effectively makes Shenandoah to " \ 226 "uncommit the regions almost immediately.") \ 227 \ 228 experimental(bool, ShenandoahUncommitWithIdle, false, \ 229 "Uncommit memory using MADV_DONTNEED.") \ 230 \ 231 experimental(bool, ShenandoahBarriersForConst, false, \ 232 "Emit barriers for constant oops in generated code, improving " \ 233 "throughput. If no barriers are emitted, GC will need to " \ 234 "pre-evacuate code roots before returning from STW, adding to " \ 235 "pause time.") \ 236 \ 237 experimental(bool, ShenandoahDontIncreaseWBFreq, true, \ 238 "Common 2 WriteBarriers or WriteBarrier and a ReadBarrier only " \ 239 "if the resulting WriteBarrier isn't executed more frequently") \ 240 \ 241 experimental(bool, ShenandoahNoLivenessFullGC, true, \ 242 "Skip liveness counting for mark during full GC.") \ 243 \ 244 experimental(bool, ShenandoahWriteBarrierToIR, true, \ 245 "Convert write barrier to IR instead of using assembly blob") \ 246 \ 247 experimental(bool, ShenandoahWriteBarrierCsetTestInIR, true, \ 248 "Perform cset test in IR rather than in the stub") \ 249 \ 250 experimental(bool, ShenandoahLoopOptsAfterExpansion, true, \ 251 "Attempt more loop opts after write barrier expansion") \ 252 \ 253 experimental(bool, UseShenandoahOWST, true, \ 254 "Use Shenandoah work stealing termination protocol") \ 255 \ 256 experimental(size_t, ShenandoahSATBBufferSize, 1 * K, \ 257 "Number of entries in an SATB log buffer.") \ 258 range(1, max_uintx) \ 259 \ 260 experimental(int, ShenandoahRegionSamplingRate, 40, \ 261 "Sampling rate for heap region sampling. " \ 262 "Number of milliseconds between samples") \ 263 writeable(Always) \ 264 \ 265 experimental(bool, ShenandoahRegionSampling, false, \ 266 "Turns on heap region sampling via JVMStat") \ 267 writeable(Always) \ 268 \ 269 experimental(bool, ShenandoahFastSyncRoots, true, \ 270 "Enable fast synchronizer roots scanning") \ 271 \ 272 experimental(bool, ShenandoahMergeSafepointCleanup, false, \ 273 "Do safepoint cleanup piggy-backed on thread scans") \ 274 \ 275 experimental(uint, ParallelSafepointCleanupThreads, 0, \ 276 "Number of parallel threads used for safepoint cleanup") \ 277 \ 278 experimental(bool, ShenandoahPreclean, true, \ 279 "Do preclean phase before final mark") \ 280 \ 281 experimental(bool, ShenandoahSuspendibleWorkers, false, \ 282 "Suspend concurrent GC worker threads at safepoints") \ 283 \ 284 experimental(uintx, ShenandoahControlIntervalMin, 1, \ 285 "The minumum sleep interval for control loop that drives " \ 286 "the cycles. Lower values would increase GC responsiveness " \ 287 "to changing heap conditions, at the expense of higher perf " \ 288 "overhead. Time is in milliseconds.") \ 289 \ 290 experimental(uintx, ShenandoahControlIntervalMax, 10, \ 291 "The maximum sleep interval for control loop that drives " \ 292 "the cycles. Lower values would increase GC responsiveness " \ 293 "to changing heap conditions, at the expense of higher perf " \ 294 "overhead. Time is in milliseconds.") \ 295 \ 296 experimental(uintx, ShenandoahControlIntervalAdjustPeriod, 1000, \ 297 "The time period for one step in control loop interval " \ 298 "adjustment. Lower values make adjustments faster, at the " \ 299 "expense of higher perf overhead. Time is in milliseconds.") \ 300 \ 301 diagnostic(bool, ShenandoahAllocImplicitLive, true, \ 302 "Treat (non-evac) allocations implicitely live") \ 303 \ 304 diagnostic(bool, ShenandoahSATBBarrier, true, \ 305 "Turn on/off SATB barriers in Shenandoah") \ 306 \ 307 diagnostic(bool, ShenandoahKeepAliveBarrier, true, \ 308 "Turn on/off keep alive barriers in Shenandoah") \ 309 \ 310 diagnostic(bool, ShenandoahWriteBarrier, true, \ 311 "Turn on/off write barriers in Shenandoah") \ 312 \ 313 diagnostic(bool, ShenandoahWriteBarrierRB, true, \ 314 "Turn on/off RB on WB fastpath in Shenandoah.") \ 315 \ 316 diagnostic(bool, ShenandoahReadBarrier, true, \ 317 "Turn on/off read barriers in Shenandoah") \ 318 \ 319 diagnostic(bool, ShenandoahStoreValEnqueueBarrier, false, \ 320 "Turn on/off enqueuing of oops for storeval barriers") \ 321 \ 322 diagnostic(bool, ShenandoahStoreValReadBarrier, true, \ 323 "Turn on/off store val read barriers in Shenandoah") \ 324 \ 325 diagnostic(bool, ShenandoahCASBarrier, true, \ 326 "Turn on/off CAS barriers in Shenandoah") \ 327 \ 328 diagnostic(bool, ShenandoahAcmpBarrier, true, \ 329 "Turn on/off acmp barriers in Shenandoah") \ 330 \ 331 diagnostic(bool, ShenandoahCloneBarrier, true, \ 332 "Turn on/off clone barriers in Shenandoah") \ 333 \ 334 diagnostic(bool, UseShenandoahMatrix, false, \ 335 "Turn on/off Shenandoah connection matrix collection") \ 336 \ 337 diagnostic(bool, PrintShenandoahMatrix, false, \ 338 "Print connection matrix after marking") \ 339 \ 340 diagnostic(bool, ShenandoahStoreCheck, false, \ 341 "Emit additional code that checks objects are written to only" \ 342 " in to-space") \ 343 \ 344 diagnostic(bool, ShenandoahVerify, false, \ 345 "Verify the Shenandoah garbage collector") \ 346 \ 347 diagnostic(intx, ShenandoahVerifyLevel, 4, \ 348 "Shenandoah verification level: " \ 349 "0 = basic heap checks; " \ 350 "1 = previous level, plus basic region checks; " \ 351 "2 = previous level, plus all roots; " \ 352 "3 = previous level, plus all reachable objects; " \ 353 "4 = previous level, plus all marked objects") \ 354 \ 355 diagnostic(bool, ShenandoahAllocationTrace, false, \ 356 "Trace allocation latencies and stalls. Can be expensive when " \ 357 "lots of allocations happen, and may introduce scalability " \ 358 "bottlenecks.") \ 359 \ 360 diagnostic(intx, ShenandoahAllocationStallThreshold, 10000, \ 361 "When allocation tracing is enabled, the allocation stalls " \ 362 "larger than this threshold would be reported as warnings. " \ 363 "Time is in microseconds.") \ 364 \ 365 experimental(bool, ShenandoahCommonGCStateLoads, false, \ 366 "Enable commonning for GC state loads in generated code.") \ 367 \ 368 develop(bool, VerifyStrictOopOperations, false, \ 369 "Verify that == and != are not used on oops. Only in fastdebug") \ 370 \ 371 develop(bool, ShenandoahVerifyOptoBarriers, false, \ 372 "Verify no missing barriers in c2") \ 373 \ 374 develop(int, ShenandoahFailHeapExpansionAfter, -1, \ 375 "Artificially fails heap expansion after specified times." \ 376 "Used to verify allocation handling. Default -1 to disable it.") \ 377 \ 378 product(bool, ShenandoahAlwaysPreTouch, false, \ 379 "Pre-touch heap memory, overrides global AlwaysPreTouch") \ 380 \ 381 experimental(intx, ShenandoahMarkScanPrefetch, 32, \ 382 "How many objects to prefetch ahead when traversing mark bitmaps." \ 383 "Set to 0 to disable prefetching.") \ 384 range(0, 256) \ 385 \ 386 experimental(intx, ShenandoahAllocGCTries, 5, \ 387 "How many times to try to do GC on allocation failure." \ 388 "Set to 0 to never try, and fail instead.") \ 389 range(0, 16) \ 390 \ 391 experimental(bool, ShenandoahHumongousMoves, true, \ 392 "Allow moving humongous regions. This makes GC more resistant " \ 393 "to external fragmentation that may otherwise fail other " \ 394 "humongous allocations, at the expense of higher GC copying " \ 395 "costs.") \ 396 \ 397 diagnostic(bool, ShenandoahOOMDuringEvacALot, false, \ 398 "Simulate OOM during evacuation frequently.") \ 399 \ 400 diagnostic(bool, ShenandoahAllocFailureALot, false, \ 401 "Make lots of artificial allocation failures.") \ 402 \ 403 diagnostic(bool, ShenandoahDegeneratedGC, true, \ 404 "Use Degenerated GC.") \ 405 \ 406 experimental(bool, ShenandoahPacing, true, \ 407 "Pace application allocations to give GC chance to start " \ 408 "and complete.") \ 409 \ 410 experimental(uintx, ShenandoahPacingMaxDelay, 10, \ 411 "Max delay for pacing application allocations. " \ 412 "Time is in milliseconds.") \ 413 \ 414 experimental(uintx, ShenandoahPacingIdleSlack, 2, \ 415 "Percent of heap counted as non-taxable allocations during idle. "\ 416 "Larger value makes the pacing milder during idle phases, " \ 417 "requiring less rendezvous with control thread. Lower value " \ 418 "makes the pacing control less responsive to out-of-cycle allocs.")\ 419 range(0, 100) \ 420 \ 421 experimental(uintx, ShenandoahPacingCycleSlack, 10, \ 422 "Percent of free space taken as non-taxable allocations during " \ 423 "the GC cycle. Larger value makes the pacing milder at the " \ 424 "beginning of the GC cycle. Lower value makes the pacing less " \ 425 "uniform during the cycle.") \ 426 range(0, 100) \ 427 \ 428 diagnostic(bool, ShenandoahAllowMixedAllocs, true, \ 429 "Allow mixing mutator and collector allocations in a single " \ 430 "region") \ 431 \ 432 diagnostic(bool, ShenandoahRecycleClearsBitmap, false, \ 433 "Recycling a region also clears the marking bitmap") \ 434 435 436 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP