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