1 /*
  2  * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
  3  * Copyright (c) 2016, 2021, Red Hat, Inc. All rights reserved.
  4  * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
  5  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  6  *
  7  * This code is free software; you can redistribute it and/or modify it
  8  * under the terms of the GNU General Public License version 2 only, as
  9  * published by the Free Software Foundation.
 10  *
 11  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  * version 2 for more details (a copy is included in the LICENSE file that
 15  * accompanied this code).
 16  *
 17  * You should have received a copy of the GNU General Public License version
 18  * 2 along with this work; if not, write to the Free Software Foundation,
 19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  *
 21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22  * or visit www.oracle.com if you need additional information or have any
 23  * questions.
 24  *
 25  */
 26 
 27 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP
 28 #define SHARE_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP
 29 
 30 #define GC_SHENANDOAH_FLAGS(develop,                                        \
 31                             develop_pd,                                     \
 32                             product,                                        \
 33                             product_pd,                                     \
 34                             range,                                          \
 35                             constraint)                                     \
 36                                                                             \
 37   product(uint, ShenandoahAccelerationSamplePeriod, 15, EXPERIMENTAL,       \
 38           "When at least this much time (measured in ms) has passed "       \
 39           "since the acceleration allocation rate was most recently "       \
 40           "sampled, capture another allocation rate sample for the purpose "\
 41           "of detecting acceleration or momentary spikes in allocation "    \
 42           "rate. A smaller value allows quicker response to changes in "    \
 43           "allocation rates but is more vulnerable to noise and requires "  \
 44           "more monitoring effort.")                                        \
 45           range(1, 1000)                                                    \
 46                                                                             \
 47   product(uint, ShenandoahRateAccelerationSampleSize, 8, EXPERIMENTAL,      \
 48           "In selected ShenandoahControlIntervals "                         \
 49           "(if ShenandoahAccelerationSamplePeriod ms have passed "          \
 50           "since previous allocation rate sample), "                        \
 51           "we compute the allocation rate since the previous rate was "     \
 52           "sampled.  This many samples are analyzed to determine whether "  \
 53           "allocation rates are accelerating.  Acceleration may occur "     \
 54           "due to increasing client demand or due to phase changes in "     \
 55           "an application.  A larger value reduces sensitivity to "         \
 56           "noise and delays recognition of the accelerating trend.  A "     \
 57           "larger value may also cause the heuristic to miss detection "    \
 58           "of very quick accelerations.  Smaller values may cause random "  \
 59           "noise to be perceived as acceleration of allocation rate, "      \
 60           "triggering excess collections.  Note that the acceleration "     \
 61           "need not last the entire span of the sampled duration to be "    \
 62           "detected.  If the last several of all samples are signficantly " \
 63           "larger than the other samples, the best fit line through all "   \
 64           "sampled values will have an upward slope, manifesting as "       \
 65           "acceleration.")                                                  \
 66           range(1,64)                                                       \
 67                                                                             \
 68   product(uint, ShenandoahMomentaryAllocationRateSpikeSampleSize,           \
 69           2, EXPERIMENTAL,                                                  \
 70           "In selected ShenandoahControlIntervals "                         \
 71           "(if ShenandoahAccelerationSamplePeriod ms have passed "          \
 72           "since previous allocation rate sample), we compute "             \
 73           "the allocation rate since the previous rate was sampled. "       \
 74           "The weighted average of this "                                   \
 75           "many most recent momentary allocation rate samples is compared " \
 76           "against current allocation runway and anticipated GC time to "   \
 77           "determine whether a spike in momentary allocation rate "         \
 78           "justifies an early GC trigger.  Momentary allocation spike "     \
 79           "detection is in addition to previously implemented "             \
 80           "ShenandoahAdaptiveInitialSpikeThreshold, the latter of which "   \
 81           "is more effective at detecting slower spikes.  The latter "      \
 82           "spike detection samples at the rate specifieid by "              \
 83           "ShenandoahAdaptiveSampleFrequencyHz.  The value of this "        \
 84           "parameter must be less than the value of "                       \
 85           "ShenandoahRateAccelerationSampleSize.  A larger value makes "    \
 86           "momentary spike detection less sensitive.  A smaller value "     \
 87           "may result in excessive GC triggers.")                           \
 88           range(1,64)                                                       \
 89                                                                             \
 90   product(uintx, ShenandoahGenerationalMinPIPUsage, 30, EXPERIMENTAL,       \
 91           "(Generational mode only) What percent of a heap region "         \
 92           "should be used before we consider promoting a region in "        \
 93           "place?  Regions with less than this amount of used will "        \
 94           "promoted by evacuation.  A benefit of promoting in place "       \
 95           "is that less work is required by the GC at the time the "        \
 96           "region is promoted.  A disadvantage of promoting in place "      \
 97           "is that this introduces fragmentation of old-gen memory, "       \
 98           "with old-gen regions scattered throughout the heap.  Regions "   \
 99           "that have been promoted in place may need to be evacuated at "   \
100           "a later time in order to compact old-gen memory to enable "      \
101           "future humongous allocations.")                                  \
102           range(0,100)                                                      \
103                                                                             \
104   product(uintx, ShenandoahGenerationalHumongousReserve, 0, EXPERIMENTAL,   \
105           "(Generational mode only) What percent of the heap should be "    \
106           "reserved for humongous objects if possible.  Old-generation "    \
107           "collections will endeavor to evacuate old-gen regions within "   \
108           "this reserved area even if these regions do not contain high "   \
109           "percentage of garbage.  Setting a larger value will cause "      \
110           "more frequent old-gen collections.  A smaller value will "       \
111           "increase the likelihood that humongous object allocations "      \
112           "fail, resulting in stop-the-world full GCs.")                    \
113           range(0,100)                                                      \
114                                                                             \
115   product(double, ShenandoahMinOldGenGrowthPercent, 50, EXPERIMENTAL,       \
116           "(Generational mode only) If the usage within old generation "    \
117           "has grown by at least this percent of its live memory size "     \
118           "at the start of the previous old-generation marking effort, "    \
119           "heuristics may trigger the start of a new old-gen collection.")  \
120           range(0.0,100.0)                                                  \
121                                                                             \
122   product(double, ShenandoahMinOldGenGrowthRemainingHeapPercent,            \
123           35, EXPERIMENTAL,                                                 \
124           "(Generational mode only) If the usage within old generation "    \
125           "has grown to exceed this percent of the remaining heap that "    \
126           "was not marked live within the old generation at the time "      \
127           "of the last old-generation marking effort, heuristics may "      \
128           "trigger the start of a new old-gen collection.  Setting "        \
129           "this value to a smaller value may cause back-to-back old "       \
130           "generation marking triggers, since the typical memory used "     \
131           "by the old generation is about 30% larger than the live "        \
132           "memory contained within the old generation (because default "    \
133           "value of ShenandoahOldGarbageThreshold is 25.")                  \
134           range(0.0,100.0)                                                  \
135                                                                             \
136   product(uintx, ShenandoahIgnoreOldGrowthBelowPercentage,                  \
137           40, EXPERIMENTAL,                                                 \
138           "(Generational mode only) If the total usage of the old "         \
139           "generation is smaller than this percent, we do not trigger "     \
140           "old gen collections even if old has grown, except when "         \
141           "ShenandoahGenerationalDoNotIgnoreGrowthAfterYoungCycles "        \
142           "consecutive cycles have been completed following the "           \
143           "preceding old-gen collection.")                                  \
144           range(0,100)                                                      \
145                                                                             \
146   product(uintx, ShenandoahDoNotIgnoreGrowthAfterYoungCycles,               \
147           100, EXPERIMENTAL,                                                \
148           "(Generational mode only) Trigger an old-generation mark "        \
149           "if old has grown and this many consecutive young-gen "           \
150           "collections have been completed following the preceding "        \
151           "old-gen collection.  We perform this old-generation mark "       \
152           "evvort even if the usage of old generation is below "            \
153           "ShenandoahIgnoreOldGrowthBelowPercentage.")                      \
154                                                                             \
155   product(bool, ShenandoahGenerationalAdaptiveTenuring, true, EXPERIMENTAL, \
156           "(Generational mode only) Dynamically adapt tenuring age.")       \
157                                                                             \
158   product(bool, ShenandoahGenerationalCensusIgnoreOlderCohorts, true,       \
159                                                                EXPERIMENTAL,\
160           "(Generational mode only) Ignore mortality rates older than the " \
161           "oldest cohort under the tenuring age for the last cycle." )      \
162                                                                             \
163   product(uintx, ShenandoahGenerationalMinTenuringAge, 1, EXPERIMENTAL,     \
164           "(Generational mode only) Floor for adaptive tenuring age. "      \
165           "Setting floor and ceiling to the same value fixes the tenuring " \
166           "age; setting both to 1 simulates a poor approximation to "       \
167           "AlwaysTenure, and setting both to 16 simulates NeverTenure.")    \
168           range(1,16)                                                       \
169                                                                             \
170   product(uintx, ShenandoahGenerationalMaxTenuringAge, 15, EXPERIMENTAL,    \
171           "(Generational mode only) Ceiling for adaptive tenuring age. "    \
172           "Setting floor and ceiling to the same value fixes the tenuring " \
173           "age; setting both to 1 simulates a poor approximation to "       \
174           "AlwaysTenure, and setting both to 16 simulates NeverTenure.")    \
175           range(1,16)                                                       \
176                                                                             \
177   product(double, ShenandoahGenerationalTenuringMortalityRateThreshold,     \
178                                                          0.1, EXPERIMENTAL, \
179           "(Generational mode only) Cohort mortality rates below this "     \
180           "value will be treated as indicative of longevity, leading to "   \
181           "tenuring. A lower value delays tenuring, a higher value hastens "\
182           "it. Used only when ShenandoahGenerationalhenAdaptiveTenuring is "\
183           "enabled.")                                                       \
184           range(0.001,0.999)                                                \
185                                                                             \
186   product(size_t, ShenandoahGenerationalTenuringCohortPopulationThreshold,  \
187                                                          4*K, EXPERIMENTAL, \
188           "(Generational mode only) Cohorts whose population is lower than "\
189           "this value in the previous census are ignored wrt tenuring "     \
190           "decisions. Effectively this makes then tenurable as soon as all "\
191           "older cohorts are. Set this value to the largest cohort "        \
192           "population volume that you are comfortable ignoring when making "\
193           "tenuring decisions.")                                            \
194                                                                             \
195   product(size_t, ShenandoahRegionSize, 0, EXPERIMENTAL,                    \
196           "Static heap region size. Set zero to enable automatic sizing.")  \
197                                                                             \
198   product(size_t, ShenandoahTargetNumRegions, 2048, EXPERIMENTAL,           \
199           "With automatic region sizing, this is the approximate number "   \
200           "of regions that would be used, within min/max region size "      \
201           "limits.")                                                        \
202                                                                             \
203   product(size_t, ShenandoahMinRegionSize, 256 * K, EXPERIMENTAL,           \
204           "With automatic region sizing, the regions would be at least "    \
205           "this large.")                                                    \
206                                                                             \
207   product(size_t, ShenandoahMaxRegionSize, 32 * M, EXPERIMENTAL,            \
208           "With automatic region sizing, the regions would be at most "     \
209           "this large.")                                                    \
210                                                                             \
211   product(ccstr, ShenandoahGCMode, "satb",                                  \
212           "GC mode to use.  Among other things, this defines which "        \
213           "barriers are in in use. Possible values are:"                    \
214           " satb - snapshot-at-the-beginning concurrent GC (three pass mark-evac-update);"  \
215           " passive - stop the world GC only (either degenerated or full);" \
216           " generational - generational concurrent GC")                     \
217                                                                             \
218   product(ccstr, ShenandoahGCHeuristics, "adaptive",                        \
219           "GC heuristics to use. This fine-tunes the GC mode selected, "    \
220           "by choosing when to start the GC, how much to process on each "  \
221           "cycle, and what other features to automatically enable. "        \
222           "When -XX:ShenandoahGCMode is generational, the only supported "  \
223           "option is the default, adaptive. Possible values are:"           \
224           " adaptive - adapt to maintain the given amount of free heap "    \
225           "at all times, even during the GC cycle;"                         \
226           " static - trigger GC when free heap falls below a specified "    \
227           "threshold;"                                                      \
228           " aggressive - run GC continuously, try to evacuate everything;"  \
229           " compact - run GC more frequently and with deeper targets to "   \
230           "free up more memory.")                                           \
231                                                                             \
232   product(uintx, ShenandoahExpeditePromotionsThreshold, 5, EXPERIMENTAL,    \
233           "When Shenandoah expects to promote at least this percentage "    \
234           "of the young generation, trigger a young collection to "         \
235           "expedite these promotions.")                                     \
236           range(0,100)                                                      \
237                                                                             \
238   product(uintx, ShenandoahExpediteMixedThreshold, 10, EXPERIMENTAL,        \
239           "When there are this many old regions waiting to be collected, "  \
240           "trigger a mixed collection immediately.")                        \
241                                                                             \
242   product(uintx, ShenandoahGarbageThreshold, 25, EXPERIMENTAL,              \
243           "How much garbage a region has to contain before it would be "    \
244           "taken for collection. This a guideline only, as GC heuristics "  \
245           "may select the region for collection even if it has little "     \
246           "garbage. This also affects how much internal fragmentation the " \
247           "collector accepts. In percents of heap region size.")            \
248           range(0,100)                                                      \
249                                                                             \
250   product(uintx, ShenandoahOldGarbageThreshold, 25, EXPERIMENTAL,           \
251           "How much garbage an old region has to contain before it would "  \
252           "be taken for collection.")                                       \
253           range(0,100)                                                      \
254                                                                             \
255   product(uintx, ShenandoahIgnoreGarbageThreshold, 5, EXPERIMENTAL,         \
256           "When less than this amount of garbage (as a percentage of "      \
257           "region size) exists within a region, the region will not be "    \
258           "added to the collection set, even when the heuristic has "       \
259           "chosen to aggressively add regions with less than "              \
260           "ShenandoahGarbageThreshold amount of garbage into the "          \
261           "collection set.")                                                \
262           range(0,100)                                                      \
263                                                                             \
264   product(uintx, ShenandoahInitFreeThreshold, 70, EXPERIMENTAL,             \
265           "When less than this amount of memory is free within the "        \
266           "heap or generation, trigger a learning cycle if we are "         \
267           "in learning mode.  Learning mode happens during initialization " \
268           "and following a drastic state change, such as following a "      \
269           "degenerated or Full GC cycle.  In percents of soft max "         \
270           "heap size.")                                                     \
271           range(0,100)                                                      \
272                                                                             \
273   product(uintx, ShenandoahMinFreeThreshold, 10, EXPERIMENTAL,              \
274           "Percentage of free heap memory (or young generation, in "        \
275           "generational mode) below which most heuristics trigger "         \
276           "collection independent of other triggers. Provides a safety "    \
277           "margin for many heuristics. In percents of (soft) max heap "     \
278           "size.")                                                          \
279           range(0,100)                                                      \
280                                                                             \
281   product(uintx, ShenandoahAllocationThreshold, 0, EXPERIMENTAL,            \
282           "How many new allocations should happen since the last GC cycle " \
283           "before some heuristics trigger the collection. In percents of "  \
284           "(soft) max heap size. Set to zero to effectively disable.")      \
285           range(0,100)                                                      \
286                                                                             \
287   product(uintx, ShenandoahAllocSpikeFactor, 5, EXPERIMENTAL,               \
288           "How much of heap should some heuristics reserve for absorbing "  \
289           "the allocation spikes. Larger value wastes more memory in "      \
290           "non-emergency cases, but provides more safety in emergency "     \
291           "cases. In percents of (soft) max heap size.")                    \
292           range(0,100)                                                      \
293                                                                             \
294   product(uintx, ShenandoahLearningSteps, 5, EXPERIMENTAL,                  \
295           "The number of cycles some heuristics take to collect in order "  \
296           "to learn application and GC performance.")                       \
297           range(0,100)                                                      \
298                                                                             \
299   product(uintx, ShenandoahImmediateThreshold, 70, EXPERIMENTAL,            \
300           "The cycle may shortcut when enough garbage can be reclaimed "    \
301           "from the immediate garbage (completely garbage regions). "       \
302           "In percents of total garbage found. Setting this threshold "     \
303           "to 100 effectively disables the shortcut.")                      \
304           range(0,100)                                                      \
305                                                                             \
306   product(uintx, ShenandoahAdaptiveSampleFrequencyHz, 10, EXPERIMENTAL,     \
307           "The number of times per second to update the allocation rate "   \
308           "moving average.")                                                \
309                                                                             \
310   product(uintx, ShenandoahAdaptiveSampleSizeSeconds, 10, EXPERIMENTAL,     \
311           "The size of the moving window over which the average "           \
312           "allocation rate is maintained. The total number of samples "     \
313           "is the product of this number and the sample frequency.")        \
314                                                                             \
315   product(double, ShenandoahAdaptiveInitialConfidence, 1.8, EXPERIMENTAL,   \
316           "The number of standard deviations used to determine an initial " \
317           "margin of error for the average cycle time and average "         \
318           "allocation rate. Increasing this value will cause the "          \
319           "heuristic to initiate more concurrent cycles." )                 \
320                                                                             \
321   product(double, ShenandoahAdaptiveInitialSpikeThreshold, 1.8, EXPERIMENTAL, \
322           "If the most recently sampled allocation rate is more than "      \
323           "this many standard deviations away from the moving average, "    \
324           "then a cycle is initiated. This value controls how sensitive "   \
325           "the heuristic is to allocation spikes. Decreasing this number "  \
326           "increases the sensitivity. ")                                    \
327                                                                             \
328   product(double, ShenandoahAdaptiveDecayFactor, 0.5, EXPERIMENTAL,         \
329           "The decay factor (alpha) used for values in the weighted "       \
330           "moving average of cycle time and allocation rate. "              \
331           "Larger values give more weight to recent values.")               \
332           range(0,1.0)                                                      \
333                                                                             \
334   product(uintx, ShenandoahGuaranteedGCInterval, 5*60*1000, EXPERIMENTAL,   \
335           "Many heuristics would guarantee a concurrent GC cycle at "       \
336           "least with this interval. This is useful when large idle "       \
337           "intervals are present, where GC can run without stealing "       \
338           "time from active application. Time is in milliseconds. "         \
339           "Setting this to 0 disables the feature.")                        \
340                                                                             \
341   product(uintx, ShenandoahGuaranteedOldGCInterval, 10*60*1000, EXPERIMENTAL, \
342           "Run a collection of the old generation at least this often. "    \
343           "Heuristics may trigger collections more frequently. Time is in " \
344           "milliseconds. Setting this to 0 disables the feature.")          \
345                                                                             \
346   product(uintx, ShenandoahGuaranteedYoungGCInterval, 5*60*1000,  EXPERIMENTAL,  \
347           "Run a collection of the young generation at least this often. "  \
348           "Heuristics may trigger collections more frequently. Time is in " \
349           "milliseconds. Setting this to 0 disables the feature.")          \
350                                                                             \
351   product(bool, ShenandoahAlwaysClearSoftRefs, false, EXPERIMENTAL,         \
352           "Unconditionally clear soft references, instead of using any "    \
353           "other cleanup policy. This minimizes footprint at expense of"    \
354           "more soft reference churn in applications.")                     \
355                                                                             \
356   product(bool, ShenandoahUncommit, true, EXPERIMENTAL,                     \
357           "Allow to uncommit memory under unused regions and metadata. "    \
358           "This optimizes footprint at expense of allocation latency in "   \
359           "regions that require committing back. Uncommits would be "       \
360           "disabled by some heuristics, or with static heap size.")         \
361                                                                             \
362   product(uintx, ShenandoahUncommitDelay, 5*60*1000, EXPERIMENTAL,          \
363           "Uncommit memory for regions that were not used for more than "   \
364           "this time. First use after that would incur allocation stalls. " \
365           "Actively used regions would never be uncommitted, because they " \
366           "do not become unused longer than this delay. Time is in "        \
367           "milliseconds. Setting this delay to 0 effectively uncommits "    \
368           "regions almost immediately after they become unused.")           \
369                                                                             \
370   product(bool, ShenandoahRegionSampling, false, EXPERIMENTAL,              \
371           "Provide heap region sampling data via jvmstat.")                 \
372                                                                             \
373   product(int, ShenandoahRegionSamplingRate, 40, EXPERIMENTAL,              \
374           "Sampling rate for heap region sampling. In milliseconds between "\
375           "the samples. Higher values provide more fidelity, at expense "   \
376           "of more sampling overhead.")                                     \
377                                                                             \
378   product(uintx, ShenandoahControlIntervalMin, 1, EXPERIMENTAL,             \
379           "The minimum sleep interval for the control loop that drives "    \
380           "the cycles. Lower values would increase GC responsiveness "      \
381           "to changing heap conditions, at the expense of higher perf "     \
382           "overhead. Time is in milliseconds.")                             \
383           range(1, 999)                                                     \
384                                                                             \
385   product(uintx, ShenandoahControlIntervalMax, 10, EXPERIMENTAL,            \
386           "The maximum sleep interval for control loop that drives "        \
387           "the cycles. Lower values would increase GC responsiveness "      \
388           "to changing heap conditions, at the expense of higher perf "     \
389           "overhead. Time is in milliseconds.")                             \
390           range(1, 999)                                                     \
391                                                                             \
392   product(uintx, ShenandoahControlIntervalAdjustPeriod, 1000, EXPERIMENTAL, \
393           "The time period for one step in control loop interval "          \
394           "adjustment. Lower values make adjustments faster, at the "       \
395           "expense of higher perf overhead. Time is in milliseconds.")      \
396                                                                             \
397   product(bool, ShenandoahVerify, false, DIAGNOSTIC,                        \
398           "Enable internal verification. This would catch many GC bugs, "   \
399           "but it would also stall the collector during the verification, " \
400           "which prolongs the pauses and might hide other bugs.")           \
401                                                                             \
402   product(intx, ShenandoahVerifyLevel, 4, DIAGNOSTIC,                       \
403           "Verification level, higher levels check more, taking more time. "\
404           "Accepted values are:"                                            \
405           " 0 = basic heap checks; "                                        \
406           " 1 = previous level, plus basic region checks; "                 \
407           " 2 = previous level, plus all roots; "                           \
408           " 3 = previous level, plus all reachable objects; "               \
409           " 4 = previous level, plus all marked objects")                   \
410                                                                             \
411   product(uintx, ShenandoahEvacReserve, 5, EXPERIMENTAL,                    \
412           "How much of (young-generation) heap to reserve for "             \
413           "(young-generation) evacuations.  Larger values allow GC to "     \
414           "evacuate more live objects on every cycle, while leaving "       \
415           "less headroom for application to allocate while GC is "          \
416           "evacuating and updating references. This parameter is "          \
417           "consulted at the end of marking, before selecting the "          \
418           "collection set.  If available memory at this time is smaller "   \
419           "than the indicated reserve, the bound on collection set size is "\
420           "adjusted downward.  The size of a generational mixed "           \
421           "evacuation collection set (comprised of both young and old "     \
422           "regions) is also bounded by this parameter.  In percents of "    \
423           "total (young-generation) heap size.")                            \
424           range(1,100)                                                      \
425                                                                             \
426   product(double, ShenandoahEvacWaste, 1.2, EXPERIMENTAL,                   \
427           "How much waste evacuations produce within the reserved space. "  \
428           "Larger values make evacuations more resilient against "          \
429           "evacuation conflicts, at expense of evacuating less on each "    \
430           "GC cycle.  Smaller values increase the risk of evacuation "      \
431           "failures, which will trigger stop-the-world Full GC passes.")    \
432           range(1.0,100.0)                                                  \
433                                                                             \
434   product(double, ShenandoahOldEvacWaste, 1.4, EXPERIMENTAL,                \
435           "How much waste evacuations produce within the reserved space. "  \
436           "Larger values make evacuations more resilient against "          \
437           "evacuation conflicts, at expense of evacuating less on each "    \
438           "GC cycle.  Smaller values increase the risk of evacuation "      \
439           "failures, which will trigger stop-the-world Full GC passes.")    \
440           range(1.0,100.0)                                                  \
441                                                                             \
442   product(double, ShenandoahPromoEvacWaste, 1.2, EXPERIMENTAL,              \
443           "How much waste promotions produce within the reserved space. "   \
444           "Larger values make evacuations more resilient against "          \
445           "evacuation conflicts, at expense of promoting less on each "     \
446           "GC cycle.  Smaller values increase the risk of evacuation "      \
447           "failures, which will trigger stop-the-world Full GC passes.")    \
448           range(1.0,100.0)                                                  \
449                                                                             \
450   product(bool, ShenandoahEvacReserveOverflow, true, EXPERIMENTAL,          \
451           "Allow evacuations to overflow the reserved space. Enabling it "  \
452           "will make evacuations more resilient when evacuation "           \
453           "reserve/waste is incorrect, at the risk that application "       \
454           "runs out of memory too early.")                                  \
455                                                                             \
456   product(uintx, ShenandoahOldEvacPercent, 75, EXPERIMENTAL,                \
457           "The maximum evacuation to old-gen expressed as a percent of "    \
458           "the total live memory within the collection set.  With the "     \
459           "default setting, if collection set evacuates X, no more than "   \
460           "75% of X may hold objects evacuated from old or promoted to "    \
461           "old from young.  A value of 100 allows the entire collection "   \
462           "set to be comprised of old-gen regions and young regions that "  \
463           "have reached the tenure age.  Larger values allow fewer mixed "  \
464           "evacuations to reclaim all the garbage from old.  Smaller "      \
465           "values result in less variation in GC cycle times between "      \
466           "young vs. mixed cycles.  A value of 0 prevents mixed "           \
467           "evacations from running and blocks promotion of aged regions "   \
468           "by evacuation.  Setting the value to 0 does not prevent "        \
469           "regions from being promoted in place.")                          \
470           range(0,100)                                                      \
471                                                                             \
472   product(bool, ShenandoahEvacTracking, false, DIAGNOSTIC,                  \
473           "Collect additional metrics about evacuations. Enabling this "    \
474           "tracks how many objects and how many bytes were evacuated, and " \
475           "how many were abandoned. The information will be categorized "   \
476           "by thread type (worker or mutator) and evacuation type (young, " \
477           "old, or promotion.")                                             \
478                                                                             \
479   product(uintx, ShenandoahCriticalFreeThreshold, 1, EXPERIMENTAL,          \
480           "How much of the heap needs to be free after recovery cycles, "   \
481           "either Degenerated or Full GC to be claimed successful. If this "\
482           "much space is not available, next recovery step would be "       \
483           "triggered.")                                                     \
484           range(0, 100)                                                     \
485                                                                             \
486   product(bool, ShenandoahDegeneratedGC, true, DIAGNOSTIC,                  \
487           "Enable Degenerated GC as the graceful degradation step. "        \
488           "Disabling this option leads to degradation to Full GC instead. " \
489           "When running in passive mode, this can be toggled to measure "   \
490           "either Degenerated GC or Full GC costs.")                        \
491                                                                             \
492   product(uintx, ShenandoahFullGCThreshold, 3, EXPERIMENTAL,                \
493           "How many back-to-back Degenerated GCs should happen before "     \
494           "going to a Full GC.")                                            \
495                                                                             \
496   product(uintx, ShenandoahNoProgressThreshold, 5, EXPERIMENTAL,            \
497           "After this number of consecutive Full GCs fail to make "         \
498           "progress, Shenandoah will raise out of memory errors. Note "     \
499           "that progress is determined by ShenandoahCriticalFreeThreshold") \
500                                                                             \
501   product(bool, ShenandoahImplicitGCInvokesConcurrent, false, EXPERIMENTAL, \
502           "Should internally-caused GC requests invoke concurrent cycles, " \
503           "should they do the stop-the-world (Degenerated / Full GC)? "     \
504           "Many heuristics automatically enable this. This option is "      \
505           "similar to global ExplicitGCInvokesConcurrent.")                 \
506                                                                             \
507   product(bool, ShenandoahHumongousMoves, true, DIAGNOSTIC,                 \
508           "Allow moving humongous regions. This makes GC more resistant "   \
509           "to external fragmentation that may otherwise fail other "        \
510           "humongous allocations, at the expense of higher GC copying "     \
511           "costs. Currently affects stop-the-world (Full) cycle only.")     \
512                                                                             \
513   product(bool, ShenandoahOOMDuringEvacALot, false, DIAGNOSTIC,             \
514           "Testing: simulate OOM during evacuation.")                       \
515                                                                             \
516   product(bool, ShenandoahAllocFailureALot, false, DIAGNOSTIC,              \
517           "Testing: make lots of artificial allocation failures.")          \
518                                                                             \
519   product(uintx, ShenandoahCoalesceChance, 0, DIAGNOSTIC,                   \
520           "Testing: Abandon remaining mixed collections with this "         \
521           "likelihood. Following each mixed collection, abandon all "       \
522           "remaining mixed collection candidate regions with likelihood "   \
523           "ShenandoahCoalesceChance. Abandoning a mixed collection will "   \
524           "cause the old regions to be made parsable, rather than being "   \
525           "evacuated.")                                                     \
526           range(0, 100)                                                     \
527                                                                             \
528   product(intx, ShenandoahMarkScanPrefetch, 32, EXPERIMENTAL,               \
529           "How many objects to prefetch ahead when traversing mark bitmaps."\
530           "Set to 0 to disable prefetching.")                               \
531           range(0, 256)                                                     \
532                                                                             \
533   product(uintx, ShenandoahMarkLoopStride, 1000, EXPERIMENTAL,              \
534           "How many items to process during one marking iteration before "  \
535           "checking for cancellation, yielding, etc. Larger values improve "\
536           "marking performance at expense of responsiveness.")              \
537                                                                             \
538   product(uintx, ShenandoahParallelRegionStride, 0, EXPERIMENTAL,           \
539           "How many regions to process at once during parallel region "     \
540           "iteration. Affects heaps with lots of regions. "                 \
541           "Set to 0 to let Shenandoah to decide the best value.")           \
542                                                                             \
543   product(size_t, ShenandoahSATBBufferSize, 1 * K, EXPERIMENTAL,            \
544           "Number of entries in an SATB log buffer.")                       \
545           range(1, max_uintx)                                               \
546                                                                             \
547   product(uintx, ShenandoahMaxSATBBufferFlushes, 5, EXPERIMENTAL,           \
548           "How many times to maximum attempt to flush SATB buffers at the " \
549           "end of concurrent marking.")                                     \
550                                                                             \
551   product(bool, ShenandoahSATBBarrier, true, DIAGNOSTIC,                    \
552           "Turn on/off SATB barriers in Shenandoah")                        \
553                                                                             \
554   product(bool, ShenandoahCardBarrier, false, DIAGNOSTIC,                   \
555           "Turn on/off card-marking post-write barrier in Shenandoah: "     \
556           " true when ShenandoahGCMode is generational, false otherwise")   \
557                                                                             \
558   product(bool, ShenandoahCASBarrier, true, DIAGNOSTIC,                     \
559           "Turn on/off CAS barriers in Shenandoah")                         \
560                                                                             \
561   product(bool, ShenandoahCloneBarrier, true, DIAGNOSTIC,                   \
562           "Turn on/off clone barriers in Shenandoah")                       \
563                                                                             \
564   product(bool, ShenandoahLoadRefBarrier, true, DIAGNOSTIC,                 \
565           "Turn on/off load-reference barriers in Shenandoah")              \
566                                                                             \
567   product(bool, ShenandoahStackWatermarkBarrier, true, DIAGNOSTIC,          \
568           "Turn on/off stack watermark barriers in Shenandoah")             \
569                                                                             \
570   product(bool, ShenandoahCloneRuntime, false, DIAGNOSTIC,                  \
571           "Handle clone in runtime instead of in copy stubs.")              \
572                                                                             \
573   product(bool, ShenandoahGCStateCheckHotpatch, false, EXPERIMENTAL,        \
574           "DANGEROUS, USE ONLY WITH PASSIVE MODE: Replace GC state checks " \
575           "with hot-patchable sequence in barrier fast-paths. Measures "    \
576           "potential improvement from GC state hot-patching.")              \
577                                                                             \
578   product(bool, ShenandoahGCStateCheckRemove, false, EXPERIMENTAL,          \
579           "DANGEROUS, USE ONLY WITH PASSIVE MODE: Remove GC state checks "  \
580           "in barrier fast-paths. Measures code density impact from GC "    \
581           "state checks.")                                                  \
582                                                                             \
583   product(bool, ShenandoahSkipBarriers, false, EXPERIMENTAL,                \
584           "DANGEROUS, USE ONLY WITH PASSIVE MODE: Skip all barriers after " \
585           "expansion. Measures code density impact from additional code "   \
586           "at both fast- and slow-paths.")                                  \
587                                                                             \
588   develop(bool, ShenandoahVerifyOptoBarriers, trueInDebug,                  \
589           "Verify no missing barriers in C2.")                              \
590                                                                             \
591   product(uintx, ShenandoahOldCompactionReserve, 8, EXPERIMENTAL,           \
592           "During generational GC, prevent promotions from filling "        \
593           "this number of heap regions.  These regions are reserved "       \
594           "for the purpose of supporting compaction of old-gen "            \
595           "memory.  Otherwise, old-gen memory cannot be compacted.")        \
596           range(0, 128)                                                     \
597                                                                             \
598   product(bool, ShenandoahAllowOldMarkingPreemption, true, DIAGNOSTIC,      \
599           "Allow young generation collections to suspend concurrent"        \
600           " marking in the old generation.")                                \
601                                                                             \
602   product(uintx, ShenandoahAgingCyclePeriod, 1, EXPERIMENTAL,               \
603           "With generational mode, increment the age of objects and"        \
604           "regions each time this many young-gen GC cycles are completed.") \
605                                                                             \
606   develop(bool, ShenandoahEnableCardStats, false,                           \
607           "Enable statistics collection related to clean & dirty cards")    \
608                                                                             \
609   develop(int, ShenandoahCardStatsLogInterval, 50,                          \
610           "Log cumulative card stats every so many remembered set or "      \
611           "update refs scans")                                              \
612                                                                             \
613   product(uintx, ShenandoahMinimumOldTimeMs, 100, EXPERIMENTAL,             \
614          "Minimum amount of time in milliseconds to run old collections "   \
615          "before a young collection is allowed to run. This is intended "   \
616          "to prevent starvation of the old collector. Setting this to "     \
617          "0 will allow back to back young collections to run during old "   \
618          "collections.")                                                    \
619   // end of GC_SHENANDOAH_FLAGS
620 
621 #endif // SHARE_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP