1 /*
   2  * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_C1_C1_GLOBALS_HPP
  26 #define SHARE_C1_C1_GLOBALS_HPP
  27 
  28 #include "runtime/globals_shared.hpp"
  29 #include "utilities/macros.hpp"
  30 
  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                                                                             \
  47   /* Printing */                                                            \
  48   notproduct(bool, PrintC1Statistics, false,                                \
  49           "Print Compiler1 statistics" )                                    \
  50                                                                             \
  51   notproduct(bool, PrintInitialBlockList, false,                            \
  52           "Print block list of BlockListBuilder")                           \
  53                                                                             \
  54   notproduct(bool, PrintCFG, false,                                         \
  55           "Print control flow graph after each change")                     \
  56                                                                             \
  57   notproduct(bool, PrintCFG0, false,                                        \
  58           "Print control flow graph after construction")                    \
  59                                                                             \
  60   notproduct(bool, PrintCFG1, false,                                        \
  61           "Print control flow graph after optimizations")                   \
  62                                                                             \
  63   notproduct(bool, PrintCFG2, false,                                        \
  64           "Print control flow graph before code generation")                \
  65                                                                             \
  66   notproduct(bool, PrintIRDuringConstruction, false,                        \
  67           "Print IR as it's being constructed (helpful for debugging frontend)")\
  68                                                                             \
  69   notproduct(bool, PrintPhiFunctions, false,                                \
  70           "Print phi functions when they are created and simplified")       \
  71                                                                             \
  72   notproduct(bool, PrintIR, false,                                          \
  73           "Print full intermediate representation after each change")       \
  74                                                                             \
  75   notproduct(bool, PrintIR0, false,                                         \
  76           "Print full intermediate representation after construction")      \
  77                                                                             \
  78   notproduct(bool, PrintIR1, false,                                         \
  79           "Print full intermediate representation after optimizations")     \
  80                                                                             \
  81   notproduct(bool, PrintIR2, false,                                         \
  82           "Print full intermediate representation before code generation")  \
  83                                                                             \
  84   notproduct(bool, PrintSimpleStubs, false,                                 \
  85           "Print SimpleStubs")                                              \
  86                                                                             \
  87   /* C1 optimizations */                                                    \
  88                                                                             \
  89   develop(bool, UseC1Optimizations, true,                                   \
  90           "Turn on C1 optimizations")                                       \
  91                                                                             \
  92   develop(bool, SelectivePhiFunctions, true,                                \
  93           "create phi functions at loop headers only when necessary")       \
  94                                                                             \
  95   develop(bool, OptimizeIfOps, true,                                        \
  96           "Optimize multiple IfOps")                                        \
  97                                                                             \
  98   develop(bool, DoCEE, true,                                                \
  99           "Do Conditional Expression Elimination to simplify CFG")          \
 100                                                                             \
 101   develop(bool, PrintCEE, false,                                            \
 102           "Print Conditional Expression Elimination")                       \
 103                                                                             \
 104   develop(bool, UseLocalValueNumbering, true,                               \
 105           "Use Local Value Numbering (embedded in GraphBuilder)")           \
 106                                                                             \
 107   develop(bool, UseGlobalValueNumbering, true,                              \
 108           "Use Global Value Numbering (separate phase)")                    \
 109                                                                             \
 110   product(bool, UseLoopInvariantCodeMotion, true,                           \
 111           "Simple loop invariant code motion for short loops during GVN")   \
 112                                                                             \
 113   develop(bool, TracePredicateFailedTraps, false,                           \
 114           "trace runtime traps caused by predicate failure")                \
 115                                                                             \
 116   develop(bool, StressLoopInvariantCodeMotion, false,                       \
 117           "stress loop invariant code motion")                              \
 118                                                                             \
 119   develop(bool, TraceRangeCheckElimination, false,                          \
 120           "Trace Range Check Elimination")                                  \
 121                                                                             \
 122   develop(bool, AssertRangeCheckElimination, false,                         \
 123           "Assert Range Check Elimination")                                 \
 124                                                                             \
 125   develop(bool, StressRangeCheckElimination, false,                         \
 126           "stress Range Check Elimination")                                 \
 127                                                                             \
 128   develop(bool, PrintValueNumbering, false,                                 \
 129           "Print Value Numbering")                                          \
 130                                                                             \
 131   product(intx, ValueMapInitialSize, 11,                                    \
 132           "Initial size of a value map")                                    \
 133           range(1, NOT_LP64(1*K) LP64_ONLY(32*K))                           \
 134                                                                             \
 135   product(intx, ValueMapMaxLoopSize, 8,                                     \
 136           "maximum size of a loop optimized by global value numbering")     \
 137           range(0, 128)                                                     \
 138                                                                             \
 139   develop(bool, EliminateBlocks, true,                                      \
 140           "Eliminate unneccessary basic blocks")                            \
 141                                                                             \
 142   develop(bool, PrintBlockElimination, false,                               \
 143           "Print basic block elimination")                                  \
 144                                                                             \
 145   develop(bool, EliminateNullChecks, true,                                  \
 146           "Eliminate unneccessary null checks")                             \
 147                                                                             \
 148   develop(bool, PrintNullCheckElimination, false,                           \
 149           "Print null check elimination")                                   \
 150                                                                             \
 151   develop(bool, EliminateFieldAccess, true,                                 \
 152           "Optimize field loads and stores")                                \
 153                                                                             \
 154   develop(bool, InlineMethodsWithExceptionHandlers, true,                   \
 155           "Inline methods containing exception handlers "                   \
 156           "(NOTE: does not work with current backend)")                     \
 157                                                                             \
 158   product(bool, InlineSynchronizedMethods, true,                            \
 159           "Inline synchronized methods")                                    \
 160                                                                             \
 161   diagnostic(bool, InlineNIOCheckIndex, true,                               \
 162           "Intrinsify java.nio.Buffer.checkIndex")                          \
 163                                                                             \
 164   develop(bool, CanonicalizeNodes, true,                                    \
 165           "Canonicalize graph nodes")                                       \
 166                                                                             \
 167   develop(bool, PrintCanonicalization, false,                               \
 168           "Print graph node canonicalization")                              \
 169                                                                             \
 170   develop(bool, UseTableRanges, true,                                       \
 171           "Faster versions of lookup table using ranges")                   \
 172                                                                             \
 173   develop(intx, NestedInliningSizeRatio, 90,                                \
 174           "Percentage of prev. allowed inline size in recursive inlining")  \
 175           range(0, 100)                                                     \
 176                                                                             \
 177   notproduct(bool, PrintIRWithLIR, false,                                   \
 178           "Print IR instructions with generated LIR")                       \
 179                                                                             \
 180   notproduct(bool, PrintLIRWithAssembly, false,                             \
 181           "Show LIR instruction with generated assembly")                   \
 182                                                                             \
 183   develop(bool, CommentedAssembly, trueInDebug,                             \
 184           "Show extra info in PrintNMethods output")                        \
 185                                                                             \
 186   develop(bool, LIRTracePeephole, false,                                    \
 187           "Trace peephole optimizer")                                       \
 188                                                                             \
 189   develop(bool, LIRTraceExecution, false,                                   \
 190           "add LIR code which logs the execution of blocks")                \
 191                                                                             \
 192   product_pd(bool, LIRFillDelaySlots,                                       \
 193              "fill delays on on SPARC with LIR")                            \
 194                                                                             \
 195   develop_pd(bool, CSEArrayLength,                                          \
 196           "Create separate nodes for length in array accesses")             \
 197                                                                             \
 198   develop_pd(bool, TwoOperandLIRForm,                                       \
 199           "true if LIR requires src1 and dst to match in binary LIR ops")   \
 200                                                                             \
 201   develop(intx, TraceLinearScanLevel, 0,                                    \
 202           "Debug levels for the linear scan allocator")                     \
 203           range(0, 4)                                                       \
 204                                                                             \
 205   develop(bool, StressLinearScan, false,                                    \
 206           "scramble block order used by LinearScan (stress test)")          \
 207                                                                             \
 208   product(bool, TimeLinearScan, false,                                      \
 209           "detailed timing of LinearScan phases")                           \
 210                                                                             \
 211   develop(bool, TimeEachLinearScan, false,                                  \
 212           "print detailed timing of each LinearScan run")                   \
 213                                                                             \
 214   develop(bool, CountLinearScan, false,                                     \
 215           "collect statistic counters during LinearScan")                   \
 216                                                                             \
 217   /* C1 variable */                                                         \
 218                                                                             \
 219   develop(bool, C1Breakpoint, false,                                        \
 220           "Sets a breakpoint at entry of each compiled method")             \
 221                                                                             \
 222   develop(bool, ImplicitDiv0Checks, true,                                   \
 223           "Use implicit division by zero checks")                           \
 224                                                                             \
 225   develop(bool, PinAllInstructions, false,                                  \
 226           "All instructions are pinned")                                    \
 227                                                                             \
 228   develop(bool, UseFastNewInstance, true,                                   \
 229           "Use fast inlined instance allocation")                           \
 230                                                                             \
 231   develop(bool, UseFastNewTypeArray, true,                                  \
 232           "Use fast inlined type array allocation")                         \
 233                                                                             \
 234   develop(bool, UseFastNewObjectArray, true,                                \
 235           "Use fast inlined object array allocation")                       \
 236                                                                             \
 237   develop(bool, UseFastLocking, true,                                       \
 238           "Use fast inlined locking code")                                  \
 239                                                                             \
 240   develop(bool, UseSlowPath, false,                                         \
 241           "For debugging: test slow cases by always using them")            \
 242                                                                             \
 243   develop(bool, GenerateArrayStoreCheck, true,                              \
 244           "Generates code for array store checks")                          \
 245                                                                             \
 246   develop(bool, DeoptC1, true,                                              \
 247           "Use deoptimization in C1")                                       \
 248                                                                             \
 249   develop(bool, PrintBailouts, false,                                       \
 250           "Print bailout and its reason")                                   \
 251                                                                             \
 252   develop(bool, TracePatching, false,                                       \
 253          "Trace patching of field access on uninitialized classes")         \
 254                                                                             \
 255   develop(bool, PatchALot, false,                                           \
 256           "Marks all fields as having unloaded classes")                    \
 257                                                                             \
 258   develop(bool, PrintNotLoaded, false,                                      \
 259           "Prints where classes are not loaded during code generation")     \
 260                                                                             \
 261   develop(bool, PrintLIR, false,                                            \
 262           "print low-level IR")                                             \
 263                                                                             \
 264   develop(bool, BailoutAfterHIR, false,                                     \
 265           "bailout of compilation after building of HIR")                   \
 266                                                                             \
 267   develop(bool, BailoutAfterLIR, false,                                     \
 268           "bailout of compilation after building of LIR")                   \
 269                                                                             \
 270   develop(bool, BailoutOnExceptionHandlers, false,                          \
 271           "bailout of compilation for methods with exception handlers")     \
 272                                                                             \
 273   develop(bool, InstallMethods, true,                                       \
 274           "Install methods at the end of successful compilations")          \
 275                                                                             \
 276   develop(intx, NMethodSizeLimit, (64*K)*wordSize,                          \
 277           "Maximum size of a compiled method.")                             \
 278           range(0, max_jint)                                                \
 279                                                                             \
 280   develop(bool, TraceFPUStack, false,                                       \
 281           "Trace emulation of the FPU stack (intel only)")                  \
 282                                                                             \
 283   develop(bool, TraceFPURegisterUsage, false,                               \
 284           "Trace usage of FPU registers at start of blocks (intel only)")   \
 285                                                                             \
 286   develop(bool, OptimizeUnsafes, true,                                      \
 287           "Optimize raw unsafe ops")                                        \
 288                                                                             \
 289   develop(bool, PrintUnsafeOptimization, false,                             \
 290           "Print optimization of raw unsafe ops")                           \
 291                                                                             \
 292   develop(intx, InstructionCountCutoff, 37000,                              \
 293           "If GraphBuilder adds this many instructions, bails out")         \
 294           range(0, max_jint)                                                \
 295                                                                             \
 296   develop(bool, ComputeExactFPURegisterUsage, true,                         \
 297           "Compute additional live set for fpu registers to simplify fpu stack merge (Intel only)") \
 298                                                                             \
 299   product(bool, C1ProfileCalls, true,                                       \
 300           "Profile calls when generating code for updating MDOs")           \
 301                                                                             \
 302   product(bool, C1ProfileVirtualCalls, true,                                \
 303           "Profile virtual calls when generating code for updating MDOs")   \
 304                                                                             \
 305   product(bool, C1ProfileInlinedCalls, true,                                \
 306           "Profile inlined calls when generating code for updating MDOs")   \
 307                                                                             \
 308   product(bool, C1ProfileBranches, true,                                    \
 309           "Profile branches when generating code for updating MDOs")        \
 310                                                                             \
 311   product(bool, C1ProfileCheckcasts, true,                                  \
 312           "Profile checkcasts when generating code for updating MDOs")      \
 313                                                                             \
 314   product(bool, C1OptimizeVirtualCallProfiling, true,                       \
 315           "Use CHA and exact type results at call sites when updating MDOs")\
 316                                                                             \
 317   product(bool, C1UpdateMethodData, trueInTiered,                           \
 318           "Update MethodData*s in Tier1-generated code")                    \
 319                                                                             \
 320   develop(bool, PrintCFGToFile, false,                                      \
 321           "print control flow graph to a separate file during compilation") \
 322                                                                             \
 323 
 324 #endif // SHARE_C1_C1_GLOBALS_HPP