1 /* 2 * Copyright (c) 2016, Red Hat, Inc. and/or its affiliates. 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU General Public License version 2 only, as 6 * published by the Free Software Foundation. 7 * 8 * This code is distributed in the hope that it will be useful, but WITHOUT 9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11 * version 2 for more details (a copy is included in the LICENSE file that 12 * accompanied this code). 13 * 14 * You should have received a copy of the GNU General Public License version 15 * 2 along with this work; if not, write to the Free Software Foundation, 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17 * 18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 * or visit www.oracle.com if you need additional information or have any 20 * questions. 21 * 22 */ 23 24 #ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP 25 #define SHARE_VM_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP 26 27 #include "runtime/globals.hpp" 28 29 #define SHENANDOAH_FLAGS(develop, \ 30 develop_pd, \ 31 product, \ 32 product_pd, \ 33 diagnostic, \ 34 experimental, \ 35 notproduct, \ 36 manageable, \ 37 product_rw, \ 38 range, \ 39 constraint, \ 40 writeable) \ 41 \ 42 product(bool, UseShenandoahGC, false, \ 43 "Use the Shenandoah garbage collector") \ 44 \ 45 product(bool, ShenandoahOptimizeStaticFinals, true, \ 46 "Optimize barriers on static final fields. " \ 47 "Turn it off for maximum compatibility with reflection or JNI " \ 48 "code that manipulates final fields.") \ 49 \ 50 product(bool, ShenandoahOptimizeInstanceFinals, false, \ 51 "Optimize barriers on final instance fields." \ 52 "Turn it off for maximum compatibility with reflection or JNI " \ 53 "code that manipulates final fields.") \ 54 \ 55 product(bool, ShenandoahOptimizeStableFinals, false, \ 56 "Optimize barriers on stable fields." \ 57 "Turn it off for maximum compatibility with reflection or JNI " \ 58 "code that manipulates final fields.") \ 59 \ 60 product(size_t, ShenandoahHeapRegionSize, 0, \ 61 "Size of the Shenandoah regions. " \ 62 "Determined automatically by default.") \ 63 \ 64 experimental(size_t, ShenandoahMinRegionSize, 256 * K, \ 65 "Minimum heap region size. ") \ 66 \ 67 experimental(size_t, ShenandoahMaxRegionSize, 32 * M, \ 68 "Maximum heap region size. ") \ 69 \ 70 experimental(intx, ShenandoahHumongousThreshold, 100, \ 71 "How large should the object be to get allocated in humongous " \ 72 "region, in percents of heap region size. This also caps the " \ 73 "maximum TLAB size.") \ 74 range(1, 100) \ 75 \ 76 experimental(size_t, ShenandoahTargetNumRegions, 2048, \ 77 "Target number of regions. We try to get around that many " \ 78 "regions, based on ShenandoahMinRegionSize and " \ 79 "ShenandoahMaxRegionSizeSize. ") \ 80 \ 81 product(ccstr, ShenandoahGCHeuristics, "adaptive", \ 82 "The heuristics to use in Shenandoah GC. Possible values:" \ 83 " *) adaptive - adapt to maintain the given amount of free heap;" \ 84 " *) static - start concurrent GC when static free heap " \ 85 " threshold and static allocation threshold are " \ 86 " tripped;" \ 87 " *) passive - do not start concurrent GC, wait for Full GC; " \ 88 " *) aggressive - run concurrent GC continuously, evacuate " \ 89 " everything;" \ 90 " *) compact - run GC with lower footprint target, may end up " \ 91 " doing continuous GC, evacuate lots of live " \ 92 " objects, uncommit heap aggressively;" \ 93 " *) connected - run partial cycles focusing on least connected " \ 94 " regions, along with adaptive concurrent GC;" \ 95 " *) generational - run partial cycles focusing on young regions,"\ 96 " along with adaptive concurrent GC), " \ 97 " *) LRU - run partial cycles focusing on old regions, along" \ 98 " with adaptive concurrent GC." \ 99 "Defaults to adaptive") \ 100 \ 101 experimental(ccstr, ShenandoahUpdateRefsEarly, "adaptive", \ 102 "Run a separate concurrent reference updating phase after" \ 103 "concurrent evacuation. Possible values: 'on', 'off', 'adaptive'")\ 104 \ 105 product(uintx, ShenandoahRefProcFrequency, 5, \ 106 "How often should (weak, soft, etc) references be processed. " \ 107 "References get processed at every Nth GC cycle. " \ 108 "Set to 0 to disable reference processing. " \ 109 "Defaults to process references every 5 cycles.") \ 110 \ 111 product(uintx, ShenandoahUnloadClassesFrequency, 5, \ 112 "How often should classes get unloaded. " \ 113 "Class unloading is performed at every Nth GC cycle. " \ 114 "Set to 0 to disable concurrent class unloading. " \ 115 "Defaults to unload classes every 5 cycles.") \ 116 \ 117 experimental(uintx, ShenandoahFullGCThreshold, 3, \ 118 "How many cycles in a row to do degenerated marking on " \ 119 "cancelled GC before triggering a full-gc" \ 120 "Defaults to 3") \ 121 writeable(Always) \ 122 \ 123 product_rw(uintx, ShenandoahGarbageThreshold, 60, \ 124 "Sets the percentage of garbage a region need to contain before " \ 125 "it can be marked for collection. Applies to " \ 126 "Shenandoah GC dynamic Heuristic mode only (ignored otherwise). " \ 127 "Defaults to 60%.") \ 128 range(0,100) \ 129 \ 130 product_rw(uintx, ShenandoahFreeThreshold, 10, \ 131 "Set the percentage of free heap at which a GC cycle is started. " \ 132 "Applies to Shenandoah GC dynamic Heuristic mode only " \ 133 "(ignored otherwise). Defaults to 10%.") \ 134 range(0,100) \ 135 \ 136 product_rw(uintx, ShenandoahCSetThreshold, 40, \ 137 "Set the approximate target percentage of the heap for the" \ 138 "collection set. Defaults to 40%.") \ 139 range(0,100) \ 140 \ 141 product_rw(uintx, ShenandoahAllocationThreshold, 0, \ 142 "Set percentage of memory allocated since last GC cycle before " \ 143 "a new GC cycle is started. " \ 144 "Applies to Shenandoah GC dynamic Heuristic mode only " \ 145 "(ignored otherwise). Defauls to 0%.") \ 146 range(0,100) \ 147 \ 148 product_rw(uintx, ShenandoahGenerationalYoungGenPercentage, 20, \ 149 "Percentage of the heap designated as young") \ 150 range(0,100) \ 151 \ 152 product_rw(uintx, ShenandoahLRUOldGenPercentage, 20, \ 153 "Percentage of the heap designated as old") \ 154 range(0,100) \ 155 \ 156 product_rw(uintx, ShenandoahConnectednessPercentage, 20, \ 157 "Percentage of the heap designated for connectedness") \ 158 range(0,100) \ 159 \ 160 experimental(uintx, ShenandoahMergeUpdateRefsMinGap, 100, \ 161 "If GC is currently running in separate update-refs mode " \ 162 "this numbers gives the threshold when to switch to " \ 163 "merged update-refs mode. Number is percentage relative to" \ 164 "duration(marking)+duration(update-refs).") \ 165 writeable(Always) \ 166 \ 167 experimental(uintx, ShenandoahMergeUpdateRefsMaxGap, 200, \ 168 "If GC is currently running in merged update-refs mode " \ 169 "this numbers gives the threshold when to switch to " \ 170 "separate update-refs mode. Number is percentage relative " \ 171 "to duration(marking)+duration(update-refs).") \ 172 writeable(Always) \ 173 \ 174 experimental(uintx, ShenandoahInitFreeThreshold, 30, \ 175 "Initial remaining free threshold for adaptive heuristics") \ 176 range(0,100) \ 177 \ 178 experimental(uintx, ShenandoahMinFreeThreshold, 3, \ 179 "Minimum remaining free threshold for adaptive heuristics") \ 180 range(0,100) \ 181 \ 182 experimental(uintx, ShenandoahMaxFreeThreshold, 70, \ 183 "Maximum remaining free threshold for adaptive heuristics") \ 184 range(0,100) \ 185 \ 186 experimental(uintx, ShenandoahImmediateThreshold, 90, \ 187 "If mark identifies more than this much immediate garbage " \ 188 "regions, it shall recycle them, and shall not continue the "\ 189 "rest of the GC cycle. The value is in percents of total " \ 190 "number of candidates for collection set. Setting this " \ 191 "threshold to 100% effectively disables this shortcut.") \ 192 range(0,100) \ 193 \ 194 experimental(uintx, ShenandoahGuaranteedGCInterval, 5*60*1000, \ 195 "Adaptive and dynamic heuristics would guarantee a GC cycle "\ 196 "at least with this interval. This is useful when large idle"\ 197 " intervals are present, where GC can run without stealing " \ 198 "time from active application. Time is in milliseconds.") \ 199 \ 200 experimental(uintx, ShenandoahHappyCyclesThreshold, 3, \ 201 "How many successful marking cycles before improving free " \ 202 "threshold for adaptive heuristics") \ 203 \ 204 experimental(uintx, ShenandoahPartialInboundThreshold, 10, \ 205 "Specifies how many inbound regions a region can have maximum " \ 206 "to be considered for collection set in partial collections.") \ 207 writeable(Always) \ 208 \ 209 experimental(uintx, ShenandoahMarkLoopStride, 1000, \ 210 "How many items are processed during one marking step") \ 211 \ 212 experimental(bool, ShenandoahConcurrentScanCodeRoots, true, \ 213 "Scan code roots concurrently, instead of during a pause") \ 214 \ 215 experimental(bool, ShenandoahConcurrentEvacCodeRoots, false, \ 216 "Evacuate code roots concurrently, instead of during a pause. " \ 217 "This requires ShenandoahBarriersForConst to be enabled.") \ 218 \ 219 experimental(uintx, ShenandoahCodeRootsStyle, 1, \ 220 "Use this style to scan code cache:" \ 221 " 0 - sequential iterator;" \ 222 " 1 - parallel iterator;" \ 223 " 2 - parallel iterator with filters;") \ 224 \ 225 experimental(bool, ShenandoahUncommit, true, \ 226 "Allow Shenandoah to uncommit unused memory.") \ 227 \ 228 experimental(uintx, ShenandoahUncommitDelay, 5*60*1000, \ 229 "Shenandoah would start to uncommit memory for regions that were"\ 230 " not used for more than this time. First use after that would " \ 231 "incur allocation stalls. Actively used regions would never be " \ 232 "uncommitted, because they never decay. Time is in milliseconds."\ 233 "Setting this delay to 0 effectively makes Shenandoah to " \ 234 "uncommit the regions almost immediately.") \ 235 \ 236 experimental(bool, ShenandoahUncommitWithIdle, false, \ 237 "Uncommit memory using MADV_DONTNEED.") \ 238 \ 239 experimental(bool, ShenandoahBarriersForConst, false, \ 240 "Emit barriers for constant oops in generated code, improving " \ 241 "throughput. If no barriers are emitted, GC will need to " \ 242 "pre-evacuate code roots before returning from STW, adding to " \ 243 "pause time.") \ 244 \ 245 experimental(bool, ShenandoahDontIncreaseWBFreq, true, \ 246 "Common 2 WriteBarriers or WriteBarrier and a ReadBarrier only " \ 247 "if the resulting WriteBarrier isn't executed more frequently") \ 248 \ 249 experimental(bool, ShenandoahNoLivenessFullGC, true, \ 250 "Skip liveness counting for mark during full GC.") \ 251 \ 252 experimental(bool, ShenandoahWriteBarrierToIR, true, \ 253 "Convert write barrier to IR instead of using assembly blob") \ 254 \ 255 experimental(bool, ShenandoahWriteBarrierCsetTestInIR, true, \ 256 "Perform cset test in IR rather than in the stub") \ 257 \ 258 experimental(bool, ShenandoahLoopOptsAfterExpansion, true, \ 259 "Attempt more loop opts after write barrier expansion") \ 260 \ 261 experimental(bool, ShenandoahWriteBarrierMemBar, true, \ 262 "Emit write barrier with membar for concurrent change of flag") \ 263 \ 264 experimental(bool, UseShenandoahOWST, true, \ 265 "Use Shenandoah work stealing termination protocol") \ 266 \ 267 experimental(size_t, ShenandoahSATBBufferSize, 1 * K, \ 268 "Number of entries in an SATB log buffer.") \ 269 range(1, max_uintx) \ 270 \ 271 experimental(int, ShenandoahRegionSamplingRate, 40, \ 272 "Sampling rate for heap region sampling. " \ 273 "Number of milliseconds between samples") \ 274 writeable(Always) \ 275 \ 276 experimental(bool, ShenandoahRegionSampling, false, \ 277 "Turns on heap region sampling via JVMStat") \ 278 writeable(Always) \ 279 \ 280 experimental(bool, ShenandoahFastSyncRoots, true, \ 281 "Enable fast synchronizer roots scanning") \ 282 \ 283 experimental(bool, ShenandoahMergeSafepointCleanup, false, \ 284 "Do safepoint cleanup piggy-backed on thread scans") \ 285 \ 286 experimental(uint, ParallelSafepointCleanupThreads, 0, \ 287 "Number of parallel threads used for safepoint cleanup") \ 288 \ 289 experimental(bool, ShenandoahPreclean, true, \ 290 "Do preclean phase before final mark") \ 291 \ 292 experimental(bool, ShenandoahSuspendibleWorkers, false, \ 293 "Suspend concurrent GC worker threads at safepoints") \ 294 \ 295 experimental(uintx, ShenandoahControlLoopInterval, 10, \ 296 "The sleep interval for control loop that drives the cycles. "\ 297 "Lower values would increase GC responsiveness to changing " \ 298 "heap conditions, at the expense of higher perf overhead. " \ 299 "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, ShenandoahConditionalSATBBarrier, false, \ 308 "Generate additional conc-mark-in-progress checks around SATB" \ 309 " barrier") \ 310 \ 311 diagnostic(bool, ShenandoahKeepAliveBarrier, true, \ 312 "Turn on/off keep alive barriers in Shenandoah") \ 313 \ 314 diagnostic(bool, ShenandoahWriteBarrier, true, \ 315 "Turn on/off write barriers in Shenandoah") \ 316 \ 317 diagnostic(bool, ShenandoahWriteBarrierRB, true, \ 318 "Turn on/off RB on WB fastpath in Shenandoah.") \ 319 \ 320 diagnostic(bool, ShenandoahReadBarrier, true, \ 321 "Turn on/off read barriers in Shenandoah") \ 322 \ 323 diagnostic(bool, ShenandoahStoreValEnqueueBarrier, false, \ 324 "Turn on/off enqueuing of oops for storeval barriers") \ 325 \ 326 diagnostic(bool, ShenandoahMWF, false, \ 327 "Turn on/off enqueuing of oops after write barriers (MWF)") \ 328 \ 329 diagnostic(bool, ShenandoahStoreValWriteBarrier, false, \ 330 "Turn on/off store val write barriers in Shenandoah") \ 331 \ 332 diagnostic(bool, ShenandoahStoreValReadBarrier, true, \ 333 "Turn on/off store val read barriers in Shenandoah") \ 334 \ 335 diagnostic(bool, ShenandoahCASBarrier, true, \ 336 "Turn on/off CAS barriers in Shenandoah") \ 337 \ 338 diagnostic(bool, ShenandoahAcmpBarrier, true, \ 339 "Turn on/off acmp barriers in Shenandoah") \ 340 \ 341 diagnostic(bool, ShenandoahCloneBarrier, true, \ 342 "Turn on/off clone barriers in Shenandoah") \ 343 \ 344 diagnostic(bool, UseShenandoahMatrix, false, \ 345 "Turn on/off Shenandoah connection matrix collection") \ 346 \ 347 diagnostic(bool, PrintShenandoahMatrix, false, \ 348 "Print connection matrix after marking") \ 349 \ 350 diagnostic(bool, ShenandoahStoreCheck, false, \ 351 "Emit additional code that checks objects are written to only" \ 352 " in to-space") \ 353 \ 354 diagnostic(bool, ShenandoahVerify, false, \ 355 "Verify the Shenandoah garbage collector") \ 356 \ 357 diagnostic(intx, ShenandoahVerifyLevel, 4, \ 358 "Shenandoah verification level: " \ 359 "0 = basic heap checks; " \ 360 "1 = previous level, plus basic region checks; " \ 361 "2 = previous level, plus all roots; " \ 362 "3 = previous level, plus all reachable objects; " \ 363 "4 = previous level, plus all marked objects") \ 364 \ 365 diagnostic(bool, ShenandoahAllocationTrace, false, \ 366 "Trace allocation latencies and stalls. Can be expensive when " \ 367 "lots of allocations happen, and may introduce scalability " \ 368 "bottlenecks.") \ 369 \ 370 diagnostic(intx, ShenandoahAllocationStallThreshold, 10000, \ 371 "When allocation tracing is enabled, the allocation stalls " \ 372 "larger than this threshold would be reported as warnings. " \ 373 "Time is in microseconds.") \ 374 \ 375 experimental(bool, ShenandoahCommonGCStateLoads, false, \ 376 "Enable commonning for GC state loads in generated code.") \ 377 \ 378 diagnostic(bool, ShenandoahConcMarkGC, true, \ 379 "Enable/disable inline concurrent mark GC.") \ 380 \ 381 develop(bool, VerifyStrictOopOperations, false, \ 382 "Verify that == and != are not used on oops. Only in fastdebug") \ 383 \ 384 develop(bool, ShenandoahVerifyOptoBarriers, false, \ 385 "Verify no missing barriers in c2") \ 386 \ 387 develop(int, ShenandoahFailHeapExpansionAfter, -1, \ 388 "Artificially fails heap expansion after specified times." \ 389 "Used to verify allocation handling. Default -1 to disable it.") \ 390 \ 391 product(bool, ShenandoahAlwaysPreTouch, false, \ 392 "Pre-touch heap memory, overrides global AlwaysPreTouch") \ 393 \ 394 experimental(intx, ShenandoahMarkScanPrefetch, 32, \ 395 "How many objects to prefetch ahead when traversing mark bitmaps." \ 396 "Set to 0 to disable prefetching.") \ 397 range(0, 256) \ 398 \ 399 experimental(intx, ShenandoahAllocGCTries, 5, \ 400 "How many times to try to do GC on allocation failure." \ 401 "Set to 0 to never try, and fail instead.") \ 402 range(0, 16) \ 403 \ 404 experimental(bool, ShenandoahHumongousMoves, true, \ 405 "Allow moving humongous regions. This makes GC more resistant " \ 406 "to external fragmentation that may otherwise fail other " \ 407 "humongous allocations, at the expense of higher GC copying " \ 408 "costs.") \ 409 \ 410 diagnostic(bool, ShenandoahOOMDuringEvacALot, false, \ 411 "Simulate OOM during evacuation frequently.") \ 412 \ 413 diagnostic(bool, ShenandoahAllocFailureALot, false, \ 414 "Make lots of artificial allocation failures.") \ 415 \ 416 diagnostic(bool, ShenandoahDegeneratedGC, true, \ 417 "Use Degenerated GC.") \ 418 \ 419 420 421 422 SHENANDOAH_FLAGS(DECLARE_DEVELOPER_FLAG, \ 423 DECLARE_PD_DEVELOPER_FLAG, \ 424 DECLARE_PRODUCT_FLAG, \ 425 DECLARE_PD_PRODUCT_FLAG, \ 426 DECLARE_DIAGNOSTIC_FLAG, \ 427 DECLARE_EXPERIMENTAL_FLAG, \ 428 DECLARE_NOTPRODUCT_FLAG, \ 429 DECLARE_MANAGEABLE_FLAG, \ 430 DECLARE_PRODUCT_RW_FLAG, \ 431 IGNORE_RANGE, \ 432 IGNORE_CONSTRAINT, \ 433 IGNORE_WRITEABLE) 434 435 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP