1 /*
2 * Copyright (c) 2000, 2025, 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_C1_C1_GLOBALS_HPP
26 #define SHARE_C1_C1_GLOBALS_HPP
27
28 #include "runtime/globals_shared.hpp"
29 #include "utilities/macros.hpp"
30 #include CPU_HEADER(c1_globals)
31 //
32 // Declare all global flags used by the client compiler.
33 //
34 #define C1_FLAGS(develop, \
35 develop_pd, \
36 product, \
37 product_pd, \
38 range, \
39 constraint) \
40 \
41 /* Printing */ \
42 develop(bool, PrintC1Statistics, false, \
43 "Print Compiler1 statistics" ) \
44 \
45 develop(bool, PrintInitialBlockList, false, \
46 "Print block list of BlockListBuilder") \
47 \
48 develop(bool, PrintCFG, false, \
49 "Print control flow graph after each change") \
50 \
51 develop(bool, PrintCFG0, false, \
52 "Print control flow graph after construction") \
53 \
54 develop(bool, PrintCFG1, false, \
55 "Print control flow graph after optimizations") \
56 \
57 develop(bool, PrintCFG2, false, \
58 "Print control flow graph before code generation") \
59 \
60 develop(bool, PrintIRDuringConstruction, false, \
61 "Print IR as it's being constructed (helpful for debugging frontend)")\
62 \
63 develop(bool, PrintPhiFunctions, false, \
64 "Print phi functions when they are created and simplified") \
65 \
66 develop(bool, PrintIR, false, \
67 "Print full intermediate representation after each change") \
68 \
69 develop(bool, PrintIR0, false, \
70 "Print full intermediate representation after construction") \
71 \
72 develop(bool, PrintIR1, false, \
73 "Print full intermediate representation after optimizations") \
74 \
75 develop(bool, PrintIR2, false, \
76 "Print full intermediate representation before code generation") \
77 \
78 develop(bool, PrintSimpleStubs, false, \
79 "Print SimpleStubs") \
80 \
81 /* C1 optimizations */ \
82 \
83 develop(bool, UseC1Optimizations, true, \
84 "Turn on C1 optimizations") \
85 \
86 develop(bool, SelectivePhiFunctions, true, \
87 "create phi functions at loop headers only when necessary") \
88 \
89 develop(bool, OptimizeIfOps, true, \
90 "Optimize multiple IfOps") \
91 \
92 develop(bool, DoCEE, true, \
93 "Do Conditional Expression Elimination to simplify CFG") \
94 \
95 develop(bool, PrintCEE, false, \
96 "Print Conditional Expression Elimination") \
97 \
98 develop(bool, UseLocalValueNumbering, true, \
99 "Use Local Value Numbering (embedded in GraphBuilder)") \
100 \
101 develop(bool, UseGlobalValueNumbering, true, \
102 "Use Global Value Numbering (separate phase)") \
103 \
104 product(bool, UseLoopInvariantCodeMotion, true, \
105 "Simple loop invariant code motion for short loops during GVN") \
106 \
107 develop(bool, TracePredicateFailedTraps, false, \
108 "trace runtime traps caused by predicate failure") \
109 \
110 develop(bool, StressLoopInvariantCodeMotion, false, \
111 "stress loop invariant code motion") \
112 \
113 develop(bool, TraceRangeCheckElimination, false, \
114 "Trace Range Check Elimination") \
115 \
116 develop(bool, AssertRangeCheckElimination, false, \
117 "Assert Range Check Elimination") \
118 \
119 develop(bool, StressRangeCheckElimination, false, \
120 "stress Range Check Elimination") \
121 \
122 develop(bool, PrintValueNumbering, false, \
123 "Print Value Numbering") \
124 \
125 product(intx, ValueMapInitialSize, 11, \
126 "Initial size of a value map") \
127 range(1, NOT_LP64(1*K) LP64_ONLY(32*K)) \
128 \
129 product(intx, ValueMapMaxLoopSize, 8, \
130 "maximum size of a loop optimized by global value numbering") \
131 range(0, 128) \
132 \
133 develop(bool, EliminateBlocks, true, \
134 "Eliminate unnecessary basic blocks") \
135 \
136 develop(bool, PrintBlockElimination, false, \
137 "Print basic block elimination") \
138 \
139 develop(bool, EliminateNullChecks, true, \
140 "Eliminate unnecessary null checks") \
141 \
142 develop(bool, PrintNullCheckElimination, false, \
143 "Print null check elimination") \
144 \
145 develop(bool, EliminateFieldAccess, true, \
146 "Optimize field loads and stores") \
147 \
148 develop(bool, InlineMethodsWithExceptionHandlers, true, \
149 "Inline methods containing exception handlers " \
150 "(NOTE: does not work with current backend)") \
151 \
152 product(bool, InlineSynchronizedMethods, true, \
153 "Inline synchronized methods") \
154 \
155 develop(bool, CanonicalizeNodes, true, \
156 "Canonicalize graph nodes") \
157 \
158 develop(bool, PrintCanonicalization, false, \
159 "Print graph node canonicalization") \
160 \
161 develop(bool, UseTableRanges, true, \
162 "Faster versions of lookup table using ranges") \
163 \
164 product(intx, C1MaxInlineSize, 35, \
165 "The maximum bytecode size of a method to be inlined by C1") \
166 range(0, max_jint) \
167 \
168 product(intx, C1MaxTrivialSize, 6, \
169 "The maximum bytecode size of a trivial method to be inlined by " \
170 "C1") \
171 range(0, max_jint) \
172 \
173 product(intx, C1MaxInlineLevel, 9, \
174 "The maximum number of nested calls that are inlined by C1") \
175 range(0, max_jint) \
176 \
177 product(intx, C1MaxRecursiveInlineLevel, 1, \
178 "maximum number of nested recursive calls that are inlined by C1")\
179 range(0, max_jint) \
180 \
181 product(intx, C1InlineStackLimit, 10, \
182 "inlining only allowed for methods which don't exceed this " \
183 "number of expression stack and local slots") \
184 range(0, max_jint) \
185 \
186 develop(intx, NestedInliningSizeRatio, 90, \
187 "Percentage of prev. allowed inline size in recursive inlining") \
188 range(0, 100) \
189 \
190 develop(bool, PrintIRWithLIR, false, \
191 "Print IR instructions with generated LIR") \
192 \
193 develop(bool, PrintLIRWithAssembly, false, \
194 "Show LIR instruction with generated assembly") \
195 \
196 develop(bool, CommentedAssembly, trueInDebug, \
197 "Show extra info in PrintNMethods output") \
198 \
199 develop(bool, LIRTraceExecution, false, \
200 "add LIR code which logs the execution of blocks") \
201 \
202 develop_pd(bool, CSEArrayLength, \
203 "Create separate nodes for length in array accesses") \
204 \
205 develop(intx, TraceLinearScanLevel, 0, \
206 "Debug levels for the linear scan allocator") \
207 range(0, 4) \
208 \
209 develop(bool, StressLinearScan, false, \
210 "scramble block order used by LinearScan (stress test)") \
211 \
212 develop(bool, TimeLinearScan, false, \
213 "detailed timing of LinearScan phases") \
214 \
215 develop(bool, CountLinearScan, false, \
216 "collect statistic counters during LinearScan") \
217 \
218 /* C1 variable */ \
219 \
220 develop(bool, C1Breakpoint, false, \
221 "Sets a breakpoint at entry of each compiled method") \
222 \
223 develop(bool, ImplicitDiv0Checks, true, \
224 "Use implicit division by zero checks") \
225 \
226 develop(bool, PinAllInstructions, false, \
227 "All instructions are pinned") \
228 \
229 develop(bool, UseFastNewInstance, true, \
230 "Use fast inlined instance allocation") \
231 \
232 develop(bool, UseFastNewTypeArray, true, \
233 "Use fast inlined type array allocation") \
234 \
235 develop(bool, UseFastNewObjectArray, true, \
236 "Use fast inlined object array allocation") \
237 \
238 develop(bool, UseSlowPath, false, \
239 "For debugging: test slow cases by always using them") \
240 \
241 develop(bool, GenerateArrayStoreCheck, true, \
242 "Generates code for array store checks") \
243 \
244 develop(bool, PrintBailouts, false, \
245 "Print bailout and its reason") \
246 \
247 develop(bool, TracePatching, false, \
248 "Trace patching of field access on uninitialized classes") \
249 \
250 develop(bool, PatchALot, false, \
251 "Marks all fields as having unloaded classes") \
252 \
253 develop(bool, PrintNotLoaded, false, \
254 "Prints where classes are not loaded during code generation") \
255 \
256 develop(bool, PrintLIR, false, \
257 "print low-level IR") \
258 \
259 develop(bool, BailoutAfterHIR, false, \
260 "bailout of compilation after building of HIR") \
261 \
262 develop(bool, BailoutAfterLIR, false, \
263 "bailout of compilation after building of LIR") \
264 \
265 develop(bool, BailoutOnExceptionHandlers, false, \
266 "bailout of compilation for methods with exception handlers") \
267 \
268 develop(intx, InstructionCountCutoff, 37000, \
269 "If GraphBuilder adds this many instructions, bails out") \
270 range(0, max_jint) \
271 \
272 develop(bool, ComputeExactFPURegisterUsage, true, \
273 "Compute additional live set for fpu registers to simplify fpu stack merge (Intel only)") \
274 \
275 product(bool, C1ProfileCalls, true, \
276 "Profile calls when generating code for updating MDOs") \
277 \
278 product(bool, C1ProfileVirtualCalls, true, \
279 "Profile virtual calls when generating code for updating MDOs") \
280 \
281 product(bool, C1ProfileInlinedCalls, true, \
282 "Profile inlined calls when generating code for updating MDOs") \
283 \
284 product(bool, C1ProfileBranches, true, \
285 "Profile branches when generating code for updating MDOs") \
286 \
287 product(bool, C1ProfileCheckcasts, true, \
288 "Profile checkcasts when generating code for updating MDOs") \
289 \
290 product(bool, C1OptimizeVirtualCallProfiling, true, \
291 "Use CHA and exact type results at call sites when updating MDOs")\
292 \
293 product(bool, C1UpdateMethodData, true, \
294 "Update MethodData*s in Tier 3 C1 generated code") \
295 \
296 develop(bool, PrintCFGToFile, false, \
297 "print control flow graph to a separate file during compilation") \
298 \
299 develop(bool, C1UseDelayedFlattenedFieldReads, true, \
300 "Use delayed reads of flat fields to reduce heap buffering")
301
302 // end of C1_FLAGS
303
304 DECLARE_FLAGS(C1_FLAGS)
305
306 #endif // SHARE_C1_C1_GLOBALS_HPP