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