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