1 /*
  2  * Copyright (c) 2000, 2021, 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 unneccessary basic blocks")                            \
136                                                                             \
137   develop(bool, PrintBlockElimination, false,                               \
138           "Print basic block elimination")                                  \
139                                                                             \
140   develop(bool, EliminateNullChecks, true,                                  \
141           "Eliminate unneccessary 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_pd(bool, TwoOperandLIRForm,                                       \
207           "true if LIR requires src1 and dst to match in binary LIR ops")   \
208                                                                             \
209   develop(intx, TraceLinearScanLevel, 0,                                    \
210           "Debug levels for the linear scan allocator")                     \
211           range(0, 4)                                                       \
212                                                                             \
213   develop(bool, StressLinearScan, false,                                    \
214           "scramble block order used by LinearScan (stress test)")          \
215                                                                             \
216   product(bool, TimeLinearScan, false,                                      \
217           "detailed timing of LinearScan phases")                           \
218                                                                             \
219   develop(bool, TimeEachLinearScan, false,                                  \
220           "print detailed timing of each LinearScan run")                   \
221                                                                             \
222   develop(bool, CountLinearScan, false,                                     \
223           "collect statistic counters during LinearScan")                   \
224                                                                             \
225   /* C1 variable */                                                         \
226                                                                             \
227   develop(bool, C1Breakpoint, false,                                        \
228           "Sets a breakpoint at entry of each compiled method")             \
229                                                                             \
230   develop(bool, ImplicitDiv0Checks, true,                                   \
231           "Use implicit division by zero checks")                           \
232                                                                             \
233   develop(bool, PinAllInstructions, false,                                  \
234           "All instructions are pinned")                                    \
235                                                                             \
236   develop(bool, UseFastNewInstance, true,                                   \
237           "Use fast inlined instance allocation")                           \
238                                                                             \
239   develop(bool, UseFastNewTypeArray, true,                                  \
240           "Use fast inlined type array allocation")                         \
241                                                                             \
242   develop(bool, UseFastNewObjectArray, true,                                \
243           "Use fast inlined object array allocation")                       \
244                                                                             \
245   develop(bool, UseFastLocking, true,                                       \
246           "Use fast inlined locking code")                                  \
247                                                                             \
248   develop(bool, UseSlowPath, false,                                         \
249           "For debugging: test slow cases by always using them")            \
250                                                                             \
251   develop(bool, GenerateArrayStoreCheck, true,                              \
252           "Generates code for array store checks")                          \
253                                                                             \
254   develop(bool, DeoptC1, true,                                              \
255           "Use deoptimization in C1")                                       \
256                                                                             \
257   develop(bool, PrintBailouts, false,                                       \
258           "Print bailout and its reason")                                   \
259                                                                             \
260   develop(bool, TracePatching, false,                                       \
261          "Trace patching of field access on uninitialized classes")         \
262                                                                             \
263   develop(bool, PatchALot, false,                                           \
264           "Marks all fields as having unloaded classes")                    \
265                                                                             \
266   develop(bool, PrintNotLoaded, false,                                      \
267           "Prints where classes are not loaded during code generation")     \
268                                                                             \
269   develop(bool, PrintLIR, false,                                            \
270           "print low-level IR")                                             \
271                                                                             \
272   develop(bool, BailoutAfterHIR, false,                                     \
273           "bailout of compilation after building of HIR")                   \
274                                                                             \
275   develop(bool, BailoutAfterLIR, false,                                     \
276           "bailout of compilation after building of LIR")                   \
277                                                                             \
278   develop(bool, BailoutOnExceptionHandlers, false,                          \
279           "bailout of compilation for methods with exception handlers")     \
280                                                                             \
281   develop(bool, InstallMethods, true,                                       \
282           "Install methods at the end of successful compilations")          \
283                                                                             \
284   develop(intx, NMethodSizeLimit, (64*K)*wordSize,                          \
285           "Maximum size of a compiled method.")                             \
286           range(0, max_jint)                                                \
287                                                                             \
288   develop(bool, TraceFPUStack, false,                                       \
289           "Trace emulation of the FPU stack (intel only)")                  \
290                                                                             \
291   develop(bool, TraceFPURegisterUsage, false,                               \
292           "Trace usage of FPU registers at start of blocks (intel only)")   \
293                                                                             \
294   develop(intx, InstructionCountCutoff, 37000,                              \
295           "If GraphBuilder adds this many instructions, bails out")         \
296           range(0, max_jint)                                                \
297                                                                             \
298   develop(bool, ComputeExactFPURegisterUsage, true,                         \
299           "Compute additional live set for fpu registers to simplify fpu stack merge (Intel only)") \
300                                                                             \
301   product(bool, C1ProfileCalls, true,                                       \
302           "Profile calls when generating code for updating MDOs")           \
303                                                                             \
304   product(bool, C1ProfileVirtualCalls, true,                                \
305           "Profile virtual calls when generating code for updating MDOs")   \
306                                                                             \
307   product(bool, C1ProfileInlinedCalls, true,                                \
308           "Profile inlined calls when generating code for updating MDOs")   \
309                                                                             \
310   product(bool, C1ProfileBranches, true,                                    \
311           "Profile branches when generating code for updating MDOs")        \
312                                                                             \
313   product(bool, C1ProfileCheckcasts, true,                                  \
314           "Profile checkcasts when generating code for updating MDOs")      \
315                                                                             \
316   product(bool, C1OptimizeVirtualCallProfiling, true,                       \
317           "Use CHA and exact type results at call sites when updating MDOs")\
318                                                                             \
319   product(bool, C1UpdateMethodData, true,                                   \
320           "Update MethodData*s in Tier1-generated code")                    \
321                                                                             \
322   develop(bool, PrintCFGToFile, false,                                      \
323           "print control flow graph to a separate file during compilation") \
324                                                                             \
325   develop(bool, C1UseDelayedFlattenedFieldReads, true,                      \
326           "Use delayed reads of flattened field to reduce buffering")
327 
328 // end of C1_FLAGS
329 
330 DECLARE_FLAGS(C1_FLAGS)
331 
332 #endif // SHARE_C1_C1_GLOBALS_HPP