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 \ 39 product(bool, ShenandoahOptimizeStaticFinals, true, \ 40 "Optimize barriers on static final fields. " \ 41 "Turn it off for maximum compatibility with reflection or JNI " \ 42 "code that manipulates final fields.") \ 43 \ 44 product(bool, ShenandoahOptimizeInstanceFinals, false, \ 45 "Optimize barriers on final instance fields." \ 46 "Turn it off for maximum compatibility with reflection or JNI " \ 47 "code that manipulates final fields.") \ 48 \ 49 product(bool, ShenandoahOptimizeStableFinals, false, \ 50 "Optimize barriers on stable fields." \ 51 "Turn it off for maximum compatibility with reflection or JNI " \ 52 "code that manipulates final fields.") \ 53 \ 54 product(uintx, ShenandoahHeapRegionSize, 0, \ 55 "Size of the Shenandoah regions. " \ 56 "Determined automatically by default.") \ 57 \ 58 experimental(uintx, ShenandoahMinRegionSize, 256 * K, \ 59 "Minimum heap region size. ") \ 60 \ 61 experimental(uintx, ShenandoahMaxRegionSize, 32 * M, \ 62 "Maximum heap region size. ") \ 63 \ 64 experimental(intx, ShenandoahHumongousThreshold, 100, \ 65 "How large should the object be to get allocated in humongous " \ 66 "region, in percents of heap region size. This also caps the " \ 67 "maximum TLAB size.") \ 68 \ 69 experimental(uintx, ShenandoahTargetNumRegions, 2048, \ 70 "Target number of regions. We try to get around that many " \ 71 "regions, based on ShenandoahMinRegionSize and " \ 72 "ShenandoahMaxRegionSizeSize. ") \ 73 \ 74 product(ccstr, ShenandoahGCHeuristics, "adaptive", \ 75 "The heuristics to use in Shenandoah GC. Possible values: " \ 76 "adaptive (adapt to maintain the given amount of free memory), " \ 77 "static (start concurrent GC when static free heap threshold " \ 78 "and static allocation threshold are tripped), " \ 79 "passive (do not start concurrent GC, wait for Full GC) " \ 80 "aggressive (run concurrent GC continuously, evacuate everything), " \ 81 "compact (run GC with lower footprint target)." \ 82 "Defaults to adaptive") \ 83 \ 84 experimental(ccstr, ShenandoahUpdateRefsEarly, "adaptive", \ 85 "Run a separate concurrent reference updating phase after" \ 86 "concurrent evacuation. Possible values: 'on', 'off', 'adaptive'")\ 87 \ 88 experimental(uintx, ShenandoahEvacAssist, 10, \ 89 "How many objects to evacuate on WB assist path. " \ 90 "Use zero to disable.") \ 91 \ 92 product(uintx, ShenandoahRefProcFrequency, 5, \ 93 "How often should (weak, soft, etc) references be processed. " \ 94 "References get processed at every Nth GC cycle. " \ 95 "Set to 0 to disable reference processing. " \ 96 "Defaults to process references every 5 cycles.") \ 97 \ 98 product(uintx, ShenandoahUnloadClassesFrequency, 5, \ 99 "How often should classes get unloaded. " \ 100 "Class unloading is performed at every Nth GC cycle. " \ 101 "Set to 0 to disable concurrent class unloading. " \ 102 "Defaults to unload classes every 5 cycles.") \ 103 \ 104 product(bool, ShenandoahLogTrace, false, \ 105 "Turns on logging in Shenandoah at trace level. ") \ 106 \ 107 product(bool, ShenandoahLogDebug, false, \ 108 "Turns on logging in Shenandoah at debug level. ") \ 109 \ 110 product(bool, ShenandoahLogInfo, false, \ 111 "Turns on logging in Shenandoah at info level. ") \ 112 \ 113 product(bool, ShenandoahLogWarning, false, \ 114 "Turns on logging in Shenandoah at warning level. ") \ 115 \ 116 product_rw(uintx, ShenandoahFullGCThreshold, 3, \ 117 "How many back-to-back Degenerated GCs to do before triggering " \ 118 "a Full GC. Defaults to 3.") \ 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 \ 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 \ 131 product_rw(uintx, ShenandoahAllocationThreshold, 0, \ 132 "Set percentage of memory allocated since last GC cycle before " \ 133 "a new GC cycle is started. " \ 134 "Applies to Shenandoah GC dynamic Heuristic mode only " \ 135 "(ignored otherwise). Defauls to 0%.") \ 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 \ 143 experimental(uintx, ShenandoahMergeUpdateRefsMaxGap, 200, \ 144 "If GC is currently running in merged update-refs mode " \ 145 "this numbers gives the threshold when to switch to " \ 146 "separate update-refs mode. Number is percentage relative " \ 147 "to duration(marking)+duration(update-refs).") \ 148 \ 149 experimental(uintx, ShenandoahInitFreeThreshold, 70, \ 150 "Initial remaining free threshold for learning steps in " \ 151 "heuristics. In percents of total heap size.") \ 152 \ 153 experimental(uintx, ShenandoahMinFreeThreshold, 10, \ 154 "Minimum remaining free threshold for adaptive heuristics") \ 155 \ 156 experimental(uintx, ShenandoahLearningSteps, 5, \ 157 "Number of GC cycles to run in order to learn application " \ 158 "and GC performance for adaptive heuristics.") \ 159 \ 160 experimental(uintx, ShenandoahAllocSpikeFactor, 5, \ 161 "The amount of heap space to reserve for absorbing the " \ 162 "allocation spikes. Larger value wastes more memory in " \ 163 "non-emergency cases, but provides more safety in emergency "\ 164 "cases. In percents of total heap size.") \ 165 \ 166 experimental(uintx, ShenandoahEvacReserve, 5, \ 167 "Maximum amount of free space to reserve for evacuation. " \ 168 "Larger values make GC more aggressive, while leaving less " \ 169 "headroom for application to allocate in. " \ 170 "In percents of free space available.") \ 171 \ 172 experimental(double, ShenandoahEvacWaste, 1.2, \ 173 "How much waste evacuations produce within the reserved " \ 174 "space. Larger values make evacuations more resilient " \ 175 "against allocation failures, at expense of smaller csets " \ 176 "on each cycle.") \ 177 \ 178 experimental(bool, ShenandoahEvacReserveOverflow, true, \ 179 "Allow evacuations to overflow the reserved space. " \ 180 "Enabling it will make evacuations more resilient when " \ 181 "evacuation reserve/waste is incorrect, at the risk that " \ 182 "application allocations run out of memory too early.") \ 183 \ 184 experimental(uintx, ShenandoahImmediateThreshold, 90, \ 185 "If mark identifies more than this much immediate garbage " \ 186 "regions, it shall recycle them, and shall not continue the "\ 187 "rest of the GC cycle. The value is in percents of total " \ 188 "number of candidates for collection set. Setting this " \ 189 "threshold to 100% effectively disables this shortcut.") \ 190 \ 191 experimental(uintx, ShenandoahGuaranteedGCInterval, 5*60*1000, \ 192 "Adaptive and dynamic heuristics would guarantee a GC cycle "\ 193 "at least with this interval. This is useful when large idle"\ 194 " intervals are present, where GC can run without stealing " \ 195 "time from active application. Time is in milliseconds.") \ 196 \ 197 experimental(uintx, ShenandoahHappyCyclesThreshold, 3, \ 198 "How many successful marking cycles before improving free " \ 199 "threshold for adaptive heuristics") \ 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(uintx, ShenandoahCodeRootsStyle, 2, \ 208 "Use this style to scan code cache:" \ 209 " 0 - sequential iterator;" \ 210 " 1 - parallel iterator;" \ 211 " 2 - parallel iterator with cset filters;") \ 212 \ 213 experimental(bool, ShenandoahUncommit, true, \ 214 "Allow Shenandoah to uncommit unused memory.") \ 215 \ 216 experimental(uintx, ShenandoahUncommitDelay, 5*60*1000, \ 217 "Shenandoah would start to uncommit memory for regions that were"\ 218 " not used for more than this time. First use after that would " \ 219 "incur allocation stalls. Actively used regions would never be " \ 220 "uncommitted, because they never decay. Time is in milliseconds."\ 221 "Setting this delay to 0 effectively makes Shenandoah to " \ 222 "uncommit the regions almost immediately.") \ 223 \ 224 experimental(bool, ShenandoahDontIncreaseWBFreq, true, \ 225 "Common 2 WriteBarriers or WriteBarrier and a ReadBarrier only " \ 226 "if the resulting WriteBarrier isn't executed more frequently") \ 227 \ 228 experimental(bool, ShenandoahWriteBarrierCsetTestInIR, true, \ 229 "Perform cset test in IR rather than in the stub") \ 230 \ 231 experimental(bool, UseShenandoahOWST, true, \ 232 "Use Shenandoah work stealing termination protocol") \ 233 \ 234 experimental(size_t, ShenandoahSATBBufferSize, 1 * K, \ 235 "Number of entries in an SATB log buffer.") \ 236 \ 237 product_rw(int, ShenandoahRegionSamplingRate, 40, \ 238 "Sampling rate for heap region sampling. " \ 239 "Number of milliseconds between samples") \ 240 \ 241 product_rw(bool, ShenandoahRegionSampling, false, \ 242 "Turns on heap region sampling via JVMStat") \ 243 \ 244 experimental(uintx, ShenandoahControlIntervalMin, 1, \ 245 "The minumum sleep interval for control loop that drives " \ 246 "the cycles. Lower values would increase GC responsiveness " \ 247 "to changing heap conditions, at the expense of higher perf " \ 248 "overhead. Time is in milliseconds.") \ 249 \ 250 experimental(uintx, ShenandoahControlIntervalMax, 10, \ 251 "The maximum sleep interval for control loop that drives " \ 252 "the cycles. Lower values would increase GC responsiveness " \ 253 "to changing heap conditions, at the expense of higher perf " \ 254 "overhead. Time is in milliseconds.") \ 255 \ 256 experimental(uintx, ShenandoahControlIntervalAdjustPeriod, 1000, \ 257 "The time period for one step in control loop interval " \ 258 "adjustment. Lower values make adjustments faster, at the " \ 259 "expense of higher perf overhead. Time is in milliseconds.") \ 260 \ 261 diagnostic(bool, ShenandoahSATBBarrier, true, \ 262 "Turn on/off SATB barriers in Shenandoah") \ 263 \ 264 diagnostic(bool, ShenandoahWriteBarrier, true, \ 265 "Turn on/off write barriers in Shenandoah") \ 266 \ 267 diagnostic(bool, ShenandoahWriteBarrierRB, true, \ 268 "Turn on/off RB on WB fastpath in Shenandoah.") \ 269 \ 270 diagnostic(bool, ShenandoahReadBarrier, true, \ 271 "Turn on/off read barriers in Shenandoah") \ 272 \ 273 diagnostic(bool, ShenandoahCASBarrier, true, \ 274 "Turn on/off CAS barriers in Shenandoah") \ 275 \ 276 diagnostic(bool, ShenandoahAcmpBarrier, true, \ 277 "Turn on/off acmp barriers in Shenandoah") \ 278 \ 279 diagnostic(bool, ShenandoahCloneBarrier, true, \ 280 "Turn on/off clone barriers in Shenandoah") \ 281 \ 282 diagnostic(bool, ShenandoahStoreCheck, false, \ 283 "Emit additional code that checks objects are written to only" \ 284 " in to-space") \ 285 \ 286 diagnostic(bool, ShenandoahVerify, false, \ 287 "Verify the Shenandoah garbage collector") \ 288 \ 289 diagnostic(intx, ShenandoahVerifyLevel, 4, \ 290 "Shenandoah verification level: " \ 291 "0 = basic heap checks; " \ 292 "1 = previous level, plus basic region checks; " \ 293 "2 = previous level, plus all roots; " \ 294 "3 = previous level, plus all reachable objects; " \ 295 "4 = previous level, plus all marked objects") \ 296 \ 297 diagnostic(bool, ShenandoahAllocationTrace, false, \ 298 "Trace allocation latencies and stalls. Can be expensive when " \ 299 "lots of allocations happen, and may introduce scalability " \ 300 "bottlenecks.") \ 301 \ 302 diagnostic(intx, ShenandoahAllocationStallThreshold, 10000, \ 303 "When allocation tracing is enabled, the allocation stalls " \ 304 "larger than this threshold would be reported as warnings. " \ 305 "Time is in microseconds.") \ 306 \ 307 develop(bool, VerifyObjectEquals, false, \ 308 "Verify that == and != are not used on oops. Only in fastdebug") \ 309 \ 310 develop(bool, ShenandoahVerifyOptoBarriers, false, \ 311 "Verify no missing barriers in c2") \ 312 \ 313 develop(intx, ShenandoahFailHeapExpansionAfter, -1, \ 314 "Artificially fails heap expansion after specified times." \ 315 "Used to verify allocation handling. Default -1 to disable it.") \ 316 \ 317 product(bool, ShenandoahAlwaysPreTouch, false, \ 318 "Pre-touch heap memory, overrides global AlwaysPreTouch") \ 319 \ 320 experimental(intx, ShenandoahMarkScanPrefetch, 32, \ 321 "How many objects to prefetch ahead when traversing mark bitmaps." \ 322 "Set to 0 to disable prefetching.") \ 323 \ 324 experimental(bool, ShenandoahFastSyncRoots, true, \ 325 "Enable fast synchronizer roots scanning") \ 326 \ 327 experimental(bool, ShenandoahPreclean, true, \ 328 "Do preclean phase before final mark") \ 329 \ 330 experimental(bool, ShenandoahHumongousMoves, true, \ 331 "Allow moving humongous regions. This makes GC more resistant " \ 332 "to external fragmentation that may otherwise fail other " \ 333 "humongous allocations, at the expense of higher GC copying " \ 334 "costs.") \ 335 \ 336 diagnostic(bool, ShenandoahOOMDuringEvacALot, false, \ 337 "Simulate OOM during evacuation frequently.") \ 338 \ 339 diagnostic(bool, ShenandoahAllocFailureALot, false, \ 340 "Make lots of artificial allocation failures.") \ 341 \ 342 diagnostic(bool, ShenandoahDegeneratedGC, true, \ 343 "Use Degenerated GC.") \ 344 \ 345 experimental(bool, ShenandoahPacing, true, \ 346 "Pace application allocations to give GC chance to start " \ 347 "and complete.") \ 348 \ 349 experimental(uintx, ShenandoahPacingMaxDelay, 10, \ 350 "Max delay for pacing application allocations. " \ 351 "Time is in milliseconds.") \ 352 \ 353 experimental(uintx, ShenandoahPacingIdleSlack, 2, \ 354 "Percent of heap counted as non-taxable allocations during idle. "\ 355 "Larger value makes the pacing milder during idle phases, " \ 356 "requiring less rendezvous with control thread. Lower value " \ 357 "makes the pacing control less responsive to out-of-cycle allocs.")\ 358 \ 359 experimental(uintx, ShenandoahPacingCycleSlack, 10, \ 360 "Percent of free space taken as non-taxable allocations during " \ 361 "the GC cycle. Larger value makes the pacing milder at the " \ 362 "beginning of the GC cycle. Lower value makes the pacing less " \ 363 "uniform during the cycle.") \ 364 \ 365 experimental(double, ShenandoahPacingSurcharge, 1.1, \ 366 "Additional pacing tax surcharge to help unclutter the heap. " \ 367 "Larger values makes the pacing more aggressive. Lower values " \ 368 "risk GC cycles finish with less memory than were available at " \ 369 "the beginning of it.") \ 370 \ 371 experimental(uintx, ShenandoahCriticalFreeThreshold, 1, \ 372 "Percent of heap that needs to be free after recovery cycles, " \ 373 "either Degenerated or Full GC. If this much space is not " \ 374 "available, next recovery step would triggered.") \ 375 \ 376 experimental(uintx, ShenandoahSATBBufferFlushInterval, 100, \ 377 "Forcefully flush non-empty SATB buffers at this interval. " \ 378 "Time is in milliseconds.") \ 379 \ 380 diagnostic(bool, ShenandoahAllowMixedAllocs, true, \ 381 "Allow mixing mutator and collector allocations in a single " \ 382 "region") \ 383 \ 384 diagnostic(bool, ShenandoahTerminationTrace, false, \ 385 "Tracing task termination timings") \ 386 \ 387 diagnostic(bool, ShenandoahElasticTLAB, true, \ 388 "Use Elastic TLABs with Shenandoah") \ 389 \ 390 diagnostic(bool, ShenandoahCompileCheck, false, \ 391 "Assert that methods are successfully compilable") \ 392 \ 393 experimental(bool, ShenandoahAlwaysClearSoftRefs, false, \ 394 "Clear soft references unconditionally") \ 395 396 SHENANDOAH_FLAGS(DECLARE_DEVELOPER_FLAG, \ 397 DECLARE_PD_DEVELOPER_FLAG, \ 398 DECLARE_PRODUCT_FLAG, \ 399 DECLARE_PD_PRODUCT_FLAG, \ 400 DECLARE_DIAGNOSTIC_FLAG, \ 401 DECLARE_EXPERIMENTAL_FLAG, \ 402 DECLARE_NOTPRODUCT_FLAG, \ 403 DECLARE_MANAGEABLE_FLAG, \ 404 DECLARE_PRODUCT_RW_FLAG) 405 406 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP