1 /*
2 * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_COMPILER_COMPILER_GLOBALS_HPP
26 #define SHARE_COMPILER_COMPILER_GLOBALS_HPP
27
28 #include "compiler/compiler_globals_pd.hpp"
29 #include "runtime/globals_shared.hpp"
30 #ifdef COMPILER1
31 #include "c1/c1_globals.hpp"
32 #endif // COMPILER1
33 #ifdef COMPILER2
34 #include "opto/c2_globals.hpp"
35 #endif // COMPILER2
36 #if INCLUDE_JVMCI
37 #include "jvmci/jvmci_globals.hpp"
38 #endif
39
40 // TODO -- currently, even if all JIT compilers are disabled, the following flags
41 // are still available in HotSpot. This should eventually be fixed ...
42
43 #define COMPILER_FLAGS(develop, \
44 develop_pd, \
45 product, \
46 product_pd, \
47 range, \
48 constraint) \
49 \
50 /* compiler interface */ \
51 \
52 product(bool, CIPrintCompilerName, false, DIAGNOSTIC, \
53 "when CIPrint is active, print the name of the active compiler") \
54 \
55 product(bool, CIPrintCompileQueue, false, DIAGNOSTIC, \
56 "display the contents of the compile queue whenever a " \
57 "compilation is enqueued") \
58 \
59 develop(bool, CIPrintRequests, false, \
60 "display every request for compilation") \
61 \
62 product(bool, CITime, false, \
63 "collect timing information for compilation") \
64 \
65 develop(bool, CITimeVerbose, false, \
66 "be more verbose in compilation timings") \
67 \
68 develop(bool, CITimeEach, false, \
69 "display timing information after each successful compilation") \
70 \
71 develop(bool, CICountOSR, false, \
72 "use a separate counter when assigning ids to osr compilations") \
73 \
74 develop(bool, CICountNative, false, \
75 "use a separate counter when assigning ids to native " \
76 "compilations") \
77 \
78 develop(bool, CICompileNatives, true, \
79 "compile native methods if supported by the compiler") \
80 \
81 develop_pd(bool, CICompileOSR, \
82 "compile on stack replacement methods if supported by the " \
83 "compiler") \
84 \
85 develop(bool, CIPrintMethodCodes, false, \
86 "print method bytecodes of the compiled code") \
87 \
88 develop(bool, CIPrintTypeFlow, false, \
89 "print the results of ciTypeFlow analysis") \
90 \
91 develop(bool, CITraceTypeFlow, false, \
92 "detailed per-bytecode tracing of ciTypeFlow analysis") \
93 \
94 product(bool, CICompilerCountPerCPU, false, \
95 "1 compiler thread for log(N CPUs)") \
96 \
97 develop(intx, CICrashAt, -1, \
98 "id of compilation to trigger assert in compiler thread for " \
99 "the purpose of testing, e.g. generation of replay data") \
100 \
101 develop(bool, CIObjectFactoryVerify, false, \
102 "enable potentially expensive verification in ciObjectFactory") \
103 \
104 develop(intx, CIStart, 0, \
105 "The id of the first compilation to permit") \
106 \
107 develop(intx, CIStop, max_jint, \
108 "The id of the last compilation to permit") \
109 \
110 develop(intx, CIStartOSR, 0, \
111 "The id of the first osr compilation to permit " \
112 "(CICountOSR must be on)") \
113 \
114 develop(intx, CIStopOSR, max_jint, \
115 "The id of the last osr compilation to permit " \
116 "(CICountOSR must be on)") \
117 \
118 develop(intx, CIBreakAtOSR, -1, \
119 "The id of osr compilation to break at") \
120 \
121 develop(intx, CIBreakAt, -1, \
122 "The id of compilation to break at") \
123 \
124 /* recompilation */ \
125 \
126 product(double, CompileThresholdScaling, 1.0, \
127 "Factor to control when first compilation happens " \
128 "(both with and without tiered compilation): " \
129 "values greater than 1.0 delay counter overflow, " \
130 "values between 0 and 1.0 rush counter overflow, " \
131 "value of 1.0 leaves compilation thresholds unchanged " \
132 "value of 0.0 is equivalent to -Xint. " \
133 "" \
134 "Flag can be set as per-method option. " \
135 "If a value is specified for a method, compilation thresholds " \
136 "for that method are scaled by both the value of the global flag "\
137 "and the value of the per-method flag.") \
138 range(0.0, DBL_MAX) \
139 \
140 product(intx, Tier0InvokeNotifyFreqLog, 7, \
141 "Interpreter (tier 0) invocation notification frequency") \
142 range(0, 30) \
143 \
144 product(intx, Tier2InvokeNotifyFreqLog, 11, \
145 "C1 without MDO (tier 2) invocation notification frequency") \
146 range(0, 30) \
147 \
148 product(intx, Tier3InvokeNotifyFreqLog, 10, \
149 "C1 with MDO profiling (tier 3) invocation notification " \
150 "frequency") \
151 range(0, 30) \
152 \
153 product(intx, Tier23InlineeNotifyFreqLog, 20, \
154 "Inlinee invocation (tiers 2 and 3) notification frequency") \
155 range(0, 30) \
156 \
157 product(intx, Tier0BackedgeNotifyFreqLog, 10, \
158 "Interpreter (tier 0) invocation notification frequency") \
159 range(0, 30) \
160 \
161 product(intx, Tier2BackedgeNotifyFreqLog, 14, \
162 "C1 without MDO (tier 2) invocation notification frequency") \
163 range(0, 30) \
164 \
165 product(intx, Tier3BackedgeNotifyFreqLog, 13, \
166 "C1 with MDO profiling (tier 3) invocation notification " \
167 "frequency") \
168 range(0, 30) \
169 \
170 product(intx, Tier2CompileThreshold, 0, \
171 "threshold at which tier 2 compilation is invoked") \
172 range(0, max_jint) \
173 \
174 product(intx, Tier2BackEdgeThreshold, 0, \
175 "Back edge threshold at which tier 2 compilation is invoked") \
176 range(0, max_jint) \
177 \
178 product(intx, Tier3InvocationThreshold, 200, \
179 "Compile if number of method invocations crosses this " \
180 "threshold") \
181 range(0, max_jint) \
182 \
183 product(intx, Tier3MinInvocationThreshold, 100, \
184 "Minimum invocation to compile at tier 3") \
185 range(0, max_jint) \
186 \
187 product(intx, Tier3CompileThreshold, 2000, \
188 "Threshold at which tier 3 compilation is invoked (invocation " \
189 "minimum must be satisfied)") \
190 range(0, max_jint) \
191 \
192 product(intx, Tier3BackEdgeThreshold, 60000, \
193 "Back edge threshold at which tier 3 OSR compilation is invoked") \
194 range(0, max_jint) \
195 \
196 product(intx, Tier4InvocationThreshold, 5000, \
197 "Compile if number of method invocations crosses this " \
198 "threshold") \
199 range(0, max_jint) \
200 \
201 product(intx, Tier4MinInvocationThreshold, 600, \
202 "Minimum invocation to compile at tier 4") \
203 range(0, max_jint) \
204 \
205 product(intx, Tier4CompileThreshold, 15000, \
206 "Threshold at which tier 4 compilation is invoked (invocation " \
207 "minimum must be satisfied)") \
208 range(0, max_jint) \
209 \
210 product(intx, Tier4BackEdgeThreshold, 40000, \
211 "Back edge threshold at which tier 4 OSR compilation is invoked") \
212 range(0, max_jint) \
213 \
214 product(intx, Tier0Delay, 20, DIAGNOSTIC, \
215 "If C2 queue size grows over this amount per compiler thread " \
216 "do not start profiling in the interpreter") \
217 range(0, max_jint) \
218 \
219 product(intx, TieredOldPercentage, 1000, DIAGNOSTIC, \
220 "Percentage over tier 3 thresholds after which a method is " \
221 "considered old (turns off parts of prioritization based on " \
222 "compile queue length)") \
223 range(0, max_jint) \
224 \
225 product(intx, Tier3DelayOn, 5, \
226 "If C2 queue size grows over this amount per compiler thread " \
227 "stop compiling at tier 3 and start compiling at tier 2") \
228 range(0, max_jint) \
229 \
230 product(intx, Tier3DelayOff, 2, \
231 "If C2 queue size is less than this amount per compiler thread " \
232 "allow methods compiled at tier 2 transition to tier 3") \
233 range(0, max_jint) \
234 \
235 product(intx, Tier3LoadFeedback, 5, \
236 "Tier 3 thresholds will increase twofold when C1 queue size " \
237 "reaches this amount per compiler thread" \
238 "Passing 0 disables the threshold scaling") \
239 range(0, max_jint) \
240 \
241 product(intx, Tier4LoadFeedback, 3, \
242 "Tier 4 thresholds will increase twofold when C2 queue size " \
243 "reaches this amount per compiler thread" \
244 "Passing 0 disables the threshold scaling") \
245 range(0, max_jint) \
246 \
247 product(intx, TieredCompileTaskTimeout, 50, \
248 "Kill compile task if method was not used within " \
249 "given timeout in milliseconds") \
250 range(0, max_intx) \
251 \
252 product(intx, TieredStopAtLevel, 4, \
253 "Stop at given compilation level") \
254 range(0, 4) \
255 \
256 product(intx, Tier0ProfilingStartPercentage, 200, \
257 "Start profiling in interpreter if the counters exceed the " \
258 "specified percentage of tier 3 thresholds") \
259 range(0, max_jint) \
260 \
261 product(uintx, IncreaseFirstTierCompileThresholdAt, 50, \
262 "Increase the compile threshold for C1 compilation if the code " \
263 "cache is filled by the specified percentage") \
264 range(0, 99) \
265 \
266 product(intx, TieredRateUpdateMinTime, 1, \
267 "Minimum rate sampling interval (in milliseconds)") \
268 range(1, max_intx) \
269 \
270 product(intx, TieredRateUpdateMaxTime, 25, \
271 "Maximum rate sampling interval (in milliseconds)") \
272 range(1, max_intx) \
273 \
274 product(double, Tier0ProfileDelayFactor, 100.0, DIAGNOSTIC, \
275 "Delay profiling/compiling of methods that were " \
276 "observed to be lukewarm") \
277 \
278 product(double, Tier2ProfileDelayFactor, 250.0, DIAGNOSTIC, \
279 "Delay profiling of methods that were observed to be lukewarm") \
280 \
281 product(bool, SkipTier2IfPossible, false, DIAGNOSTIC, \
282 "Compile at tier 4 instead of tier 2 in training replay " \
283 "mode if posssible") \
284 \
285 product(ccstr, CompilationMode, "default", \
286 "Compilation modes: " \
287 "default: normal tiered compilation; " \
288 "quick-only: C1-only mode; " \
289 "high-only: C2/JVMCI-only mode; " \
290 "high-only-quick-internal: C2/JVMCI-only mode, " \
291 "with JVMCI compiler compiled with C1.") \
292 \
293 product(bool, PrintTieredEvents, false, \
294 "Print tiered events notifications") \
295 \
296 product_pd(intx, OnStackReplacePercentage, \
297 "NON_TIERED number of method invocations/branches (expressed as " \
298 "% of CompileThreshold) before (re-)compiling OSR code") \
299 constraint(OnStackReplacePercentageConstraintFunc, AfterErgo) \
300 \
301 product(intx, InterpreterProfilePercentage, 33, \
302 "NON_TIERED number of method invocations/branches (expressed as " \
303 "% of CompileThreshold) before profiling in the interpreter") \
304 range(0, 100) \
305 \
306 /* compiler directives */ \
307 \
308 product(ccstrlist, CompileOnly, "", \
309 "List of methods (pkg/class.name) to restrict compilation to") \
310 \
311 product(ccstr, CompileCommandFile, nullptr, \
312 "Read compiler commands from this file [.hotspot_compiler]") \
313 \
314 product(ccstr, CompilerDirectivesFile, nullptr, DIAGNOSTIC, \
315 "Read compiler directives from this file") \
316 \
317 product(ccstrlist, CompileCommand, "", \
318 "Prepend to .hotspot_compiler; e.g. log,java/lang/String.<init>") \
319 \
320 product(bool, ReplayCompiles, false, DIAGNOSTIC, \
321 "Enable replay of compilations from ReplayDataFile") \
322 \
323 product(bool, ReplayReduce, false, EXPERIMENTAL, \
324 "Enable features to facilitate replay file reduction") \
325 \
326 product(ccstr, ReplayDataFile, nullptr, \
327 "File containing compilation replay information" \
328 "[default: ./replay_pid%p.log] (%p replaced with pid)") \
329 \
330 product(ccstr, InlineDataFile, nullptr, \
331 "File containing inlining replay information" \
332 "[default: ./inline_pid%p.log] (%p replaced with pid)") \
333 \
334 product(intx, ReplaySuppressInitializers, 2, DIAGNOSTIC, \
335 "Control handling of class initialization during replay: " \
336 "0 - don't do anything special; " \
337 "1 - treat all class initializers as empty; " \
338 "2 - treat class initializers for application classes as empty; " \
339 "3 - allow all class initializers to run during bootstrap but " \
340 " pretend they are empty after starting replay") \
341 range(0, 3) \
342 \
343 product(bool, ReplayIgnoreInitErrors, false, DIAGNOSTIC, \
344 "Ignore exceptions thrown during initialization for replay") \
345 \
346 product(bool, DumpReplayDataOnError, true, \
347 "Record replay data for crashing compiler threads") \
348 \
349 product(bool, CompilerDirectivesIgnoreCompileCommands, false, DIAGNOSTIC, \
350 "Disable backwards compatibility for compile commands.") \
351 \
352 product(bool, CompilerDirectivesPrint, false, DIAGNOSTIC, \
353 "Print compiler directives on installation.") \
354 \
355 product(int, CompilerDirectivesLimit, 50, DIAGNOSTIC, \
356 "Limit on number of compiler directives.") \
357 \
358 /* Bytecode escape analysis estimation. */ \
359 \
360 product(bool, EstimateArgEscape, true, \
361 "Analyze bytecodes to estimate escape state of arguments") \
362 \
363 product(intx, BCEATraceLevel, 0, \
364 "How much tracing to do of bytecode escape analysis estimates " \
365 "(0-3)") \
366 range(0, 3) \
367 \
368 product(intx, MaxBCEAEstimateLevel, 5, \
369 "Maximum number of nested calls that are analyzed by BC EA") \
370 range(0, max_jint) \
371 \
372 product(intx, MaxBCEAEstimateSize, 150, \
373 "Maximum bytecode size of a method to be analyzed by BC EA") \
374 range(0, max_jint) \
375 \
376 /* misc compiler flags */ \
377 \
378 product(bool, AbortVMOnCompilationFailure, false, DIAGNOSTIC, \
379 "Abort VM when method had failed to compile.") \
380 \
381 develop(intx, OSROnlyBCI, -1, \
382 "OSR only at this bci. Negative values mean exclude that bci") \
383 \
384 develop(intx, DesiredMethodLimit, 8000, \
385 "The desired maximum method size (in bytecodes) after inlining") \
386 \
387 product(bool, DontCompileHugeMethods, true, \
388 "Do not compile methods > HugeMethodLimit") \
389 \
390 develop(intx, HugeMethodLimit, 8000, \
391 "Don't compile methods larger than this if " \
392 "+DontCompileHugeMethods") \
393 \
394 product(bool, CaptureBailoutInformation, trueInDebug, DIAGNOSTIC, \
395 "If compilation is stopped with an error, capture diagnostic " \
396 "information at the bailout point") \
397 \
398 // end of COMPILER_FLAGS
399
400 DECLARE_FLAGS(COMPILER_FLAGS)
401
402 #endif // SHARE_COMPILER_COMPILER_GLOBALS_HPP