1 /*
   2  * Copyright (c) 2000, 2010, 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_OPTO_C2_GLOBALS_HPP
  26 #define SHARE_VM_OPTO_C2_GLOBALS_HPP
  27 
  28 #include "runtime/globals.hpp"
  29 #ifdef TARGET_ARCH_x86
  30 # include "c2_globals_x86.hpp"
  31 #endif
  32 #ifdef TARGET_ARCH_sparc
  33 # include "c2_globals_sparc.hpp"
  34 #endif
  35 #ifdef TARGET_OS_FAMILY_linux
  36 # include "c2_globals_linux.hpp"
  37 #endif
  38 #ifdef TARGET_OS_FAMILY_solaris
  39 # include "c2_globals_solaris.hpp"
  40 #endif
  41 #ifdef TARGET_OS_FAMILY_windows
  42 # include "c2_globals_windows.hpp"
  43 #endif
  44 
  45 //
  46 // Defines all globals flags used by the server compiler.
  47 //
  48 
  49 #define C2_FLAGS(develop, develop_pd, product, product_pd, diagnostic, experimental, notproduct) \
  50                                                                             \
  51   notproduct(intx, CompileZapFirst, 0,                                      \
  52           "If +ZapDeadCompiledLocals, "                                     \
  53           "skip this many before compiling in zap calls")                   \
  54                                                                             \
  55   notproduct(intx, CompileZapLast, -1,                                      \
  56           "If +ZapDeadCompiledLocals, "                                     \
  57           "compile this many after skipping (incl. skip count, -1 = all)")  \
  58                                                                             \
  59   notproduct(intx, ZapDeadCompiledLocalsFirst, 0,                           \
  60           "If +ZapDeadCompiledLocals, "                                     \
  61           "skip this many before really doing it")                          \
  62                                                                             \
  63   notproduct(intx, ZapDeadCompiledLocalsLast, -1,                           \
  64           "If +ZapDeadCompiledLocals, "                                     \
  65           "do this many after skipping (incl. skip count, -1 = all)")       \
  66                                                                             \
  67   develop(intx, OptoPrologueNops, 0,                                        \
  68           "Insert this many extra nop instructions "                        \
  69           "in the prologue of every nmethod")                               \
  70                                                                             \
  71   product_pd(intx, InteriorEntryAlignment,                                  \
  72           "Code alignment for interior entry points "                       \
  73           "in generated code (in bytes)")                                   \
  74                                                                             \
  75   product(intx, MaxLoopPad, (OptoLoopAlignment-1),                          \
  76           "Align a loop if padding size in bytes is less or equal to this value") \
  77                                                                             \
  78   product(intx, NumberOfLoopInstrToAlign, 4,                                \
  79           "Number of first instructions in a loop to align")                \
  80                                                                             \
  81   notproduct(intx, IndexSetWatch, 0,                                        \
  82           "Trace all operations on this IndexSet (-1 means all, 0 none)")   \
  83                                                                             \
  84   develop(intx, OptoNodeListSize, 4,                                        \
  85           "Starting allocation size of Node_List data structures")          \
  86                                                                             \
  87   develop(intx, OptoBlockListSize, 8,                                       \
  88           "Starting allocation size of Block_List data structures")         \
  89                                                                             \
  90   develop(intx, OptoPeepholeAt, -1,                                         \
  91           "Apply peephole optimizations to this peephole rule")             \
  92                                                                             \
  93   notproduct(bool, PrintIdeal, false,                                       \
  94           "Print ideal graph before code generation")                       \
  95                                                                             \
  96   notproduct(bool, PrintOpto, false,                                        \
  97           "Print compiler2 attempts")                                       \
  98                                                                             \
  99   notproduct(bool, PrintOptoInlining, false,                                \
 100           "Print compiler2 inlining decisions")                             \
 101                                                                             \
 102   notproduct(bool, VerifyOpto, false,                                       \
 103           "Apply more time consuming verification during compilation")      \
 104                                                                             \
 105   notproduct(bool, VerifyOptoOopOffsets, false,                             \
 106           "Check types of base addresses in field references")              \
 107                                                                             \
 108   develop(bool, IdealizedNumerics, false,                                   \
 109           "Check performance difference allowing FP "                       \
 110           "associativity and commutativity...")                             \
 111                                                                             \
 112   develop(bool, OptoBreakpoint, false,                                      \
 113           "insert breakpoint at method entry")                              \
 114                                                                             \
 115   notproduct(bool, OptoBreakpointOSR, false,                                \
 116           "insert breakpoint at osr method entry")                          \
 117                                                                             \
 118   notproduct(intx, BreakAtNode, 0,                                          \
 119           "Break at construction of this Node (either _idx or _debug_idx)") \
 120                                                                             \
 121   notproduct(bool, OptoBreakpointC2R, false,                                \
 122           "insert breakpoint at runtime stub entry")                        \
 123                                                                             \
 124   notproduct(bool, OptoNoExecute, false,                                    \
 125           "Attempt to parse and compile but do not execute generated code") \
 126                                                                             \
 127   notproduct(bool, PrintOptoStatistics, false,                              \
 128           "Print New compiler statistics")                                  \
 129                                                                             \
 130   notproduct(bool, PrintOptoAssembly, false,                                \
 131           "Print New compiler assembly output")                             \
 132                                                                             \
 133   develop_pd(bool, OptoPeephole,                                            \
 134           "Apply peephole optimizations after register allocation")         \
 135                                                                             \
 136   develop(bool, OptoRemoveUseless, true,                                    \
 137           "Remove useless nodes after parsing")                             \
 138                                                                             \
 139   notproduct(bool, PrintFrameConverterAssembly, false,                      \
 140           "Print New compiler assembly output for frame converters")        \
 141                                                                             \
 142   notproduct(bool, PrintParseStatistics, false,                             \
 143           "Print nodes, transforms and new values made per bytecode parsed")\
 144                                                                             \
 145   notproduct(bool, PrintOptoPeephole, false,                                \
 146           "Print New compiler peephole replacements")                       \
 147                                                                             \
 148   develop(bool, PrintCFGBlockFreq, false,                                   \
 149           "Print CFG block freqencies")                                     \
 150                                                                             \
 151   develop(bool, TraceOptoParse, false,                                      \
 152           "Trace bytecode parse and control-flow merge")                    \
 153                                                                             \
 154   product_pd(intx,  LoopUnrollLimit,                                        \
 155           "Unroll loop bodies with node count less than this")              \
 156                                                                             \
 157   product(intx,  LoopUnrollMin, 4,                                          \
 158           "Minimum number of unroll loop bodies before checking progress"   \
 159           "of rounds of unroll,optimize,..")                                \
 160                                                                             \
 161   develop(intx, UnrollLimitForProfileCheck, 1,                              \
 162           "Don't use profile_trip_cnt() to restrict unrolling until "       \
 163           "unrolling would push the number of unrolled iterations above "   \
 164           "UnrollLimitForProfileCheck. A higher value allows more "         \
 165           "unrolling. Zero acts as a very large value." )                   \
 166                                                                             \
 167   product(intx, MultiArrayExpandLimit, 6,                                   \
 168           "Maximum number of individual allocations in an inline-expanded " \
 169           "multianewarray instruction")                                     \
 170                                                                             \
 171   notproduct(bool, TraceProfileTripCount, false,                            \
 172           "Trace profile loop trip count information")                      \
 173                                                                             \
 174   product(bool, UseLoopPredicate, true,                                     \
 175           "Generate a predicate to select fast/slow loop versions")         \
 176                                                                             \
 177   develop(bool, TraceLoopPredicate, false,                                  \
 178           "Trace generation of loop predicates")                            \
 179                                                                             \
 180   product(bool, OptimizeFill, false,                                        \
 181           "convert fill/copy loops into intrinsic")                         \
 182                                                                             \
 183   develop(bool, TraceOptimizeFill, false,                                   \
 184           "print detailed information about fill conversion")               \
 185                                                                             \
 186   develop(bool, OptoCoalesce, true,                                         \
 187           "Use Conservative Copy Coalescing in the Register Allocator")     \
 188                                                                             \
 189   develop(bool, UseUniqueSubclasses, true,                                  \
 190           "Narrow an abstract reference to the unique concrete subclass")   \
 191                                                                             \
 192   develop(bool, UseExactTypes, true,                                        \
 193           "Use exact types to eliminate array store checks and v-calls")    \
 194                                                                             \
 195   product(intx, TrackedInitializationLimit, 50,                             \
 196           "When initializing fields, track up to this many words")          \
 197                                                                             \
 198   product(bool, ReduceFieldZeroing, true,                                   \
 199           "When initializing fields, try to avoid needless zeroing")        \
 200                                                                             \
 201   product(bool, ReduceInitialCardMarks, true,                               \
 202           "When initializing fields, try to avoid needless card marks")     \
 203                                                                             \
 204   product(bool, ReduceBulkZeroing, true,                                    \
 205           "When bulk-initializing, try to avoid needless zeroing")          \
 206                                                                             \
 207   product(bool, UseFPUForSpilling, false,                                   \
 208           "Spill integer registers to FPU instead of stack when possible")  \
 209                                                                             \
 210   develop_pd(intx, RegisterCostAreaRatio,                                   \
 211           "Spill selection in reg allocator: scale area by (X/64K) before " \
 212           "adding cost")                                                    \
 213                                                                             \
 214   develop_pd(bool, UseCISCSpill,                                            \
 215           "Use ADLC supplied cisc instructions during allocation")          \
 216                                                                             \
 217   notproduct(bool, VerifyGraphEdges , false,                                \
 218           "Verify Bi-directional Edges")                                    \
 219                                                                             \
 220   notproduct(bool, VerifyDUIterators, true,                                 \
 221           "Verify the safety of all iterations of Bi-directional Edges")    \
 222                                                                             \
 223   notproduct(bool, VerifyHashTableKeys, true,                               \
 224           "Verify the immutability of keys in the VN hash tables")          \
 225                                                                             \
 226   notproduct(bool, VerifyRegisterAllocator , false,                         \
 227           "Verify Register Allocator")                                      \
 228                                                                             \
 229   develop_pd(intx, FLOATPRESSURE,                                           \
 230           "Number of float LRG's that constitute high register pressure")   \
 231                                                                             \
 232   develop_pd(intx, INTPRESSURE,                                             \
 233           "Number of integer LRG's that constitute high register pressure") \
 234                                                                             \
 235   notproduct(bool, TraceOptoPipelining, false,                              \
 236           "Trace pipelining information")                                   \
 237                                                                             \
 238   notproduct(bool, TraceOptoOutput, false,                                  \
 239           "Trace pipelining information")                                   \
 240                                                                             \
 241   product_pd(bool, OptoScheduling,                                          \
 242           "Instruction Scheduling after register allocation")               \
 243                                                                             \
 244   product(bool, PartialPeelLoop, true,                                      \
 245           "Partial peel (rotate) loops")                                    \
 246                                                                             \
 247   product(intx, PartialPeelNewPhiDelta, 0,                                  \
 248           "Additional phis that can be created by partial peeling")         \
 249                                                                             \
 250   notproduct(bool, TracePartialPeeling, false,                              \
 251           "Trace partial peeling (loop rotation) information")              \
 252                                                                             \
 253   product(bool, PartialPeelAtUnsignedTests, true,                           \
 254           "Partial peel at unsigned tests if no signed test exists")        \
 255                                                                             \
 256   product(bool, ReassociateInvariants, true,                                \
 257           "Enable reassociation of expressions with loop invariants.")      \
 258                                                                             \
 259   product(bool, LoopUnswitching, true,                                      \
 260           "Enable loop unswitching (a form of invariant test hoisting)")    \
 261                                                                             \
 262   notproduct(bool, TraceLoopUnswitching, false,                             \
 263           "Trace loop unswitching")                                         \
 264                                                                             \
 265   product(bool, UseSuperWord, true,                                         \
 266           "Transform scalar operations into superword operations")          \
 267                                                                             \
 268   develop(bool, SuperWordRTDepCheck, false,                                 \
 269           "Enable runtime dependency checks.")                              \
 270                                                                             \
 271   product(bool, TraceSuperWord, false,                                      \
 272           "Trace superword transforms")                                     \
 273                                                                             \
 274   product_pd(bool, OptoBundling,                                            \
 275           "Generate nops to fill i-cache lines")                            \
 276                                                                             \
 277   product_pd(intx, ConditionalMoveLimit,                                    \
 278           "Limit of ops to make speculative when using CMOVE")              \
 279                                                                             \
 280   /* Set BranchOnRegister == false. See 4965987. */                         \
 281   product(bool, BranchOnRegister, false,                                    \
 282           "Use Sparc V9 branch-on-register opcodes")                        \
 283                                                                             \
 284   develop(bool, SparcV9RegsHiBitsZero, true,                                \
 285           "Assume Sparc V9 I&L registers on V8+ systems are zero-extended") \
 286                                                                             \
 287   develop(intx, PrintIdealGraphLevel, 0,                                    \
 288           "Print ideal graph to XML file / network interface. "             \
 289           "By default attempts to connect to the visualizer on a socket.")  \
 290                                                                             \
 291   develop(intx, PrintIdealGraphPort, 4444,                                  \
 292           "Ideal graph printer to network port")                            \
 293                                                                             \
 294   notproduct(ccstr, PrintIdealGraphAddress, "127.0.0.1",                    \
 295           "IP address to connect to visualizer")                            \
 296                                                                             \
 297   notproduct(ccstr, PrintIdealGraphFile, NULL,                              \
 298           "File to dump ideal graph to.  If set overrides the "             \
 299           "use of the network")                                             \
 300                                                                             \
 301   product(bool, UseOldInlining, true,                                       \
 302           "Enable the 1.3 inlining strategy")                               \
 303                                                                             \
 304   product(bool, UseBimorphicInlining, true,                                 \
 305           "Profiling based inlining for two receivers")                     \
 306                                                                             \
 307   product(bool, UseOnlyInlinedBimorphic, true,                              \
 308           "Don't use BimorphicInlining if can't inline a second method")    \
 309                                                                             \
 310   product(bool, InsertMemBarAfterArraycopy, true,                           \
 311           "Insert memory barrier after arraycopy call")                     \
 312                                                                             \
 313   develop(bool, SubsumeLoads, true,                                         \
 314           "Attempt to compile while subsuming loads into machine instructions.") \
 315                                                                             \
 316   develop(bool, StressRecompilation, false,                                 \
 317           "Recompile each compiled method without subsuming loads or escape analysis.") \
 318                                                                             \
 319   /* controls for tier 1 compilations */                                    \
 320                                                                             \
 321   develop(bool, Tier1CountInvocations, true,                                \
 322           "Generate code, during tier 1, to update invocation counter")     \
 323                                                                             \
 324   product(intx, Tier1Inline, false,                                         \
 325           "enable inlining during tier 1")                                  \
 326                                                                             \
 327   product(intx, Tier1MaxInlineSize, 8,                                      \
 328           "maximum bytecode size of a method to be inlined, during tier 1") \
 329                                                                             \
 330   product(intx, Tier1FreqInlineSize, 35,                                    \
 331           "max bytecode size of a frequent method to be inlined, tier 1")   \
 332                                                                             \
 333   develop(intx, ImplicitNullCheckThreshold, 3,                              \
 334           "Don't do implicit null checks if NPE's in a method exceeds limit") \
 335                                                                             \
 336  /* controls for loop optimization */                                       \
 337   product(intx, Tier1LoopOptsCount, 0,                                      \
 338           "Set level of loop optimization for tier 1 compiles")             \
 339                                                                             \
 340   product(intx, LoopOptsCount, 43,                                          \
 341           "Set level of loop optimization for tier 1 compiles")             \
 342                                                                             \
 343   /* controls for heat-based inlining */                                    \
 344                                                                             \
 345   develop(intx, NodeCountInliningCutoff, 18000,                             \
 346           "If parser node generation exceeds limit stop inlining")          \
 347                                                                             \
 348   develop(intx, NodeCountInliningStep, 1000,                                \
 349           "Target size of warm calls inlined between optimization passes")  \
 350                                                                             \
 351   develop(bool, InlineWarmCalls, false,                                     \
 352           "Use a heat-based priority queue to govern inlining")             \
 353                                                                             \
 354   develop(intx, HotCallCountThreshold, 999999,                              \
 355           "large numbers of calls (per method invocation) force hotness")   \
 356                                                                             \
 357   develop(intx, HotCallProfitThreshold, 999999,                             \
 358           "highly profitable inlining opportunities force hotness")         \
 359                                                                             \
 360   develop(intx, HotCallTrivialWork, -1,                                     \
 361           "trivial execution time (no larger than this) forces hotness")    \
 362                                                                             \
 363   develop(intx, HotCallTrivialSize, -1,                                     \
 364           "trivial methods (no larger than this) force calls to be hot")    \
 365                                                                             \
 366   develop(intx, WarmCallMinCount, -1,                                       \
 367           "number of calls (per method invocation) to enable inlining")     \
 368                                                                             \
 369   develop(intx, WarmCallMinProfit, -1,                                      \
 370           "number of calls (per method invocation) to enable inlining")     \
 371                                                                             \
 372   develop(intx, WarmCallMaxWork, 999999,                                    \
 373           "execution time of the largest inlinable method")                 \
 374                                                                             \
 375   develop(intx, WarmCallMaxSize, 999999,                                    \
 376           "size of the largest inlinable method")                           \
 377                                                                             \
 378   product(intx, MaxNodeLimit, 65000,                                        \
 379           "Maximum number of nodes")                                        \
 380                                                                             \
 381   product(intx, NodeLimitFudgeFactor, 1000,                                 \
 382           "Fudge Factor for certain optimizations")                         \
 383                                                                             \
 384   product(bool, UseJumpTables, true,                                        \
 385           "Use JumpTables instead of a binary search tree for switches")    \
 386                                                                             \
 387   product(bool, UseDivMod, true,                                            \
 388           "Use combined DivMod instruction if available")                   \
 389                                                                             \
 390   product(intx, MinJumpTableSize, 18,                                       \
 391           "Minimum number of targets in a generated jump table")            \
 392                                                                             \
 393   product(intx, MaxJumpTableSize, 65000,                                    \
 394           "Maximum number of targets in a generated jump table")            \
 395                                                                             \
 396   product(intx, MaxJumpTableSparseness, 5,                                  \
 397           "Maximum sparseness for jumptables")                              \
 398                                                                             \
 399   product(bool, EliminateLocks, true,                                       \
 400           "Coarsen locks when possible")                                    \
 401                                                                             \
 402   notproduct(bool, PrintLockStatistics, false,                              \
 403           "Print precise statistics on the dynamic lock usage")             \
 404                                                                             \
 405   diagnostic(bool, PrintPreciseBiasedLockingStatistics, false,              \
 406           "Print per-lock-site statistics of biased locking in JVM")        \
 407                                                                             \
 408   notproduct(bool, PrintEliminateLocks, false,                              \
 409           "Print out when locks are eliminated")                            \
 410                                                                             \
 411   diagnostic(bool, EliminateAutoBox, false,                                 \
 412           "Private flag to control optimizations for autobox elimination")  \
 413                                                                             \
 414   product(intx, AutoBoxCacheMax, 128,                                       \
 415           "Sets max value cached by the java.lang.Integer autobox cache")   \
 416                                                                             \
 417   product(bool, DoEscapeAnalysis, true,                                     \
 418           "Perform escape analysis")                                        \
 419                                                                             \
 420   notproduct(bool, PrintEscapeAnalysis, false,                              \
 421           "Print the results of escape analysis")                           \
 422                                                                             \
 423   product(bool, EliminateAllocations, true,                                 \
 424           "Use escape analysis to eliminate allocations")                   \
 425                                                                             \
 426   notproduct(bool, PrintEliminateAllocations, false,                        \
 427           "Print out when allocations are eliminated")                      \
 428                                                                             \
 429   product(intx, EliminateAllocationArraySizeLimit, 64,                      \
 430           "Array size (number of elements) limit for scalar replacement")   \
 431                                                                             \
 432   product(bool, UseOptoBiasInlining, true,                                  \
 433           "Generate biased locking code in C2 ideal graph")                 \
 434                                                                             \
 435   product(bool, OptimizeStringConcat, false,                                \
 436           "Optimize the construction of Strings by StringBuilder")          \
 437                                                                             \
 438   notproduct(bool, PrintOptimizeStringConcat, false,                        \
 439           "Print information about transformations performed on Strings")   \
 440                                                                             \
 441   product(intx, ValueSearchLimit, 1000,                                     \
 442           "Recursion limit in PhaseMacroExpand::value_from_mem_phi")        \
 443                                                                             \
 444   product(intx, MaxLabelRootDepth, 1100,                                    \
 445           "Maximum times call Label_Root to prevent stack overflow")        \
 446                                                                             \
 447   diagnostic(intx, DominatorSearchLimit, 1000,                              \
 448           "Iterations limit in Node::dominates")                            \
 449                                                                             \
 450   product(bool, BlockLayoutByFrequency, true,                               \
 451           "Use edge frequencies to drive block ordering")                   \
 452                                                                             \
 453   product(intx, BlockLayoutMinDiamondPercentage, 20,                        \
 454           "Miniumum %% of a successor (predecessor) for which block layout "\
 455           "a will allow a fork (join) in a single chain")                   \
 456                                                                             \
 457   product(bool, BlockLayoutRotateLoops, true,                               \
 458           "Allow back branches to be fall throughs in the block layour")    \
 459 
 460 C2_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_EXPERIMENTAL_FLAG, DECLARE_NOTPRODUCT_FLAG)
 461 
 462 #endif // SHARE_VM_OPTO_C2_GLOBALS_HPP