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 "Defaults to adaptive") \ 91 \ 92 experimental(ccstr, ShenandoahUpdateRefsEarly, "adaptive", \ 93 "Run a separate concurrent reference updating phase after" \ 94 "concurrent evacuation. Possible values: 'on', 'off', 'adaptive'")\ 95 \ 96 experimental(uintx, ShenandoahEvacAssist, 10, \ 97 "How many objects to evacuate on WB assist path. " \ 98 "Use zero to disable.") \ 99 \ 100 product(uintx, ShenandoahRefProcFrequency, 5, \ 101 "How often should (weak, soft, etc) references be processed. " \ 102 "References get processed at every Nth GC cycle. " \ 103 "Set to 0 to disable reference processing. " \ 104 "Defaults to process references every 5 cycles.") \ 105 \ 106 product(uintx, ShenandoahUnloadClassesFrequency, 5, \ 107 "How often should classes get unloaded. " \ 108 "Class unloading is performed at every Nth GC cycle. " \ 109 "Set to 0 to disable concurrent class unloading. " \ 110 "Defaults to unload classes every 5 cycles.") \ 111 \ 112 experimental(uintx, ShenandoahFullGCThreshold, 3, \ 113 "How many back-to-back Degenerated GCs to do before triggering " \ 114 "a Full GC. Defaults to 3.") \ 115 writeable(Always) \ 116 \ 117 product_rw(uintx, ShenandoahGarbageThreshold, 60, \ 118 "Sets the percentage of garbage a region need to contain before " \ 119 "it can be marked for collection. Applies to " \ 120 "Shenandoah GC dynamic Heuristic mode only (ignored otherwise). " \ 121 "Defaults to 60%.") \ 122 range(0,100) \ 123 \ 124 product_rw(uintx, ShenandoahFreeThreshold, 10, \ 125 "Set the percentage of free heap at which a GC cycle is started. " \ 126 "Applies to Shenandoah GC dynamic Heuristic mode only " \ 127 "(ignored otherwise). Defaults to 10%.") \ 128 range(0,100) \ 129 \ 130 product_rw(uintx, ShenandoahAllocationThreshold, 0, \ 131 "Set percentage of memory allocated since last GC cycle before " \ 132 "a new GC cycle is started. " \ 133 "Applies to Shenandoah GC dynamic Heuristic mode only " \ 134 "(ignored otherwise). Defauls to 0%.") \ 135 range(0,100) \ 136 \ 137 experimental(uintx, ShenandoahMergeUpdateRefsMinGap, 100, \ 138 "If GC is currently running in separate update-refs mode " \ 139 "this numbers gives the threshold when to switch to " \ 140 "merged update-refs mode. Number is percentage relative to" \ 141 "duration(marking)+duration(update-refs).") \ 142 writeable(Always) \ 143 \ 144 experimental(uintx, ShenandoahMergeUpdateRefsMaxGap, 200, \ 145 "If GC is currently running in merged update-refs mode " \ 146 "this numbers gives the threshold when to switch to " \ 147 "separate update-refs mode. Number is percentage relative " \ 148 "to duration(marking)+duration(update-refs).") \ 149 writeable(Always) \ 150 \ 151 experimental(uintx, ShenandoahInitFreeThreshold, 70, \ 152 "Initial remaining free threshold for learning steps in " \ 153 "heuristics. In percents of total heap size.") \ 154 range(0,100) \ 155 \ 156 experimental(uintx, ShenandoahMinFreeThreshold, 10, \ 157 "Minimum remaining free threshold for adaptive heuristics") \ 158 range(0,100) \ 159 \ 160 experimental(uintx, ShenandoahLearningSteps, 5, \ 161 "Number of GC cycles to run in order to learn application " \ 162 "and GC performance for adaptive heuristics.") \ 163 range(0,100) \ 164 \ 165 experimental(uintx, ShenandoahAllocSpikeFactor, 5, \ 166 "The amount of heap space to reserve for absorbing the " \ 167 "allocation spikes. Larger value wastes more memory in " \ 168 "non-emergency cases, but provides more safety in emergency "\ 169 "cases. In percents of total heap size.") \ 170 range(0,100) \ 171 \ 172 experimental(uintx, ShenandoahEvacReserve, 5, \ 173 "Maximum amount of free space to reserve for evacuation. " \ 174 "Larger values make GC more aggressive, while leaving less " \ 175 "headroom for application to allocate in. " \ 176 "In percents of free space available.") \ 177 range(1,100) \ 178 \ 179 experimental(double, ShenandoahEvacWaste, 1.2, \ 180 "How much waste evacuations produce within the reserved " \ 181 "space. Larger values make evacuations more resilient " \ 182 "against allocation failures, at expense of smaller csets " \ 183 "on each cycle.") \ 184 range(1.0,100.0) \ 185 \ 186 experimental(bool, ShenandoahEvacReserveOverflow, true, \ 187 "Allow evacuations to overflow the reserved space. " \ 188 "Enabling it will make evacuations more resilient when " \ 189 "evacuation reserve/waste is incorrect, at the risk that " \ 190 "application allocations run out of memory too early.") \ 191 \ 192 experimental(uintx, ShenandoahImmediateThreshold, 90, \ 193 "If mark identifies more than this much immediate garbage " \ 194 "regions, it shall recycle them, and shall not continue the "\ 195 "rest of the GC cycle. The value is in percents of total " \ 196 "number of candidates for collection set. Setting this " \ 197 "threshold to 100% effectively disables this shortcut.") \ 198 range(0,100) \ 199 \ 200 experimental(uintx, ShenandoahGuaranteedGCInterval, 5*60*1000, \ 201 "Adaptive and dynamic heuristics would guarantee a GC cycle "\ 202 "at least with this interval. This is useful when large idle"\ 203 " intervals are present, where GC can run without stealing " \ 204 "time from active application. Time is in milliseconds.") \ 205 \ 206 experimental(uintx, ShenandoahHappyCyclesThreshold, 3, \ 207 "How many successful marking cycles before improving free " \ 208 "threshold for adaptive heuristics") \ 209 \ 210 experimental(uintx, ShenandoahMarkLoopStride, 1000, \ 211 "How many items are processed during one marking step") \ 212 \ 213 experimental(bool, ShenandoahConcurrentScanCodeRoots, true, \ 214 "Scan code roots concurrently, instead of during a pause") \ 215 \ 216 experimental(uintx, ShenandoahCodeRootsStyle, 2, \ 217 "Use this style to scan code cache:" \ 218 " 0 - sequential iterator;" \ 219 " 1 - parallel iterator;" \ 220 " 2 - parallel iterator with cset filters;") \ 221 \ 222 experimental(bool, ShenandoahUncommit, true, \ 223 "Allow Shenandoah to uncommit unused memory.") \ 224 \ 225 experimental(uintx, ShenandoahUncommitDelay, 5*60*1000, \ 226 "Shenandoah would start to uncommit memory for regions that were"\ 227 " not used for more than this time. First use after that would " \ 228 "incur allocation stalls. Actively used regions would never be " \ 229 "uncommitted, because they never decay. Time is in milliseconds."\ 230 "Setting this delay to 0 effectively makes Shenandoah to " \ 231 "uncommit the regions almost immediately.") \ 232 \ 233 experimental(bool, ShenandoahUncommitWithIdle, false, \ 234 "Uncommit memory using MADV_DONTNEED.") \ 235 \ 236 experimental(bool, ShenandoahDontIncreaseWBFreq, true, \ 237 "Common 2 WriteBarriers or WriteBarrier and a ReadBarrier only " \ 238 "if the resulting WriteBarrier isn't executed more frequently") \ 239 \ 240 experimental(bool, ShenandoahWriteBarrierCsetTestInIR, true, \ 241 "Perform cset test in IR rather than in the stub") \ 242 \ 243 experimental(bool, ShenandoahLoopOptsAfterExpansion, true, \ 244 "Attempt more loop opts after write barrier expansion") \ 245 \ 246 experimental(bool, UseShenandoahOWST, true, \ 247 "Use Shenandoah work stealing termination protocol") \ 248 \ 249 experimental(size_t, ShenandoahSATBBufferSize, 1 * K, \ 250 "Number of entries in an SATB log buffer.") \ 251 range(1, max_uintx) \ 252 \ 253 experimental(int, ShenandoahRegionSamplingRate, 40, \ 254 "Sampling rate for heap region sampling. " \ 255 "Number of milliseconds between samples") \ 256 writeable(Always) \ 257 \ 258 experimental(bool, ShenandoahRegionSampling, false, \ 259 "Turns on heap region sampling via JVMStat") \ 260 writeable(Always) \ 261 \ 262 experimental(bool, ShenandoahFastSyncRoots, true, \ 263 "Enable fast synchronizer roots scanning") \ 264 \ 265 experimental(bool, ShenandoahMergeSafepointCleanup, false, \ 266 "Do safepoint cleanup piggy-backed on thread scans") \ 267 \ 268 experimental(uint, ParallelSafepointCleanupThreads, 4, \ 269 "Number of parallel threads used for safepoint cleanup") \ 270 \ 271 experimental(bool, ShenandoahPreclean, true, \ 272 "Do preclean phase before final mark") \ 273 \ 274 experimental(bool, ShenandoahSuspendibleWorkers, false, \ 275 "Suspend concurrent GC worker threads at safepoints") \ 276 \ 277 experimental(uintx, ShenandoahControlIntervalMin, 1, \ 278 "The minumum sleep interval for control loop that drives " \ 279 "the cycles. Lower values would increase GC responsiveness " \ 280 "to changing heap conditions, at the expense of higher perf " \ 281 "overhead. Time is in milliseconds.") \ 282 \ 283 experimental(uintx, ShenandoahControlIntervalMax, 10, \ 284 "The maximum sleep interval for control loop that drives " \ 285 "the cycles. Lower values would increase GC responsiveness " \ 286 "to changing heap conditions, at the expense of higher perf " \ 287 "overhead. Time is in milliseconds.") \ 288 \ 289 experimental(uintx, ShenandoahControlIntervalAdjustPeriod, 1000, \ 290 "The time period for one step in control loop interval " \ 291 "adjustment. Lower values make adjustments faster, at the " \ 292 "expense of higher perf overhead. Time is in milliseconds.") \ 293 \ 294 diagnostic(bool, ShenandoahSATBBarrier, true, \ 295 "Turn on/off SATB barriers in Shenandoah") \ 296 \ 297 diagnostic(bool, ShenandoahKeepAliveBarrier, true, \ 298 "Turn on/off keep alive barriers in Shenandoah") \ 299 \ 300 diagnostic(bool, ShenandoahWriteBarrier, true, \ 301 "Turn on/off write barriers in Shenandoah") \ 302 \ 303 diagnostic(bool, ShenandoahWriteBarrierRB, true, \ 304 "Turn on/off RB on WB fastpath in Shenandoah.") \ 305 \ 306 diagnostic(bool, ShenandoahReadBarrier, true, \ 307 "Turn on/off read barriers in Shenandoah") \ 308 \ 309 diagnostic(bool, ShenandoahStoreValEnqueueBarrier, false, \ 310 "Turn on/off enqueuing of oops for storeval barriers") \ 311 \ 312 diagnostic(bool, ShenandoahStoreValReadBarrier, true, \ 313 "Turn on/off store val read barriers in Shenandoah") \ 314 \ 315 diagnostic(bool, ShenandoahCASBarrier, true, \ 316 "Turn on/off CAS barriers in Shenandoah") \ 317 \ 318 diagnostic(bool, ShenandoahAcmpBarrier, true, \ 319 "Turn on/off acmp barriers in Shenandoah") \ 320 \ 321 diagnostic(bool, ShenandoahCloneBarrier, true, \ 322 "Turn on/off clone barriers in Shenandoah") \ 323 \ 324 diagnostic(bool, ShenandoahStoreCheck, false, \ 325 "Emit additional code that checks objects are written to only" \ 326 " in to-space") \ 327 \ 328 diagnostic(bool, ShenandoahVerify, false, \ 329 "Verify the Shenandoah garbage collector") \ 330 \ 331 diagnostic(intx, ShenandoahVerifyLevel, 4, \ 332 "Shenandoah verification level: " \ 333 "0 = basic heap checks; " \ 334 "1 = previous level, plus basic region checks; " \ 335 "2 = previous level, plus all roots; " \ 336 "3 = previous level, plus all reachable objects; " \ 337 "4 = previous level, plus all marked objects") \ 338 \ 339 diagnostic(bool, ShenandoahAllocationTrace, false, \ 340 "Trace allocation latencies and stalls. Can be expensive when " \ 341 "lots of allocations happen, and may introduce scalability " \ 342 "bottlenecks.") \ 343 \ 344 diagnostic(intx, ShenandoahAllocationStallThreshold, 10000, \ 345 "When allocation tracing is enabled, the allocation stalls " \ 346 "larger than this threshold would be reported as warnings. " \ 347 "Time is in microseconds.") \ 348 \ 349 experimental(bool, ShenandoahCommonGCStateLoads, false, \ 350 "Enable commonning for GC state loads in generated code.") \ 351 \ 352 develop(bool, VerifyStrictOopOperations, false, \ 353 "Verify that == and != are not used on oops. Only in fastdebug") \ 354 \ 355 develop(bool, ShenandoahVerifyOptoBarriers, false, \ 356 "Verify no missing barriers in c2") \ 357 \ 358 develop(int, ShenandoahFailHeapExpansionAfter, -1, \ 359 "Artificially fails heap expansion after specified times." \ 360 "Used to verify allocation handling. Default -1 to disable it.") \ 361 \ 362 product(bool, ShenandoahAlwaysPreTouch, false, \ 363 "Pre-touch heap memory, overrides global AlwaysPreTouch") \ 364 \ 365 experimental(intx, ShenandoahMarkScanPrefetch, 32, \ 366 "How many objects to prefetch ahead when traversing mark bitmaps." \ 367 "Set to 0 to disable prefetching.") \ 368 range(0, 256) \ 369 \ 370 experimental(bool, ShenandoahHumongousMoves, true, \ 371 "Allow moving humongous regions. This makes GC more resistant " \ 372 "to external fragmentation that may otherwise fail other " \ 373 "humongous allocations, at the expense of higher GC copying " \ 374 "costs.") \ 375 \ 376 diagnostic(bool, ShenandoahOOMDuringEvacALot, false, \ 377 "Simulate OOM during evacuation frequently.") \ 378 \ 379 diagnostic(bool, ShenandoahAllocFailureALot, false, \ 380 "Make lots of artificial allocation failures.") \ 381 \ 382 diagnostic(bool, ShenandoahDegeneratedGC, true, \ 383 "Use Degenerated GC.") \ 384 \ 385 experimental(bool, ShenandoahPacing, true, \ 386 "Pace application allocations to give GC chance to start " \ 387 "and complete.") \ 388 \ 389 experimental(uintx, ShenandoahPacingMaxDelay, 10, \ 390 "Max delay for pacing application allocations. " \ 391 "Time is in milliseconds.") \ 392 \ 393 experimental(uintx, ShenandoahPacingIdleSlack, 2, \ 394 "Percent of heap counted as non-taxable allocations during idle. "\ 395 "Larger value makes the pacing milder during idle phases, " \ 396 "requiring less rendezvous with control thread. Lower value " \ 397 "makes the pacing control less responsive to out-of-cycle allocs.")\ 398 range(0, 100) \ 399 \ 400 experimental(uintx, ShenandoahPacingCycleSlack, 10, \ 401 "Percent of free space taken as non-taxable allocations during " \ 402 "the GC cycle. Larger value makes the pacing milder at the " \ 403 "beginning of the GC cycle. Lower value makes the pacing less " \ 404 "uniform during the cycle.") \ 405 range(0, 100) \ 406 \ 407 experimental(double, ShenandoahPacingSurcharge, 1.1, \ 408 "Additional pacing tax surcharge to help unclutter the heap. " \ 409 "Larger values makes the pacing more aggressive. Lower values " \ 410 "risk GC cycles finish with less memory than were available at " \ 411 "the beginning of it.") \ 412 range(1.0, 100.0) \ 413 \ 414 experimental(uintx, ShenandoahCriticalFreeThreshold, 1, \ 415 "Percent of heap that needs to be free after recovery cycles, " \ 416 "either Degenerated or Full GC. If this much space is not " \ 417 "available, next recovery step would triggered.") \ 418 range(0, 100) \ 419 \ 420 experimental(uintx, ShenandoahSATBBufferFlushInterval, 100, \ 421 "Forcefully flush non-empty SATB buffers at this interval. " \ 422 "Time is in milliseconds.") \ 423 \ 424 diagnostic(bool, ShenandoahAllowMixedAllocs, true, \ 425 "Allow mixing mutator and collector allocations in a single " \ 426 "region") \ 427 \ 428 diagnostic(bool, ShenandoahTerminationTrace, false, \ 429 "Tracing task termination timings") \ 430 \ 431 diagnostic(bool, ShenandoahElasticTLAB, true, \ 432 "Use Elastic TLABs with Shenandoah") \ 433 \ 434 diagnostic(bool, ShenandoahCompileCheck, false, \ 435 "Assert that methods are successfully compilable") \ 436 \ 437 experimental(bool, ShenandoahAlwaysClearSoftRefs, false, \ 438 "Clear soft references unconditionally") \ 439 440 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP