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