1 | /* |
2 | * Copyright (c) 2016, 2018, Red Hat, Inc. All rights reserved. |
3 | * |
4 | * This code is free software; you can redistribute it and/or modify it |
5 | * under the terms of the GNU General Public License version 2 only, as |
6 | * published by the Free Software Foundation. |
7 | * |
8 | * This code is distributed in the hope that it will be useful, but WITHOUT |
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
11 | * version 2 for more details (a copy is included in the LICENSE file that |
12 | * accompanied this code). |
13 | * |
14 | * You should have received a copy of the GNU General Public License version |
15 | * 2 along with this work; if not, write to the Free Software Foundation, |
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
17 | * |
18 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
19 | * or visit www.oracle.com if you need additional information or have any |
20 | * questions. |
21 | * |
22 | */ |
23 | |
24 | #ifndef SHARE_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP |
25 | #define SHARE_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP |
26 | |
27 | #define GC_SHENANDOAH_FLAGS(develop, \ |
28 | develop_pd, \ |
29 | product, \ |
30 | product_pd, \ |
31 | diagnostic, \ |
32 | diagnostic_pd, \ |
33 | experimental, \ |
34 | notproduct, \ |
35 | manageable, \ |
36 | product_rw, \ |
37 | lp64_product, \ |
38 | range, \ |
39 | constraint, \ |
40 | writeable) \ |
41 | \ |
42 | experimental(size_t, ShenandoahHeapRegionSize, 0, \ |
43 | "Size of the Shenandoah regions. Set to zero to detect " \ |
44 | "automatically.") \ |
45 | \ |
46 | experimental(size_t, ShenandoahTargetNumRegions, 2048, \ |
47 | "Target number of regions. We try to get around that many " \ |
48 | "regions, based on Shenandoah{Min,Max}RegionSize.") \ |
49 | \ |
50 | experimental(size_t, ShenandoahMinRegionSize, 256 * K, \ |
51 | "Minimum Shenandoah heap region size.") \ |
52 | \ |
53 | experimental(size_t, ShenandoahMaxRegionSize, 32 * M, \ |
54 | "Maximum Shenandoah heap region size.") \ |
55 | \ |
56 | experimental(intx, ShenandoahHumongousThreshold, 100, \ |
57 | "How large should the object be to get allocated in humongous " \ |
58 | "region, in percents of heap region size. This also caps the " \ |
59 | "maximum TLAB size.") \ |
60 | range(1, 100) \ |
61 | \ |
62 | experimental(ccstr, ShenandoahGCHeuristics, "adaptive", \ |
63 | "The heuristics to use in Shenandoah GC. Possible values:" \ |
64 | " *) adaptive - adapt to maintain the given amount of free heap;" \ |
65 | " *) static - start concurrent GC when static free heap " \ |
66 | " threshold and static allocation threshold are " \ |
67 | " tripped;" \ |
68 | " *) passive - do not start concurrent GC, wait for Full GC; " \ |
69 | " *) aggressive - run concurrent GC continuously, evacuate " \ |
70 | " everything;" \ |
71 | " *) compact - run GC with lower footprint target, may end up " \ |
72 | " doing continuous GC, evacuate lots of live " \ |
73 | " objects, uncommit heap aggressively;") \ |
74 | \ |
75 | experimental(ccstr, ShenandoahUpdateRefsEarly, "adaptive", \ |
76 | "Run a separate concurrent reference updating phase after" \ |
77 | "concurrent evacuation. Possible values: 'on', 'off', 'adaptive'")\ |
78 | \ |
79 | experimental(uintx, ShenandoahRefProcFrequency, 5, \ |
80 | "How often should (weak, soft, etc) references be processed. " \ |
81 | "References get processed at every Nth GC cycle. Set to zero " \ |
82 | "to disable reference processing.") \ |
83 | \ |
84 | experimental(uintx, ShenandoahUnloadClassesFrequency, 5, \ |
85 | "How often should classes get unloaded. " \ |
86 | "Class unloading is performed at every Nth GC cycle. " \ |
87 | "Set to zero to disable class unloading during concurrent GC.") \ |
88 | \ |
89 | experimental(uintx, ShenandoahGarbageThreshold, 60, \ |
90 | "Sets the percentage of garbage a region need to contain before " \ |
91 | "it can be marked for collection. Does not apply to all " \ |
92 | "heuristics.") \ |
93 | range(0,100) \ |
94 | \ |
95 | experimental(uintx, ShenandoahFreeThreshold, 10, \ |
96 | "Set the percentage of free heap at which a GC cycle is started. "\ |
97 | "Does not apply to all heuristics.") \ |
98 | range(0,100) \ |
99 | \ |
100 | experimental(uintx, ShenandoahInitFreeThreshold, 70, \ |
101 | "Initial remaining free heap threshold for learning steps in " \ |
102 | "heuristics. In percents of total heap size. Does not apply to " \ |
103 | "all heuristics.") \ |
104 | range(0,100) \ |
105 | \ |
106 | experimental(uintx, ShenandoahMinFreeThreshold, 10, \ |
107 | "Minimum remaining free space threshold, after which collection " \ |
108 | "definitely triggers. Does not apply to all heuristics.") \ |
109 | range(0,100) \ |
110 | \ |
111 | experimental(uintx, ShenandoahAllocationThreshold, 0, \ |
112 | "Set percentage of memory allocated since last GC cycle before " \ |
113 | "a new GC cycle can be started. Set to zero to effectively " \ |
114 | "disable.") \ |
115 | range(0,100) \ |
116 | \ |
117 | experimental(uintx, ShenandoahLearningSteps, 5, \ |
118 | "Number of GC cycles to run in order to learn application " \ |
119 | "and GC performance for adaptive heuristics.") \ |
120 | range(0,100) \ |
121 | \ |
122 | experimental(uintx, ShenandoahImmediateThreshold, 90, \ |
123 | "If mark identifies more than this much immediate garbage " \ |
124 | "regions, it shall recycle them, and shall not continue the " \ |
125 | "rest of the GC cycle. The value is in percents of total " \ |
126 | "number of candidate regions for collection set. Setting this " \ |
127 | "threshold to 100% effectively disables this shortcut.") \ |
128 | range(0,100) \ |
129 | \ |
130 | experimental(uintx, ShenandoahMergeUpdateRefsMinGap, 100, \ |
131 | "If GC is currently running in separate update-refs mode " \ |
132 | "this numbers gives the threshold when to switch to " \ |
133 | "merged update-refs mode. Number is percentage relative to" \ |
134 | "duration(marking)+duration(update-refs).") \ |
135 | \ |
136 | experimental(uintx, ShenandoahMergeUpdateRefsMaxGap, 200, \ |
137 | "If GC is currently running in merged update-refs mode " \ |
138 | "this numbers gives the threshold when to switch to " \ |
139 | "separate update-refs mode. Number is percentage relative " \ |
140 | "to duration(marking)+duration(update-refs).") \ |
141 | \ |
142 | experimental(uintx, ShenandoahGuaranteedGCInterval, 5*60*1000, \ |
143 | "Adaptive and dynamic heuristics would guarantee a GC cycle " \ |
144 | "at least with this interval. This is useful when large idle" \ |
145 | " intervals are present, where GC can run without stealing " \ |
146 | "time from active application. Time is in milliseconds.") \ |
147 | \ |
148 | experimental(bool, ShenandoahAlwaysClearSoftRefs, false, \ |
149 | "Clear soft references always, instead of using any smart " \ |
150 | "cleanup policy. This minimizes footprint at expense of more " \ |
151 | "softref churn in applications.") \ |
152 | \ |
153 | experimental(bool, ShenandoahUncommit, true, \ |
154 | "Allow Shenandoah to uncommit unused memory.") \ |
155 | \ |
156 | experimental(uintx, ShenandoahUncommitDelay, 5*60*1000, \ |
157 | "Shenandoah would start to uncommit memory for regions that were" \ |
158 | " not used for more than this time. First use after that would " \ |
159 | "incur allocation stalls. Actively used regions would never be " \ |
160 | "uncommitted, because they never decay. Time is in milliseconds." \ |
161 | "Setting this delay to 0 effectively makes Shenandoah to " \ |
162 | "uncommit the regions almost immediately.") \ |
163 | \ |
164 | experimental(bool, ShenandoahRegionSampling, false, \ |
165 | "Turns on heap region sampling via JVMStat") \ |
166 | \ |
167 | experimental(int, ShenandoahRegionSamplingRate, 40, \ |
168 | "Sampling rate for heap region sampling. " \ |
169 | "Number of milliseconds between samples") \ |
170 | \ |
171 | experimental(uintx, ShenandoahControlIntervalMin, 1, \ |
172 | "The minumum sleep interval for control loop that drives " \ |
173 | "the cycles. Lower values would increase GC responsiveness " \ |
174 | "to changing heap conditions, at the expense of higher perf " \ |
175 | "overhead. Time is in milliseconds.") \ |
176 | \ |
177 | experimental(uintx, ShenandoahControlIntervalMax, 10, \ |
178 | "The maximum sleep interval for control loop that drives " \ |
179 | "the cycles. Lower values would increase GC responsiveness " \ |
180 | "to changing heap conditions, at the expense of higher perf " \ |
181 | "overhead. Time is in milliseconds.") \ |
182 | \ |
183 | experimental(uintx, ShenandoahControlIntervalAdjustPeriod, 1000, \ |
184 | "The time period for one step in control loop interval " \ |
185 | "adjustment. Lower values make adjustments faster, at the " \ |
186 | "expense of higher perf overhead. Time is in milliseconds.") \ |
187 | \ |
188 | experimental(bool, ShenandoahCriticalControlThreadPriority, false, \ |
189 | "Shenandoah control thread runs at critical scheduling priority.")\ |
190 | \ |
191 | diagnostic(bool, ShenandoahVerify, false, \ |
192 | "Verify the Shenandoah garbage collector") \ |
193 | \ |
194 | diagnostic(intx, ShenandoahVerifyLevel, 4, \ |
195 | "Shenandoah verification level: " \ |
196 | "0 = basic heap checks; " \ |
197 | "1 = previous level, plus basic region checks; " \ |
198 | "2 = previous level, plus all roots; " \ |
199 | "3 = previous level, plus all reachable objects; " \ |
200 | "4 = previous level, plus all marked objects") \ |
201 | \ |
202 | diagnostic(bool, ShenandoahElasticTLAB, true, \ |
203 | "Use Elastic TLABs with Shenandoah") \ |
204 | \ |
205 | diagnostic(bool, ShenandoahAllowMixedAllocs, true, \ |
206 | "Allow mixing mutator and collector allocations in a single " \ |
207 | "region") \ |
208 | \ |
209 | experimental(uintx, ShenandoahAllocSpikeFactor, 5, \ |
210 | "The amount of heap space to reserve for absorbing the " \ |
211 | "allocation spikes. Larger value wastes more memory in " \ |
212 | "non-emergency cases, but provides more safety in emergency " \ |
213 | "cases. In percents of total heap size.") \ |
214 | range(0,100) \ |
215 | \ |
216 | experimental(uintx, ShenandoahEvacReserve, 5, \ |
217 | "Maximum amount of free space to reserve for evacuation. " \ |
218 | "Larger values make GC more aggressive, while leaving less " \ |
219 | "headroom for application to allocate in. " \ |
220 | "In percents of total heap size.") \ |
221 | range(1,100) \ |
222 | \ |
223 | experimental(double, ShenandoahEvacWaste, 1.2, \ |
224 | "How much waste evacuations produce within the reserved " \ |
225 | "space. Larger values make evacuations more resilient " \ |
226 | "against allocation failures, at expense of smaller csets " \ |
227 | "on each cycle.") \ |
228 | range(1.0,100.0) \ |
229 | \ |
230 | experimental(bool, ShenandoahEvacReserveOverflow, true, \ |
231 | "Allow evacuations to overflow the reserved space. " \ |
232 | "Enabling it will make evacuations more resilient when " \ |
233 | "evacuation reserve/waste is incorrect, at the risk that " \ |
234 | "application allocations run out of memory too early.") \ |
235 | \ |
236 | diagnostic(bool, ShenandoahAllocationTrace, false, \ |
237 | "Trace allocation latencies and stalls. Can be expensive when " \ |
238 | "lots of allocations happen, and may introduce scalability " \ |
239 | "bottlenecks.") \ |
240 | \ |
241 | diagnostic(intx, ShenandoahAllocationStallThreshold, 10000, \ |
242 | "When allocation tracing is enabled, the allocation stalls " \ |
243 | "larger than this threshold would be reported as warnings. " \ |
244 | "Time is in microseconds.") \ |
245 | \ |
246 | experimental(uintx, ShenandoahEvacAssist, 10, \ |
247 | "How many objects to evacuate on LRB assist path. " \ |
248 | "Use zero to disable.") \ |
249 | \ |
250 | experimental(bool, ShenandoahPacing, true, \ |
251 | "Pace application allocations to give GC chance to start " \ |
252 | "and complete before allocation failure is reached.") \ |
253 | \ |
254 | experimental(uintx, ShenandoahPacingMaxDelay, 10, \ |
255 | "Max delay for pacing application allocations. " \ |
256 | "Time is in milliseconds.") \ |
257 | \ |
258 | experimental(uintx, ShenandoahPacingIdleSlack, 2, \ |
259 | "Percent of heap counted as non-taxable allocations during idle. "\ |
260 | "Larger value makes the pacing milder during idle phases, " \ |
261 | "requiring less rendezvous with control thread. Lower value " \ |
262 | "makes the pacing control less responsive to out-of-cycle allocs.")\ |
263 | range(0, 100) \ |
264 | \ |
265 | experimental(uintx, ShenandoahPacingCycleSlack, 10, \ |
266 | "Percent of free space taken as non-taxable allocations during " \ |
267 | "the GC cycle. Larger value makes the pacing milder at the " \ |
268 | "beginning of the GC cycle. Lower value makes the pacing less " \ |
269 | "uniform during the cycle.") \ |
270 | range(0, 100) \ |
271 | \ |
272 | experimental(double, ShenandoahPacingSurcharge, 1.1, \ |
273 | "Additional pacing tax surcharge to help unclutter the heap. " \ |
274 | "Larger values makes the pacing more aggressive. Lower values " \ |
275 | "risk GC cycles finish with less memory than were available at " \ |
276 | "the beginning of it.") \ |
277 | range(1.0, 100.0) \ |
278 | \ |
279 | experimental(uintx, ShenandoahCriticalFreeThreshold, 1, \ |
280 | "Percent of heap that needs to be free after recovery cycles, " \ |
281 | "either Degenerated or Full GC. If this much space is not " \ |
282 | "available, next recovery step would triggered.") \ |
283 | range(0, 100) \ |
284 | \ |
285 | diagnostic(bool, ShenandoahDegeneratedGC, true, \ |
286 | "Use Degenerated GC as the graceful degradation step. Disabling " \ |
287 | "this leads to degradation to Full GC") \ |
288 | \ |
289 | experimental(uintx, ShenandoahFullGCThreshold, 3, \ |
290 | "How many back-to-back Degenerated GCs to do before triggering " \ |
291 | "a Full GC.") \ |
292 | \ |
293 | experimental(bool, ShenandoahImplicitGCInvokesConcurrent, false, \ |
294 | "Should internally-caused GCs invoke concurrent cycles, or go to" \ |
295 | "stop-the-world (degenerated/full)?") \ |
296 | \ |
297 | experimental(bool, ShenandoahHumongousMoves, true, \ |
298 | "Allow moving humongous regions. This makes GC more resistant " \ |
299 | "to external fragmentation that may otherwise fail other " \ |
300 | "humongous allocations, at the expense of higher GC copying " \ |
301 | "costs.") \ |
302 | \ |
303 | diagnostic(bool, ShenandoahOOMDuringEvacALot, false, \ |
304 | "Simulate OOM during evacuation frequently.") \ |
305 | \ |
306 | diagnostic(bool, ShenandoahAllocFailureALot, false, \ |
307 | "Make lots of artificial allocation failures.") \ |
308 | \ |
309 | diagnostic(bool, ShenandoahTerminationTrace, false, \ |
310 | "Tracing task termination timings") \ |
311 | \ |
312 | develop(bool, ShenandoahVerifyObjectEquals, false, \ |
313 | "Verify that == and != are not used on oops. Only in fastdebug") \ |
314 | \ |
315 | diagnostic(bool, ShenandoahAlwaysPreTouch, false, \ |
316 | "Pre-touch heap memory, overrides global AlwaysPreTouch") \ |
317 | \ |
318 | experimental(intx, ShenandoahMarkScanPrefetch, 32, \ |
319 | "How many objects to prefetch ahead when traversing mark bitmaps."\ |
320 | "Set to 0 to disable prefetching.") \ |
321 | range(0, 256) \ |
322 | \ |
323 | experimental(uintx, ShenandoahMarkLoopStride, 1000, \ |
324 | "How many items are processed during one marking step") \ |
325 | \ |
326 | experimental(uintx, ShenandoahParallelRegionStride, 1024, \ |
327 | "How many regions are processed in one stride during parallel " \ |
328 | "iteration.") \ |
329 | \ |
330 | experimental(size_t, ShenandoahSATBBufferSize, 1 * K, \ |
331 | "Number of entries in an SATB log buffer.") \ |
332 | range(1, max_uintx) \ |
333 | \ |
334 | experimental(uintx, ShenandoahSATBBufferFlushInterval, 100, \ |
335 | "Forcefully flush non-empty SATB buffers at this interval. " \ |
336 | "Time is in milliseconds.") \ |
337 | \ |
338 | experimental(uint, ShenandoahParallelSafepointThreads, 4, \ |
339 | "Number of parallel threads used for safepoint prolog/epilog") \ |
340 | \ |
341 | experimental(bool, ShenandoahPreclean, true, \ |
342 | "Do concurrent preclean phase before final mark: process " \ |
343 | "definitely alive references to avoid dealing with them during " \ |
344 | "pause.") \ |
345 | \ |
346 | experimental(bool, ShenandoahSuspendibleWorkers, false, \ |
347 | "Suspend concurrent GC worker threads at safepoints") \ |
348 | \ |
349 | diagnostic(bool, ShenandoahSATBBarrier, true, \ |
350 | "Turn on/off SATB barriers in Shenandoah") \ |
351 | \ |
352 | diagnostic(bool, ShenandoahKeepAliveBarrier, true, \ |
353 | "Turn on/off keep alive barriers in Shenandoah") \ |
354 | \ |
355 | diagnostic(bool, ShenandoahStoreValEnqueueBarrier, false, \ |
356 | "Turn on/off enqueuing of oops for storeval barriers") \ |
357 | \ |
358 | diagnostic(bool, ShenandoahCASBarrier, true, \ |
359 | "Turn on/off CAS barriers in Shenandoah") \ |
360 | \ |
361 | diagnostic(bool, ShenandoahCloneBarrier, true, \ |
362 | "Turn on/off clone barriers in Shenandoah") \ |
363 | \ |
364 | diagnostic(bool, ShenandoahLoadRefBarrier, true, \ |
365 | "Turn on/off load-reference barriers in Shenandoah") \ |
366 | \ |
367 | diagnostic(bool, ShenandoahStoreCheck, false, \ |
368 | "Emit additional code that checks objects are written to only" \ |
369 | " in to-space") \ |
370 | \ |
371 | experimental(bool, ShenandoahConcurrentScanCodeRoots, true, \ |
372 | "Scan code roots concurrently, instead of during a pause") \ |
373 | \ |
374 | experimental(uintx, ShenandoahCodeRootsStyle, 2, \ |
375 | "Use this style to scan code cache:" \ |
376 | " 0 - sequential iterator;" \ |
377 | " 1 - parallel iterator;" \ |
378 | " 2 - parallel iterator with cset filters;") \ |
379 | \ |
380 | experimental(bool, ShenandoahOptimizeStaticFinals, true, \ |
381 | "Optimize barriers on static final fields. " \ |
382 | "Turn it off for maximum compatibility with reflection or JNI " \ |
383 | "code that manipulates final fields.") \ |
384 | \ |
385 | experimental(bool, ShenandoahOptimizeInstanceFinals, false, \ |
386 | "Optimize barriers on final instance fields." \ |
387 | "Turn it off for maximum compatibility with reflection or JNI " \ |
388 | "code that manipulates final fields.") \ |
389 | \ |
390 | experimental(bool, ShenandoahOptimizeStableFinals, false, \ |
391 | "Optimize barriers on stable fields." \ |
392 | "Turn it off for maximum compatibility with reflection or JNI " \ |
393 | "code that manipulates final fields.") \ |
394 | \ |
395 | experimental(bool, ShenandoahCommonGCStateLoads, false, \ |
396 | "Enable commonming for GC state loads in generated code.") \ |
397 | \ |
398 | develop(bool, ShenandoahVerifyOptoBarriers, false, \ |
399 | "Verify no missing barriers in C2") \ |
400 | \ |
401 | experimental(bool, ShenandoahLoopOptsAfterExpansion, true, \ |
402 | "Attempt more loop opts after barrier expansion") \ |
403 | |
404 | #endif // SHARE_GC_SHENANDOAH_SHENANDOAH_GLOBALS_HPP |
405 | |