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