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, ShenandoahOptimizeFinals, true, \ 46 "Optimize barriers on final and stable fields/arrays. " \ 47 "Turn it off for maximum compatibility with reflection or JNI " \ 48 "code that manipulates final fields." \ 49 "Defaults to true. ") \ 50 \ 51 product(size_t, ShenandoahHeapRegionSize, 0, \ 52 "Size of the Shenandoah regions. " \ 53 "Determined automatically by default.") \ 54 \ 55 experimental(size_t, ShenandoahMinRegionSize, 256 * K, \ 56 "Minimum heap region size. ") \ 57 \ 58 experimental(size_t, ShenandoahMaxRegionSize, 32 * M, \ 59 "Maximum heap region size. ") \ 60 \ 61 experimental(intx, ShenandoahHumongousThreshold, 100, \ 62 "How large should the object be to get allocated in humongous " \ 63 "region, in percents of heap region size. This also caps the " \ 64 "maximum TLAB size.") \ 65 range(1, 100) \ 66 \ 67 experimental(size_t, ShenandoahTargetNumRegions, 2048, \ 68 "Target number of regions. We try to get around that many " \ 69 "regions, based on ShenandoahMinRegionSize and " \ 70 "ShenandoahMaxRegionSizeSize. ") \ 71 \ 72 product(bool, UseShenandoahMatrix, false, \ 73 "Keep a connection matrix and use this to drive collection sets") \ 74 \ 75 product(bool, PrintShenandoahMatrix, false, \ 76 "Print connection matrix after marking") \ 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 " *) dynamic - start concurrent GC based on amount of free heap,"\ 82 " allocation threshold, etc;" \ 83 " *) passive - do not start concurrent GC, wait for Full GC; " \ 84 " *) aggressive - run concurrent GC continuously, evacuate " \ 85 " everything;" \ 86 " *) connected - run partial cycles focusing on least connected " \ 87 " regions, along with adaptive concurrent GC;" \ 88 " *) generational - run partial cycles focusing on young regions,"\ 89 " along with adaptive concurrent GC), " \ 90 " *) LRU - run partial cycles focusing on old regions, along" \ 91 " with adaptive concurrent GC." \ 92 "Defaults to adaptive") \ 93 \ 94 experimental(ccstr, ShenandoahUpdateRefsEarly, "adaptive", \ 95 "Run a separate concurrent reference updating phase after" \ 96 "concurrent evacuation. Possible values: 'on', 'off', 'adaptive'")\ 97 \ 98 product(uintx, ShenandoahRefProcFrequency, 5, \ 99 "How often should (weak, soft, etc) references be processed. " \ 100 "References get processed at every Nth GC cycle. " \ 101 "Set to 0 to disable reference processing. " \ 102 "Defaults to process references every 5 cycles.") \ 103 \ 104 product(uintx, ShenandoahUnloadClassesFrequency, 5, \ 105 "How often should classes get unloaded. " \ 106 "Class unloading is performed at every Nth GC cycle. " \ 107 "Set to 0 to disable concurrent class unloading. " \ 108 "Defaults to unload classes every 5 cycles.") \ 109 \ 110 experimental(uintx, ShenandoahFullGCThreshold, 3, \ 111 "How many cycles in a row to do degenerated marking on " \ 112 "cancelled GC before triggering a full-gc" \ 113 "Defaults to 3") \ 114 writeable(Always) \ 115 \ 116 product_rw(uintx, ShenandoahGarbageThreshold, 60, \ 117 "Sets the percentage of garbage a region need to contain before " \ 118 "it can be marked for collection. Applies to " \ 119 "Shenandoah GC dynamic Heuristic mode only (ignored otherwise). " \ 120 "Defaults to 60%.") \ 121 range(0,100) \ 122 \ 123 product_rw(uintx, ShenandoahFreeThreshold, 10, \ 124 "Set the percentage of free heap at which a GC cycle is started. " \ 125 "Applies to Shenandoah GC dynamic Heuristic mode only " \ 126 "(ignored otherwise). Defaults to 10%.") \ 127 range(0,100) \ 128 \ 129 product_rw(uintx, ShenandoahCSetThreshold, 40, \ 130 "Set the approximate target percentage of the heap for the" \ 131 "collection set. Defaults to 40%.") \ 132 range(0,100) \ 133 \ 134 product_rw(uintx, ShenandoahAllocationThreshold, 0, \ 135 "Set percentage of memory allocated since last GC cycle before " \ 136 "a new GC cycle is started. " \ 137 "Applies to Shenandoah GC dynamic Heuristic mode only " \ 138 "(ignored otherwise). Defauls to 0%.") \ 139 range(0,100) \ 140 \ 141 product_rw(uintx, ShenandoahGenerationalYoungGenPercentage, 20, \ 142 "Percentage of the heap designated as young") \ 143 range(0,100) \ 144 \ 145 product_rw(uintx, ShenandoahLRUOldGenPercentage, 20, \ 146 "Percentage of the heap designated as old") \ 147 range(0,100) \ 148 \ 149 product_rw(uintx, ShenandoahConnectednessPercentage, 20, \ 150 "Percentage of the heap designated for connectedness") \ 151 range(0,100) \ 152 \ 153 experimental(uintx, ShenandoahMergeUpdateRefsMinGap, 100, \ 154 "If GC is currently running in separate update-refs mode " \ 155 "this numbers gives the threshold when to switch to " \ 156 "merged update-refs mode. Number is percentage relative to" \ 157 "duration(marking)+duration(update-refs).") \ 158 writeable(Always) \ 159 \ 160 experimental(uintx, ShenandoahMergeUpdateRefsMaxGap, 200, \ 161 "If GC is currently running in merged update-refs mode " \ 162 "this numbers gives the threshold when to switch to " \ 163 "separate update-refs mode. Number is percentage relative " \ 164 "to duration(marking)+duration(update-refs).") \ 165 writeable(Always) \ 166 \ 167 experimental(double, ShenandoahGCWorkerPerJavaThread, 0.5, \ 168 "Set GC worker to Java thread ratio when " \ 169 "UseDynamicNumberOfGCThreads is enabled") \ 170 range(0.1,10.0) \ 171 \ 172 experimental(uintx, ShenandoahInitFreeThreshold, 30, \ 173 "Initial remaining free threshold for adaptive heuristics") \ 174 range(0,100) \ 175 \ 176 experimental(uintx, ShenandoahMinFreeThreshold, 3, \ 177 "Minimum remaining free threshold for adaptive heuristics") \ 178 range(0,100) \ 179 \ 180 experimental(uintx, ShenandoahMaxFreeThreshold, 70, \ 181 "Maximum remaining free threshold for adaptive heuristics") \ 182 range(0,100) \ 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 range(0,100) \ 191 \ 192 experimental(uintx, ShenandoahGuaranteedGCInterval, 5*60*1000, \ 193 "Adaptive and dynamic heuristics would guarantee a GC cycle "\ 194 "at least with this interval. This is useful when large idle"\ 195 " intervals are present, where GC can run without stealing " \ 196 "time from active application. Time is in milliseconds.") \ 197 \ 198 experimental(uintx, ShenandoahHappyCyclesThreshold, 3, \ 199 "How many successful marking cycles before improving free " \ 200 "threshold for adaptive heuristics") \ 201 \ 202 experimental(uintx, ShenandoahPartialInboundThreshold, 10, \ 203 "Specifies how many inbound regions a region can have maximum " \ 204 "to be considered for collection set in partial collections.") \ 205 writeable(Always) \ 206 \ 207 experimental(uintx, ShenandoahMarkLoopStride, 1000, \ 208 "How many items are processed during one marking step") \ 209 \ 210 experimental(bool, ShenandoahConcurrentScanCodeRoots, true, \ 211 "Scan code roots concurrently, instead of during a pause") \ 212 \ 213 experimental(bool, ShenandoahConcurrentEvacCodeRoots, false, \ 214 "Evacuate code roots concurrently, instead of during a pause. " \ 215 "This requires ShenandoahBarriersForConst to be enabled.") \ 216 \ 217 experimental(uintx, ShenandoahCodeRootsStyle, 1, \ 218 "Use this style to scan code cache:" \ 219 " 0 - sequential iterator;" \ 220 " 1 - parallel iterator;" \ 221 " 2 - parallel iterator with filters;") \ 222 \ 223 experimental(uintx, ShenandoahUncommitDelay, 5*60*1000, \ 224 "Shenandoah would start to uncommit memory for regions that were"\ 225 " not used for more than this time. First use after that would " \ 226 "incur allocation stalls. Actively used regions would never be " \ 227 "uncommitted, because they never decay. Time is in milliseconds."\ 228 "Setting this delay to 0 effectively makes Shenandoah to " \ 229 "uncommit the regions almost immediately.") \ 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 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, ShenandoahReadBarrier, true, \ 294 "Turn on/off read barriers in Shenandoah") \ 295 \ 296 diagnostic(bool, ShenandoahStoreValBarrier, true, \ 297 "Turn on/off store val barriers in Shenandoah") \ 298 \ 299 diagnostic(bool, ShenandoahCASBarrier, true, \ 300 "Turn on/off CAS barriers in Shenandoah") \ 301 \ 302 diagnostic(bool, ShenandoahAcmpBarrier, true, \ 303 "Turn on/off acmp barriers in Shenandoah") \ 304 \ 305 diagnostic(bool, ShenandoahCloneBarrier, true, \ 306 "Turn on/off clone barriers in Shenandoah") \ 307 \ 308 diagnostic(bool, ShenandoahStoreCheck, false, \ 309 "Emit additional code that checks objects are written to only" \ 310 " in to-space") \ 311 \ 312 diagnostic(bool, ShenandoahVerify, false, \ 313 "Verify the Shenandoah garbage collector") \ 314 \ 315 diagnostic(intx, ShenandoahVerifyLevel, 4, \ 316 "Shenandoah verification level: " \ 317 "0 = basic heap checks; " \ 318 "1 = previous level, plus basic region checks; " \ 319 "2 = previous level, plus all roots; " \ 320 "3 = previous level, plus all reachable objects; " \ 321 "4 = previous level, plus all marked objects") \ 322 \ 323 diagnostic(bool, ShenandoahAllocationTrace, false, \ 324 "Trace allocation latencies and stalls. Can be expensive when " \ 325 "lots of allocations happen, and may introduce scalability " \ 326 "bottlenecks.") \ 327 \ 328 diagnostic(intx, ShenandoahAllocationStallThreshold, 10000, \ 329 "When allocation tracing is enabled, the allocation stalls " \ 330 "larger than this threshold would be reported as warnings. " \ 331 "Time is in microseconds.") \ 332 \ 333 diagnostic(bool, ShenandoahAsmWB, true, \ 334 "Enable/disable inline assembler write barrier code.") \ 335 \ 336 develop(bool, VerifyStrictOopOperations, false, \ 337 "Verify that == and != are not used on oops. Only in fastdebug") \ 338 \ 339 develop(bool, ShenandoahVerifyOptoBarriers, false, \ 340 "Verify no missing barriers in c2") \ 341 \ 342 develop(int, ShenandoahFailHeapExpansionAfter, -1, \ 343 "Artificially fails heap expansion after specified times." \ 344 "Used to verify allocation handling. Default -1 to disable it.") \ 345 \ 346 product(bool, ShenandoahAlwaysPreTouch, false, \ 347 "Pre-touch heap memory, overrides global AlwaysPreTouch") \ 348 \ 349 experimental(intx, ShenandoahMarkScanPrefetch, 32, \ 350 "How many objects to prefetch ahead when traversing mark bitmaps." \ 351 "Set to 0 to disable prefetching.") \ 352 range(0, 256) \ 353 \ 354 experimental(intx, ShenandoahFullGCTries, 3, \ 355 "How many times to try to do Full GC on allocation failure." \ 356 "Set to 0 to never try, and fail instead.") \ 357 range(0, 16) \ 358 359 360 SHENANDOAH_FLAGS(DECLARE_DEVELOPER_FLAG, \ 361 DECLARE_PD_DEVELOPER_FLAG, \ 362 DECLARE_PRODUCT_FLAG, \ 363 DECLARE_PD_PRODUCT_FLAG, \ 364 DECLARE_DIAGNOSTIC_FLAG, \ 365 DECLARE_EXPERIMENTAL_FLAG, \ 366 DECLARE_NOTPRODUCT_FLAG, \ 367 DECLARE_MANAGEABLE_FLAG, \ 368 DECLARE_PRODUCT_RW_FLAG, \ 369 IGNORE_RANGE, \ 370 IGNORE_CONSTRAINT, \ 371 IGNORE_WRITEABLE) 372 373 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP