1 /*
  2  * Copyright (c) 2000, 2026, 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_OPTO_C2_GLOBALS_HPP
 26 #define SHARE_OPTO_C2_GLOBALS_HPP
 27 
 28 #include "runtime/globals_shared.hpp"
 29 #include "utilities/macros.hpp"
 30 #include CPU_HEADER(c2_globals)
 31 
 32 //
 33 // Defines all globals flags used by the server compiler.
 34 //
 35 
 36 #define C2_FLAGS(develop,                                                   \
 37                  develop_pd,                                                \
 38                  product,                                                   \
 39                  product_pd,                                                \
 40                  range,                                                     \
 41                  constraint)                                                \
 42                                                                             \
 43   product(bool, StressLCM, false, DIAGNOSTIC,                               \
 44           "Randomize instruction scheduling in LCM")                        \
 45                                                                             \
 46   product(bool, StressGCM, false, DIAGNOSTIC,                               \
 47           "Randomize instruction scheduling in GCM")                        \
 48                                                                             \
 49   product(bool, StressIGVN, false, DIAGNOSTIC,                              \
 50           "Randomize worklist traversal in IGVN")                           \
 51                                                                             \
 52   product(bool, StressCCP, false, DIAGNOSTIC,                               \
 53           "Randomize worklist traversal in CCP")                            \
 54                                                                             \
 55   product(bool, StressIncrementalInlining, false, DIAGNOSTIC,               \
 56           "Randomize the incremental inlining decision")                    \
 57                                                                             \
 58   product(bool, StressMacroExpansion, false, DIAGNOSTIC,                    \
 59           "Randomize macro node expansion order")                           \
 60                                                                             \
 61   product(bool, StressMacroElimination, false, DIAGNOSTIC,                  \
 62           "Randomize macro node elimination order")                         \
 63                                                                             \
 64   product(bool, StressUnstableIfTraps, false, DIAGNOSTIC,                   \
 65           "Randomly take unstable if traps")                                \
 66                                                                             \
 67   product(uint, StressSeed, 0, DIAGNOSTIC,                                  \
 68           "Seed for randomized stress testing (if unset, a random one is "  \
 69           "generated). The seed is recorded in the compilation log, if "    \
 70           "available.")                                                     \
 71           range(0, max_juint)                                               \
 72                                                                             \
 73   develop(bool, StressMethodHandleLinkerInlining, false,                    \
 74           "Stress inlining through method handle linkers")                  \
 75                                                                             \
 76   develop(bool, StressBailout, false,                                       \
 77           "Perform bailouts randomly at C2 failing() checks")               \
 78                                                                             \
 79   product(bool, OptimizeReachabilityFences, true, DIAGNOSTIC,               \
 80           "Optimize reachability fences "                                   \
 81           "(leave reachability fence nodes intact when turned off)")        \
 82                                                                             \
 83   product(bool, PreserveReachabilityFencesOnConstants, false, DIAGNOSTIC,   \
 84           "Keep reachability fences on compile-time constants")             \
 85                                                                             \
 86   product(bool, StressReachabilityFences, false, DIAGNOSTIC,                \
 87           "Aggressively insert reachability fences "                        \
 88           "for all oop method arguments")                                   \
 89                                                                             \
 90   develop(uint, StressBailoutMean, 100000,                                  \
 91           "The expected number of failing() checks made until "             \
 92           "a random bailout.")                                              \
 93           range(1, max_juint)                                               \
 94                                                                             \
 95   develop(intx, OptoPrologueNops, 0,                                        \
 96           "Insert this many extra nop instructions "                        \
 97           "in the prologue of every nmethod")                               \
 98           range(0, 128)                                                     \
 99                                                                             \
100   product_pd(intx, InteriorEntryAlignment,                                  \
101           "Code alignment for interior entry points "                       \
102           "in generated code (in bytes)")                                   \
103           constraint(InteriorEntryAlignmentConstraintFunc, AfterErgo)       \
104                                                                             \
105   product(intx, MaxLoopPad, (OptoLoopAlignment-1),                          \
106           "Align a loop if padding size in bytes is less or equal to this " \
107           "value")                                                          \
108           range(0, max_jint)                                                \
109                                                                             \
110   product(intx, MaxVectorSize, 64,                                          \
111           "Max vector size in bytes, "                                      \
112           "actual size could be less depending on elements type")           \
113           range(0, max_jint)                                                \
114                                                                             \
115   product(intx, ArrayOperationPartialInlineSize, 0, DIAGNOSTIC,             \
116           "Partial inline size used for small array operations"             \
117           "(e.g. copy,cmp) acceleration.")                                  \
118           range(0, 256)                                                     \
119                                                                             \
120   product(bool, AlignVector, true,                                          \
121           "Perform vector store/load alignment in loop")                    \
122                                                                             \
123   develop(bool, VerifyAlignVector, false,                                   \
124           "Check that vector stores/loads are aligned if AlignVector"       \
125           "is enabled.")                                                    \
126                                                                             \
127   product(intx, NumberOfLoopInstrToAlign, 4,                                \
128           "Number of first instructions in a loop to align")                \
129           range(0, max_jint)                                                \
130                                                                             \
131   develop(intx, IndexSetWatch, 0,                                           \
132           "Trace all operations on this IndexSet (-1 means all, 0 none)")   \
133           range(-1, max_intx)                                               \
134                                                                             \
135   develop(intx, OptoNodeListSize, 4,                                        \
136           "Starting allocation size of Node_List data structures")          \
137           range(1, max_jint)                                                \
138                                                                             \
139   develop(intx, OptoBlockListSize, 8,                                       \
140           "Starting allocation size of Block_List data structures")         \
141           range(1, max_jint)                                                \
142                                                                             \
143   develop(intx, OptoPeepholeAt, -1,                                         \
144           "Apply peephole optimizations to this peephole rule")             \
145                                                                             \
146   develop(bool, PrintIdeal, false,                                          \
147           "Print ideal graph before code generation")                       \
148                                                                             \
149   develop(bool, PrintOpto, false,                                           \
150           "Print compiler2 attempts")                                       \
151                                                                             \
152   develop(bool, PrintOptoInlining, false,                                   \
153           "Print compiler2 inlining decisions")                             \
154                                                                             \
155   develop(bool, VerifyIdealNodeCount, false,                                \
156           "Verify that tracked dead ideal node count is accurate")          \
157                                                                             \
158   develop(bool, PrintIdealNodeCount, false,                                 \
159           "Print liveness counts of ideal nodes")                           \
160                                                                             \
161   product_pd(bool, IdealizeClearArrayNode, DIAGNOSTIC,                      \
162           "Replace ClearArrayNode by subgraph of basic operations.")        \
163                                                                             \
164   develop(bool, OptoBreakpoint, false,                                      \
165           "insert breakpoint at method entry")                              \
166                                                                             \
167   develop(bool, OptoBreakpointOSR, false,                                   \
168           "insert breakpoint at osr method entry")                          \
169                                                                             \
170   develop(uint64_t, BreakAtNode, 0,                                         \
171           "Break at construction of this Node (either _idx or _debug_idx)") \
172                                                                             \
173   develop(bool, OptoBreakpointC2R, false,                                   \
174           "insert breakpoint at runtime stub entry")                        \
175                                                                             \
176   develop(bool, OptoNoExecute, false,                                       \
177           "Attempt to parse and compile but do not execute generated code") \
178                                                                             \
179   develop(bool, PrintOptoStatistics, false,                                 \
180           "Print New compiler statistics")                                  \
181                                                                             \
182   product(bool, PrintOptoAssembly, false, DIAGNOSTIC,                       \
183           "Print New compiler assembly output")                             \
184                                                                             \
185   develop_pd(bool, OptoPeephole,                                            \
186           "Apply peephole optimizations after register allocation")         \
187                                                                             \
188   develop(bool, PrintFrameConverterAssembly, false,                         \
189           "Print New compiler assembly output for frame converters")        \
190                                                                             \
191   develop(bool, PrintParseStatistics, false,                                \
192           "Print nodes, transforms and new values made per bytecode parsed")\
193                                                                             \
194   develop(bool, PrintOptoPeephole, false,                                   \
195           "Print New compiler peephole replacements")                       \
196                                                                             \
197   develop(bool, PrintCFGBlockFreq, false,                                   \
198           "Print CFG block frequencies")                                    \
199                                                                             \
200   develop(bool, TraceOptoParse, false,                                      \
201           "Trace bytecode parse and control-flow merge")                    \
202                                                                             \
203   product_pd(intx,  LoopUnrollLimit,                                        \
204           "Unroll loop bodies with node count less than this")              \
205           range(0, max_jint / 4)                                            \
206                                                                             \
207   product_pd(intx, LoopPercentProfileLimit,                                 \
208              "Unroll loop bodies with % node count of profile limit")       \
209              range(10, 100)                                                 \
210                                                                             \
211   product(intx,  LoopMaxUnroll, 16,                                         \
212           "Maximum number of unrolls for main loop")                        \
213           range(0, max_jint)                                                \
214                                                                             \
215   product_pd(bool,  SuperWordLoopUnrollAnalysis,                            \
216            "Map number of unrolls for main loop via "                       \
217            "Superword Level Parallelism analysis")                          \
218                                                                             \
219   develop(bool, TraceSuperWordLoopUnrollAnalysis, false,                    \
220           "Trace what Superword Level Parallelism analysis applies")        \
221                                                                             \
222   product(bool, UseVectorMacroLogic, true, DIAGNOSTIC,                      \
223           "Use ternary macro logic instructions")                           \
224                                                                             \
225   product(intx,  LoopUnrollMin, 4,                                          \
226           "Minimum number of unroll loop bodies before checking progress"   \
227           "of rounds of unroll,optimize,..")                                \
228           range(0, max_jint)                                                \
229                                                                             \
230   product(bool, UseSubwordForMaxVector, true,                               \
231           "Use Subword Analysis to set maximum vector size")                \
232                                                                             \
233   product(bool, UseVectorCmov, false,                                       \
234           "Use Vectorized Cmov")                                            \
235                                                                             \
236   develop(intx, UnrollLimitForProfileCheck, 1,                              \
237           "Don't use profile_trip_cnt() to restrict unrolling until "       \
238           "unrolling would push the number of unrolled iterations above "   \
239           "UnrollLimitForProfileCheck. A higher value allows more "         \
240           "unrolling. Zero acts as a very large value." )                   \
241           range(0, max_intx)                                                \
242                                                                             \
243   product(intx, MultiArrayExpandLimit, 6,                                   \
244           "Maximum number of individual allocations in an inline-expanded " \
245           "multianewarray instruction")                                     \
246           range(0, max_jint)                                                \
247                                                                             \
248   develop(bool, TraceProfileTripCount, false,                               \
249           "Trace profile loop trip count information")                      \
250                                                                             \
251   product(bool, UseCountedLoopSafepoints, false,                            \
252           "Force counted loops to keep a safepoint")                        \
253                                                                             \
254   product(bool, UseLoopPredicate, true,                                     \
255           "Move checks with uncommon trap out of loops.")                   \
256                                                                             \
257   develop(bool, TraceLoopPredicate, false,                                  \
258           "Trace generation of loop predicates")                            \
259                                                                             \
260   develop(bool, TraceLoopOpts, false,                                       \
261           "Trace executed loop optimizations")                              \
262                                                                             \
263   develop(bool, TraceSplitIf, false,                                        \
264           "Trace Split-If optimization")                                    \
265                                                                             \
266   develop(bool, TraceLoopLimitCheck, false,                                 \
267           "Trace generation of loop limits checks")                         \
268                                                                             \
269   develop(bool, TraceRangeLimitCheck, false,                                \
270           "Trace additional overflow checks in RCE")                        \
271                                                                             \
272   /* OptimizeFill not yet supported on PowerPC. */                          \
273   product(bool, OptimizeFill, true PPC64_ONLY(&& false),                    \
274           "convert fill/copy loops into intrinsic")                         \
275                                                                             \
276   develop(bool, TraceOptimizeFill, false,                                   \
277           "print detailed information about fill conversion")               \
278                                                                             \
279   develop(bool, OptoCoalesce, true,                                         \
280           "Use Conservative Copy Coalescing in the Register Allocator")     \
281                                                                             \
282   product(uint, IFGEdgesLimit, 10000000, DIAGNOSTIC,                        \
283           "Maximum allowed edges in the interference graphs")               \
284           range(0, max_juint)                                               \
285                                                                             \
286   develop(bool, UseUniqueSubclasses, true,                                  \
287           "Narrow an abstract reference to the unique concrete subclass")   \
288                                                                             \
289   product(intx, TrackedInitializationLimit, 50,                             \
290           "When initializing fields, track up to this many words")          \
291           range(0, 65535)                                                   \
292                                                                             \
293   product(bool, ReduceFieldZeroing, true,                                   \
294           "When initializing fields, try to avoid needless zeroing")        \
295                                                                             \
296   product(bool, ReduceInitialCardMarks, true,                               \
297           "When initializing fields, try to avoid needless card marks")     \
298                                                                             \
299   product(bool, ReduceBulkZeroing, true,                                    \
300           "When bulk-initializing, try to avoid needless zeroing")          \
301                                                                             \
302   product(bool, UseFPUForSpilling, false,                                   \
303           "Spill integer registers to FPU instead of stack when possible")  \
304                                                                             \
305   develop_pd(intx, RegisterCostAreaRatio,                                   \
306           "Spill selection in reg allocator: scale area by (X/64K) before " \
307           "adding cost")                                                    \
308                                                                             \
309   develop_pd(bool, UseCISCSpill,                                            \
310           "Use ADLC supplied cisc instructions during allocation")          \
311                                                                             \
312   develop(bool, VerifyGraphEdges , false,                                   \
313           "Verify Bi-directional Edges")                                    \
314                                                                             \
315   develop(bool, VerifyDUIterators, true,                                    \
316           "Verify the safety of all iterations of Bi-directional Edges")    \
317                                                                             \
318   develop(bool, VerifyHashTableKeys, true,                                  \
319           "Verify the immutability of keys in the VN hash tables")          \
320                                                                             \
321   develop(bool, VerifyRegisterAllocator , false,                            \
322           "Verify Register Allocator")                                      \
323                                                                             \
324   develop(intx, FLOATPRESSURE, -1,                                          \
325           "Number of float LRG's that constitute high register pressure."   \
326           "-1: means the threshold is determined by number of available "   \
327           "float register for allocation")                                  \
328           range(-1, max_jint)                                               \
329                                                                             \
330   develop(intx, INTPRESSURE, -1,                                            \
331           "Number of integer LRG's that constitute high register pressure." \
332           "-1: means the threshold is determined by number of available "   \
333           "integer register for allocation")                                \
334           range(-1, max_jint)                                               \
335                                                                             \
336   develop(bool, TraceOptoPipelining, false,                                 \
337           "Trace pipelining information")                                   \
338                                                                             \
339   develop(bool, TraceOptoOutput, false,                                     \
340           "Trace pipelining information")                                   \
341                                                                             \
342   product_pd(bool, OptoScheduling,                                          \
343           "Instruction Scheduling after register allocation")               \
344                                                                             \
345   product_pd(bool, OptoRegScheduling,                                       \
346           "Instruction Scheduling before register allocation for pressure") \
347                                                                             \
348   product(bool, PartialPeelLoop, true,                                      \
349           "Partial peel (rotate) loops")                                    \
350                                                                             \
351   product(uint, LoopPeeling, 1, DIAGNOSTIC,                                 \
352           "Control loop peeling optimization: "                             \
353           "0 = always disable loop peeling, "                               \
354           "1 = enable loop peeling (default), "                             \
355           "2 = disable loop peeling as a standalone optimization but "      \
356           "allow it as a helper to other loop optimizations like removing " \
357           "empty loops")                                                    \
358           range(0, 2)                                                       \
359                                                                             \
360   product(intx, PartialPeelNewPhiDelta, 0,                                  \
361           "Additional phis that can be created by partial peeling")         \
362           range(0, max_jint)                                                \
363                                                                             \
364   develop(bool, TracePartialPeeling, false,                                 \
365           "Trace partial peeling (loop rotation) information")              \
366                                                                             \
367   product(bool, PartialPeelAtUnsignedTests, true,                           \
368           "Partial peel at unsigned tests if no signed test exists")        \
369                                                                             \
370   product(bool, ReassociateInvariants, true,                                \
371           "Enable reassociation of expressions with loop invariants.")      \
372                                                                             \
373   product(bool, LoopUnswitching, true,                                      \
374           "Enable loop unswitching (a form of invariant test hoisting)")    \
375                                                                             \
376   develop(bool, TraceLoopUnswitching, false,                                \
377           "Trace loop unswitching")                                         \
378                                                                             \
379   product(bool, LoopMultiversioning, true, DIAGNOSTIC,                      \
380           "Enable loop multiversioning (for speculative compilation)")      \
381                                                                             \
382   develop(bool, TraceLoopMultiversioning, false,                            \
383           "Trace loop multiversioning")                                     \
384                                                                             \
385   product(bool, UseAutoVectorizationPredicate, true, DIAGNOSTIC,            \
386           "Use AutoVectorization predicate (for speculative compilation)")  \
387                                                                             \
388   product(bool, UseAutoVectorizationSpeculativeAliasingChecks, true, DIAGNOSTIC, \
389           "Allow the use Multiversioning or Predicate to add aliasing"      \
390           "runtime checks. Runtime checks will only be inserted if either"  \
391           "LoopMultiversioning or UseAutoVectorizationPredicate are"        \
392           "enabled.")                                                       \
393                                                                             \
394   product(bool, AllowVectorizeOnDemand, true,                               \
395           "Globally suppress vectorization set in VectorizeMethod")         \
396                                                                             \
397   product(bool, UseSuperWord, true,                                         \
398           "Transform scalar operations into superword operations")          \
399                                                                             \
400   product(bool, SuperWordReductions, true,                                  \
401           "Enable reductions support in superword.")                        \
402                                                                             \
403   product_pd(uint, SuperWordStoreToLoadForwardingFailureDetection, DIAGNOSTIC, \
404           "if >0, auto-vectorization detects possible store-to-load "       \
405           "forwarding failures. The number specifies over how many "        \
406           "loop iterations this detection spans.")                          \
407           range(0, 4096)                                                    \
408                                                                             \
409   product(uint, SuperWordAutomaticAlignment, 1, DIAGNOSTIC,                 \
410           "0 = Disabled (unless AlignVector is enabled)"                    \
411           "Else: align with a load or store of the largest vector width,"   \
412           "      and if there are loads and stores of the largest width:"   \
413           "1 = Prefer alignment with vector store (default)"                \
414           "2 = Prefer alignment with vector load.")                         \
415           range(0, 2)                                                       \
416                                                                             \
417   product(uint, AutoVectorizationOverrideProfitability, 1, DIAGNOSTIC,      \
418           "Override the auto vectorization profitability heuristics."       \
419           "0 = Run auto vectorizer, but abort just before applying"         \
420           "    vectorization, as though it was not profitable."             \
421           "1 = Run auto vectorizer with the default profitability"          \
422           "    heuristics. This is the default, and hopefully"              \
423           "    delivers the best performance."                              \
424           "2 = Run auto vectorizer, and vectorize even if the"              \
425           "    profitability heuristics predict that vectorization"         \
426           "    is not profitable.")                                         \
427           range(0, 2)                                                       \
428                                                                             \
429   product(bool, UseCMoveUnconditionally, false,                             \
430           "Use CMove (scalar and vector) ignoring profitability test.")     \
431                                                                             \
432   develop(bool, TraceSuperWord, false,                                      \
433           "Trace superword transforms")                                     \
434                                                                             \
435   develop(bool, TraceNewVectors, false,                                     \
436           "Trace creation of Vector nodes")                                 \
437                                                                             \
438   product(bool, MergeStores, true, DIAGNOSTIC,                              \
439           "Optimize stores by combining values into larger store")          \
440                                                                             \
441   product_pd(bool, OptoBundling,                                            \
442           "Generate nops to fill i-cache lines")                            \
443                                                                             \
444   product_pd(intx, ConditionalMoveLimit,                                    \
445           "Limit of ops to make speculative when using CMOVE")              \
446           range(0, max_jint)                                                \
447                                                                             \
448   develop(intx, PrintPhaseLevel, 0,                                         \
449           "Level of detail of the phase trace print. "                      \
450           "System-wide value, -1=printing is disabled, "                    \
451           "0=print nothing except PhasePrintLevel directives, "             \
452           "6=all details printed. "                                         \
453           "Level of detail of printouts can be set on a per-method level "  \
454           "as well by using CompileCommand=PhasePrintLevel.")               \
455           range(-1, 6)                                                      \
456                                                                             \
457   develop(bool, PrintIdealGraph, false,                                     \
458           "Print ideal graph to XML file / network interface. "             \
459           "By default attempts to connect to the visualizer on a socket.")  \
460                                                                             \
461   develop(intx, PrintIdealGraphLevel, 0,                                    \
462           "Level of detail of the ideal graph printout. "                   \
463           "System-wide value, -1=printing is disabled, "                    \
464           "0=print nothing except IGVPrintLevel directives, "               \
465           "6=all details printed. "                                         \
466           "Level of detail of printouts can be set on a per-method level "  \
467           "as well by using CompileCommand=option.")                        \
468           range(-1, 6)                                                      \
469                                                                             \
470   develop(intx, PrintIdealGraphPort, 4444,                                  \
471           "Ideal graph printer to network port")                            \
472           range(0, SHRT_MAX)                                                \
473                                                                             \
474   develop(ccstr, PrintIdealGraphAddress, "127.0.0.1",                       \
475           "IP address to connect to visualizer")                            \
476                                                                             \
477   develop(ccstr, PrintIdealGraphFile, nullptr,                              \
478           "File to dump ideal graph to.  If set overrides the "             \
479           "use of the network")                                             \
480                                                                             \
481   product(bool, UseBimorphicInlining, true,                                 \
482           "Profiling based inlining for two receivers")                     \
483                                                                             \
484   product(bool, UseOnlyInlinedBimorphic, true,                              \
485           "Don't use BimorphicInlining if can't inline a second method")    \
486                                                                             \
487   develop(bool, SubsumeLoads, true,                                         \
488           "Attempt to compile while subsuming loads into machine "          \
489           "instructions.")                                                  \
490                                                                             \
491   develop(bool, StressRecompilation, false,                                 \
492           "Recompile each compiled method without subsuming loads "         \
493           "or escape analysis.")                                            \
494                                                                             \
495   develop(intx, ImplicitNullCheckThreshold, 3,                              \
496           "Don't do implicit null checks if NPE's in a method exceeds "     \
497           "limit")                                                          \
498           range(0, max_jint)                                                \
499                                                                             \
500   product(intx, LoopOptsCount, 43,                                          \
501           "Set level of loop optimization for tier 1 compiles")             \
502           range(5, max_jint)                                                \
503                                                                             \
504   product(bool, OptimizeUnstableIf, true, DIAGNOSTIC,                       \
505           "Optimize UnstableIf traps")                                      \
506                                                                             \
507   /* controls for heat-based inlining */                                    \
508                                                                             \
509   develop(intx, NodeCountInliningCutoff, 18000,                             \
510           "If parser node generation exceeds limit stop inlining")          \
511           range(0, max_jint)                                                \
512                                                                             \
513   product(intx, MaxNodeLimit, 80000,                                        \
514           "Maximum number of nodes")                                        \
515           range(1000, max_jint / 3)                                         \
516                                                                             \
517   product(intx, NodeLimitFudgeFactor, 2000,                                 \
518           "Fudge Factor for certain optimizations")                         \
519           constraint(NodeLimitFudgeFactorConstraintFunc, AfterErgo)         \
520                                                                             \
521   product(bool, UseJumpTables, true,                                        \
522           "Use JumpTables instead of a binary search tree for switches")    \
523                                                                             \
524   product(bool, UseDivMod, true,                                            \
525           "Use combined DivMod instruction if available")                   \
526                                                                             \
527   product_pd(intx, MinJumpTableSize,                                        \
528           "Minimum number of targets in a generated jump table")            \
529           range(0, max_intx)                                                \
530                                                                             \
531   product(intx, MaxJumpTableSize, 65000,                                    \
532           "Maximum number of targets in a generated jump table")            \
533           range(0, max_intx)                                                \
534                                                                             \
535   product(intx, MaxJumpTableSparseness, 5,                                  \
536           "Maximum sparseness for jumptables")                              \
537           range(0, max_intx / 4)                                            \
538                                                                             \
539   product(bool, EliminateLocks, true,                                       \
540           "Coarsen locks when possible")                                    \
541                                                                             \
542   product(bool, EliminateNestedLocks, true,                                 \
543           "Eliminate nested locks of the same object when possible")        \
544                                                                             \
545   develop(bool, PrintLockStatistics, false,                                 \
546           "Print precise statistics on the dynamic lock usage")             \
547                                                                             \
548   develop(bool, PrintEliminateLocks, false,                                 \
549           "Print out when locks are eliminated")                            \
550                                                                             \
551   product(bool, EliminateAutoBox, true,                                     \
552           "Control optimizations for autobox elimination")                  \
553                                                                             \
554   product(intx, AutoBoxCacheMax, 128,                                       \
555           "Sets max value cached by the java.lang.Integer autobox cache")   \
556           range(0, max_jint)                                                \
557                                                                             \
558   product(bool, AggressiveUnboxing, true, DIAGNOSTIC,                       \
559           "Control optimizations for aggressive boxing elimination")        \
560                                                                             \
561   develop(bool, TracePostallocExpand, false, "Trace expanding nodes after"  \
562           " register allocation.")                                          \
563                                                                             \
564   product(bool, ReduceAllocationMerges, true, DIAGNOSTIC,                   \
565           "Try to simplify allocation merges before Scalar Replacement")    \
566                                                                             \
567   develop(bool, TraceReduceAllocationMerges, false,                         \
568              "Trace decision for simplifying allocation merges.")           \
569                                                                             \
570   develop(bool, VerifyReduceAllocationMerges, true,                         \
571           "Verify reduce allocation merges in escape analysis")             \
572                                                                             \
573   product(bool, DoEscapeAnalysis, true,                                     \
574           "Perform escape analysis")                                        \
575                                                                             \
576   product(double, EscapeAnalysisTimeout, 20. DEBUG_ONLY(+40.),              \
577           "Abort EA when it reaches time limit (in sec)")                   \
578           range(0, DBL_MAX)                                                 \
579                                                                             \
580   develop(bool, ExitEscapeAnalysisOnTimeout, true,                          \
581           "Exit or throw assert in EA when it reaches time limit")          \
582                                                                             \
583   develop(bool, PrintEscapeAnalysis, false,                                 \
584           "Print the results of escape analysis")                           \
585                                                                             \
586   product(bool, EliminateAllocations, true,                                 \
587           "Use escape analysis to eliminate allocations")                   \
588                                                                             \
589   develop(bool, PrintEliminateAllocations, false,                           \
590           "Print out when allocations are eliminated")                      \
591                                                                             \
592   product(intx, EliminateAllocationArraySizeLimit, 64,                      \
593           "Array size (number of elements) limit for scalar replacement")   \
594           range(0, max_jint)                                                \
595                                                                             \
596   product(intx, EliminateAllocationFieldsLimit, 512, DIAGNOSTIC,            \
597           "Number of fields in instance limit for scalar replacement")      \
598           range(0, max_jint)                                                \
599                                                                             \
600   product(bool, OptimizePtrCompare, true,                                   \
601           "Use escape analysis to optimize pointers compare")               \
602                                                                             \
603   develop(bool, PrintOptimizePtrCompare, false,                             \
604           "Print information about optimized pointers compare")             \
605                                                                             \
606   develop(bool, VerifyConnectionGraph , true,                               \
607           "Verify Connection Graph construction in Escape Analysis")        \
608                                                                             \
609   product(bool, OptimizeStringConcat, true,                                 \
610           "Optimize the construction of Strings by StringBuilder")          \
611                                                                             \
612   develop(bool, PrintOptimizeStringConcat, false,                           \
613           "Print information about transformations performed on Strings")   \
614                                                                             \
615   product(intx, ValueSearchLimit, 1000,                                     \
616           "Recursion limit in PhaseMacroExpand::value_from_mem_phi")        \
617           range(0, max_jint)                                                \
618                                                                             \
619   product(intx, MaxLabelRootDepth, 1100,                                    \
620           "Maximum times call Label_Root to prevent stack overflow")        \
621           range(100, max_jint)                                              \
622                                                                             \
623   product(intx, DominatorSearchLimit, 1000, DIAGNOSTIC,                     \
624           "Iterations limit in Node::dominates")                            \
625           range(0, max_jint)                                                \
626                                                                             \
627   product(bool, BlockLayoutByFrequency, true,                               \
628           "Use edge frequencies to drive block ordering")                   \
629                                                                             \
630   product(intx, BlockLayoutMinDiamondPercentage, 20,                        \
631           "Minimum %% of a successor (predecessor) for which block "        \
632           "layout a will allow a fork (join) in a single chain")            \
633           range(0, 100)                                                     \
634                                                                             \
635   product(bool, BlockLayoutRotateLoops, true,                               \
636           "Allow back branches to be fall throughs in the block layout")    \
637                                                                             \
638   product(bool, InlineReflectionGetCallerClass, true, DIAGNOSTIC,           \
639           "inline sun.reflect.Reflection.getCallerClass(), known to be "    \
640           "part of base library DLL")                                       \
641                                                                             \
642   product(bool, InlineObjectCopy, true, DIAGNOSTIC,                         \
643           "inline Object.clone and Arrays.copyOf[Range] intrinsics")        \
644                                                                             \
645   product(bool, SpecialStringCompareTo, true, DIAGNOSTIC,                   \
646           "special version of string compareTo")                            \
647                                                                             \
648   product(bool, SpecialStringIndexOf, true, DIAGNOSTIC,                     \
649           "special version of string indexOf")                              \
650                                                                             \
651   product(bool, SpecialStringEquals, true, DIAGNOSTIC,                      \
652           "special version of string equals")                               \
653                                                                             \
654   product(bool, SpecialArraysEquals, true, DIAGNOSTIC,                      \
655           "special version of Arrays.equals(char[],char[])")                \
656                                                                             \
657   product(bool, SpecialEncodeISOArray, true, DIAGNOSTIC,                    \
658           "special version of ISO_8859_1$Encoder.encodeISOArray")           \
659                                                                             \
660   develop(bool, BailoutToInterpreterForThrows, false,                       \
661           "Compiled methods which throws/catches exceptions will be "       \
662           "deopt and intp.")                                                \
663                                                                             \
664   develop(bool, ConvertCmpD2CmpF, true,                                     \
665           "Convert cmpD to cmpF when one input is constant in float range") \
666                                                                             \
667   develop(bool, ConvertFloat2IntClipping, true,                             \
668           "Convert float2int clipping idiom to integer clipping")           \
669                                                                             \
670   develop(bool, MonomorphicArrayCheck, true,                                \
671           "Uncommon-trap array store checks that require full type check")  \
672                                                                             \
673   develop(bool, TracePhaseCCP, false,                                       \
674           "Print progress during Conditional Constant Propagation")         \
675                                                                             \
676   develop(bool, PrintDominators, false,                                     \
677           "Print out dominator trees for GVN")                              \
678                                                                             \
679   product(bool, TraceSpilling, false, DIAGNOSTIC,                           \
680           "Trace spilling")                                                 \
681                                                                             \
682   product(bool, TraceTypeProfile, false, DIAGNOSTIC,                        \
683           "Trace type profile")                                             \
684                                                                             \
685   develop(bool, PoisonOSREntry, true,                                       \
686            "Detect abnormal calls to OSR code")                             \
687                                                                             \
688   develop(bool, SoftMatchFailure, trueInProduct,                            \
689           "If the DFA fails to match a node, print a message and bail out") \
690                                                                             \
691   develop(bool, InlineAccessors, true,                                      \
692           "inline accessor methods (get/set)")                              \
693                                                                             \
694   product(intx, TypeProfileMajorReceiverPercent, 90,                        \
695           "% of major receiver type to all profiled receivers")             \
696           range(0, 100)                                                     \
697                                                                             \
698   product(bool, PrintIntrinsics, false, DIAGNOSTIC,                         \
699           "prints attempted and successful inlining of intrinsics")         \
700                                                                             \
701   develop(bool, StressReflectiveCode, false,                                \
702           "Use inexact types at allocations, etc., to test reflection")     \
703                                                                             \
704   product(bool, DebugInlinedCalls, true, DIAGNOSTIC,                        \
705          "If false, restricts profiled locations to the root method only")  \
706                                                                             \
707   develop(bool, VerifyLoopOptimizations, false,                             \
708           "verify major loop optimizations")                                \
709                                                                             \
710   develop(bool, VerifyNoNewIrreducibleLoops, false,                         \
711           "Verify that no new irreducible loops are created after parsing") \
712                                                                             \
713   product(bool, ProfileDynamicTypes, true, DIAGNOSTIC,                      \
714           "do extra type profiling and use it more aggressively")           \
715                                                                             \
716   develop(bool, TraceIterativeGVN, false,                                   \
717           "Print progress during Iterative Global Value Numbering")         \
718                                                                             \
719   develop(bool, UseDeepIGVNRevisit, true,                                   \
720           "Re-process nodes that could benefit from a deep revisit after "  \
721           "the IGVN worklist drains")                                       \
722                                                                             \
723   develop(uint, VerifyIterativeGVN, 0,                                      \
724           "Verify Iterative Global Value Numbering =FEDCBA, with:"          \
725           "  F: verify Node::Ideal does not return nullptr if the node"     \
726                 "hash has changed"                                          \
727           "  E: verify node specific invariants"                            \
728           "  D: verify Node::Identity did not miss opportunities"           \
729           "  C: verify Node::Ideal did not miss opportunities"              \
730           "  B: verify that type(n) == n->Value() after IGVN"               \
731           "  A: verify Def-Use modifications during IGVN"                   \
732           "Each can be 0=off or 1=on")                                      \
733           constraint(VerifyIterativeGVNConstraintFunc, AtParse)             \
734                                                                             \
735   develop(bool, TraceCISCSpill, false,                                      \
736           "Trace allocators use of cisc spillable instructions")            \
737                                                                             \
738   product(bool, SplitIfBlocks, true,                                        \
739           "Clone compares and control flow through merge points to fold "   \
740           "some branches")                                                  \
741                                                                             \
742   develop(intx, FreqCountInvocations,  1,                                   \
743           "Scaling factor for branch frequencies (deprecated)")             \
744           range(1, max_intx)                                                \
745                                                                             \
746   develop(bool, VerifyAliases, false,                                       \
747           "perform extra checks on the results of alias analysis")          \
748                                                                             \
749   product(uint, VerifyConstraintCasts, 0, DIAGNOSTIC,                       \
750           "Perform runtime checks to verify the value of a "                \
751           "ConstraintCast lies inside its type"                             \
752           "0 = does not perform any verification, "                         \
753           "1 = perform verification on ConstraintCastNodes that are "       \
754               "present during code emission, "                              \
755           "2 = Do not do widening of ConstraintCastNodes so that we can "   \
756               "have more verification coverage")                            \
757           range(0, 2)                                                       \
758                                                                             \
759   product(intx, MaxInlineLevel, 15,                                         \
760           "maximum number of nested calls that are inlined by high tier "   \
761           "compiler")                                                       \
762           range(0, max_jint)                                                \
763                                                                             \
764   product(intx, MaxRecursiveInlineLevel, 1,                                 \
765           "maximum number of nested recursive calls that are inlined by "   \
766           "high tier compiler")                                             \
767           range(0, max_jint)                                                \
768                                                                             \
769   product_pd(intx, InlineSmallCode,                                         \
770           "Only inline already compiled methods if their code size is "     \
771           "less than this")                                                 \
772           range(0, max_jint)                                                \
773                                                                             \
774   product(intx, MaxInlineSize, 35,                                          \
775           "The maximum bytecode size of a method to be inlined by high "    \
776           "tier compiler")                                                  \
777           range(0, max_jint)                                                \
778                                                                             \
779   product_pd(intx, FreqInlineSize,                                          \
780           "The maximum bytecode size of a frequent method to be inlined")   \
781           range(0, max_jint)                                                \
782                                                                             \
783   product(intx, MaxTrivialSize, 6,                                          \
784           "The maximum bytecode size of a trivial method to be inlined by " \
785           "high tier compiler")                                             \
786           range(0, max_jint)                                                \
787                                                                             \
788   product(bool, IncrementalInline, true,                                    \
789           "do post parse inlining")                                         \
790                                                                             \
791   product(bool, IncrementalInlineMH, true, DIAGNOSTIC,                      \
792           "do post parse inlining of method handle calls")                  \
793                                                                             \
794   product(bool, IncrementalInlineVirtual, true, DIAGNOSTIC,                 \
795           "do post parse inlining of virtual calls")                        \
796                                                                             \
797   develop(bool, AlwaysIncrementalInline, false,                             \
798           "do all inlining incrementally")                                  \
799                                                                             \
800   product(bool, IncrementalInlineForceCleanup, false, DIAGNOSTIC,           \
801           "do cleanup after every iteration of incremental inlining")       \
802                                                                             \
803   product(intx, LiveNodeCountInliningCutoff, 40000,                         \
804           "max number of live nodes in a method")                           \
805           range(0, max_juint / 8)                                           \
806                                                                             \
807   product(bool, OptimizeExpensiveOps, true, DIAGNOSTIC,                     \
808           "Find best control for expensive operations")                     \
809                                                                             \
810   product(bool, UseMathExactIntrinsics, true, DIAGNOSTIC,                   \
811           "Enables intrinsification of various java.lang.Math functions")   \
812                                                                             \
813   product(bool, UseCharacterCompareIntrinsics, false, DIAGNOSTIC,           \
814           "Enables intrinsification of java.lang.Character functions")      \
815                                                                             \
816   product(bool, UseMultiplyToLenIntrinsic, false, DIAGNOSTIC,               \
817           "Enables intrinsification of BigInteger.multiplyToLen()")         \
818                                                                             \
819   product(bool, UseSquareToLenIntrinsic, false, DIAGNOSTIC,                 \
820           "Enables intrinsification of BigInteger.squareToLen()")           \
821                                                                             \
822   product(bool, UseMulAddIntrinsic, false, DIAGNOSTIC,                      \
823           "Enables intrinsification of BigInteger.mulAdd()")                \
824                                                                             \
825   product(bool, UseMontgomeryMultiplyIntrinsic, false, DIAGNOSTIC,          \
826           "Enables intrinsification of BigInteger.montgomeryMultiply()")    \
827                                                                             \
828   product(bool, UseMontgomerySquareIntrinsic, false, DIAGNOSTIC,            \
829           "Enables intrinsification of BigInteger.montgomerySquare()")      \
830                                                                             \
831   product(bool, EnableVectorSupport, false, EXPERIMENTAL,                   \
832           "Enables VectorSupport intrinsics")                               \
833                                                                             \
834   product(bool, EnableVectorReboxing, false, EXPERIMENTAL,                  \
835           "Enables reboxing of vectors")                                    \
836                                                                             \
837   product(bool, EnableVectorAggressiveReboxing, false, EXPERIMENTAL,        \
838           "Enables aggressive reboxing of vectors")                         \
839                                                                             \
840   product(bool, UseTypeSpeculation, true,                                   \
841           "Speculatively propagate types from profiles")                    \
842                                                                             \
843   product(bool, UseInlineDepthForSpeculativeTypes, true, DIAGNOSTIC,        \
844           "Carry inline depth of profile point with speculative type "      \
845           "and give priority to profiling from lower inline depth")         \
846                                                                             \
847   product_pd(bool, TrapBasedRangeChecks,                                    \
848           "Generate code for range checks that uses a cmp and trap "        \
849           "instruction raising SIGTRAP. Used on PPC64.")                    \
850                                                                             \
851   product(intx, ArrayCopyLoadStoreMaxElem, 8,                               \
852           "Maximum number of arraycopy elements inlined as a sequence of"   \
853           "loads/stores")                                                   \
854           range(0, max_intx)                                                \
855                                                                             \
856   develop(bool, StressArrayCopyMacroNode, false,                            \
857           "Perform ArrayCopy load/store replacement during IGVN only")      \
858                                                                             \
859   develop(bool, RenumberLiveNodes, true,                                    \
860           "Renumber live nodes")                                            \
861                                                                             \
862   product(uintx, LoopStripMiningIter, 0,                                    \
863           "Number of iterations in strip mined loop")                       \
864           range(0, max_juint)                                               \
865           constraint(LoopStripMiningIterConstraintFunc, AfterErgo)          \
866                                                                             \
867   product(uintx, LoopStripMiningIterShortLoop, 0,                           \
868           "Loop with fewer iterations are not strip mined")                 \
869           range(0, max_juint)                                               \
870                                                                             \
871   product(bool, UseProfiledLoopPredicate, true,                             \
872           "Move checks with an uncommon trap out of loops based on "        \
873           "profiling data. "                                                \
874           "Requires UseLoopPredicate to be turned on (default).")           \
875                                                                             \
876   product(bool, UseArrayLoadStoreProfile, true, DIAGNOSTIC,                 \
877           "Take advantage of profiling at array load/store")                \
878                                                                             \
879   product(bool, UseACmpProfile, true, DIAGNOSTIC,                           \
880           "Take advantage of profiling at if_acmp<cond>")                   \
881                                                                             \
882   develop(uintx, StressLongCountedLoop, 0,                                  \
883           "if > 0, convert int counted loops to long counted loops"         \
884           "to stress handling of long counted loops: run inner loop"        \
885           "for at most jint_max / StressLongCountedLoop")                   \
886           range(0, max_juint)                                               \
887                                                                             \
888   product(bool, DuplicateBackedge, true, DIAGNOSTIC,                        \
889           "Transform loop with a merge point into 2 loops if inner loop is" \
890           "expected to optimize better")                                    \
891                                                                             \
892   develop(bool, StressDuplicateBackedge, false,                             \
893           "Run DuplicateBackedge whenever possible ignoring benefit"        \
894           "analysis")                                                       \
895                                                                             \
896   product(bool, VerifyReceiverTypes, trueInDebug, DIAGNOSTIC,               \
897           "Verify receiver types at runtime")                               \
898                                                                             \
899   product(intx, TypeProfileSubTypeCheckCommonThreshold, 50,                 \
900           "Use profile data at type check if profiled types account for"    \
901           "more than this threshold")                                       \
902           range(0, 100)                                                     \
903                                                                             \
904   develop(bool, StressPrunedExceptionHandlers, false,                       \
905           "Always prune exception handlers")                                \
906                                                                             \
907   product(bool, InlineSecondarySupersTest, true, DIAGNOSTIC,                \
908           "Inline the secondary supers hash lookup.")                       \
909                                                                             \
910   product(bool, UseStoreStoreForCtor, true, DIAGNOSTIC,                     \
911           "Use StoreStore barrier instead of Release barrier at the end "   \
912           "of constructors")                                                \
913                                                                             \
914   develop(bool, KillPathsReachableByDeadTypeNode, true,                     \
915           "When a Type node becomes top, make paths where the node is "     \
916           "used dead by replacing them with a Halt node. Turning this off " \
917           "could corrupt the graph in rare cases and should be used with "  \
918           "care.")                                                          \
919                                                                             \
920   product(bool, ShortRunningLongLoop, true, DIAGNOSTIC,                     \
921           "long counted loop/long range checks: don't create loop nest if " \
922           "loop runs for small enough number of iterations. Long loop is "  \
923           "converted to a single int loop.")                                \
924                                                                             \
925   develop(bool, StressShortRunningLongLoop, false,                          \
926           "Speculate all long counted loops are short running when bounds " \
927           "are unknown even if profile data doesn't say so.")               \
928                                                                             \
929   develop(bool, StressLoopPeeling, false,                                   \
930           "Randomize loop peeling decision")                                \
931                                                                             \
932   develop(bool, StressCountedLoop, false,                                   \
933           "Randomly delay conversion to counted loops")                     \
934                                                                             \
935   product(bool, HotCodeHeap, false, EXPERIMENTAL,                           \
936           "Enable the code heap for hot C2 nmethods")                       \
937                                                                             \
938   product(double, HotCodeSamplePercent, 80, EXPERIMENTAL,                   \
939           "Minimum percentage of profiling samples that must be in "        \
940           "the MethodHot heap before stopping hot code collection")         \
941           range(0, 100)                                                     \
942                                                                             \
943   product(double, HotCodeStablePercent, 5, EXPERIMENTAL,                    \
944           "Maximum percentage of newly compiled to total C2 nmethods "      \
945           "to treat nmethod count as stable. "                              \
946           "Values less than zero disable the stable check")                 \
947           range(-1, DBL_MAX)                                                \
948                                                                             \
949   product(uint, HotCodeIntervalSeconds, 300, EXPERIMENTAL,                  \
950           "Seconds between hot code grouping attempts")                     \
951           range(0, max_juint)                                               \
952                                                                             \
953   product(uint, HotCodeSampleSeconds, 120, EXPERIMENTAL,                    \
954           "Seconds to sample application threads per grouping attempt")     \
955           range(0, max_juint)                                               \
956                                                                             \
957   product(uint, HotCodeStartupDelaySeconds, 120, EXPERIMENTAL,              \
958           "Seconds to delay before starting hot code grouping thread")      \
959           range(0, max_juint)                                               \
960                                                                             \
961   product(uint, HotCodeMinSamplingMs, 5, EXPERIMENTAL,                      \
962           "Minimum sampling interval in milliseconds")                      \
963           range(0, max_juint)                                               \
964                                                                             \
965   product(uint, HotCodeMaxSamplingMs, 15, EXPERIMENTAL,                     \
966           "Maximum sampling interval in milliseconds")                      \
967           range(0, max_juint)                                               \
968                                                                             \
969   product(uint, HotCodeCallLevel, 1, EXPERIMENTAL,                          \
970           "Number of levels of callees to relocate per candidate")          \
971           range(0, max_juint)                                               \
972 
973 // end of C2_FLAGS
974 
975 DECLARE_FLAGS(C2_FLAGS)
976 
977 #endif // SHARE_OPTO_C2_GLOBALS_HPP