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_pd(bool, RoundFPResults,                                          \
 174           "Indicates whether rounding is needed for floating point results")\
 175                                                                             \
 176   develop(intx, NestedInliningSizeRatio, 90,                                \
 177           "Percentage of prev. allowed inline size in recursive inlining")  \
 178           range(0, 100)                                                     \
 179                                                                             \
 180   notproduct(bool, PrintIRWithLIR, false,                                   \
 181           "Print IR instructions with generated LIR")                       \
 182                                                                             \
 183   notproduct(bool, PrintLIRWithAssembly, false,                             \
 184           "Show LIR instruction with generated assembly")                   \
 185                                                                             \
 186   develop(bool, CommentedAssembly, trueInDebug,                             \
 187           "Show extra info in PrintNMethods output")                        \
 188                                                                             \
 189   develop(bool, LIRTracePeephole, false,                                    \
 190           "Trace peephole optimizer")                                       \
 191                                                                             \
 192   develop(bool, LIRTraceExecution, false,                                   \
 193           "add LIR code which logs the execution of blocks")                \
 194                                                                             \
 195   product_pd(bool, LIRFillDelaySlots,                                       \
 196              "fill delays on on SPARC with LIR")                            \
 197                                                                             \
 198   develop_pd(bool, CSEArrayLength,                                          \
 199           "Create separate nodes for length in array accesses")             \
 200                                                                             \
 201   develop_pd(bool, TwoOperandLIRForm,                                       \
 202           "true if LIR requires src1 and dst to match in binary LIR ops")   \
 203                                                                             \
 204   develop(intx, TraceLinearScanLevel, 0,                                    \
 205           "Debug levels for the linear scan allocator")                     \
 206           range(0, 4)                                                       \
 207                                                                             \
 208   develop(bool, StressLinearScan, false,                                    \
 209           "scramble block order used by LinearScan (stress test)")          \
 210                                                                             \
 211   product(bool, TimeLinearScan, false,                                      \
 212           "detailed timing of LinearScan phases")                           \
 213                                                                             \
 214   develop(bool, TimeEachLinearScan, false,                                  \
 215           "print detailed timing of each LinearScan run")                   \
 216                                                                             \
 217   develop(bool, CountLinearScan, false,                                     \
 218           "collect statistic counters during LinearScan")                   \
 219                                                                             \
 220   /* C1 variable */                                                         \
 221                                                                             \
 222   develop(bool, C1Breakpoint, false,                                        \
 223           "Sets a breakpoint at entry of each compiled method")             \
 224                                                                             \
 225   develop(bool, ImplicitDiv0Checks, true,                                   \
 226           "Use implicit division by zero checks")                           \
 227                                                                             \
 228   develop(bool, PinAllInstructions, false,                                  \
 229           "All instructions are pinned")                                    \
 230                                                                             \
 231   develop(bool, UseFastNewInstance, true,                                   \
 232           "Use fast inlined instance allocation")                           \
 233                                                                             \
 234   develop(bool, UseFastNewTypeArray, true,                                  \
 235           "Use fast inlined type array allocation")                         \
 236                                                                             \
 237   develop(bool, UseFastNewObjectArray, true,                                \
 238           "Use fast inlined object array allocation")                       \
 239                                                                             \
 240   develop(bool, UseFastLocking, true,                                       \
 241           "Use fast inlined locking code")                                  \
 242                                                                             \
 243   develop(bool, UseSlowPath, false,                                         \
 244           "For debugging: test slow cases by always using them")            \
 245                                                                             \
 246   develop(bool, GenerateArrayStoreCheck, true,                              \
 247           "Generates code for array store checks")                          \
 248                                                                             \
 249   develop(bool, DeoptC1, true,                                              \
 250           "Use deoptimization in C1")                                       \
 251                                                                             \
 252   develop(bool, PrintBailouts, false,                                       \
 253           "Print bailout and its reason")                                   \
 254                                                                             \
 255   develop(bool, TracePatching, false,                                       \
 256          "Trace patching of field access on uninitialized classes")         \
 257                                                                             \
 258   develop(bool, PatchALot, false,                                           \
 259           "Marks all fields as having unloaded classes")                    \
 260                                                                             \
 261   develop(bool, PrintNotLoaded, false,                                      \
 262           "Prints where classes are not loaded during code generation")     \
 263                                                                             \
 264   develop(bool, PrintLIR, false,                                            \
 265           "print low-level IR")                                             \
 266                                                                             \
 267   develop(bool, BailoutAfterHIR, false,                                     \
 268           "bailout of compilation after building of HIR")                   \
 269                                                                             \
 270   develop(bool, BailoutAfterLIR, false,                                     \
 271           "bailout of compilation after building of LIR")                   \
 272                                                                             \
 273   develop(bool, BailoutOnExceptionHandlers, false,                          \
 274           "bailout of compilation for methods with exception handlers")     \
 275                                                                             \
 276   develop(bool, InstallMethods, true,                                       \
 277           "Install methods at the end of successful compilations")          \
 278                                                                             \
 279   develop(intx, NMethodSizeLimit, (64*K)*wordSize,                          \
 280           "Maximum size of a compiled method.")                             \
 281           range(0, max_jint)                                                \
 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(bool, OptimizeUnsafes, true,                                      \
 290           "Optimize raw unsafe ops")                                        \
 291                                                                             \
 292   develop(bool, PrintUnsafeOptimization, false,                             \
 293           "Print optimization of raw unsafe ops")                           \
 294                                                                             \
 295   develop(intx, InstructionCountCutoff, 37000,                              \
 296           "If GraphBuilder adds this many instructions, bails out")         \
 297           range(0, max_jint)                                                \
 298                                                                             \
 299   develop(bool, ComputeExactFPURegisterUsage, true,                         \
 300           "Compute additional live set for fpu registers to simplify fpu stack merge (Intel only)") \
 301                                                                             \
 302   product(bool, C1ProfileCalls, true,                                       \
 303           "Profile calls when generating code for updating MDOs")           \
 304                                                                             \
 305   product(bool, C1ProfileVirtualCalls, true,                                \
 306           "Profile virtual calls when generating code for updating MDOs")   \
 307                                                                             \
 308   product(bool, C1ProfileInlinedCalls, true,                                \
 309           "Profile inlined calls when generating code for updating MDOs")   \
 310                                                                             \
 311   product(bool, C1ProfileBranches, true,                                    \
 312           "Profile branches when generating code for updating MDOs")        \
 313                                                                             \
 314   product(bool, C1ProfileCheckcasts, true,                                  \
 315           "Profile checkcasts when generating code for updating MDOs")      \
 316                                                                             \
 317   product(bool, C1OptimizeVirtualCallProfiling, true,                       \
 318           "Use CHA and exact type results at call sites when updating MDOs")\
 319                                                                             \
 320   product(bool, C1UpdateMethodData, trueInTiered,                           \
 321           "Update MethodData*s in Tier1-generated code")                    \
 322                                                                             \
 323   develop(bool, PrintCFGToFile, false,                                      \
 324           "print control flow graph to a separate file during compilation") \
 325                                                                             \
 326 
 327 #endif // SHARE_C1_C1_GLOBALS_HPP