1/*
2 * Copyright (c) 2000, 2016, 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_VM_C1_C1_GLOBALS_HPP
26#define SHARE_VM_C1_C1_GLOBALS_HPP
27
28#include "runtime/globals.hpp"
29#include "utilities/macros.hpp"
30
31#include CPU_HEADER(c1_globals)
32#include OS_HEADER(c1_globals)
33
34//
35// Defines all global flags used by the client compiler.
36//
37#define C1_FLAGS(develop, \
38                 develop_pd, \
39                 product, \
40                 product_pd, \
41                 diagnostic, \
42                 diagnostic_pd, \
43                 notproduct, \
44                 range, \
45                 constraint, \
46                 writeable) \
47                                                                            \
48  /* Printing */                                                            \
49  notproduct(bool, PrintC1Statistics, false,                                \
50          "Print Compiler1 statistics" )                                    \
51                                                                            \
52  notproduct(bool, PrintInitialBlockList, false,                            \
53          "Print block list of BlockListBuilder")                           \
54                                                                            \
55  notproduct(bool, PrintCFG, false,                                         \
56          "Print control flow graph after each change")                     \
57                                                                            \
58  notproduct(bool, PrintCFG0, false,                                        \
59          "Print control flow graph after construction")                    \
60                                                                            \
61  notproduct(bool, PrintCFG1, false,                                        \
62          "Print control flow graph after optimizations")                   \
63                                                                            \
64  notproduct(bool, PrintCFG2, false,                                        \
65          "Print control flow graph before code generation")                \
66                                                                            \
67  notproduct(bool, PrintIRDuringConstruction, false,                        \
68          "Print IR as it's being constructed (helpful for debugging frontend)")\
69                                                                            \
70  notproduct(bool, PrintPhiFunctions, false,                                \
71          "Print phi functions when they are created and simplified")       \
72                                                                            \
73  notproduct(bool, PrintIR, false,                                          \
74          "Print full intermediate representation after each change")       \
75                                                                            \
76  notproduct(bool, PrintIR0, false,                                         \
77          "Print full intermediate representation after construction")      \
78                                                                            \
79  notproduct(bool, PrintIR1, false,                                         \
80          "Print full intermediate representation after optimizations")     \
81                                                                            \
82  notproduct(bool, PrintIR2, false,                                         \
83          "Print full intermediate representation before code generation")  \
84                                                                            \
85  notproduct(bool, PrintSimpleStubs, false,                                 \
86          "Print SimpleStubs")                                              \
87                                                                            \
88  /* C1 optimizations */                                                    \
89                                                                            \
90  develop(bool, UseC1Optimizations, true,                                   \
91          "Turn on C1 optimizations")                                       \
92                                                                            \
93  develop(bool, SelectivePhiFunctions, true,                                \
94          "create phi functions at loop headers only when necessary")       \
95                                                                            \
96  develop(bool, OptimizeIfOps, true,                                        \
97          "Optimize multiple IfOps")                                        \
98                                                                            \
99  develop(bool, DoCEE, true,                                                \
100          "Do Conditional Expression Elimination to simplify CFG")          \
101                                                                            \
102  develop(bool, PrintCEE, false,                                            \
103          "Print Conditional Expression Elimination")                       \
104                                                                            \
105  develop(bool, UseLocalValueNumbering, true,                               \
106          "Use Local Value Numbering (embedded in GraphBuilder)")           \
107                                                                            \
108  develop(bool, UseGlobalValueNumbering, true,                              \
109          "Use Global Value Numbering (separate phase)")                    \
110                                                                            \
111  product(bool, UseLoopInvariantCodeMotion, true,                           \
112          "Simple loop invariant code motion for short loops during GVN")   \
113                                                                            \
114  develop(bool, TracePredicateFailedTraps, false,                           \
115          "trace runtime traps caused by predicate failure")                \
116                                                                            \
117  develop(bool, StressLoopInvariantCodeMotion, false,                       \
118          "stress loop invariant code motion")                              \
119                                                                            \
120  develop(bool, TraceRangeCheckElimination, false,                          \
121          "Trace Range Check Elimination")                                  \
122                                                                            \
123  develop(bool, AssertRangeCheckElimination, false,                         \
124          "Assert Range Check Elimination")                                 \
125                                                                            \
126  develop(bool, StressRangeCheckElimination, false,                         \
127          "stress Range Check Elimination")                                 \
128                                                                            \
129  develop(bool, PrintValueNumbering, false,                                 \
130          "Print Value Numbering")                                          \
131                                                                            \
132  product(intx, ValueMapInitialSize, 11,                                    \
133          "Initial size of a value map")                                    \
134          range(1, NOT_LP64(1*K) LP64_ONLY(32*K))                           \
135                                                                            \
136  product(intx, ValueMapMaxLoopSize, 8,                                     \
137          "maximum size of a loop optimized by global value numbering")     \
138          range(0, 128)                                                     \
139                                                                            \
140  develop(bool, EliminateBlocks, true,                                      \
141          "Eliminate unneccessary basic blocks")                            \
142                                                                            \
143  develop(bool, PrintBlockElimination, false,                               \
144          "Print basic block elimination")                                  \
145                                                                            \
146  develop(bool, EliminateNullChecks, true,                                  \
147          "Eliminate unneccessary null checks")                             \
148                                                                            \
149  develop(bool, PrintNullCheckElimination, false,                           \
150          "Print null check elimination")                                   \
151                                                                            \
152  develop(bool, EliminateFieldAccess, true,                                 \
153          "Optimize field loads and stores")                                \
154                                                                            \
155  develop(bool, InlineMethodsWithExceptionHandlers, true,                   \
156          "Inline methods containing exception handlers "                   \
157          "(NOTE: does not work with current backend)")                     \
158                                                                            \
159  product(bool, InlineSynchronizedMethods, true,                            \
160          "Inline synchronized methods")                                    \
161                                                                            \
162  diagnostic(bool, InlineNIOCheckIndex, true,                               \
163          "Intrinsify java.nio.Buffer.checkIndex")                          \
164                                                                            \
165  develop(bool, CanonicalizeNodes, true,                                    \
166          "Canonicalize graph nodes")                                       \
167                                                                            \
168  develop(bool, PrintCanonicalization, false,                               \
169          "Print graph node canonicalization")                              \
170                                                                            \
171  develop(bool, UseTableRanges, true,                                       \
172          "Faster versions of lookup table using ranges")                   \
173                                                                            \
174  develop_pd(bool, RoundFPResults,                                          \
175          "Indicates whether rounding is needed for floating point results")\
176                                                                            \
177  develop(intx, NestedInliningSizeRatio, 90,                                \
178          "Percentage of prev. allowed inline size in recursive inlining")  \
179          range(0, 100)                                                     \
180                                                                            \
181  notproduct(bool, PrintIRWithLIR, false,                                   \
182          "Print IR instructions with generated LIR")                       \
183                                                                            \
184  notproduct(bool, PrintLIRWithAssembly, false,                             \
185          "Show LIR instruction with generated assembly")                   \
186                                                                            \
187  develop(bool, CommentedAssembly, trueInDebug,                             \
188          "Show extra info in PrintNMethods output")                        \
189                                                                            \
190  develop(bool, LIRTracePeephole, false,                                    \
191          "Trace peephole optimizer")                                       \
192                                                                            \
193  develop(bool, LIRTraceExecution, false,                                   \
194          "add LIR code which logs the execution of blocks")                \
195                                                                            \
196  product_pd(bool, LIRFillDelaySlots,                                       \
197             "fill delays on on SPARC with LIR")                            \
198                                                                            \
199  develop_pd(bool, CSEArrayLength,                                          \
200          "Create separate nodes for length in array accesses")             \
201                                                                            \
202  develop_pd(bool, TwoOperandLIRForm,                                       \
203          "true if LIR requires src1 and dst to match in binary LIR ops")   \
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  product(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, UseFastLocking, true,                                       \
242          "Use fast inlined locking code")                                  \
243                                                                            \
244  develop(bool, UseSlowPath, false,                                         \
245          "For debugging: test slow cases by always using them")            \
246                                                                            \
247  develop(bool, GenerateArrayStoreCheck, true,                              \
248          "Generates code for array store checks")                          \
249                                                                            \
250  develop(bool, DeoptC1, true,                                              \
251          "Use deoptimization in C1")                                       \
252                                                                            \
253  develop(bool, PrintBailouts, false,                                       \
254          "Print bailout and its reason")                                   \
255                                                                            \
256  develop(bool, TracePatching, false,                                       \
257         "Trace patching of field access on uninitialized classes")         \
258                                                                            \
259  develop(bool, PatchALot, false,                                           \
260          "Marks all fields as having unloaded classes")                    \
261                                                                            \
262  develop(bool, PrintNotLoaded, false,                                      \
263          "Prints where classes are not loaded during code generation")     \
264                                                                            \
265  develop(bool, PrintLIR, false,                                            \
266          "print low-level IR")                                             \
267                                                                            \
268  develop(bool, BailoutAfterHIR, false,                                     \
269          "bailout of compilation after building of HIR")                   \
270                                                                            \
271  develop(bool, BailoutAfterLIR, false,                                     \
272          "bailout of compilation after building of LIR")                   \
273                                                                            \
274  develop(bool, BailoutOnExceptionHandlers, false,                          \
275          "bailout of compilation for methods with exception handlers")     \
276                                                                            \
277  develop(bool, InstallMethods, true,                                       \
278          "Install methods at the end of successful compilations")          \
279                                                                            \
280  develop(intx, NMethodSizeLimit, (64*K)*wordSize,                          \
281          "Maximum size of a compiled method.")                             \
282          range(0, max_jint)                                                \
283                                                                            \
284  develop(bool, TraceFPUStack, false,                                       \
285          "Trace emulation of the FPU stack (intel only)")                  \
286                                                                            \
287  develop(bool, TraceFPURegisterUsage, false,                               \
288          "Trace usage of FPU registers at start of blocks (intel only)")   \
289                                                                            \
290  develop(bool, OptimizeUnsafes, true,                                      \
291          "Optimize raw unsafe ops")                                        \
292                                                                            \
293  develop(bool, PrintUnsafeOptimization, false,                             \
294          "Print optimization of raw unsafe ops")                           \
295                                                                            \
296  develop(intx, InstructionCountCutoff, 37000,                              \
297          "If GraphBuilder adds this many instructions, bails out")         \
298          range(0, max_jint)                                                \
299                                                                            \
300  develop(bool, ComputeExactFPURegisterUsage, true,                         \
301          "Compute additional live set for fpu registers to simplify fpu stack merge (Intel only)") \
302                                                                            \
303  product(bool, C1ProfileCalls, true,                                       \
304          "Profile calls when generating code for updating MDOs")           \
305                                                                            \
306  product(bool, C1ProfileVirtualCalls, true,                                \
307          "Profile virtual calls when generating code for updating MDOs")   \
308                                                                            \
309  product(bool, C1ProfileInlinedCalls, true,                                \
310          "Profile inlined calls when generating code for updating MDOs")   \
311                                                                            \
312  product(bool, C1ProfileBranches, true,                                    \
313          "Profile branches when generating code for updating MDOs")        \
314                                                                            \
315  product(bool, C1ProfileCheckcasts, true,                                  \
316          "Profile checkcasts when generating code for updating MDOs")      \
317                                                                            \
318  product(bool, C1OptimizeVirtualCallProfiling, true,                       \
319          "Use CHA and exact type results at call sites when updating MDOs")\
320                                                                            \
321  product(bool, C1UpdateMethodData, trueInTiered,                           \
322          "Update MethodData*s in Tier1-generated code")                    \
323                                                                            \
324  develop(bool, PrintCFGToFile, false,                                      \
325          "print control flow graph to a separate file during compilation") \
326                                                                            \
327// Read default values for c1 globals
328
329C1_FLAGS(DECLARE_DEVELOPER_FLAG, \
330         DECLARE_PD_DEVELOPER_FLAG, \
331         DECLARE_PRODUCT_FLAG, \
332         DECLARE_PD_PRODUCT_FLAG, \
333         DECLARE_DIAGNOSTIC_FLAG, \
334         DECLARE_PD_DIAGNOSTIC_FLAG, \
335         DECLARE_NOTPRODUCT_FLAG, \
336         IGNORE_RANGE, \
337         IGNORE_CONSTRAINT, \
338         IGNORE_WRITEABLE)
339
340#endif // SHARE_VM_C1_C1_GLOBALS_HPP
341