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, ShenandoahGenerationalCensusIgnoreOlderCohorts, true,       \
156                                                                EXPERIMENTAL,\
157           "(Generational mode only) Ignore mortality rates older than the " \
158           "oldest cohort under the tenuring age for the last cycle." )      \
159                                                                             \
160   product(uintx, ShenandoahGenerationalMinTenuringAge, 1, EXPERIMENTAL,     \
161           "(Generational mode only) Floor for adaptive tenuring age. "      \
162           "Setting floor and ceiling to the same value fixes the tenuring " \
163           "age; setting both to 1 simulates a poor approximation to "       \
164           "AlwaysTenure, and setting both to 16 simulates NeverTenure.")    \
165           range(1,16)                                                       \
166                                                                             \
167   product(uintx, ShenandoahGenerationalMaxTenuringAge, 15, EXPERIMENTAL,    \
168           "(Generational mode only) Ceiling for adaptive tenuring age. "    \
169           "Setting floor and ceiling to the same value fixes the tenuring " \
170           "age; setting both to 1 simulates a poor approximation to "       \
171           "AlwaysTenure, and setting both to 16 simulates NeverTenure.")    \
172           range(1,16)                                                       \
173                                                                             \
174   product(double, ShenandoahGenerationalTenuringMortalityRateThreshold,     \
175                                                          0.1, EXPERIMENTAL, \
176           "(Generational mode only) Cohort mortality rates below this "     \
177           "value will be treated as indicative of longevity, leading to "   \
178           "tenuring. A lower value delays tenuring, a higher value hastens "\
179           "it.")                                                       \
180           range(0.001,0.999)                                                \
181                                                                             \
182   product(size_t, ShenandoahGenerationalTenuringCohortPopulationThreshold,  \
183                                                          4*K, EXPERIMENTAL, \
184           "(Generational mode only) Cohorts whose population is lower than "\
185           "this value in the previous census are ignored wrt tenuring "     \
186           "decisions. Effectively this makes then tenurable as soon as all "\
187           "older cohorts are. Set this value to the largest cohort "        \
188           "population volume that you are comfortable ignoring when making "\
189           "tenuring decisions.")                                            \
190                                                                             \
191   product(size_t, ShenandoahRegionSize, 0, EXPERIMENTAL,                    \
192           "Static heap region size. Set zero to enable automatic sizing.")  \
193                                                                             \
194   product(size_t, ShenandoahTargetNumRegions, 2048, EXPERIMENTAL,           \
195           "With automatic region sizing, this is the approximate number "   \
196           "of regions that would be used, within min/max region size "      \
197           "limits.")                                                        \
198                                                                             \
199   product(ccstr, ShenandoahGCMode, "satb",                                  \
200           "GC mode to use.  Among other things, this defines which "        \
201           "barriers are in in use. Possible values are:"                    \
202           " satb - snapshot-at-the-beginning concurrent GC (three pass mark-evac-update);"  \
203           " passive - stop the world GC only (either degenerated or full);" \
204           " generational - generational concurrent GC")                     \
205                                                                             \
206   product(ccstr, ShenandoahGCHeuristics, "adaptive",                        \
207           "GC heuristics to use. This fine-tunes the GC mode selected, "    \
208           "by choosing when to start the GC, how much to process on each "  \
209           "cycle, and what other features to automatically enable. "        \
210           "When -XX:ShenandoahGCMode is generational, the only supported "  \
211           "option is the default, adaptive. Possible values are:"           \
212           " adaptive - adapt to maintain the given amount of free heap "    \
213           "at all times, even during the GC cycle;"                         \
214           " static - trigger GC when free heap falls below a specified "    \
215           "threshold;"                                                      \
216           " aggressive - run GC continuously, try to evacuate everything;"  \
217           " compact - run GC more frequently and with deeper targets to "   \
218           "free up more memory.")                                           \
219                                                                             \
220   product(uintx, ShenandoahExpeditePromotionsThreshold, 5, EXPERIMENTAL,    \
221           "When Shenandoah expects to promote at least this percentage "    \
222           "of the young generation, trigger a young collection to "         \
223           "expedite these promotions.")                                     \
224           range(0,100)                                                      \
225                                                                             \
226   product(uintx, ShenandoahExpediteMixedThreshold, 10, EXPERIMENTAL,        \
227           "When there are this many old regions waiting to be collected, "  \
228           "trigger a mixed collection immediately.")                        \
229                                                                             \
230   product(uintx, ShenandoahGarbageThreshold, 25, EXPERIMENTAL,              \
231           "How much garbage a region has to contain before it would be "    \
232           "taken for collection. This a guideline only, as GC heuristics "  \
233           "may select the region for collection even if it has little "     \
234           "garbage. This also affects how much internal fragmentation the " \
235           "collector accepts. In percents of heap region size.")            \
236           range(0,100)                                                      \
237                                                                             \
238   product(uintx, ShenandoahOldGarbageThreshold, 25, EXPERIMENTAL,           \
239           "How much garbage an old region has to contain before it would "  \
240           "be taken for collection.")                                       \
241           range(0,100)                                                      \
242                                                                             \
243   product(uintx, ShenandoahIgnoreGarbageThreshold, 5, EXPERIMENTAL,         \
244           "When less than this amount of garbage (as a percentage of "      \
245           "region size) exists within a region, the region will not be "    \
246           "added to the collection set, even when the heuristic has "       \
247           "chosen to aggressively add regions with less than "              \
248           "ShenandoahGarbageThreshold amount of garbage into the "          \
249           "collection set.")                                                \
250           range(0,100)                                                      \
251                                                                             \
252   product(uintx, ShenandoahInitFreeThreshold, 70, EXPERIMENTAL,             \
253           "When less than this amount of memory is free within the "        \
254           "heap or generation, trigger a learning cycle if we are "         \
255           "in learning mode.  Learning mode happens during initialization " \
256           "and following a drastic state change, such as following a "      \
257           "degenerated or Full GC cycle.  In percents of soft max "         \
258           "heap size.")                                                     \
259           range(0,100)                                                      \
260                                                                             \
261   product(uintx, ShenandoahMinFreeThreshold, 10, EXPERIMENTAL,              \
262           "Percentage of free heap memory (or young generation, in "        \
263           "generational mode) below which most heuristics trigger "         \
264           "collection independent of other triggers. Provides a safety "    \
265           "margin for many heuristics. In percents of (soft) max heap "     \
266           "size.")                                                          \
267           range(0,100)                                                      \
268                                                                             \
269   product(uintx, ShenandoahAllocationThreshold, 0, EXPERIMENTAL,            \
270           "How many new allocations should happen since the last GC cycle " \
271           "before some heuristics trigger the collection. In percents of "  \
272           "(soft) max heap size. Set to zero to effectively disable.")      \
273           range(0,100)                                                      \
274                                                                             \
275   product(uintx, ShenandoahAllocSpikeFactor, 5, EXPERIMENTAL,               \
276           "How much of heap should some heuristics reserve for absorbing "  \
277           "the allocation spikes. Larger value wastes more memory in "      \
278           "non-emergency cases, but provides more safety in emergency "     \
279           "cases. In percents of (soft) max heap size.")                    \
280           range(0,100)                                                      \
281                                                                             \
282   product(uintx, ShenandoahLearningSteps, 5, EXPERIMENTAL,                  \
283           "The number of cycles some heuristics take to collect in order "  \
284           "to learn application and GC performance.")                       \
285           range(0,100)                                                      \
286                                                                             \
287   product(uintx, ShenandoahImmediateThreshold, 70, EXPERIMENTAL,            \
288           "The cycle may shortcut when enough garbage can be reclaimed "    \
289           "from the immediate garbage (completely garbage regions). "       \
290           "In percents of total garbage found. Setting this threshold "     \
291           "to 100 effectively disables the shortcut.")                      \
292           range(0,100)                                                      \
293                                                                             \
294   product(uintx, ShenandoahAdaptiveSampleFrequencyHz, 10, EXPERIMENTAL,     \
295           "The number of times per second to update the allocation rate "   \
296           "moving average.")                                                \
297                                                                             \
298   product(uintx, ShenandoahAdaptiveSampleSizeSeconds, 10, EXPERIMENTAL,     \
299           "The size of the moving window over which the average "           \
300           "allocation rate is maintained. The total number of samples "     \
301           "is the product of this number and the sample frequency.")        \
302                                                                             \
303   product(double, ShenandoahAdaptiveInitialConfidence, 1.8, EXPERIMENTAL,   \
304           "The number of standard deviations used to determine an initial " \
305           "margin of error for the average cycle time and average "         \
306           "allocation rate. Increasing this value will cause the "          \
307           "heuristic to initiate more concurrent cycles." )                 \
308                                                                             \
309   product(double, ShenandoahAdaptiveInitialSpikeThreshold, 1.8, EXPERIMENTAL, \
310           "If the most recently sampled allocation rate is more than "      \
311           "this many standard deviations away from the moving average, "    \
312           "then a cycle is initiated. This value controls how sensitive "   \
313           "the heuristic is to allocation spikes. Decreasing this number "  \
314           "increases the sensitivity. ")                                    \
315                                                                             \
316   product(double, ShenandoahAdaptiveDecayFactor, 0.5, EXPERIMENTAL,         \
317           "The decay factor (alpha) used for values in the weighted "       \
318           "moving average of cycle time and allocation rate. "              \
319           "Larger values give more weight to recent values.")               \
320           range(0,1.0)                                                      \
321                                                                             \
322   product(uintx, ShenandoahGuaranteedGCInterval, 5*60*1000, EXPERIMENTAL,   \
323           "Many heuristics would guarantee a concurrent GC cycle at "       \
324           "least with this interval. This is useful when large idle "       \
325           "intervals are present, where GC can run without stealing "       \
326           "time from active application. Time is in milliseconds. "         \
327           "Setting this to 0 disables the feature.")                        \
328                                                                             \
329   product(uintx, ShenandoahGuaranteedOldGCInterval, 10*60*1000, EXPERIMENTAL, \
330           "Run a collection of the old generation at least this often. "    \
331           "Heuristics may trigger collections more frequently. Time is in " \
332           "milliseconds. Setting this to 0 disables the feature.")          \
333                                                                             \
334   product(uintx, ShenandoahGuaranteedYoungGCInterval, 5*60*1000,  EXPERIMENTAL,  \
335           "Run a collection of the young generation at least this often. "  \
336           "Heuristics may trigger collections more frequently. Time is in " \
337           "milliseconds. Setting this to 0 disables the feature.")          \
338                                                                             \
339   product(bool, ShenandoahAlwaysClearSoftRefs, false, EXPERIMENTAL,         \
340           "Unconditionally clear soft references, instead of using any "    \
341           "other cleanup policy. This minimizes footprint at expense of"    \
342           "more soft reference churn in applications.")                     \
343                                                                             \
344   product(bool, ShenandoahUncommit, true, EXPERIMENTAL,                     \
345           "Allow to uncommit memory under unused regions and metadata. "    \
346           "This optimizes footprint at expense of allocation latency in "   \
347           "regions that require committing back. Uncommits would be "       \
348           "disabled by some heuristics, or with static heap size.")         \
349                                                                             \
350   product(uintx, ShenandoahUncommitDelay, 5*60*1000, EXPERIMENTAL,          \
351           "Uncommit memory for regions that were not used for more than "   \
352           "this time. First use after that would incur allocation stalls. " \
353           "Actively used regions would never be uncommitted, because they " \
354           "do not become unused longer than this delay. Time is in "        \
355           "milliseconds. Setting this delay to 0 effectively uncommits "    \
356           "regions almost immediately after they become unused.")           \
357                                                                             \
358   product(bool, ShenandoahRegionSampling, false, EXPERIMENTAL,              \
359           "Provide heap region sampling data via jvmstat.")                 \
360                                                                             \
361   product(int, ShenandoahRegionSamplingRate, 40, EXPERIMENTAL,              \
362           "Sampling rate for heap region sampling. In milliseconds between "\
363           "the samples. Higher values provide more fidelity, at expense "   \
364           "of more sampling overhead.")                                     \
365                                                                             \
366   product(uintx, ShenandoahControlIntervalMin, 1, EXPERIMENTAL,             \
367           "The minimum sleep interval for the control loop that drives "    \
368           "the cycles. Lower values would increase GC responsiveness "      \
369           "to changing heap conditions, at the expense of higher perf "     \
370           "overhead. Time is in milliseconds.")                             \
371           range(1, 999)                                                     \
372                                                                             \
373   product(uintx, ShenandoahControlIntervalMax, 10, EXPERIMENTAL,            \
374           "The maximum sleep interval for control loop that drives "        \
375           "the cycles. Lower values would increase GC responsiveness "      \
376           "to changing heap conditions, at the expense of higher perf "     \
377           "overhead. Time is in milliseconds.")                             \
378           range(1, 999)                                                     \
379                                                                             \
380   product(uintx, ShenandoahControlIntervalAdjustPeriod, 1000, EXPERIMENTAL, \
381           "The time period for one step in control loop interval "          \
382           "adjustment. Lower values make adjustments faster, at the "       \
383           "expense of higher perf overhead. Time is in milliseconds.")      \
384                                                                             \
385   product(bool, ShenandoahVerify, false, DIAGNOSTIC,                        \
386           "Enable internal verification. This would catch many GC bugs, "   \
387           "but it would also stall the collector during the verification, " \
388           "which prolongs the pauses and might hide other bugs.")           \
389                                                                             \
390   product(intx, ShenandoahVerifyLevel, 4, DIAGNOSTIC,                       \
391           "Verification level, higher levels check more, taking more time. "\
392           "Accepted values are:"                                            \
393           " 0 = basic heap checks; "                                        \
394           " 1 = previous level, plus basic region checks; "                 \
395           " 2 = previous level, plus all roots; "                           \
396           " 3 = previous level, plus all reachable objects; "               \
397           " 4 = previous level, plus all marked objects")                   \
398                                                                             \
399   product(uintx, ShenandoahEvacReserve, 5, EXPERIMENTAL,                    \
400           "How much of (young-generation) heap to reserve for "             \
401           "(young-generation) evacuations.  Larger values allow GC to "     \
402           "evacuate more live objects on every cycle, while leaving "       \
403           "less headroom for application to allocate while GC is "          \
404           "evacuating and updating references. This parameter is "          \
405           "consulted at the end of marking, before selecting the "          \
406           "collection set.  If available memory at this time is smaller "   \
407           "than the indicated reserve, the bound on collection set size is "\
408           "adjusted downward.  The size of a generational mixed "           \
409           "evacuation collection set (comprised of both young and old "     \
410           "regions) is also bounded by this parameter.  In percents of "    \
411           "total (young-generation) heap size.")                            \
412           range(1,100)                                                      \
413                                                                             \
414   product(double, ShenandoahEvacWaste, 1.2, EXPERIMENTAL,                   \
415           "How much waste evacuations produce within the reserved space. "  \
416           "Larger values make evacuations more resilient against "          \
417           "evacuation conflicts, at expense of evacuating less on each "    \
418           "GC cycle.  Smaller values increase the risk of evacuation "      \
419           "failures, which will trigger stop-the-world Full GC passes.")    \
420           range(1.0,100.0)                                                  \
421                                                                             \
422   product(double, ShenandoahOldEvacWaste, 1.4, EXPERIMENTAL,                \
423           "How much waste evacuations produce within the reserved space. "  \
424           "Larger values make evacuations more resilient against "          \
425           "evacuation conflicts, at expense of evacuating less on each "    \
426           "GC cycle.  Smaller values increase the risk of evacuation "      \
427           "failures, which will trigger stop-the-world Full GC passes.")    \
428           range(1.0,100.0)                                                  \
429                                                                             \
430   product(double, ShenandoahPromoEvacWaste, 1.2, EXPERIMENTAL,              \
431           "How much waste promotions produce within the reserved space. "   \
432           "Larger values make evacuations more resilient against "          \
433           "evacuation conflicts, at expense of promoting less on each "     \
434           "GC cycle.  Smaller values increase the risk of evacuation "      \
435           "failures, which will trigger stop-the-world Full GC passes.")    \
436           range(1.0,100.0)                                                  \
437                                                                             \
438   product(bool, ShenandoahEvacReserveOverflow, true, EXPERIMENTAL,          \
439           "Allow evacuations to overflow the reserved space. Enabling it "  \
440           "will make evacuations more resilient when evacuation "           \
441           "reserve/waste is incorrect, at the risk that application "       \
442           "runs out of memory too early.")                                  \
443                                                                             \
444   product(uintx, ShenandoahOldEvacPercent, 75, EXPERIMENTAL,                \
445           "The maximum evacuation to old-gen expressed as a percent of "    \
446           "the total live memory within the collection set.  With the "     \
447           "default setting, if collection set evacuates X, no more than "   \
448           "75% of X may hold objects evacuated from old or promoted to "    \
449           "old from young.  A value of 100 allows the entire collection "   \
450           "set to be comprised of old-gen regions and young regions that "  \
451           "have reached the tenure age.  Larger values allow fewer mixed "  \
452           "evacuations to reclaim all the garbage from old.  Smaller "      \
453           "values result in less variation in GC cycle times between "      \
454           "young vs. mixed cycles.  A value of 0 prevents mixed "           \
455           "evacations from running and blocks promotion of aged regions "   \
456           "by evacuation.  Setting the value to 0 does not prevent "        \
457           "regions from being promoted in place.")                          \
458           range(0,100)                                                      \
459                                                                             \
460   product(bool, ShenandoahEvacTracking, false, DIAGNOSTIC,                  \
461           "Collect additional metrics about evacuations. Enabling this "    \
462           "tracks how many objects and how many bytes were evacuated, and " \
463           "how many were abandoned. The information will be categorized "   \
464           "by thread type (worker or mutator) and evacuation type (young, " \
465           "old, or promotion.")                                             \
466                                                                             \
467   product(uintx, ShenandoahCriticalFreeThreshold, 1, EXPERIMENTAL,          \
468           "How much of the heap needs to be free after recovery cycles, "   \
469           "either Degenerated or Full GC to be claimed successful. If this "\
470           "much space is not available, next recovery step would be "       \
471           "triggered.")                                                     \
472           range(0, 100)                                                     \
473                                                                             \
474   product(bool, ShenandoahDegeneratedGC, true, DIAGNOSTIC,                  \
475           "Enable Degenerated GC as the graceful degradation step. "        \
476           "Disabling this option leads to degradation to Full GC instead. " \
477           "When running in passive mode, this can be toggled to measure "   \
478           "either Degenerated GC or Full GC costs.")                        \
479                                                                             \
480   product(uintx, ShenandoahFullGCThreshold, 3, EXPERIMENTAL,                \
481           "How many back-to-back Degenerated GCs should happen before "     \
482           "going to a Full GC.")                                            \
483                                                                             \
484   product(uintx, ShenandoahNoProgressThreshold, 5, EXPERIMENTAL,            \
485           "After this number of consecutive Full GCs fail to make "         \
486           "progress, Shenandoah will raise out of memory errors. Note "     \
487           "that progress is determined by ShenandoahCriticalFreeThreshold") \
488                                                                             \
489   product(bool, ShenandoahImplicitGCInvokesConcurrent, false, EXPERIMENTAL, \
490           "Should internally-caused GC requests invoke concurrent cycles, " \
491           "should they do the stop-the-world (Degenerated / Full GC)? "     \
492           "Many heuristics automatically enable this. This option is "      \
493           "similar to global ExplicitGCInvokesConcurrent.")                 \
494                                                                             \
495   product(bool, ShenandoahHumongousMoves, true, DIAGNOSTIC,                 \
496           "Allow moving humongous regions. This makes GC more resistant "   \
497           "to external fragmentation that may otherwise fail other "        \
498           "humongous allocations, at the expense of higher GC copying "     \
499           "costs. Currently affects stop-the-world (Full) cycle only.")     \
500                                                                             \
501   product(bool, ShenandoahOOMDuringEvacALot, false, DIAGNOSTIC,             \
502           "Testing: simulate OOM during evacuation.")                       \
503                                                                             \
504   product(bool, ShenandoahAllocFailureALot, false, DIAGNOSTIC,              \
505           "Testing: make lots of artificial allocation failures.")          \
506                                                                             \
507   product(uintx, ShenandoahCoalesceChance, 0, DIAGNOSTIC,                   \
508           "Testing: Abandon remaining mixed collections with this "         \
509           "likelihood. Following each mixed collection, abandon all "       \
510           "remaining mixed collection candidate regions with likelihood "   \
511           "ShenandoahCoalesceChance. Abandoning a mixed collection will "   \
512           "cause the old regions to be made parsable, rather than being "   \
513           "evacuated.")                                                     \
514           range(0, 100)                                                     \
515                                                                             \
516   product(intx, ShenandoahMarkScanPrefetch, 32, EXPERIMENTAL,               \
517           "How many objects to prefetch ahead when traversing mark bitmaps."\
518           "Set to 0 to disable prefetching.")                               \
519           range(0, 256)                                                     \
520                                                                             \
521   product(uintx, ShenandoahMarkLoopStride, 1000, EXPERIMENTAL,              \
522           "How many items to process during one marking iteration before "  \
523           "checking for cancellation, yielding, etc. Larger values improve "\
524           "marking performance at expense of responsiveness.")              \
525                                                                             \
526   product(uintx, ShenandoahParallelRegionStride, 0, EXPERIMENTAL,           \
527           "How many regions to process at once during parallel region "     \
528           "iteration. Affects heaps with lots of regions. "                 \
529           "Set to 0 to let Shenandoah to decide the best value.")           \
530                                                                             \
531   product(size_t, ShenandoahSATBBufferSize, 1 * K, EXPERIMENTAL,            \
532           "Number of entries in an SATB log buffer.")                       \
533           range(1, max_uintx)                                               \
534                                                                             \
535   product(uintx, ShenandoahMaxSATBBufferFlushes, 5, EXPERIMENTAL,           \
536           "How many times to maximum attempt to flush SATB buffers at the " \
537           "end of concurrent marking.")                                     \
538                                                                             \
539   product(bool, ShenandoahSATBBarrier, true, DIAGNOSTIC,                    \
540           "Turn on/off SATB barriers in Shenandoah")                        \
541                                                                             \
542   product(bool, ShenandoahCardBarrier, false, DIAGNOSTIC,                   \
543           "Turn on/off card-marking post-write barrier in Shenandoah: "     \
544           " true when ShenandoahGCMode is generational, false otherwise")   \
545                                                                             \
546   product(bool, ShenandoahCASBarrier, true, DIAGNOSTIC,                     \
547           "Turn on/off CAS barriers in Shenandoah")                         \
548                                                                             \
549   product(bool, ShenandoahCloneBarrier, true, DIAGNOSTIC,                   \
550           "Turn on/off clone barriers in Shenandoah")                       \
551                                                                             \
552   product(bool, ShenandoahLoadRefBarrier, true, DIAGNOSTIC,                 \
553           "Turn on/off load-reference barriers in Shenandoah")              \
554                                                                             \
555   product(bool, ShenandoahCloneRuntime, false, DIAGNOSTIC,                  \
556           "Handle clone in runtime instead of in copy stubs.")              \
557                                                                             \
558   product(bool, ShenandoahElideBarriers, true, DIAGNOSTIC,                  \
559           "Elide redundant Shenandoah barriers.")                           \
560                                                                             \
561   product(bool, ShenandoahElideDominatedBarriers, true, DIAGNOSTIC,         \
562           "Elide redundant dominated Shenandoah barriers.")                 \
563                                                                             \
564   product(bool, ShenandoahWeakRootsEarly, false, EXPERIMENTAL,              \
565           "Turn off weak roots earlier than usual. TODO: Upstream!")        \
566                                                                             \
567   product(int, ShenandoahDelayGC, 0, EXPERIMENTAL,                          \
568           "Delay GC phases by this amount of milliseconds. "                \
569           "Helps to measure active GC barriers costs.")                     \
570                                                                             \
571   develop(bool, ShenandoahVerifyOptoBarriers, trueInDebug,                  \
572           "Verify no missing barriers in C2.")                              \
573                                                                             \
574   product(uintx, ShenandoahOldCompactionReserve, 8, EXPERIMENTAL,           \
575           "During generational GC, prevent promotions from filling "        \
576           "this number of heap regions.  These regions are reserved "       \
577           "for the purpose of supporting compaction of old-gen "            \
578           "memory.  Otherwise, old-gen memory cannot be compacted.")        \
579           range(0, 128)                                                     \
580                                                                             \
581   product(bool, ShenandoahAllowOldMarkingPreemption, true, DIAGNOSTIC,      \
582           "Allow young generation collections to suspend concurrent"        \
583           " marking in the old generation.")                                \
584                                                                             \
585   product(uintx, ShenandoahAgingCyclePeriod, 1, EXPERIMENTAL,               \
586           "With generational mode, increment the age of objects and"        \
587           "regions each time this many young-gen GC cycles are completed.") \
588                                                                             \
589   develop(bool, ShenandoahEnableCardStats, false,                           \
590           "Enable statistics collection related to clean & dirty cards")    \
591                                                                             \
592   develop(int, ShenandoahCardStatsLogInterval, 50,                          \
593           "Log cumulative card stats every so many remembered set or "      \
594           "update refs scans")                                              \
595                                                                             \
596   product(uintx, ShenandoahMinimumOldTimeMs, 100, EXPERIMENTAL,             \
597          "Minimum amount of time in milliseconds to run old collections "   \
598          "before a young collection is allowed to run. This is intended "   \
599          "to prevent starvation of the old collector. Setting this to "     \
600          "0 will allow back to back young collections to run during old "   \
601          "collections.")                                                    \
602   // end of GC_SHENANDOAH_FLAGS
603 
604 #endif // SHARE_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP