annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java @ 19320:49605c649beb

Merge.
author Doug Simon <doug.simon@oracle.com>
date Thu, 12 Feb 2015 15:20:14 +0100
parents 137773e5250c
children e7e868a42b3f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
23 package com.oracle.graal.hotspot;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
11561
e1309fc4d17f ensure Debug.enable() is called before any DebugTimer or DebugMetric objects are requested
Doug Simon <doug.simon@oracle.com>
parents: 11365
diff changeset
25 import static com.oracle.graal.compiler.GraalDebugConfig.*;
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
26 import static com.oracle.graal.hotspot.HotSpotOptionsLoader.*;
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
27 import static java.lang.Double.*;
9935
2a091d2987bd added graal.options mechanism for being able to override default option values
Doug Simon <doug.simon@oracle.com>
parents: 9919
diff changeset
28
12777
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
29 import java.lang.reflect.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
30
15591
55977f9fa56f fixed assertion position and documented critical class initialization dependency
Doug Simon <doug.simon@oracle.com>
parents: 15470
diff changeset
31 import com.oracle.graal.api.runtime.*;
15193
96bb07a5d667 Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents: 15040
diff changeset
32 import com.oracle.graal.compiler.common.*;
11561
e1309fc4d17f ensure Debug.enable() is called before any DebugTimer or DebugMetric objects are requested
Doug Simon <doug.simon@oracle.com>
parents: 11365
diff changeset
33 import com.oracle.graal.debug.*;
9849
e876c2a6954f extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 7739
diff changeset
34 import com.oracle.graal.options.*;
18684
137773e5250c Factor out VM-independent parts of option parsing
Christian Wimmer <christian.wimmer@oracle.com>
parents: 16399
diff changeset
35 import com.oracle.graal.options.OptionUtils.OptionConsumer;
15470
c55f44b3c5e5 remove NodesToDoubles, refactoring of node probability and inlining relevance computation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15193
diff changeset
36 import com.oracle.graal.phases.common.inlining.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
37
16029
8bbfddf8483f exclude CompilationQueue and HotSpotOptions from JaCoCo
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
38 //JaCoCo Exclude
8bbfddf8483f exclude CompilationQueue and HotSpotOptions from JaCoCo
Doug Simon <doug.simon@oracle.com>
parents: 16006
diff changeset
39
9935
2a091d2987bd added graal.options mechanism for being able to override default option values
Doug Simon <doug.simon@oracle.com>
parents: 9919
diff changeset
40 /**
18684
137773e5250c Factor out VM-independent parts of option parsing
Christian Wimmer <christian.wimmer@oracle.com>
parents: 16399
diff changeset
41 * Sets Graal options from the HotSpot command line. Such options are distinguished by the
137773e5250c Factor out VM-independent parts of option parsing
Christian Wimmer <christian.wimmer@oracle.com>
parents: 16399
diff changeset
42 * {@link #GRAAL_OPTION_PREFIX} prefix.
9935
2a091d2987bd added graal.options mechanism for being able to override default option values
Doug Simon <doug.simon@oracle.com>
parents: 9919
diff changeset
43 */
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
44 public class HotSpotOptions {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
45
18684
137773e5250c Factor out VM-independent parts of option parsing
Christian Wimmer <christian.wimmer@oracle.com>
parents: 16399
diff changeset
46 private static final String GRAAL_OPTION_PREFIX = "-G:";
137773e5250c Factor out VM-independent parts of option parsing
Christian Wimmer <christian.wimmer@oracle.com>
parents: 16399
diff changeset
47
9935
2a091d2987bd added graal.options mechanism for being able to override default option values
Doug Simon <doug.simon@oracle.com>
parents: 9919
diff changeset
48 /**
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
49 * Parses the Graal specific options specified to HotSpot (e.g., on the command line).
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
50 *
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
51 * @return true if the CITime or CITimeEach HotSpot VM options are set
9986
4f542ceb5fed added VerifyHotSpotOptionsPhase to ensure that global state is not initialized from options prior to command line parsing
Doug Simon <doug.simon@oracle.com>
parents: 9935
diff changeset
52 */
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
53 private static native boolean parseVMOptions();
15603
b7fb36e57da8 made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents: 15591
diff changeset
54
9935
2a091d2987bd added graal.options mechanism for being able to override default option values
Doug Simon <doug.simon@oracle.com>
parents: 9919
diff changeset
55 static {
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
56 boolean timeCompilations = parseVMOptions();
16399
4481cf549cfc removed (Java based) CompilationQueue
Doug Simon <doug.simon@oracle.com>
parents: 16272
diff changeset
57 if (timeCompilations) {
15603
b7fb36e57da8 made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents: 15591
diff changeset
58 unconditionallyEnableTimerOrMetric(InliningUtil.class, "InlinedBytecodes");
b7fb36e57da8 made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents: 15591
diff changeset
59 unconditionallyEnableTimerOrMetric(CompilationTask.class, "CompilationTime");
b7fb36e57da8 made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents: 15591
diff changeset
60 }
b7fb36e57da8 made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents: 15591
diff changeset
61 assert !Debug.Initialization.isDebugInitialized() : "The class " + Debug.class.getName() + " must not be initialized before the Graal runtime has been initialized. " +
b7fb36e57da8 made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents: 15591
diff changeset
62 "This can be fixed by placing a call to " + Graal.class.getName() + ".runtime() on the path that triggers initialization of " + Debug.class.getName();
b7fb36e57da8 made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents: 15591
diff changeset
63 if (areDebugScopePatternsEnabled()) {
b7fb36e57da8 made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents: 15591
diff changeset
64 System.setProperty(Debug.Initialization.INITIALIZER_PROPERTY_NAME, "true");
b7fb36e57da8 made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents: 15591
diff changeset
65 }
9935
2a091d2987bd added graal.options mechanism for being able to override default option values
Doug Simon <doug.simon@oracle.com>
parents: 9919
diff changeset
66 }
2a091d2987bd added graal.options mechanism for being able to override default option values
Doug Simon <doug.simon@oracle.com>
parents: 9919
diff changeset
67
15603
b7fb36e57da8 made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents: 15591
diff changeset
68 /**
b7fb36e57da8 made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents: 15591
diff changeset
69 * Ensures {@link HotSpotOptions} is initialized.
b7fb36e57da8 made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents: 15591
diff changeset
70 */
b7fb36e57da8 made Graal initialization be driven from Java to simplify sequencing and synchronization
Doug Simon <doug.simon@oracle.com>
parents: 15591
diff changeset
71 public static void initialize() {
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13106
diff changeset
72 }
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13106
diff changeset
73
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13106
diff changeset
74 /**
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
75 * Helper for the VM code called by {@link #parseVMOptions()}.
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
76 *
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
77 * @param name the name of a parsed option
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
78 * @param option the object encapsulating the option
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
79 * @param spec specification of boolean option value, type of option value or action to take
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
80 */
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
81 static void setOption(String name, OptionValue<?> option, char spec, String stringValue, long primitiveValue) {
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
82 switch (spec) {
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
83 case '+':
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
84 option.setValue(Boolean.TRUE);
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
85 break;
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
86 case '-':
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
87 option.setValue(Boolean.FALSE);
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
88 break;
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
89 case '?':
18684
137773e5250c Factor out VM-independent parts of option parsing
Christian Wimmer <christian.wimmer@oracle.com>
parents: 16399
diff changeset
90 OptionUtils.printFlags(options, GRAAL_OPTION_PREFIX);
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
91 break;
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
92 case ' ':
18684
137773e5250c Factor out VM-independent parts of option parsing
Christian Wimmer <christian.wimmer@oracle.com>
parents: 16399
diff changeset
93 OptionUtils.printNoMatchMessage(options, name, GRAAL_OPTION_PREFIX);
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
94 break;
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
95 case 'i':
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
96 option.setValue((int) primitiveValue);
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
97 break;
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
98 case 'f':
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
99 option.setValue((float) longBitsToDouble(primitiveValue));
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
100 break;
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
101 case 'd':
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
102 option.setValue(longBitsToDouble(primitiveValue));
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
103 break;
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
104 case 's':
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
105 option.setValue(stringValue);
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
106 break;
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
107 }
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
108 }
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
109
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
110 /**
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13106
diff changeset
111 * Parses a given option value specification.
15470
c55f44b3c5e5 remove NodesToDoubles, refactoring of node probability and inlining relevance computation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15193
diff changeset
112 *
13353
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13106
diff changeset
113 * @param option the specification of an option and its value
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13106
diff changeset
114 * @param setter the object to notify of the parsed option and value. If null, the
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13106
diff changeset
115 * {@link OptionValue#setValue(Object)} method of the specified option is called
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13106
diff changeset
116 * instead.
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13106
diff changeset
117 */
0e5c4f9fa9a5 enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents: 13106
diff changeset
118 public static boolean parseOption(String option, OptionConsumer setter) {
18684
137773e5250c Factor out VM-independent parts of option parsing
Christian Wimmer <christian.wimmer@oracle.com>
parents: 16399
diff changeset
119 return OptionUtils.parseOption(options, option, GRAAL_OPTION_PREFIX, setter);
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
120 }
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15603
diff changeset
121
11365
5a7644d5fe20 added capability for embedding new lines in lengthy option help messages
Doug Simon <doug.simon@oracle.com>
parents: 9986
diff changeset
122 /**
12777
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
123 * Sets the relevant system property such that a {@link DebugTimer} or {@link DebugMetric}
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
124 * associated with a field in a class will be unconditionally enabled when it is created.
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
125 * <p>
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
126 * This method verifies that the named field exists and is of an expected type. However, it does
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
127 * not verify that the timer or metric created has the same name of the field.
15470
c55f44b3c5e5 remove NodesToDoubles, refactoring of node probability and inlining relevance computation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15193
diff changeset
128 *
12777
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
129 * @param c the class in which the field is declared
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
130 * @param name the name of the field
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
131 */
15040
288c23143d47 Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents: 13464
diff changeset
132 private static void unconditionallyEnableTimerOrMetric(Class<?> c, String name) {
12777
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
133 try {
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
134 Field field = c.getDeclaredField(name);
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
135 String propertyName;
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
136 if (DebugTimer.class.isAssignableFrom(field.getType())) {
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
137 propertyName = Debug.ENABLE_TIMER_PROPERTY_NAME_PREFIX + name;
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
138 } else {
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
139 assert DebugMetric.class.isAssignableFrom(field.getType());
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
140 propertyName = Debug.ENABLE_METRIC_PROPERTY_NAME_PREFIX + name;
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
141 }
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
142 String previous = System.setProperty(propertyName, "true");
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
143 if (previous != null) {
15872
b7fc7cdb9005 HotSpotOptions error messages should go to System.err
Doug Simon <doug.simon@oracle.com>
parents: 15870
diff changeset
144 System.err.println("Overrode value \"" + previous + "\" of system property \"" + propertyName + "\" with \"true\"");
12777
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
145 }
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
146 } catch (Exception e) {
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
147 throw new GraalInternalError(e);
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
148 }
516ad7baa080 made the BytecodesParsed and InlinedBytecodes metrics and CompilationTime timer be unconditionally enabled if -XX:+CITime
Doug Simon <doug.simon@oracle.com>
parents: 12570
diff changeset
149 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
150 }