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 node count exceeds limit stop inlining")                      \
511           range(0, max_jint)                                                \
512                                                                             \
513   product(bool, DelayAfterInliningCutoff, false, DIAGNOSTIC,                \
514           "If node count exceeds limit during parsing, attempt inlining "   \
515           "later instead of giving up completely")                          \
516                                                                             \
517   product(intx, MaxNodeLimit, 80000,                                        \
518           "Maximum number of nodes")                                        \
519           range(1000, max_jint / 3)                                         \
520                                                                             \
521   product(intx, NodeLimitFudgeFactor, 2000,                                 \
522           "Fudge Factor for certain optimizations")                         \
523           constraint(NodeLimitFudgeFactorConstraintFunc, AfterErgo)         \
524                                                                             \
525   product(bool, UseJumpTables, true,                                        \
526           "Use JumpTables instead of a binary search tree for switches")    \
527                                                                             \
528   product(bool, UseDivMod, true,                                            \
529           "Use combined DivMod instruction if available")                   \
530                                                                             \
531   product_pd(intx, MinJumpTableSize,                                        \
532           "Minimum number of targets in a generated jump table")            \
533           range(0, max_intx)                                                \
534                                                                             \
535   product(intx, MaxJumpTableSize, 65000,                                    \
536           "Maximum number of targets in a generated jump table")            \
537           range(0, max_intx)                                                \
538                                                                             \
539   product(intx, MaxJumpTableSparseness, 5,                                  \
540           "Maximum sparseness for jumptables")                              \
541           range(0, max_intx / 4)                                            \
542                                                                             \
543   product(bool, EliminateLocks, true,                                       \
544           "Coarsen locks when possible")                                    \
545                                                                             \
546   product(bool, EliminateNestedLocks, true,                                 \
547           "Eliminate nested locks of the same object when possible")        \
548                                                                             \
549   develop(bool, PrintLockStatistics, false,                                 \
550           "Print precise statistics on the dynamic lock usage")             \
551                                                                             \
552   develop(bool, PrintEliminateLocks, false,                                 \
553           "Print out when locks are eliminated")                            \
554                                                                             \
555   product(bool, EliminateAutoBox, true,                                     \
556           "Control optimizations for autobox elimination")                  \
557                                                                             \
558   product(intx, AutoBoxCacheMax, 128,                                       \
559           "Sets max value cached by the java.lang.Integer autobox cache")   \
560           range(0, max_jint)                                                \
561                                                                             \
562   product(bool, AggressiveUnboxing, true, DIAGNOSTIC,                       \
563           "Control optimizations for aggressive boxing elimination")        \
564                                                                             \
565   develop(bool, TracePostallocExpand, false, "Trace expanding nodes after"  \
566           " register allocation.")                                          \
567                                                                             \
568   product(bool, ReduceAllocationMerges, true, DIAGNOSTIC,                   \
569           "Try to simplify allocation merges before Scalar Replacement")    \
570                                                                             \
571   develop(bool, TraceReduceAllocationMerges, false,                         \
572              "Trace decision for simplifying allocation merges.")           \
573                                                                             \
574   develop(bool, VerifyReduceAllocationMerges, true,                         \
575           "Verify reduce allocation merges in escape analysis")             \
576                                                                             \
577   product(bool, DoEscapeAnalysis, true,                                     \
578           "Perform escape analysis")                                        \
579                                                                             \
580   product(double, EscapeAnalysisTimeout, 20. DEBUG_ONLY(+40.),              \
581           "Abort EA when it reaches time limit (in sec)")                   \
582           range(0, DBL_MAX)                                                 \
583                                                                             \
584   develop(bool, ExitEscapeAnalysisOnTimeout, true,                          \
585           "Exit or throw assert in EA when it reaches time limit")          \
586                                                                             \
587   develop(bool, PrintEscapeAnalysis, false,                                 \
588           "Print the results of escape analysis")                           \
589                                                                             \
590   product(bool, EliminateAllocations, true,                                 \
591           "Use escape analysis to eliminate allocations")                   \
592                                                                             \
593   develop(bool, PrintEliminateAllocations, false,                           \
594           "Print out when allocations are eliminated")                      \
595                                                                             \
596   product(intx, EliminateAllocationArraySizeLimit, 64,                      \
597           "Array size (number of elements) limit for scalar replacement")   \
598           range(0, max_jint)                                                \
599                                                                             \
600   product(intx, EliminateAllocationFieldsLimit, 512, DIAGNOSTIC,            \
601           "Number of fields in instance limit for scalar replacement")      \
602           range(0, max_jint)                                                \
603                                                                             \
604   product(bool, OptimizePtrCompare, true,                                   \
605           "Use escape analysis to optimize pointers compare")               \
606                                                                             \
607   develop(bool, PrintOptimizePtrCompare, false,                             \
608           "Print information about optimized pointers compare")             \
609                                                                             \
610   develop(bool, VerifyConnectionGraph , true,                               \
611           "Verify Connection Graph construction in Escape Analysis")        \
612                                                                             \
613   product(bool, OptimizeStringConcat, true,                                 \
614           "Optimize the construction of Strings by StringBuilder")          \
615                                                                             \
616   develop(bool, PrintOptimizeStringConcat, false,                           \
617           "Print information about transformations performed on Strings")   \
618                                                                             \
619   product(intx, ValueSearchLimit, 1000,                                     \
620           "Recursion limit in PhaseMacroExpand::value_from_mem_phi")        \
621           range(0, max_jint)                                                \
622                                                                             \
623   product(intx, MaxLabelRootDepth, 1100,                                    \
624           "Maximum times call Label_Root to prevent stack overflow")        \
625           range(100, max_jint)                                              \
626                                                                             \
627   product(intx, DominatorSearchLimit, 1000, DIAGNOSTIC,                     \
628           "Iterations limit in Node::dominates")                            \
629           range(0, max_jint)                                                \
630                                                                             \
631   product(bool, BlockLayoutByFrequency, true,                               \
632           "Use edge frequencies to drive block ordering")                   \
633                                                                             \
634   product(intx, BlockLayoutMinDiamondPercentage, 20,                        \
635           "Minimum %% of a successor (predecessor) for which block "        \
636           "layout a will allow a fork (join) in a single chain")            \
637           range(0, 100)                                                     \
638                                                                             \
639   product(bool, BlockLayoutRotateLoops, true,                               \
640           "Allow back branches to be fall throughs in the block layout")    \
641                                                                             \
642   product(bool, InlineReflectionGetCallerClass, true, DIAGNOSTIC,           \
643           "inline sun.reflect.Reflection.getCallerClass(), known to be "    \
644           "part of base library DLL")                                       \
645                                                                             \
646   product(bool, InlineObjectCopy, true, DIAGNOSTIC,                         \
647           "inline Object.clone and Arrays.copyOf[Range] intrinsics")        \
648                                                                             \
649   product(bool, SpecialStringCompareTo, true, DIAGNOSTIC,                   \
650           "special version of string compareTo")                            \
651                                                                             \
652   product(bool, SpecialStringIndexOf, true, DIAGNOSTIC,                     \
653           "special version of string indexOf")                              \
654                                                                             \
655   product(bool, SpecialStringEquals, true, DIAGNOSTIC,                      \
656           "special version of string equals")                               \
657                                                                             \
658   product(bool, SpecialArraysEquals, true, DIAGNOSTIC,                      \
659           "special version of Arrays.equals(char[],char[])")                \
660                                                                             \
661   product(bool, SpecialEncodeISOArray, true, DIAGNOSTIC,                    \
662           "special version of ISO_8859_1$Encoder.encodeISOArray")           \
663                                                                             \
664   develop(bool, BailoutToInterpreterForThrows, false,                       \
665           "Compiled methods which throws/catches exceptions will be "       \
666           "deopt and intp.")                                                \
667                                                                             \
668   develop(bool, ConvertCmpD2CmpF, true,                                     \
669           "Convert cmpD to cmpF when one input is constant in float range") \
670                                                                             \
671   develop(bool, ConvertFloat2IntClipping, true,                             \
672           "Convert float2int clipping idiom to integer clipping")           \
673                                                                             \
674   develop(bool, MonomorphicArrayCheck, true,                                \
675           "Uncommon-trap array store checks that require full type check")  \
676                                                                             \
677   develop(bool, TracePhaseCCP, false,                                       \
678           "Print progress during Conditional Constant Propagation")         \
679                                                                             \
680   develop(bool, PrintDominators, false,                                     \
681           "Print out dominator trees for GVN")                              \
682                                                                             \
683   product(bool, TraceSpilling, false, DIAGNOSTIC,                           \
684           "Trace spilling")                                                 \
685                                                                             \
686   product(bool, TraceTypeProfile, false, DIAGNOSTIC,                        \
687           "Trace type profile")                                             \
688                                                                             \
689   develop(bool, PoisonOSREntry, true,                                       \
690            "Detect abnormal calls to OSR code")                             \
691                                                                             \
692   develop(bool, SoftMatchFailure, trueInProduct,                            \
693           "If the DFA fails to match a node, print a message and bail out") \
694                                                                             \
695   develop(bool, InlineAccessors, true,                                      \
696           "inline accessor methods (get/set)")                              \
697                                                                             \
698   product(intx, TypeProfileMajorReceiverPercent, 90,                        \
699           "% of major receiver type to all profiled receivers")             \
700           range(0, 100)                                                     \
701                                                                             \
702   product(bool, PrintIntrinsics, false, DIAGNOSTIC,                         \
703           "prints attempted and successful inlining of intrinsics")         \
704                                                                             \
705   develop(bool, StressReflectiveCode, false,                                \
706           "Use inexact types at allocations, etc., to test reflection")     \
707                                                                             \
708   product(bool, DebugInlinedCalls, true, DIAGNOSTIC,                        \
709          "If false, restricts profiled locations to the root method only")  \
710                                                                             \
711   develop(bool, VerifyLoopOptimizations, false,                             \
712           "verify major loop optimizations")                                \
713                                                                             \
714   develop(bool, VerifyNoNewIrreducibleLoops, false,                         \
715           "Verify that no new irreducible loops are created after parsing") \
716                                                                             \
717   product(bool, ProfileDynamicTypes, true, DIAGNOSTIC,                      \
718           "do extra type profiling and use it more aggressively")           \
719                                                                             \
720   develop(bool, TraceIterativeGVN, false,                                   \
721           "Print progress during Iterative Global Value Numbering")         \
722                                                                             \
723   develop(bool, UseDeepIGVNRevisit, true,                                   \
724           "Re-process nodes that could benefit from a deep revisit after "  \
725           "the IGVN worklist drains")                                       \
726                                                                             \
727   develop(uint, VerifyIterativeGVN, 0,                                      \
728           "Verify Iterative Global Value Numbering =FEDCBA, with:"          \
729           "  F: verify Node::Ideal does not return nullptr if the node"     \
730                 "hash has changed"                                          \
731           "  E: verify node specific invariants"                            \
732           "  D: verify Node::Identity did not miss opportunities"           \
733           "  C: verify Node::Ideal did not miss opportunities"              \
734           "  B: verify that type(n) == n->Value() after IGVN"               \
735           "  A: verify Def-Use modifications during IGVN"                   \
736           "Each can be 0=off or 1=on")                                      \
737           constraint(VerifyIterativeGVNConstraintFunc, AtParse)             \
738                                                                             \
739   develop(bool, TraceCISCSpill, false,                                      \
740           "Trace allocators use of cisc spillable instructions")            \
741                                                                             \
742   product(bool, SplitIfBlocks, true,                                        \
743           "Clone compares and control flow through merge points to fold "   \
744           "some branches")                                                  \
745                                                                             \
746   develop(intx, FreqCountInvocations,  1,                                   \
747           "Scaling factor for branch frequencies (deprecated)")             \
748           range(1, max_intx)                                                \
749                                                                             \
750   develop(bool, VerifyAliases, false,                                       \
751           "perform extra checks on the results of alias analysis")          \
752                                                                             \
753   product(uint, VerifyConstraintCasts, 0, DIAGNOSTIC,                       \
754           "Perform runtime checks to verify the value of a "                \
755           "ConstraintCast lies inside its type"                             \
756           "0 = does not perform any verification, "                         \
757           "1 = perform verification on ConstraintCastNodes that are "       \
758               "present during code emission, "                              \
759           "2 = Do not do widening of ConstraintCastNodes so that we can "   \
760               "have more verification coverage")                            \
761           range(0, 2)                                                       \
762                                                                             \
763   product(intx, MaxInlineLevel, 15,                                         \
764           "maximum number of nested calls that are inlined by high tier "   \
765           "compiler")                                                       \
766           range(0, max_jint)                                                \
767                                                                             \
768   product(intx, MaxRecursiveInlineLevel, 1,                                 \
769           "maximum number of nested recursive calls that are inlined by "   \
770           "high tier compiler")                                             \
771           range(0, max_jint)                                                \
772                                                                             \
773   product_pd(intx, InlineSmallCode,                                         \
774           "Only inline already compiled methods if their code size is "     \
775           "less than this")                                                 \
776           range(0, max_jint)                                                \
777                                                                             \
778   product(intx, MaxInlineSize, 35,                                          \
779           "The maximum bytecode size of a method to be inlined by high "    \
780           "tier compiler")                                                  \
781           range(0, max_jint)                                                \
782                                                                             \
783   product_pd(intx, FreqInlineSize,                                          \
784           "The maximum bytecode size of a frequent method to be inlined")   \
785           range(0, max_jint)                                                \
786                                                                             \
787   product(intx, MaxTrivialSize, 6,                                          \
788           "The maximum bytecode size of a trivial method to be inlined by " \
789           "high tier compiler")                                             \
790           range(0, max_jint)                                                \
791                                                                             \
792   product(bool, IncrementalInline, true,                                    \
793           "do post parse inlining")                                         \
794                                                                             \
795   product(bool, IncrementalInlineMH, true, DIAGNOSTIC,                      \
796           "do post parse inlining of method handle calls")                  \
797                                                                             \
798   product(bool, IncrementalInlineVirtual, true, DIAGNOSTIC,                 \
799           "do post parse inlining of virtual calls")                        \
800                                                                             \
801   develop(bool, AlwaysIncrementalInline, false,                             \
802           "do all inlining incrementally")                                  \
803                                                                             \
804   product(bool, IncrementalInlineForceCleanup, false, DIAGNOSTIC,           \
805           "do cleanup after every iteration of incremental inlining")       \
806                                                                             \
807   product(intx, LiveNodeCountInliningCutoff, 40000,                         \
808           "max number of live nodes in a method")                           \
809           range(0, max_juint / 8)                                           \
810                                                                             \
811   product(bool, OptimizeExpensiveOps, true, DIAGNOSTIC,                     \
812           "Find best control for expensive operations")                     \
813                                                                             \
814   product(bool, UseMathExactIntrinsics, true, DIAGNOSTIC,                   \
815           "Enables intrinsification of various java.lang.Math functions")   \
816                                                                             \
817   product(bool, UseCharacterCompareIntrinsics, false, DIAGNOSTIC,           \
818           "Enables intrinsification of java.lang.Character functions")      \
819                                                                             \
820   product(bool, UseMultiplyToLenIntrinsic, false, DIAGNOSTIC,               \
821           "Enables intrinsification of BigInteger.multiplyToLen()")         \
822                                                                             \
823   product(bool, UseSquareToLenIntrinsic, false, DIAGNOSTIC,                 \
824           "Enables intrinsification of BigInteger.squareToLen()")           \
825                                                                             \
826   product(bool, UseMulAddIntrinsic, false, DIAGNOSTIC,                      \
827           "Enables intrinsification of BigInteger.mulAdd()")                \
828                                                                             \
829   product(bool, UseMontgomeryMultiplyIntrinsic, false, DIAGNOSTIC,          \
830           "Enables intrinsification of BigInteger.montgomeryMultiply()")    \
831                                                                             \
832   product(bool, UseMontgomerySquareIntrinsic, false, DIAGNOSTIC,            \
833           "Enables intrinsification of BigInteger.montgomerySquare()")      \
834                                                                             \
835   product(bool, EnableVectorSupport, false, EXPERIMENTAL,                   \
836           "Enables VectorSupport intrinsics")                               \
837                                                                             \
838   product(bool, EnableVectorReboxing, false, EXPERIMENTAL,                  \
839           "Enables reboxing of vectors")                                    \
840                                                                             \
841   product(bool, EnableVectorAggressiveReboxing, false, EXPERIMENTAL,        \
842           "Enables aggressive reboxing of vectors")                         \
843                                                                             \
844   product(bool, UseTypeSpeculation, true,                                   \
845           "Speculatively propagate types from profiles")                    \
846                                                                             \
847   product(bool, UseInlineDepthForSpeculativeTypes, true, DIAGNOSTIC,        \
848           "Carry inline depth of profile point with speculative type "      \
849           "and give priority to profiling from lower inline depth")         \
850                                                                             \
851   product_pd(bool, TrapBasedRangeChecks,                                    \
852           "Generate code for range checks that uses a cmp and trap "        \
853           "instruction raising SIGTRAP. Used on PPC64.")                    \
854                                                                             \
855   product(intx, ArrayCopyLoadStoreMaxElem, 8,                               \
856           "Maximum number of arraycopy elements inlined as a sequence of"   \
857           "loads/stores")                                                   \
858           range(0, max_intx)                                                \
859                                                                             \
860   develop(bool, StressArrayCopyMacroNode, false,                            \
861           "Perform ArrayCopy load/store replacement during IGVN only")      \
862                                                                             \
863   develop(bool, RenumberLiveNodes, true,                                    \
864           "Renumber live nodes")                                            \
865                                                                             \
866   product(uintx, LoopStripMiningIter, 0,                                    \
867           "Number of iterations in strip mined loop")                       \
868           range(0, max_juint)                                               \
869           constraint(LoopStripMiningIterConstraintFunc, AfterErgo)          \
870                                                                             \
871   product(uintx, LoopStripMiningIterShortLoop, 0,                           \
872           "Loop with fewer iterations are not strip mined")                 \
873           range(0, max_juint)                                               \
874                                                                             \
875   product(bool, UseProfiledLoopPredicate, true,                             \
876           "Move checks with an uncommon trap out of loops based on "        \
877           "profiling data. "                                                \
878           "Requires UseLoopPredicate to be turned on (default).")           \
879                                                                             \
880   product(bool, UseArrayLoadStoreProfile, true, DIAGNOSTIC,                 \
881           "Take advantage of profiling at array load/store")                \
882                                                                             \
883   product(bool, UseACmpProfile, true, DIAGNOSTIC,                           \
884           "Take advantage of profiling at if_acmp<cond>")                   \
885                                                                             \
886   develop(uintx, StressLongCountedLoop, 0,                                  \
887           "if > 0, convert int counted loops to long counted loops"         \
888           "to stress handling of long counted loops: run inner loop"        \
889           "for at most jint_max / StressLongCountedLoop")                   \
890           range(0, max_juint)                                               \
891                                                                             \
892   product(bool, DuplicateBackedge, true, DIAGNOSTIC,                        \
893           "Transform loop with a merge point into 2 loops if inner loop is" \
894           "expected to optimize better")                                    \
895                                                                             \
896   develop(bool, StressDuplicateBackedge, false,                             \
897           "Run DuplicateBackedge whenever possible ignoring benefit"        \
898           "analysis")                                                       \
899                                                                             \
900   product(bool, VerifyReceiverTypes, trueInDebug, DIAGNOSTIC,               \
901           "Verify receiver types at runtime")                               \
902                                                                             \
903   product(intx, TypeProfileSubTypeCheckCommonThreshold, 50,                 \
904           "Use profile data at type check if profiled types account for"    \
905           "more than this threshold")                                       \
906           range(0, 100)                                                     \
907                                                                             \
908   develop(bool, StressPrunedExceptionHandlers, false,                       \
909           "Always prune exception handlers")                                \
910                                                                             \
911   product(bool, InlineSecondarySupersTest, true, DIAGNOSTIC,                \
912           "Inline the secondary supers hash lookup.")                       \
913                                                                             \
914   product(bool, UseStoreStoreForCtor, true, DIAGNOSTIC,                     \
915           "Use StoreStore barrier instead of Release barrier at the end "   \
916           "of constructors")                                                \
917                                                                             \
918   develop(bool, KillPathsReachableByDeadTypeNode, true,                     \
919           "When a Type node becomes top, make paths where the node is "     \
920           "used dead by replacing them with a Halt node. Turning this off " \
921           "could corrupt the graph in rare cases and should be used with "  \
922           "care.")                                                          \
923                                                                             \
924   product(bool, ShortRunningLongLoop, true, DIAGNOSTIC,                     \
925           "long counted loop/long range checks: don't create loop nest if " \
926           "loop runs for small enough number of iterations. Long loop is "  \
927           "converted to a single int loop.")                                \
928                                                                             \
929   develop(bool, StressShortRunningLongLoop, false,                          \
930           "Speculate all long counted loops are short running when bounds " \
931           "are unknown even if profile data doesn't say so.")               \
932                                                                             \
933   develop(bool, StressLoopPeeling, false,                                   \
934           "Randomize loop peeling decision")                                \
935                                                                             \
936   develop(bool, StressCountedLoop, false,                                   \
937           "Randomly delay conversion to counted loops")                     \
938                                                                             \
939   product(bool, HotCodeHeap, false, EXPERIMENTAL,                           \
940           "Enable the code heap for hot C2 nmethods")                       \
941                                                                             \
942   product(double, HotCodeSamplePercent, 80, EXPERIMENTAL,                   \
943           "Minimum percentage of profiling samples that must be in "        \
944           "the MethodHot heap before stopping hot code collection")         \
945           range(0, 100)                                                     \
946                                                                             \
947   product(double, HotCodeStablePercent, 5, EXPERIMENTAL,                    \
948           "Maximum percentage of newly compiled to total C2 nmethods "      \
949           "to treat nmethod count as stable. "                              \
950           "Values less than zero disable the stable check")                 \
951           range(-1, DBL_MAX)                                                \
952                                                                             \
953   product(uint, HotCodeIntervalSeconds, 300, EXPERIMENTAL,                  \
954           "Seconds between hot code grouping attempts")                     \
955           range(0, max_juint)                                               \
956                                                                             \
957   product(uint, HotCodeSampleSeconds, 120, EXPERIMENTAL,                    \
958           "Seconds to sample application threads per grouping attempt")     \
959           range(0, max_juint)                                               \
960                                                                             \
961   product(uint, HotCodeStartupDelaySeconds, 120, EXPERIMENTAL,              \
962           "Seconds to delay before starting hot code grouping thread")      \
963           range(0, max_juint)                                               \
964                                                                             \
965   product(uint, HotCodeMinSamplingMs, 5, EXPERIMENTAL,                      \
966           "Minimum sampling interval in milliseconds")                      \
967           range(0, max_juint)                                               \
968                                                                             \
969   product(uint, HotCodeMaxSamplingMs, 15, EXPERIMENTAL,                     \
970           "Maximum sampling interval in milliseconds")                      \
971           range(0, max_juint)                                               \
972                                                                             \
973   product(uint, HotCodeCallLevel, 1, EXPERIMENTAL,                          \
974           "Number of levels of callees to relocate per candidate")          \
975           range(0, max_juint)                                               \
976 
977 // end of C2_FLAGS
978 
979 DECLARE_FLAGS(C2_FLAGS)
980 
981 #endif // SHARE_OPTO_C2_GLOBALS_HPP