1 /* 2 * Copyright (c) 2009, 2019, 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 package org.graalvm.compiler.core.common; 26 27 import org.graalvm.compiler.options.Option; 28 import org.graalvm.compiler.options.OptionKey; 29 import org.graalvm.compiler.options.OptionType; 30 31 /** 32 * This class encapsulates options that control the behavior of the Graal compiler. 33 */ 34 // @formatter:off 35 public final class GraalOptions { 36 37 @Option(help = "Use compiler intrinsifications.", type = OptionType.Debug) 38 public static final OptionKey<Boolean> Intrinsify = new OptionKey<>(true); 39 40 @Option(help = "Inline calls with monomorphic type profile.", type = OptionType.Expert) 41 public static final OptionKey<Boolean> InlineMonomorphicCalls = new OptionKey<>(true); 42 43 @Option(help = "Inline calls with polymorphic type profile.", type = OptionType.Expert) 44 public static final OptionKey<Boolean> InlinePolymorphicCalls = new OptionKey<>(true); 45 46 @Option(help = "Inline calls with megamorphic type profile (i.e., not all types could be recorded).", type = OptionType.Expert) 47 public static final OptionKey<Boolean> InlineMegamorphicCalls = new OptionKey<>(true); 48 49 @Option(help = "Maximum desired size of the compiler graph in nodes.", type = OptionType.User) 50 public static final OptionKey<Integer> MaximumDesiredSize = new OptionKey<>(20000); 51 52 @Option(help = "Minimum probability for methods to be inlined for megamorphic type profiles.", type = OptionType.Expert) 53 public static final OptionKey<Double> MegamorphicInliningMinMethodProbability = new OptionKey<>(0.33D); 54 55 @Option(help = "Maximum level of recursive inlining.", type = OptionType.Expert) 56 public static final OptionKey<Integer> MaximumRecursiveInlining = new OptionKey<>(5); 57 58 @Option(help = "Graphs with less than this number of nodes are trivial and therefore always inlined.", type = OptionType.Expert) 59 public static final OptionKey<Integer> TrivialInliningSize = new OptionKey<>(10); 60 61 @Option(help = "Inlining is explored up to this number of nodes in the graph for each call site.", type = OptionType.Expert) 62 public static final OptionKey<Integer> MaximumInliningSize = new OptionKey<>(300); 63 64 @Option(help = "If the previous low-level graph size of the method exceeds the threshold, it is not inlined.", type = OptionType.Expert) 65 public static final OptionKey<Integer> SmallCompiledLowLevelGraphSize = new OptionKey<>(300); 66 67 @Option(help = "", type = OptionType.Expert) 68 public static final OptionKey<Double> LimitInlinedInvokes = new OptionKey<>(5.0); 69 70 @Option(help = "", type = OptionType.Expert) 71 public static final OptionKey<Boolean> InlineEverything = new OptionKey<>(false); 72 73 // escape analysis settings 74 @Option(help = "", type = OptionType.Debug) 75 public static final OptionKey<Boolean> PartialEscapeAnalysis = new OptionKey<>(true); 76 77 @Option(help = "", type = OptionType.Debug) 78 public static final OptionKey<Integer> EscapeAnalysisIterations = new OptionKey<>(2); 79 80 @Option(help = "", type = OptionType.Debug) 81 public static final OptionKey<Integer> EscapeAnalysisLoopCutoff = new OptionKey<>(20); 82 83 @Option(help = "", type = OptionType.Debug) 84 public static final OptionKey<String> EscapeAnalyzeOnly = new OptionKey<>(null); 85 86 @Option(help = "The maximum length of an array that will be escape analyzed.", type = OptionType.Expert) 87 public static final OptionKey<Integer> MaximumEscapeAnalysisArrayLength = new OptionKey<>(128); 88 89 @Option(help = "", type = OptionType.Debug) 90 public static final OptionKey<Boolean> PEAInliningHints = new OptionKey<>(false); 91 92 @Option(help = "", type = OptionType.Expert) 93 public static final OptionKey<Double> TailDuplicationProbability = new OptionKey<>(0.5); 94 95 @Option(help = "", type = OptionType.Expert) 96 public static final OptionKey<Integer> TailDuplicationTrivialSize = new OptionKey<>(1); 97 98 @Option(help = "", type = OptionType.Expert) 99 public static final OptionKey<Integer> DeoptsToDisableOptimisticOptimization = new OptionKey<>(40); 100 101 @Option(help = "", type = OptionType.Debug) 102 public static final OptionKey<Boolean> LoopPeeling = new OptionKey<>(true); 103 104 @Option(help = "", type = OptionType.Debug) 105 public static final OptionKey<Boolean> ReassociateInvariants = new OptionKey<>(true); 106 107 @Option(help = "", type = OptionType.Debug) 108 public static final OptionKey<Boolean> FullUnroll = new OptionKey<>(true); 109 110 @Option(help = "", type = OptionType.Debug) 111 public static final OptionKey<Boolean> LoopUnswitch = new OptionKey<>(true); 112 113 @Option(help = "", type = OptionType.Debug) 114 public static final OptionKey<Boolean> PartialUnroll = new OptionKey<>(true); 115 116 @Option(help = "", type = OptionType.Expert) 117 public static final OptionKey<Float> MinimumPeelProbability = new OptionKey<>(0.35f); 118 119 @Option(help = "", type = OptionType.Expert) 120 public static final OptionKey<Integer> LoopMaxUnswitch = new OptionKey<>(3); 121 122 @Option(help = "", type = OptionType.Debug) 123 public static final OptionKey<Boolean> UseLoopLimitChecks = new OptionKey<>(true); 124 125 // debugging settings 126 @Option(help = "", type = OptionType.Debug) 127 public static final OptionKey<Boolean> ZapStackOnMethodEntry = new OptionKey<>(false); 128 129 @Option(help = "", type = OptionType.Debug) 130 public static final OptionKey<Boolean> DeoptALot = new OptionKey<>(false); 131 132 @Option(help = "Stress the code emitting explicit exception throwing code.", type = OptionType.Debug) 133 public static final OptionKey<Boolean> StressExplicitExceptionCode = new OptionKey<>(false); 134 135 @Option(help = "Stress the code emitting invokes with explicit exception edges.", type = OptionType.Debug) 136 public static final OptionKey<Boolean> StressInvokeWithExceptionNode = new OptionKey<>(false); 137 138 @Option(help = "Stress the code by emitting reads at earliest instead of latest point.", type = OptionType.Debug) 139 public static final OptionKey<Boolean> StressTestEarlyReads = new OptionKey<>(false); 140 141 @Option(help = "", type = OptionType.Debug) 142 public static final OptionKey<Boolean> VerifyPhases = new OptionKey<>(false); 143 144 // Debug settings: 145 @Option(help = "Start tracing compiled GC barriers after N garbage collections (disabled if N <= 0).", type = OptionType.Debug) 146 public static final OptionKey<Integer> GCDebugStartCycle = new OptionKey<>(-1); 147 148 @Option(help = "Perform platform dependent validation of the Java heap at returns", type = OptionType.Debug) 149 public static final OptionKey<Boolean> VerifyHeapAtReturn = new OptionKey<>(false); 150 151 // Other printing settings 152 @Option(help = "Print profiling information when parsing a method's bytecode", type = OptionType.Debug) 153 public static final OptionKey<Boolean> PrintProfilingInformation = new OptionKey<>(false); 154 155 @Option(help = "", type = OptionType.Debug) 156 public static final OptionKey<Boolean> TraceEscapeAnalysis = new OptionKey<>(false); 157 158 // HotSpot command line options 159 @Option(help = "Print inlining optimizations", type = OptionType.Debug) 160 public static final OptionKey<Boolean> HotSpotPrintInlining = new OptionKey<>(false); 161 162 // Register allocator debugging 163 @Option(help = "Comma separated list of registers that register allocation is limited to.", type = OptionType.Debug) 164 public static final OptionKey<String> RegisterPressure = new OptionKey<>(null); 165 166 @Option(help = "", type = OptionType.Debug) 167 public static final OptionKey<Boolean> ConditionalElimination = new OptionKey<>(true); 168 169 @Option(help = "", type = OptionType.Debug) 170 public static final OptionKey<Boolean> RawConditionalElimination = new OptionKey<>(true); 171 172 @Option(help = "", type = OptionType.Debug) 173 public static final OptionKey<Boolean> ReplaceInputsWithConstantsBasedOnStamps = new OptionKey<>(true); 174 175 @Option(help = "", type = OptionType.Debug) 176 public static final OptionKey<Boolean> RemoveNeverExecutedCode = new OptionKey<>(true); 177 178 @Option(help = "", type = OptionType.Debug) 179 public static final OptionKey<Boolean> UseExceptionProbability = new OptionKey<>(true); 180 181 @Option(help = "", type = OptionType.Debug) 182 public static final OptionKey<Boolean> OmitHotExceptionStacktrace = new OptionKey<>(false); 183 184 @Option(help = "", type = OptionType.Debug) 185 public static final OptionKey<Boolean> GenSafepoints = new OptionKey<>(true); 186 187 @Option(help = "", type = OptionType.Debug) 188 public static final OptionKey<Boolean> GenLoopSafepoints = new OptionKey<>(true); 189 190 @Option(help = "", type = OptionType.Debug) 191 public static final OptionKey<Boolean> UseTypeCheckHints = new OptionKey<>(true); 192 193 @Option(help = "", type = OptionType.Expert) 194 public static final OptionKey<Boolean> InlineVTableStubs = new OptionKey<>(true); 195 196 @Option(help = "", type = OptionType.Expert) 197 public static final OptionKey<Boolean> AlwaysInlineVTableStubs = new OptionKey<>(false); 198 199 @Option(help = "", type = OptionType.Debug) 200 public static final OptionKey<Boolean> CanOmitFrame = new OptionKey<>(true); 201 202 // Ahead of time compilation 203 @Option(help = "Try to avoid emitting code where patching is required", type = OptionType.Expert) 204 public static final OptionKey<Boolean> ImmutableCode = new OptionKey<>(false); 205 206 @Option(help = "Generate position independent code", type = OptionType.Expert) 207 public static final OptionKey<Boolean> GeneratePIC = new OptionKey<>(false); 208 209 // Runtime settings 210 @Option(help = "", type = OptionType.Expert) 211 public static final OptionKey<Boolean> SupportJsrBytecodes = new OptionKey<>(true); 212 213 @Option(help = "", type = OptionType.Expert) 214 public static final OptionKey<Boolean> OptAssumptions = new OptionKey<>(true); 215 216 @Option(help = "", type = OptionType.Debug) 217 public static final OptionKey<Boolean> OptConvertDeoptsToGuards = new OptionKey<>(true); 218 219 @Option(help = "", type = OptionType.Debug) 220 public static final OptionKey<Boolean> OptReadElimination = new OptionKey<>(true); 221 222 @Option(help = "", type = OptionType.Debug) 223 public static final OptionKey<Integer> ReadEliminationMaxLoopVisits = new OptionKey<>(5); 224 225 @Option(help = "", type = OptionType.Debug) 226 public static final OptionKey<Boolean> OptDeoptimizationGrouping = new OptionKey<>(true); 227 228 @Option(help = "", type = OptionType.Debug) 229 public static final OptionKey<Boolean> OptScheduleOutOfLoops = new OptionKey<>(true); 230 231 @Option(help = "", type = OptionType.Debug) 232 public static final OptionKey<Boolean> GuardPriorities = new OptionKey<>(true); 233 234 @Option(help = "", type = OptionType.Debug) 235 public static final OptionKey<Boolean> OptEliminateGuards = new OptionKey<>(true); 236 237 @Option(help = "", type = OptionType.Debug) 238 public static final OptionKey<Boolean> OptImplicitNullChecks = new OptionKey<>(true); 239 240 @Option(help = "", type = OptionType.Debug) 241 public static final OptionKey<Boolean> OptClearNonLiveLocals = new OptionKey<>(true); 242 243 @Option(help = "", type = OptionType.Debug) 244 public static final OptionKey<Boolean> OptLoopTransform = new OptionKey<>(true); 245 246 @Option(help = "", type = OptionType.Debug) 247 public static final OptionKey<Boolean> OptFloatingReads = new OptionKey<>(true); 248 249 @Option(help = "", type = OptionType.Debug) 250 public static final OptionKey<Boolean> OptEliminatePartiallyRedundantGuards = new OptionKey<>(true); 251 252 @Option(help = "", type = OptionType.Debug) 253 public static final OptionKey<Boolean> OptFilterProfiledTypes = new OptionKey<>(true); 254 255 @Option(help = "", type = OptionType.Debug) 256 public static final OptionKey<Boolean> OptDevirtualizeInvokesOptimistically = new OptionKey<>(true); 257 258 @Option(help = "Track the NodeSourcePosition.", type = OptionType.Debug) 259 public static final OptionKey<Boolean> TrackNodeSourcePosition = new OptionKey<>(false); 260 261 @Option(help = "Track source stack trace where a node was inserted into the graph.", type = OptionType.Debug) 262 public static final OptionKey<Boolean> TrackNodeInsertion = new OptionKey<>(false); 263 264 @Option(help = "Allow backend to match complex expressions.", type = OptionType.Debug) 265 public static final OptionKey<Boolean> MatchExpressions = new OptionKey<>(true); 266 267 @Option(help = "Enable counters for various paths in snippets.", type = OptionType.Debug) 268 public static final OptionKey<Boolean> SnippetCounters = new OptionKey<>(false); 269 270 @Option(help = "Eagerly construct extra snippet info.", type = OptionType.Debug) 271 public static final OptionKey<Boolean> EagerSnippets = new OptionKey<>(false); 272 273 @Option(help = "Use a cache for snippet graphs.", type = OptionType.Debug) 274 public static final OptionKey<Boolean> UseSnippetGraphCache = new OptionKey<>(true); 275 276 @Option(help = "file:doc-files/TraceInliningHelp.txt", type = OptionType.Debug) 277 public static final OptionKey<Boolean> TraceInlining = new OptionKey<>(false); 278 279 @Option(help = "Enable inlining decision tracing in stubs and snippets.", type = OptionType.Debug) 280 public static final OptionKey<Boolean> TraceInliningForStubsAndSnippets = new OptionKey<>(false); 281 282 @Option(help = "Use Graal-generated stubs for complicated LIR operations instead of embedding all the emitted code.", type = OptionType.Expert) 283 public static final OptionKey<Boolean> UseGraalStubs = new OptionKey<>(true); 284 285 @Option(help = "Encode and decode snippets and substitutions before parsing to test libgraal code path. This option is ignored in the context of libgraal.") 286 public static final OptionKey<Boolean> UseEncodedGraphs = new OptionKey<>(false); 287 288 @Option(help = "If applicable, use bulk zeroing instructions when the zeroing size in bytes exceeds this threshold.", type = OptionType.Expert) 289 public static final OptionKey<Integer> MinimalBulkZeroingSize = new OptionKey<>(2048); 290 291 }