1 /* 2 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package com.oracle.graal.phases; 24 25 /** 26 * This class encapsulates options that control the behavior of the Graal compiler. 27 * 28 * (thomaswue) WARNING: Fields of this class are treated as final by Graal. 29 */ 30 // @formatter:off 31 public final class GraalOptions { 32 33 // Checkstyle: stop 34 private static final boolean ____ = false; 35 // Checkstyle: resume 36 37 public static int Threads = 4; 38 39 // inlining settings 40 public static boolean Inline = true; 41 public static boolean AlwaysInlineIntrinsics = ____; 42 public static boolean Intrinsify = true; 43 static boolean InlineMonomorphicCalls = true; 44 static boolean InlinePolymorphicCalls = true; 45 static boolean InlineMegamorphicCalls = ____; 46 public static int MaximumDesiredSize = 5000; 47 public static int MaximumRecursiveInlining = 1; 48 public static boolean LimitInlinedProbability = ____; 49 public static boolean LimitInlinedRelevance = true; 50 public static float BoostInliningForEscapeAnalysis = 2f; 51 public static float RelevanceCapForInlining = 1f; 52 public static boolean IterativeInlining = ____; 53 54 public static int TrivialBytecodeSize = 10; 55 public static int NormalBytecodeSize = 150; 56 public static int MaximumBytecodeSize = 500; 57 public static int TrivialComplexity = 10; 58 public static int NormalComplexity = 60; 59 public static int MaximumComplexity = 400; 60 public static int TrivialCompiledCodeSize = 150; 61 public static int NormalCompiledCodeSize = 750; 62 public static int MaximumCompiledCodeSize = 4000; 63 public static int SmallCompiledCodeSize = 1000; 64 65 // escape analysis settings 66 public static boolean PartialEscapeAnalysis = true; 67 public static boolean EscapeAnalysisHistogram = ____; 68 public static int EscapeAnalysisIterations = 2; 69 public static String EscapeAnalyzeOnly = null; 70 public static int MaximumEscapeAnalysisArrayLength = 32; 71 public static boolean PEAInliningHints = ____; 72 73 public static double TailDuplicationProbability = 0.5; 74 public static int TailDuplicationTrivialSize = 1; 75 76 // absolute probability analysis 77 public static boolean ProbabilityAnalysis = true; 78 79 // profiling information 80 public static int DeoptsToDisableOptimisticOptimization = 40; 81 public static int MatureExecutionsBranch = 1; 82 public static int MatureExecutionsPerSwitchCase = 1; 83 public static int MatureExecutionsTypeProfile = 1; 84 85 // comilation queue 86 public static int TimedBootstrap = -1; 87 public static boolean PriorityCompileQueue = true; 88 public static int SlowQueueCutoff = 100000; 89 public static boolean SlowCompileThreads = ____; 90 public static boolean DynamicCompilePriority = ____; 91 92 // graph caching 93 public static boolean CacheGraphs = true; 94 public static int GraphCacheSize = 1000; 95 public static boolean PrintGraphCache = ____; 96 97 //loop transform settings TODO (gd) tune 98 public static boolean LoopPeeling = true; 99 public static boolean ReassociateInvariants = true; 100 public static boolean FullUnroll = true; 101 public static boolean LoopUnswitch = true; 102 public static int FullUnrollMaxNodes = 300; 103 public static int ExactFullUnrollMaxNodes = 1200; 104 public static float MinimumPeelProbability = 0.35f; 105 public static int LoopMaxUnswitch = 3; 106 public static int LoopUnswitchMaxIncrease = 50; 107 public static int LoopUnswitchUncertaintyBoost = 5; 108 109 // debugging settings 110 public static boolean ZapStackOnMethodEntry = ____; 111 public static boolean DeoptALot = ____; 112 public static boolean VerifyPhases = true; 113 114 public static String PrintFilter = null; 115 116 // Debug settings: 117 public static boolean Debug = true; 118 public static boolean DebugReplacements = ____; 119 public static boolean BootstrapReplacements = ____; 120 public static boolean PerThreadDebugValues = ____; 121 public static boolean SummarizeDebugValues = ____; 122 public static boolean SummarizePerPhase = ____; 123 public static String Dump = null; 124 public static String Meter = null; 125 public static String Time = null; 126 public static String Log = null; 127 public static String LogFile = null; 128 public static String MethodFilter = null; 129 public static boolean DumpOnError = ____; 130 public static boolean GenericDynamicCounters = ____; 131 public static boolean BenchmarkDynamicCounters = ____; 132 133 // Ideal graph visualizer output settings 134 public static boolean PrintBinaryGraphs = true; 135 public static boolean PrintCFG = ____; 136 public static boolean PrintIdealGraphFile = ____; 137 public static String PrintIdealGraphAddress = "127.0.0.1"; 138 public static int PrintIdealGraphPort = 4444; 139 public static int PrintBinaryGraphPort = 4445; 140 141 // Other printing settings 142 public static boolean PrintQueue = ____; 143 public static boolean PrintCompilation = ____; 144 public static boolean PrintProfilingInformation = ____; 145 public static boolean PrintIRWithLIR = ____; 146 public static boolean PrintCodeBytes = ____; 147 public static boolean PrintBailout = ____; 148 public static int TraceLinearScanLevel = 0; 149 public static int TraceLIRGeneratorLevel = 0; 150 public static boolean TraceEscapeAnalysis = ____; 151 public static int TraceBytecodeParserLevel = 0; 152 public static boolean ExitVMOnBailout = ____; 153 public static boolean ExitVMOnException = true; 154 155 // HotSpot command line options 156 public static boolean HotSpotPrintCompilation = ____; 157 public static boolean HotSpotPrintInlining = ____; 158 159 // Register allocator debugging 160 public static String RegisterPressure = null; 161 162 // Code generator settings 163 public static boolean ConditionalElimination = true; 164 public static boolean CullFrameStates = ____; 165 public static boolean UseProfilingInformation = true; 166 static boolean RemoveNeverExecutedCode = true; 167 static boolean UseExceptionProbability = true; 168 static boolean UseExceptionProbabilityForOperations = true; 169 public static boolean OmitHotExceptionStacktrace = ____; 170 public static boolean GenSafepoints = true; 171 public static boolean GenLoopSafepoints = true; 172 static boolean UseTypeCheckHints = true; 173 public static boolean InlineVTableStubs = true; 174 public static boolean AlwaysInlineVTableStubs = ____; 175 public static boolean GenAssertionCode = ____; 176 public static boolean AlignCallsForPatching = true; 177 public static boolean ResolveClassBeforeStaticInvoke = ____; 178 public static boolean CanOmitFrame = true; 179 public static int SafepointPollOffset = 256; 180 181 public static boolean MemoryAwareScheduling = true; 182 183 // Translating tableswitch instructions 184 public static int MinimumJumpTableSize = 5; 185 public static int RangeTestsSwitchDensity = 5; 186 public static double MinTableSwitchDensity = 0.5; 187 188 public static boolean DetailedAsserts = ____; 189 190 // Runtime settings 191 public static int StackShadowPages = 2; 192 193 public static boolean SupportJsrBytecodes = true; 194 195 public static boolean OptAssumptions = true; 196 public static boolean OptConvertDeoptsToGuards = true; 197 public static boolean OptReadElimination = true; 198 public static boolean OptEarlyReadElimination = true; 199 public static boolean OptCanonicalizer = true; 200 public static boolean OptScheduleOutOfLoops = true; 201 public static boolean OptEliminateGuards = true; 202 public static boolean OptEliminateSafepoints = true; 203 public static boolean OptImplicitNullChecks = true; 204 public static boolean OptLivenessAnalysis = true; 205 public static boolean OptLoopTransform = true; 206 public static boolean OptFloatingReads = true; 207 public static boolean OptTailDuplication = true; 208 public static boolean OptEliminatePartiallyRedundantGuards = true; 209 public static boolean OptFilterProfiledTypes = true; 210 public static boolean OptDevirtualizeInvokesOptimistically = true; 211 public static boolean OptPushThroughPi = true; 212 213 214 // Intrinsification settings 215 public static boolean IntrinsifyObjectClone = ____; 216 public static boolean IntrinsifyArrayCopy = true; 217 public static boolean IntrinsifyObjectMethods = true; 218 public static boolean IntrinsifySystemMethods = true; 219 public static boolean IntrinsifyClassMethods = true; 220 public static boolean IntrinsifyThreadMethods = true; 221 public static boolean IntrinsifyUnsafeMethods = true; 222 public static boolean IntrinsifyMathMethods = true; 223 public static boolean IntrinsifyAESMethods = true; 224 public static boolean IntrinsifyInstalledCodeMethods = true; 225 public static boolean IntrinsifyCallSiteTarget = true; 226 /** 227 * Counts the various paths taken through snippets. 228 */ 229 public static boolean SnippetCounters = false; 230 231 /** 232 * If the probability that a checkcast will hit one the profiled types (up to {@link #CheckcastMaxHints}) 233 * is below this value, the checkcast will be compiled without hints. 234 */ 235 public static double CheckcastMinHintHitProbability = 0.5; 236 237 /** 238 * The maximum number of hint types that will be used when compiling a checkcast for which 239 * profiling information is available. Note that {@link #CheckcastMinHintHitProbability} 240 * also influences whether hints are used. 241 */ 242 public static int CheckcastMaxHints = 2; 243 244 /** 245 * @see #CheckcastMinHintHitProbability 246 */ 247 public static double InstanceOfMinHintHitProbability = 0.5; 248 249 /** 250 * @see #CheckcastMaxHints 251 */ 252 public static int InstanceOfMaxHints = 2; 253 254 static { 255 // turn detailed assertions on when the general assertions are on (misusing the assert keyword for this) 256 assert (DetailedAsserts = true) == true; 257 } 258 }