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