1 /*
  2  * Copyright (c) 2020, 2023, 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                             notproduct,                                     \
 35                             range,                                          \
 36                             constraint)                                     \
 37                                                                             \
 38   product(uintx, ShenandoahGenerationalHumongousReserve, 0, EXPERIMENTAL,   \
 39           "(Generational mode only) What percent of the heap should be "    \
 40           "reserved for humongous objects if possible.  Old-generation "    \
 41           "collections will endeavor to evacuate old-gen regions within "   \
 42           "this reserved area even if these regions do not contain high "   \
 43           "percentage of garbage.  Setting a larger value will cause "      \
 44           "more frequent old-gen collections.  A smaller value will "       \
 45           "increase the likelihood that humongous object allocations "      \
 46           "fail, resulting in stop-the-world full GCs.")                    \
 47           range(0,100)                                                      \
 48                                                                             \
 49   product(double, ShenandoahMinOldGenGrowthPercent, 12.5, EXPERIMENTAL,     \
 50           "(Generational mode only) If the usage within old generation "    \
 51           "has grown by at least this percent of its live memory size "     \
 52           "at completion of the most recent old-generation marking "        \
 53           "effort, heuristics may trigger the start of a new old-gen "      \
 54           "collection.")                                                    \
 55           range(0.0,100.0)                                                  \
 56                                                                             \
 57   product(uintx, ShenandoahIgnoreOldGrowthBelowPercentage,10, EXPERIMENTAL, \
 58           "(Generational mode only) If the total usage of the old "         \
 59           "generation is smaller than this percent, we do not trigger "     \
 60           "old gen collections even if old has grown, except when "         \
 61           "ShenandoahGenerationalDoNotIgnoreGrowthAfterYoungCycles "        \
 62           "consecutive cycles have been completed following the "           \
 63           "preceding old-gen collection.")                                  \
 64           range(0,100)                                                      \
 65                                                                             \
 66   product(uintx, ShenandoahDoNotIgnoreGrowthAfterYoungCycles,               \
 67           50, EXPERIMENTAL,                                                 \
 68           "(Generational mode only) Even if the usage of old generation "   \
 69           "is below ShenandoahIgnoreOldGrowthBelowPercentage, "             \
 70           "trigger an old-generation mark if old has grown and this "       \
 71           "many consecutive young-gen collections have been "               \
 72           "completed following the preceding old-gen collection.")          \
 73                                                                             \
 74   product(bool, ShenandoahGenerationalCensusAtEvac, false, EXPERIMENTAL,    \
 75           "(Generational mode only) Object age census at evacuation, "      \
 76           "rather than during marking.")                                    \
 77                                                                             \
 78   product(bool, ShenandoahGenerationalAdaptiveTenuring, true, EXPERIMENTAL, \
 79           "(Generational mode only) Dynamically adapt tenuring age.")       \
 80                                                                             \
 81   product(bool, ShenandoahGenerationalCensusIgnoreOlderCohorts, true,       \
 82                                                                EXPERIMENTAL,\
 83           "(Generational mode only) Ignore mortality rates older than the " \
 84           "oldest cohort under the tenuring age for the last cycle." )      \
 85                                                                             \
 86   product(uintx, ShenandoahGenerationalMinTenuringAge, 1, EXPERIMENTAL,     \
 87           "(Generational mode only) Floor for adaptive tenuring age. "      \
 88           "Setting floor and ceiling to the same value fixes the tenuring " \
 89           "age; setting both to 1 simulates a poor approximation to "       \
 90           "AlwaysTenure, and setting both to 16 simulates NeverTenure.")    \
 91           range(1,16)                                                       \
 92                                                                             \
 93   product(uintx, ShenandoahGenerationalMaxTenuringAge, 15, EXPERIMENTAL,    \
 94           "(Generational mode only) Ceiling for adaptive tenuring age. "    \
 95           "Setting floor and ceiling to the same value fixes the tenuring " \
 96           "age; setting both to 1 simulates a poor approximation to "       \
 97           "AlwaysTenure, and setting both to 16 simulates NeverTenure.")    \
 98           range(1,16)                                                       \
 99                                                                             \
100   product(double, ShenandoahGenerationalTenuringMortalityRateThreshold,     \
101                                                          0.1, EXPERIMENTAL, \
102           "(Generational mode only) Cohort mortality rates below this "     \
103           "value will be treated as indicative of longevity, leading to "   \
104           "tenuring. A lower value delays tenuring, a higher value hastens "\
105           "it. Used only when ShenandoahGenerationalhenAdaptiveTenuring is "\
106           "enabled.")                                                       \
107           range(0.001,0.999)                                                \
108                                                                             \
109   product(size_t, ShenandoahGenerationalTenuringCohortPopulationThreshold,  \
110                                                          4*K, EXPERIMENTAL, \
111           "(Generational mode only) Cohorts whose population is lower than "\
112           "this value in the previous census are ignored wrt tenuring "     \
113           "decisions. Effectively this makes then tenurable as soon as all "\
114           "older cohorts are. Set this value to the largest cohort "        \
115           "population volume that you are comfortable ignoring when making "\
116           "tenuring decisions.")                                            \
117                                                                             \
118   product(size_t, ShenandoahRegionSize, 0, EXPERIMENTAL,                    \
119           "Static heap region size. Set zero to enable automatic sizing.")  \
120                                                                             \
121   product(size_t, ShenandoahTargetNumRegions, 2048, EXPERIMENTAL,           \
122           "With automatic region sizing, this is the approximate number "   \
123           "of regions that would be used, within min/max region size "      \
124           "limits.")                                                        \
125                                                                             \
126   product(size_t, ShenandoahMinRegionSize, 256 * K, EXPERIMENTAL,           \
127           "With automatic region sizing, the regions would be at least "    \
128           "this large.")                                                    \
129                                                                             \
130   product(size_t, ShenandoahMaxRegionSize, 32 * M, EXPERIMENTAL,            \
131           "With automatic region sizing, the regions would be at most "     \
132           "this large.")                                                    \
133                                                                             \
134   product(intx, ShenandoahHumongousThreshold, 100, EXPERIMENTAL,            \
135           "Humongous objects are allocated in separate regions. "           \
136           "This setting defines how large the object should be to be "      \
137           "deemed humongous. Value is in  percents of heap region size. "   \
138           "This also caps the maximum TLAB size.")                          \
139           range(1, 100)                                                     \
140                                                                             \
141   product(ccstr, ShenandoahGCMode, "satb",                                  \
142           "GC mode to use.  Among other things, this defines which "        \
143           "barriers are in in use. Possible values are:"                    \
144           " satb - snapshot-at-the-beginning concurrent GC (three pass mark-evac-update);"  \
145           " iu - incremental-update concurrent GC (three pass mark-evac-update);"  \
146           " passive - stop the world GC only (either degenerated or full);" \
147           " generational - generational concurrent GC")                     \
148                                                                             \
149   product(ccstr, ShenandoahGCHeuristics, "adaptive",                        \
150           "GC heuristics to use. This fine-tunes the GC mode selected, "    \
151           "by choosing when to start the GC, how much to process on each "  \
152           "cycle, and what other features to automatically enable. "        \
153           "Possible values are:"                                            \
154           " adaptive - adapt to maintain the given amount of free heap "    \
155           "at all times, even during the GC cycle;"                         \
156           " static -  trigger GC when free heap falls below the threshold;" \
157           " aggressive - run GC continuously, try to evacuate everything;"  \
158           " compact - run GC more frequently and with deeper targets to "   \
159           "free up more memory.")                                           \
160                                                                             \
161   product(uintx, ShenandoahExpeditePromotionsThreshold, 5, EXPERIMENTAL,    \
162           "When Shenandoah expects to promote at least this percentage "    \
163           "of the young generation, trigger a young collection to "         \
164           "expedite these promotions.")                                     \
165           range(0,100)                                                      \
166                                                                             \
167   product(uintx, ShenandoahExpediteMixedThreshold, 10, EXPERIMENTAL,        \
168           "When there are this many old regions waiting to be collected, "  \
169           "trigger a mixed collection immediately.")                        \
170                                                                             \
171   product(uintx, ShenandoahGarbageThreshold, 25, EXPERIMENTAL,              \
172           "How much garbage a region has to contain before it would be "    \
173           "taken for collection. This a guideline only, as GC heuristics "  \
174           "may select the region for collection even if it has little "     \
175           "garbage. This also affects how much internal fragmentation the " \
176           "collector accepts. In percents of heap region size.")            \
177           range(0,100)                                                      \
178                                                                             \
179   product(uintx, ShenandoahOldGarbageThreshold, 15, EXPERIMENTAL,           \
180           "How much garbage an old region has to contain before it would "  \
181           "be taken for collection.")                                       \
182           range(0,100)                                                      \
183                                                                             \
184   product(uintx, ShenandoahIgnoreGarbageThreshold, 5, EXPERIMENTAL,         \
185           "When less than this amount of garbage (as a percentage of "      \
186           "region size) exists within a region, the region will not be "    \
187           "added to the collection set, even when the heuristic has "       \
188           "chosen to aggressively add regions with less than "              \
189           "ShenandoahGarbageThreshold amount of garbage into the "          \
190           "collection set.")                                                \
191           range(0,100)                                                      \
192                                                                             \
193   product(uintx, ShenandoahInitFreeThreshold, 70, EXPERIMENTAL,             \
194           "When less than this amount of memory is free within the"         \
195           "heap or generation, trigger a learning cycle if we are "         \
196           "in learning mode.  Learning mode happens during initialization " \
197           "and following a drastic state change, such as following a "      \
198           "degenerated or Full GC cycle.  In percents of soft max "         \
199           "heap size.")                                                     \
200           range(0,100)                                                      \
201                                                                             \
202   product(uintx, ShenandoahMinFreeThreshold, 10, EXPERIMENTAL,              \
203           "Percentage of free heap memory (or young generation, in "        \
204           "generational mode) below which most heuristics trigger "         \
205           "collection independent of other triggers. Provides a safety "    \
206           "margin for many heuristics. In percents of (soft) max heap "     \
207           "size.")                                                          \
208           range(0,100)                                                      \
209                                                                             \
210   product(uintx, ShenandoahAllocationThreshold, 0, EXPERIMENTAL,            \
211           "How many new allocations should happen since the last GC cycle " \
212           "before some heuristics trigger the collection. In percents of "  \
213           "(soft) max heap size. Set to zero to effectively disable.")      \
214           range(0,100)                                                      \
215                                                                             \
216   product(uintx, ShenandoahAllocSpikeFactor, 5, EXPERIMENTAL,               \
217           "How much of heap should some heuristics reserve for absorbing "  \
218           "the allocation spikes. Larger value wastes more memory in "      \
219           "non-emergency cases, but provides more safety in emergency "     \
220           "cases. In percents of (soft) max heap size.")                    \
221           range(0,100)                                                      \
222                                                                             \
223   product(uintx, ShenandoahLearningSteps, 10, EXPERIMENTAL,                 \
224           "The number of cycles some heuristics take to collect in order "  \
225           "to learn application and GC performance.")                       \
226           range(0,100)                                                      \
227                                                                             \
228   product(uintx, ShenandoahImmediateThreshold, 70, EXPERIMENTAL,            \
229           "The cycle may shortcut when enough garbage can be reclaimed "    \
230           "from the immediate garbage (completely garbage regions). "       \
231           "In percents of total garbage found. Setting this threshold "     \
232           "to 100 effectively disables the shortcut.")                      \
233           range(0,100)                                                      \
234                                                                             \
235   product(uintx, ShenandoahAdaptiveSampleFrequencyHz, 10, EXPERIMENTAL,     \
236           "The number of times per second to update the allocation rate "   \
237           "moving average.")                                                \
238                                                                             \
239   product(uintx, ShenandoahAdaptiveSampleSizeSeconds, 10, EXPERIMENTAL,     \
240           "The size of the moving window over which the average "           \
241           "allocation rate is maintained. The total number of samples "     \
242           "is the product of this number and the sample frequency.")        \
243                                                                             \
244   product(double, ShenandoahAdaptiveInitialConfidence, 1.8, EXPERIMENTAL,   \
245           "The number of standard deviations used to determine an initial " \
246           "margin of error for the average cycle time and average "         \
247           "allocation rate. Increasing this value will cause the "          \
248           "heuristic to initiate more concurrent cycles." )                 \
249                                                                             \
250   product(double, ShenandoahAdaptiveInitialSpikeThreshold, 1.8, EXPERIMENTAL, \
251           "If the most recently sampled allocation rate is more than "      \
252           "this many standard deviations away from the moving average, "    \
253           "then a cycle is initiated. This value controls how sensitive "   \
254           "the heuristic is to allocation spikes. Decreasing this number "  \
255           "increases the sensitivity. ")                                    \
256                                                                             \
257   product(double, ShenandoahAdaptiveDecayFactor, 0.1, EXPERIMENTAL,         \
258           "The decay factor (alpha) used for values in the weighted "       \
259           "moving average of cycle time and allocation rate. "              \
260           "Larger values give more weight to recent values.")               \
261           range(0,1.0)                                                      \
262                                                                             \
263   product(bool, ShenandoahAdaptiveIgnoreShortCycles, true, EXPERIMENTAL,    \
264           "The adaptive heuristic tracks a moving average of cycle "        \
265           "times in order to start a gc before memory is exhausted. "       \
266           "In some cases, Shenandoah may skip the evacuation and update "   \
267           "reference phases, resulting in a shorter cycle. These may skew " \
268           "the average cycle time downward and may cause the heuristic "    \
269           "to wait too long to start a cycle. Disabling this will have "    \
270           "the gc run less often, which will reduce CPU utilization, but"   \
271           "increase the risk of degenerated cycles.")                       \
272                                                                             \
273   product(uintx, ShenandoahGuaranteedGCInterval, 5*60*1000, EXPERIMENTAL,   \
274           "Many heuristics would guarantee a concurrent GC cycle at "       \
275           "least with this interval. This is useful when large idle "       \
276           "intervals are present, where GC can run without stealing "       \
277           "time from active application. Time is in milliseconds. "         \
278           "Setting this to 0 disables the feature.")                        \
279                                                                             \
280   product(uintx, ShenandoahGuaranteedOldGCInterval, 10*60*1000, EXPERIMENTAL, \
281           "Run a collection of the old generation at least this often. "    \
282           "Heuristics may trigger collections more frequently. Time is in " \
283           "milliseconds. Setting this to 0 disables the feature.")          \
284                                                                             \
285   product(uintx, ShenandoahGuaranteedYoungGCInterval, 5*60*1000,  EXPERIMENTAL,  \
286           "Run a collection of the young generation at least this often. "  \
287           "Heuristics may trigger collections more frequently. Time is in " \
288           "milliseconds. Setting this to 0 disables the feature.")          \
289                                                                             \
290   product(bool, ShenandoahAlwaysClearSoftRefs, false, EXPERIMENTAL,         \
291           "Unconditionally clear soft references, instead of using any "    \
292           "other cleanup policy. This minimizes footprint at expense of"    \
293           "more soft reference churn in applications.")                     \
294                                                                             \
295   product(bool, ShenandoahUncommit, true, EXPERIMENTAL,                     \
296           "Allow to uncommit memory under unused regions and metadata. "    \
297           "This optimizes footprint at expense of allocation latency in "   \
298           "regions that require committing back. Uncommits would be "       \
299           "disabled by some heuristics, or with static heap size.")         \
300                                                                             \
301   product(uintx, ShenandoahUncommitDelay, 5*60*1000, EXPERIMENTAL,          \
302           "Uncommit memory for regions that were not used for more than "   \
303           "this time. First use after that would incur allocation stalls. " \
304           "Actively used regions would never be uncommitted, because they " \
305           "do not become unused longer than this delay. Time is in "        \
306           "milliseconds. Setting this delay to 0 effectively uncommits "    \
307           "regions almost immediately after they become unused.")           \
308                                                                             \
309   product(bool, ShenandoahRegionSampling, false, EXPERIMENTAL,              \
310           "Provide heap region sampling data via jvmstat.")                 \
311                                                                             \
312   product(int, ShenandoahRegionSamplingRate, 40, EXPERIMENTAL,              \
313           "Sampling rate for heap region sampling. In milliseconds between "\
314           "the samples. Higher values provide more fidelity, at expense "   \
315           "of more sampling overhead.")                                     \
316                                                                             \
317   product(uintx, ShenandoahControlIntervalMin, 1, EXPERIMENTAL,             \
318           "The minimum sleep interval for the control loop that drives "    \
319           "the cycles. Lower values would increase GC responsiveness "      \
320           "to changing heap conditions, at the expense of higher perf "     \
321           "overhead. Time is in milliseconds.")                             \
322                                                                             \
323   product(uintx, ShenandoahControlIntervalMax, 10, EXPERIMENTAL,            \
324           "The maximum sleep interval for control loop that drives "        \
325           "the cycles. Lower values would increase GC responsiveness "      \
326           "to changing heap conditions, at the expense of higher perf "     \
327           "overhead. Time is in milliseconds.")                             \
328                                                                             \
329   product(uintx, ShenandoahControlIntervalAdjustPeriod, 1000, EXPERIMENTAL, \
330           "The time period for one step in control loop interval "          \
331           "adjustment. Lower values make adjustments faster, at the "       \
332           "expense of higher perf overhead. Time is in milliseconds.")      \
333                                                                             \
334   product(bool, ShenandoahVerify, false, DIAGNOSTIC,                        \
335           "Enable internal verification. This would catch many GC bugs, "   \
336           "but it would also stall the collector during the verification, " \
337           "which prolongs the pauses and might hide other bugs.")           \
338                                                                             \
339   product(intx, ShenandoahVerifyLevel, 4, DIAGNOSTIC,                       \
340           "Verification level, higher levels check more, taking more time. "\
341           "Accepted values are:"                                            \
342           " 0 = basic heap checks; "                                        \
343           " 1 = previous level, plus basic region checks; "                 \
344           " 2 = previous level, plus all roots; "                           \
345           " 3 = previous level, plus all reachable objects; "               \
346           " 4 = previous level, plus all marked objects")                   \
347                                                                             \
348   product(uintx, ShenandoahEvacReserve, 5, EXPERIMENTAL,                    \
349           "How much of (young-generation) heap to reserve for "             \
350           "(young-generation) evacuations.  Larger values allow GC to "     \
351           "evacuate more live objects on every cycle, while leaving "       \
352           "less headroom for application to allocate while GC is "          \
353           "evacuating and updating references. This parameter is "          \
354           "consulted at the end of marking, before selecting the "          \
355           "collection set.  If available memory at this time is smaller "   \
356           "than the indicated reserve, the bound on collection set size is "\
357           "adjusted downward.  The size of a generational mixed "           \
358           "evacuation collection set (comprised of both young and old "     \
359           "regions) is also bounded by this parameter.  In percents of "    \
360           "total (young-generation) heap size.")                            \
361           range(1,100)                                                      \
362                                                                             \
363   product(double, ShenandoahEvacWaste, 1.2, EXPERIMENTAL,                   \
364           "How much waste evacuations produce within the reserved space. "  \
365           "Larger values make evacuations more resilient against "          \
366           "evacuation conflicts, at expense of evacuating less on each "    \
367           "GC cycle.  Smaller values increase the risk of evacuation "      \
368           "failures, which will trigger stop-the-world Full GC passes.")    \
369           range(1.0,100.0)                                                  \
370                                                                             \
371   product(double, ShenandoahOldEvacWaste, 1.4, EXPERIMENTAL,                \
372           "How much waste evacuations produce within the reserved space. "  \
373           "Larger values make evacuations more resilient against "          \
374           "evacuation conflicts, at expense of evacuating less on each "    \
375           "GC cycle.  Smaller values increase the risk of evacuation "      \
376           "failures, which will trigger stop-the-world Full GC passes.")    \
377           range(1.0,100.0)                                                  \
378                                                                             \
379   product(double, ShenandoahPromoEvacWaste, 1.2, EXPERIMENTAL,              \
380           "How much waste promotions produce within the reserved space. "   \
381           "Larger values make evacuations more resilient against "          \
382           "evacuation conflicts, at expense of promoting less on each "     \
383           "GC cycle.  Smaller values increase the risk of evacuation "      \
384           "failures, which will trigger stop-the-world Full GC passes.")    \
385           range(1.0,100.0)                                                  \
386                                                                             \
387   product(uintx, ShenandoahMaxEvacLABRatio, 0, EXPERIMENTAL,                \
388           "Potentially, each running thread maintains a PLAB for "          \
389           "evacuating objects into old-gen memory and a GCLAB for "         \
390           "evacuating objects into young-gen memory.  Each time a thread "  \
391           "exhausts its PLAB or GCLAB, a new local buffer is allocated. "   \
392           "By default, the new buffer is twice the size of the previous "   \
393           "buffer.  The sizes are reset to the minimum at the start of "    \
394           "each GC pass.  This parameter limits the growth of evacuation "  \
395           "buffer sizes to its value multiplied by the minimum buffer "     \
396           "size.  A higher value allows evacuation allocations to be more " \
397           "efficient because less synchronization is required by "          \
398           "individual threads.  However, a larger value increases the "     \
399           "likelihood of evacuation failures, leading to long "             \
400           "stop-the-world pauses.  This is because a large value "          \
401           "allows individual threads to consume large percentages of "      \
402           "the total evacuation budget without necessarily effectively "    \
403           "filling their local evacuation buffers with evacuated "          \
404           "objects.  A value of zero means no maximum size is enforced.")   \
405           range(0, 1024)                                                    \
406                                                                             \
407   product(bool, ShenandoahEvacReserveOverflow, true, EXPERIMENTAL,          \
408           "Allow evacuations to overflow the reserved space. Enabling it "  \
409           "will make evacuations more resilient when evacuation "           \
410           "reserve/waste is incorrect, at the risk that application "       \
411           "runs out of memory too early.")                                  \
412                                                                             \
413   product(uintx, ShenandoahOldEvacRatioPercent, 75, EXPERIMENTAL,           \
414           "The maximum proportion of evacuation from old-gen memory, "      \
415           "expressed as a percentage. The default value 75 denotes that no" \
416           "more than 75% of the collection set evacuation workload may be " \
417           "towards evacuation of old-gen heap regions. This limits both the"\
418           "promotion of aged regions and the compaction of existing old "   \
419           "regions.  A value of 75 denotes that the total evacuation work"  \
420           "may increase to up to four times the young gen evacuation work." \
421           "A larger value allows quicker promotion and allows"              \
422           "a smaller number of mixed evacuations to process "               \
423           "the entire list of old-gen collection candidates at the cost "   \
424           "of an increased disruption of the normal cadence of young-gen "  \
425           "collections.  A value of 100 allows a mixed evacuation to "      \
426           "focus entirely on old-gen memory, allowing no young-gen "        \
427           "regions to be collected, likely resulting in subsequent "        \
428           "allocation failures because the allocation pool is not "         \
429           "replenished.  A value of 0 allows a mixed evacuation to"         \
430           "focus entirely on young-gen memory, allowing no old-gen "        \
431           "regions to be collected, likely resulting in subsequent "        \
432           "promotion failures and triggering of stop-the-world full GC "    \
433           "events.")                                                        \
434           range(0,100)                                                      \
435                                                                             \
436   product(uintx, ShenandoahMinYoungPercentage, 20, EXPERIMENTAL,            \
437           "The minimum percentage of the heap to use for the young "        \
438           "generation. Heuristics will not adjust the young generation "    \
439           "to be less than this.")                                          \
440           range(0, 100)                                                     \
441                                                                             \
442   product(uintx, ShenandoahMaxYoungPercentage, 100, EXPERIMENTAL,           \
443           "The maximum percentage of the heap to use for the young "        \
444           "generation. Heuristics will not adjust the young generation "    \
445           "to be more than this.")                                          \
446           range(0, 100)                                                     \
447                                                                             \
448   product(bool, ShenandoahPacing, true, EXPERIMENTAL,                       \
449           "Pace application allocations to give GC chance to start "        \
450           "and complete before allocation failure is reached.")             \
451                                                                             \
452   product(uintx, ShenandoahPacingMaxDelay, 10, EXPERIMENTAL,                \
453           "Max delay for pacing application allocations. Larger values "    \
454           "provide more resilience against out of memory, at expense at "   \
455           "hiding the GC latencies in the allocation path. Time is in "     \
456           "milliseconds. Setting it to arbitrarily large value makes "      \
457           "GC effectively stall the threads indefinitely instead of going " \
458           "to degenerated or Full GC.")                                     \
459                                                                             \
460   product(uintx, ShenandoahPacingIdleSlack, 2, EXPERIMENTAL,                \
461           "How much of heap counted as non-taxable allocations during idle "\
462           "phases. Larger value makes the pacing milder when collector is " \
463           "idle, requiring less rendezvous with control thread. Lower "     \
464           "value makes the pacing control less responsive to out-of-cycle " \
465           "allocs. In percent of total heap size.")                         \
466           range(0, 100)                                                     \
467                                                                             \
468   product(uintx, ShenandoahPacingCycleSlack, 10, EXPERIMENTAL,              \
469           "How much of free space to take as non-taxable allocations "      \
470           "the GC cycle. Larger value makes the pacing milder at the "      \
471           "beginning of the GC cycle. Lower value makes the pacing less "   \
472           "uniform during the cycle. In percent of free space.")            \
473           range(0, 100)                                                     \
474                                                                             \
475   product(double, ShenandoahPacingSurcharge, 1.1, EXPERIMENTAL,             \
476           "Additional pacing tax surcharge to help unclutter the heap. "    \
477           "Larger values makes the pacing more aggressive. Lower values "   \
478           "risk GC cycles finish with less memory than were available at "  \
479           "the beginning of it.")                                           \
480           range(1.0, 100.0)                                                 \
481                                                                             \
482   product(uintx, ShenandoahCriticalFreeThreshold, 1, EXPERIMENTAL,          \
483           "How much of the heap needs to be free after recovery cycles, "   \
484           "either Degenerated or Full GC to be claimed successful. If this "\
485           "much space is not available, next recovery step would be "       \
486           "triggered.")                                                     \
487           range(0, 100)                                                     \
488                                                                             \
489   product(bool, ShenandoahDegeneratedGC, true, DIAGNOSTIC,                  \
490           "Enable Degenerated GC as the graceful degradation step. "        \
491           "Disabling this option leads to degradation to Full GC instead. " \
492           "When running in passive mode, this can be toggled to measure "   \
493           "either Degenerated GC or Full GC costs.")                        \
494                                                                             \
495   product(uintx, ShenandoahFullGCThreshold, 3, EXPERIMENTAL,                \
496           "How many back-to-back Degenerated GCs should happen before "     \
497           "going to a Full GC.")                                            \
498                                                                             \
499   product(uintx, ShenandoahNoProgressThreshold, 5, EXPERIMENTAL,            \
500           "After this number of consecutive Full GCs fail to make "         \
501           "progress, Shenandoah will raise out of memory errors. Note "     \
502           "that progress is determined by ShenandoahCriticalFreeThreshold") \
503                                                                             \
504   product(bool, ShenandoahImplicitGCInvokesConcurrent, false, EXPERIMENTAL, \
505           "Should internally-caused GC requests invoke concurrent cycles, " \
506           "should they do the stop-the-world (Degenerated / Full GC)? "     \
507           "Many heuristics automatically enable this. This option is "      \
508           "similar to global ExplicitGCInvokesConcurrent.")                 \
509                                                                             \
510   product(bool, ShenandoahHumongousMoves, true, DIAGNOSTIC,                 \
511           "Allow moving humongous regions. This makes GC more resistant "   \
512           "to external fragmentation that may otherwise fail other "        \
513           "humongous allocations, at the expense of higher GC copying "     \
514           "costs. Currently affects stop-the-world (Full) cycle only.")     \
515                                                                             \
516   product(bool, ShenandoahOOMDuringEvacALot, false, DIAGNOSTIC,             \
517           "Testing: simulate OOM during evacuation.")                       \
518                                                                             \
519   product(bool, ShenandoahAllocFailureALot, false, DIAGNOSTIC,              \
520           "Testing: make lots of artificial allocation failures.")          \
521                                                                             \
522   product(uintx, ShenandoahCoalesceChance, 0, DIAGNOSTIC,                   \
523           "Testing: Abandon remaining mixed collections with this "         \
524           "likelihood. Following each mixed collection, abandon all "       \
525           "remaining mixed collection candidate regions with likelihood "   \
526           "ShenandoahCoalesceChance. Abandoning a mixed collection will "   \
527           "cause the old regions to be made parsable, rather than being "   \
528           "evacuated.")                                                     \
529           range(0, 100)                                                     \
530                                                                             \
531   product(intx, ShenandoahMarkScanPrefetch, 32, EXPERIMENTAL,               \
532           "How many objects to prefetch ahead when traversing mark bitmaps."\
533           "Set to 0 to disable prefetching.")                               \
534           range(0, 256)                                                     \
535                                                                             \
536   product(uintx, ShenandoahMarkLoopStride, 1000, EXPERIMENTAL,              \
537           "How many items to process during one marking iteration before "  \
538           "checking for cancellation, yielding, etc. Larger values improve "\
539           "marking performance at expense of responsiveness.")              \
540                                                                             \
541   product(uintx, ShenandoahParallelRegionStride, 1024, EXPERIMENTAL,        \
542           "How many regions to process at once during parallel region "     \
543           "iteration. Affects heaps with lots of regions.")                 \
544                                                                             \
545   product(size_t, ShenandoahSATBBufferSize, 1 * K, EXPERIMENTAL,            \
546           "Number of entries in an SATB log buffer.")                       \
547           range(1, max_uintx)                                               \
548                                                                             \
549   product(uintx, ShenandoahMaxSATBBufferFlushes, 5, EXPERIMENTAL,           \
550           "How many times to maximum attempt to flush SATB buffers at the " \
551           "end of concurrent marking.")                                     \
552                                                                             \
553   product(bool, ShenandoahSATBBarrier, true, DIAGNOSTIC,                    \
554           "Turn on/off SATB barriers in Shenandoah")                        \
555                                                                             \
556   product(bool, ShenandoahIUBarrier, false, DIAGNOSTIC,                     \
557           "Turn on/off I-U barriers barriers in Shenandoah")                \
558                                                                             \
559   product(bool, ShenandoahCardBarrier, false, DIAGNOSTIC,                   \
560           "Turn on/off card-marking post-write barrier in Shenandoah: "     \
561           " true when ShenandoahGCMode is generational, false otherwise")   \
562                                                                             \
563   product(bool, ShenandoahCASBarrier, true, DIAGNOSTIC,                     \
564           "Turn on/off CAS barriers in Shenandoah")                         \
565                                                                             \
566   product(bool, ShenandoahCloneBarrier, true, DIAGNOSTIC,                   \
567           "Turn on/off clone barriers in Shenandoah")                       \
568                                                                             \
569   product(bool, ShenandoahLoadRefBarrier, true, DIAGNOSTIC,                 \
570           "Turn on/off load-reference barriers in Shenandoah")              \
571                                                                             \
572   product(bool, ShenandoahStackWatermarkBarrier, true, DIAGNOSTIC,          \
573           "Turn on/off stack watermark barriers in Shenandoah")             \
574                                                                             \
575   develop(bool, ShenandoahVerifyOptoBarriers, trueInDebug,                  \
576           "Verify no missing barriers in C2.")                              \
577                                                                             \
578   product(uintx, ShenandoahOldCompactionReserve, 8, EXPERIMENTAL,           \
579           "During generational GC, prevent promotions from filling "        \
580           "this number of heap regions.  These regions are reserved "       \
581           "for the purpose of supporting compaction of old-gen "            \
582           "memory.  Otherwise, old-gen memory cannot be compacted.")        \
583           range(0, 128)                                                     \
584                                                                             \
585   product(bool, ShenandoahAllowOldMarkingPreemption, true, DIAGNOSTIC,      \
586           "Allow young generation collections to suspend concurrent"        \
587           " marking in the old generation.")                                \
588                                                                             \
589   product(uintx, ShenandoahAgingCyclePeriod, 1, EXPERIMENTAL,               \
590           "With generational mode, increment the age of objects and"        \
591           "regions each time this many young-gen GC cycles are completed.") \
592                                                                             \
593   notproduct(bool, ShenandoahEnableCardStats, false,                        \
594           "Enable statistics collection related to clean & dirty cards")    \
595                                                                             \
596   notproduct(int, ShenandoahCardStatsLogInterval, 50,                       \
597           "Log cumulative card stats every so many remembered set or "      \
598           "update refs scans")                                              \
599                                                                             \
600   product(uintx, ShenandoahMinimumOldMarkTimeMs, 100, EXPERIMENTAL,         \
601          "Minimum amount of time in milliseconds to run old marking "       \
602          "before a young collection is allowed to run. This is intended "   \
603          "to prevent starvation of the old collector. Setting this to "     \
604          "0 will allow back to back young collections to run during old "   \
605          "marking.")                                                        \
606   // end of GC_SHENANDOAH_FLAGS
607 
608 #endif // SHARE_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP