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