author | coleenp |
Thu, 27 Jul 2017 18:06:41 -0400 | |
changeset 46727 | 6e4a84748e2c |
parent 46560 | 388aa8d67c80 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
46560
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
40079
diff
changeset
|
2 |
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4584
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4584
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4584
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "compiler/compilerOracle.hpp" |
|
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
27 |
#include "compiler/methodMatcher.hpp" |
7397 | 28 |
#include "memory/allocation.inline.hpp" |
29 |
#include "memory/oopFactory.hpp" |
|
30 |
#include "memory/resourceArea.hpp" |
|
31 |
#include "oops/klass.hpp" |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13202
diff
changeset
|
32 |
#include "oops/method.hpp" |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7701
diff
changeset
|
33 |
#include "oops/symbol.hpp" |
46560
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
40079
diff
changeset
|
34 |
#include "prims/jvm.h" |
7397 | 35 |
#include "runtime/handles.inline.hpp" |
36 |
#include "runtime/jniHandles.hpp" |
|
25949 | 37 |
#include "runtime/os.hpp" |
1 | 38 |
|
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
39 |
enum OptionType { |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
40 |
IntxType, |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
41 |
UintxType, |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
42 |
BoolType, |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
43 |
CcstrType, |
27143
feee4a6106bc
8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents:
26441
diff
changeset
|
44 |
DoubleType, |
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
45 |
UnknownType |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
46 |
}; |
1 | 47 |
|
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
48 |
/* Methods to map real type names to OptionType */ |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
49 |
template<typename T> |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
50 |
static OptionType get_type_for() { |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
51 |
return UnknownType; |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
52 |
}; |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
53 |
|
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
54 |
template<> OptionType get_type_for<intx>() { |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
55 |
return IntxType; |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
56 |
} |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
57 |
|
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
58 |
template<> OptionType get_type_for<uintx>() { |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
59 |
return UintxType; |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
60 |
} |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
61 |
|
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
62 |
template<> OptionType get_type_for<bool>() { |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
63 |
return BoolType; |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
64 |
} |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
65 |
|
26433 | 66 |
template<> OptionType get_type_for<ccstr>() { |
67 |
return CcstrType; |
|
68 |
} |
|
69 |
||
27143
feee4a6106bc
8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents:
26441
diff
changeset
|
70 |
template<> OptionType get_type_for<double>() { |
feee4a6106bc
8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents:
26441
diff
changeset
|
71 |
return DoubleType; |
feee4a6106bc
8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents:
26441
diff
changeset
|
72 |
} |
feee4a6106bc
8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents:
26441
diff
changeset
|
73 |
|
1 | 74 |
// this must parallel the command_names below |
75 |
enum OracleCommand { |
|
76 |
UnknownCommand = -1, |
|
77 |
OracleFirstCommand = 0, |
|
78 |
BreakCommand = OracleFirstCommand, |
|
79 |
PrintCommand, |
|
80 |
ExcludeCommand, |
|
81 |
InlineCommand, |
|
82 |
DontInlineCommand, |
|
83 |
CompileOnlyCommand, |
|
84 |
LogCommand, |
|
85 |
OptionCommand, |
|
86 |
QuietCommand, |
|
87 |
HelpCommand, |
|
88 |
OracleCommandCount |
|
89 |
}; |
|
90 |
||
91 |
// this must parallel the enum OracleCommand |
|
92 |
static const char * command_names[] = { |
|
93 |
"break", |
|
94 |
"print", |
|
95 |
"exclude", |
|
96 |
"inline", |
|
97 |
"dontinline", |
|
98 |
"compileonly", |
|
99 |
"log", |
|
100 |
"option", |
|
101 |
"quiet", |
|
102 |
"help" |
|
103 |
}; |
|
104 |
||
105 |
class MethodMatcher; |
|
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
106 |
class TypedMethodOptionMatcher; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
107 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
108 |
static BasicMatcher* lists[OracleCommandCount] = { 0, }; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
109 |
static TypedMethodOptionMatcher* option_list = NULL; |
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
110 |
static bool any_set = false; |
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
111 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
112 |
class TypedMethodOptionMatcher : public MethodMatcher { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
113 |
private: |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
114 |
TypedMethodOptionMatcher* _next; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
115 |
const char* _option; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
116 |
OptionType _type; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
117 |
public: |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
118 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
119 |
union { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
120 |
bool bool_value; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
121 |
intx intx_value; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
122 |
uintx uintx_value; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
123 |
double double_value; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
124 |
ccstr ccstr_value; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
125 |
} _u; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
126 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
127 |
TypedMethodOptionMatcher() : MethodMatcher(), |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
128 |
_next(NULL), |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
129 |
_type(UnknownType) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
130 |
_option = NULL; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
131 |
memset(&_u, 0, sizeof(_u)); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
132 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
133 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
134 |
static TypedMethodOptionMatcher* parse_method_pattern(char*& line, const char*& error_msg); |
46727
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46560
diff
changeset
|
135 |
TypedMethodOptionMatcher* match(const methodHandle& method, const char* opt, OptionType type); |
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
136 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
137 |
void init(const char* opt, OptionType type, TypedMethodOptionMatcher* next) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
138 |
_next = next; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
139 |
_type = type; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
140 |
_option = os::strdup_check_oom(opt); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
141 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
142 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
143 |
void set_next(TypedMethodOptionMatcher* next) {_next = next; } |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
144 |
TypedMethodOptionMatcher* next() { return _next; } |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
145 |
OptionType type() { return _type; } |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
146 |
template<typename T> T value(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
147 |
template<typename T> void set_value(T value); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
148 |
void print(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
149 |
void print_all(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
150 |
TypedMethodOptionMatcher* clone(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
151 |
~TypedMethodOptionMatcher(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
152 |
}; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
153 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
154 |
// A few templated accessors instead of a full template class. |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
155 |
template<> intx TypedMethodOptionMatcher::value<intx>() { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
156 |
return _u.intx_value; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
157 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
158 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
159 |
template<> uintx TypedMethodOptionMatcher::value<uintx>() { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
160 |
return _u.uintx_value; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
161 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
162 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
163 |
template<> bool TypedMethodOptionMatcher::value<bool>() { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
164 |
return _u.bool_value; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
165 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
166 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
167 |
template<> double TypedMethodOptionMatcher::value<double>() { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
168 |
return _u.double_value; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
169 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
170 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
171 |
template<> ccstr TypedMethodOptionMatcher::value<ccstr>() { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
172 |
return _u.ccstr_value; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
173 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
174 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
175 |
template<> void TypedMethodOptionMatcher::set_value(intx value) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
176 |
_u.intx_value = value; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
177 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
178 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
179 |
template<> void TypedMethodOptionMatcher::set_value(uintx value) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
180 |
_u.uintx_value = value; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
181 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
182 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
183 |
template<> void TypedMethodOptionMatcher::set_value(double value) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
184 |
_u.double_value = value; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
185 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
186 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
187 |
template<> void TypedMethodOptionMatcher::set_value(bool value) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
188 |
_u.bool_value = value; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
189 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
190 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
191 |
template<> void TypedMethodOptionMatcher::set_value(ccstr value) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
192 |
_u.ccstr_value = (const ccstr)os::strdup_check_oom(value); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
193 |
} |
1 | 194 |
|
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
195 |
void TypedMethodOptionMatcher::print() { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
196 |
ttyLocker ttyl; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
197 |
print_base(tty); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
198 |
switch (_type) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
199 |
case IntxType: |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
200 |
tty->print_cr(" intx %s = " INTX_FORMAT, _option, value<intx>()); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
201 |
break; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
202 |
case UintxType: |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
203 |
tty->print_cr(" uintx %s = " UINTX_FORMAT, _option, value<uintx>()); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
204 |
break; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
205 |
case BoolType: |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
206 |
tty->print_cr(" bool %s = %s", _option, value<bool>() ? "true" : "false"); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
207 |
break; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
208 |
case DoubleType: |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
209 |
tty->print_cr(" double %s = %f", _option, value<double>()); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
210 |
break; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
211 |
case CcstrType: |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
212 |
tty->print_cr(" const char* %s = '%s'", _option, value<ccstr>()); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
213 |
break; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
214 |
default: |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
215 |
ShouldNotReachHere(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
216 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
217 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
218 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
219 |
void TypedMethodOptionMatcher::print_all() { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
220 |
print(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
221 |
if (_next != NULL) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
222 |
tty->print(" "); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
223 |
_next->print_all(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
224 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
225 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
226 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
227 |
TypedMethodOptionMatcher* TypedMethodOptionMatcher::clone() { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
228 |
TypedMethodOptionMatcher* m = new TypedMethodOptionMatcher(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
229 |
m->_class_mode = _class_mode; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
230 |
m->_class_name = _class_name; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
231 |
m->_method_mode = _method_mode; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
232 |
m->_method_name = _method_name; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
233 |
m->_signature = _signature; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
234 |
// Need to ref count the symbols |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
235 |
if (_class_name != NULL) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
236 |
_class_name->increment_refcount(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
237 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
238 |
if (_method_name != NULL) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
239 |
_method_name->increment_refcount(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
240 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
241 |
if (_signature != NULL) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
242 |
_signature->increment_refcount(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
243 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
244 |
return m; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
245 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
246 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
247 |
TypedMethodOptionMatcher::~TypedMethodOptionMatcher() { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
248 |
if (_option != NULL) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
249 |
os::free((void*)_option); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
250 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
251 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
252 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
253 |
TypedMethodOptionMatcher* TypedMethodOptionMatcher::parse_method_pattern(char*& line, const char*& error_msg) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
254 |
assert(error_msg == NULL, "Dont call here with error_msg already set"); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
255 |
TypedMethodOptionMatcher* tom = new TypedMethodOptionMatcher(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
256 |
MethodMatcher::parse_method_pattern(line, error_msg, tom); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
257 |
if (error_msg != NULL) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
258 |
delete tom; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
259 |
return NULL; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
260 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
261 |
return tom; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
262 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
263 |
|
46727
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46560
diff
changeset
|
264 |
TypedMethodOptionMatcher* TypedMethodOptionMatcher::match(const methodHandle& method, const char* opt, OptionType type) { |
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
265 |
TypedMethodOptionMatcher* current = this; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
266 |
while (current != NULL) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
267 |
// Fastest compare first. |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
268 |
if (current->type() == type) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
269 |
if (strcmp(current->_option, opt) == 0) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
270 |
if (current->matches(method)) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
271 |
return current; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
272 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
273 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
274 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
275 |
current = current->next(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
276 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
277 |
return NULL; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
278 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
279 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
280 |
template<typename T> |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
281 |
static void add_option_string(TypedMethodOptionMatcher* matcher, |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
282 |
const char* option, |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
283 |
T value) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
284 |
assert(matcher != option_list, "No circular lists please"); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
285 |
matcher->init(option, get_type_for<T>(), option_list); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
286 |
matcher->set_value<T>(value); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
287 |
option_list = matcher; |
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
288 |
any_set = true; |
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
289 |
return; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
290 |
} |
1 | 291 |
|
46727
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46560
diff
changeset
|
292 |
static bool check_predicate(OracleCommand command, const methodHandle& method) { |
1 | 293 |
return ((lists[command] != NULL) && |
294 |
!method.is_null() && |
|
295 |
lists[command]->match(method)); |
|
296 |
} |
|
297 |
||
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
298 |
static void add_predicate(OracleCommand command, BasicMatcher* bm) { |
1 | 299 |
assert(command != OptionCommand, "must use add_option_string"); |
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
300 |
if (command == LogCommand && !LogCompilation && lists[LogCommand] == NULL) { |
1 | 301 |
tty->print_cr("Warning: +LogCompilation must be enabled in order for individual methods to be logged."); |
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
302 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
303 |
bm->set_next(lists[command]); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
304 |
lists[command] = bm; |
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
305 |
if ((command != DontInlineCommand) && (command != InlineCommand)) { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
306 |
any_set = true; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
307 |
} |
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
308 |
return; |
1 | 309 |
} |
310 |
||
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
311 |
template<typename T> |
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33069
diff
changeset
|
312 |
bool CompilerOracle::has_option_value(const methodHandle& method, const char* option, T& value) { |
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
313 |
if (option_list != NULL) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
314 |
TypedMethodOptionMatcher* m = option_list->match(method, option, get_type_for<T>()); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
315 |
if (m != NULL) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
316 |
value = m->value<T>(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
317 |
return true; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
318 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
319 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
320 |
return false; |
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
321 |
} |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
322 |
|
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
323 |
bool CompilerOracle::has_any_option() { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
324 |
return any_set; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
325 |
} |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
326 |
|
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
327 |
// Explicit instantiation for all OptionTypes supported. |
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33069
diff
changeset
|
328 |
template bool CompilerOracle::has_option_value<intx>(const methodHandle& method, const char* option, intx& value); |
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33069
diff
changeset
|
329 |
template bool CompilerOracle::has_option_value<uintx>(const methodHandle& method, const char* option, uintx& value); |
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33069
diff
changeset
|
330 |
template bool CompilerOracle::has_option_value<bool>(const methodHandle& method, const char* option, bool& value); |
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33069
diff
changeset
|
331 |
template bool CompilerOracle::has_option_value<ccstr>(const methodHandle& method, const char* option, ccstr& value); |
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33069
diff
changeset
|
332 |
template bool CompilerOracle::has_option_value<double>(const methodHandle& method, const char* option, double& value); |
1 | 333 |
|
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33069
diff
changeset
|
334 |
bool CompilerOracle::has_option_string(const methodHandle& method, const char* option) { |
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
335 |
bool value = false; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
336 |
has_option_value(method, option, value); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
337 |
return value; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
338 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
339 |
|
33626 | 340 |
bool CompilerOracle::should_exclude(const methodHandle& method) { |
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
341 |
if (check_predicate(ExcludeCommand, method)) { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33069
diff
changeset
|
342 |
return true; |
1 | 343 |
} |
344 |
if (lists[CompileOnlyCommand] != NULL) { |
|
345 |
return !lists[CompileOnlyCommand]->match(method); |
|
346 |
} |
|
347 |
return false; |
|
348 |
} |
|
349 |
||
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33069
diff
changeset
|
350 |
bool CompilerOracle::should_inline(const methodHandle& method) { |
1 | 351 |
return (check_predicate(InlineCommand, method)); |
352 |
} |
|
353 |
||
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33069
diff
changeset
|
354 |
bool CompilerOracle::should_not_inline(const methodHandle& method) { |
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
355 |
return check_predicate(DontInlineCommand, method) || check_predicate(ExcludeCommand, method); |
1 | 356 |
} |
357 |
||
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33069
diff
changeset
|
358 |
bool CompilerOracle::should_print(const methodHandle& method) { |
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
359 |
return check_predicate(PrintCommand, method); |
1 | 360 |
} |
361 |
||
24658
e41df2fc6e87
8042727: nsk/jdb/unwatch/unwatch001 crash in InstanceKlass::methods_do(void (*)(Method*))
coleenp
parents:
24424
diff
changeset
|
362 |
bool CompilerOracle::should_print_methods() { |
e41df2fc6e87
8042727: nsk/jdb/unwatch/unwatch001 crash in InstanceKlass::methods_do(void (*)(Method*))
coleenp
parents:
24424
diff
changeset
|
363 |
return lists[PrintCommand] != NULL; |
e41df2fc6e87
8042727: nsk/jdb/unwatch/unwatch001 crash in InstanceKlass::methods_do(void (*)(Method*))
coleenp
parents:
24424
diff
changeset
|
364 |
} |
1 | 365 |
|
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33069
diff
changeset
|
366 |
bool CompilerOracle::should_log(const methodHandle& method) { |
1 | 367 |
if (!LogCompilation) return false; |
368 |
if (lists[LogCommand] == NULL) return true; // by default, log all |
|
369 |
return (check_predicate(LogCommand, method)); |
|
370 |
} |
|
371 |
||
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33069
diff
changeset
|
372 |
bool CompilerOracle::should_break_at(const methodHandle& method) { |
1 | 373 |
return check_predicate(BreakCommand, method); |
374 |
} |
|
375 |
||
376 |
static OracleCommand parse_command_name(const char * line, int* bytes_read) { |
|
377 |
assert(ARRAY_SIZE(command_names) == OracleCommandCount, |
|
378 |
"command_names size mismatch"); |
|
379 |
||
380 |
*bytes_read = 0; |
|
7701
766eb9258574
6765546: Wrong sscanf used to parse CompilerOracle command >= 32 characters could lead to crash
never
parents:
7397
diff
changeset
|
381 |
char command[33]; |
1 | 382 |
int result = sscanf(line, "%32[a-z]%n", command, bytes_read); |
383 |
for (uint i = 0; i < ARRAY_SIZE(command_names); i++) { |
|
384 |
if (strcmp(command, command_names[i]) == 0) { |
|
385 |
return (OracleCommand)i; |
|
386 |
} |
|
387 |
} |
|
388 |
return UnknownCommand; |
|
389 |
} |
|
390 |
||
391 |
static void usage() { |
|
28496
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
392 |
tty->cr(); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
393 |
tty->print_cr("The CompileCommand option enables the user of the JVM to control specific"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
394 |
tty->print_cr("behavior of the dynamic compilers. Many commands require a pattern that defines"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
395 |
tty->print_cr("the set of methods the command shall be applied to. The CompileCommand"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
396 |
tty->print_cr("option provides the following commands:"); |
1 | 397 |
tty->cr(); |
28496
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
398 |
tty->print_cr(" break,<pattern> - debug breakpoint in compiler and in generated code"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
399 |
tty->print_cr(" print,<pattern> - print assembly"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
400 |
tty->print_cr(" exclude,<pattern> - don't compile or inline"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
401 |
tty->print_cr(" inline,<pattern> - always inline"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
402 |
tty->print_cr(" dontinline,<pattern> - don't inline"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
403 |
tty->print_cr(" compileonly,<pattern> - compile only"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
404 |
tty->print_cr(" log,<pattern> - log compilation"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
405 |
tty->print_cr(" option,<pattern>,<option type>,<option name>,<value>"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
406 |
tty->print_cr(" - set value of custom option"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
407 |
tty->print_cr(" option,<pattern>,<bool option name>"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
408 |
tty->print_cr(" - shorthand for setting boolean flag"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
409 |
tty->print_cr(" quiet - silence the compile command output"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
410 |
tty->print_cr(" help - print this text"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
411 |
tty->cr(); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
412 |
tty->print_cr("The preferred format for the method matching pattern is:"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
413 |
tty->print_cr(" package/Class.method()"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
414 |
tty->cr(); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
415 |
tty->print_cr("For backward compatibility this form is also allowed:"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
416 |
tty->print_cr(" package.Class::method()"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
417 |
tty->cr(); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
418 |
tty->print_cr("The signature can be separated by an optional whitespace or comma:"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
419 |
tty->print_cr(" package/Class.method ()"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
420 |
tty->cr(); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
421 |
tty->print_cr("The class and method identifier can be used together with leading or"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
422 |
tty->print_cr("trailing *'s for a small amount of wildcarding:"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
423 |
tty->print_cr(" *ackage/Clas*.*etho*()"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
424 |
tty->cr(); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
425 |
tty->print_cr("It is possible to use more than one CompileCommand on the command line:"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
426 |
tty->print_cr(" -XX:CompileCommand=exclude,java/*.* -XX:CompileCommand=log,java*.*"); |
1 | 427 |
tty->cr(); |
28496
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
428 |
tty->print_cr("The CompileCommands can be loaded from a file with the flag"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
429 |
tty->print_cr("-XX:CompileCommandFile=<file> or be added to the file '.hotspot_compiler'"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
430 |
tty->print_cr("Use the same format in the file as the argument to the CompileCommand flag."); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
431 |
tty->print_cr("Add one command on each line."); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
432 |
tty->print_cr(" exclude java/*.*"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
433 |
tty->print_cr(" option java/*.* ReplayInline"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
434 |
tty->cr(); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
435 |
tty->print_cr("The following commands have conflicting behavior: 'exclude', 'inline', 'dontinline',"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
436 |
tty->print_cr("and 'compileonly'. There is no priority of commands. Applying (a subset of) these"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
437 |
tty->print_cr("commands to the same method results in undefined behavior."); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
438 |
tty->cr(); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
439 |
}; |
1 | 440 |
|
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
441 |
// Scan next flag and value in line, return MethodMatcher object on success, NULL on failure. |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
442 |
// On failure, error_msg contains description for the first error. |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
443 |
// For future extensions: set error_msg on first error. |
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
444 |
static void scan_flag_and_value(const char* type, const char* line, int& total_bytes_read, |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
445 |
TypedMethodOptionMatcher* matcher, |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
446 |
char* errorbuf, const int buf_size) { |
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
447 |
total_bytes_read = 0; |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
448 |
int bytes_read = 0; |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
449 |
char flag[256]; |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
450 |
|
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
451 |
// Read flag name. |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
452 |
if (sscanf(line, "%*[ \t]%255[a-zA-Z0-9]%n", flag, &bytes_read) == 1) { |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
453 |
line += bytes_read; |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
454 |
total_bytes_read += bytes_read; |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
455 |
|
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
456 |
// Read value. |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
457 |
if (strcmp(type, "intx") == 0) { |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
458 |
intx value; |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
459 |
if (sscanf(line, "%*[ \t]" INTX_FORMAT "%n", &value, &bytes_read) == 1) { |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
460 |
total_bytes_read += bytes_read; |
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
461 |
add_option_string(matcher, flag, value); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
462 |
return; |
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
463 |
} else { |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
464 |
jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s ", flag, type); |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
465 |
} |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
466 |
} else if (strcmp(type, "uintx") == 0) { |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
467 |
uintx value; |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
468 |
if (sscanf(line, "%*[ \t]" UINTX_FORMAT "%n", &value, &bytes_read) == 1) { |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
469 |
total_bytes_read += bytes_read; |
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
470 |
add_option_string(matcher, flag, value); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
471 |
return; |
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
472 |
} else { |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
473 |
jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type); |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
474 |
} |
26433 | 475 |
} else if (strcmp(type, "ccstr") == 0) { |
476 |
ResourceMark rm; |
|
477 |
char* value = NEW_RESOURCE_ARRAY(char, strlen(line) + 1); |
|
478 |
if (sscanf(line, "%*[ \t]%255[_a-zA-Z0-9]%n", value, &bytes_read) == 1) { |
|
479 |
total_bytes_read += bytes_read; |
|
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
480 |
add_option_string(matcher, flag, (ccstr)value); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
481 |
return; |
26433 | 482 |
} else { |
483 |
jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type); |
|
484 |
} |
|
485 |
} else if (strcmp(type, "ccstrlist") == 0) { |
|
486 |
// Accumulates several strings into one. The internal type is ccstr. |
|
487 |
ResourceMark rm; |
|
488 |
char* value = NEW_RESOURCE_ARRAY(char, strlen(line) + 1); |
|
489 |
char* next_value = value; |
|
490 |
if (sscanf(line, "%*[ \t]%255[_a-zA-Z0-9]%n", next_value, &bytes_read) == 1) { |
|
491 |
total_bytes_read += bytes_read; |
|
492 |
line += bytes_read; |
|
493 |
next_value += bytes_read; |
|
494 |
char* end_value = next_value-1; |
|
495 |
while (sscanf(line, "%*[ \t]%255[_a-zA-Z0-9]%n", next_value, &bytes_read) == 1) { |
|
496 |
total_bytes_read += bytes_read; |
|
497 |
line += bytes_read; |
|
498 |
*end_value = ' '; // override '\0' |
|
499 |
next_value += bytes_read; |
|
500 |
end_value = next_value-1; |
|
501 |
} |
|
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
502 |
add_option_string(matcher, flag, (ccstr)value); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
503 |
return; |
26433 | 504 |
} else { |
505 |
jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type); |
|
506 |
} |
|
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
507 |
} else if (strcmp(type, "bool") == 0) { |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
508 |
char value[256]; |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
509 |
if (sscanf(line, "%*[ \t]%255[a-zA-Z]%n", value, &bytes_read) == 1) { |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
510 |
if (strcmp(value, "true") == 0) { |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
511 |
total_bytes_read += bytes_read; |
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
512 |
add_option_string(matcher, flag, true); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
513 |
return; |
26433 | 514 |
} else if (strcmp(value, "false") == 0) { |
515 |
total_bytes_read += bytes_read; |
|
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
516 |
add_option_string(matcher, flag, false); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
517 |
return; |
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
518 |
} else { |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
519 |
jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type); |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
520 |
} |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
521 |
} else { |
31615 | 522 |
jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type); |
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
523 |
} |
27143
feee4a6106bc
8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents:
26441
diff
changeset
|
524 |
} else if (strcmp(type, "double") == 0) { |
feee4a6106bc
8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents:
26441
diff
changeset
|
525 |
char buffer[2][256]; |
feee4a6106bc
8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents:
26441
diff
changeset
|
526 |
// Decimal separator '.' has been replaced with ' ' or '/' earlier, |
feee4a6106bc
8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents:
26441
diff
changeset
|
527 |
// so read integer and fraction part of double value separately. |
feee4a6106bc
8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents:
26441
diff
changeset
|
528 |
if (sscanf(line, "%*[ \t]%255[0-9]%*[ /\t]%255[0-9]%n", buffer[0], buffer[1], &bytes_read) == 2) { |
feee4a6106bc
8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents:
26441
diff
changeset
|
529 |
char value[512] = ""; |
30281 | 530 |
jio_snprintf(value, sizeof(value), "%s.%s", buffer[0], buffer[1]); |
27143
feee4a6106bc
8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents:
26441
diff
changeset
|
531 |
total_bytes_read += bytes_read; |
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
532 |
add_option_string(matcher, flag, atof(value)); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
533 |
return; |
27143
feee4a6106bc
8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents:
26441
diff
changeset
|
534 |
} else { |
feee4a6106bc
8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents:
26441
diff
changeset
|
535 |
jio_snprintf(errorbuf, buf_size, " Value cannot be read for flag %s of type %s", flag, type); |
feee4a6106bc
8059847: complement JDK-8055286 and JDK-8056964 changes
anoll
parents:
26441
diff
changeset
|
536 |
} |
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
537 |
} else { |
31615 | 538 |
jio_snprintf(errorbuf, buf_size, " Type %s not supported ", type); |
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
539 |
} |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
540 |
} else { |
31615 | 541 |
jio_snprintf(errorbuf, buf_size, " Flag name for type %s should be alphanumeric ", type); |
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
542 |
} |
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
543 |
return; |
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
544 |
} |
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
545 |
|
28721
b9655115bf4e
8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents:
28720
diff
changeset
|
546 |
int skip_whitespace(char* line) { |
b9655115bf4e
8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents:
28720
diff
changeset
|
547 |
// Skip any leading spaces |
b9655115bf4e
8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents:
28720
diff
changeset
|
548 |
int whitespace_read = 0; |
b9655115bf4e
8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents:
28720
diff
changeset
|
549 |
sscanf(line, "%*[ \t]%n", &whitespace_read); |
b9655115bf4e
8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents:
28720
diff
changeset
|
550 |
return whitespace_read; |
b9655115bf4e
8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents:
28720
diff
changeset
|
551 |
} |
b9655115bf4e
8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents:
28720
diff
changeset
|
552 |
|
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
553 |
void CompilerOracle::print_parse_error(const char*& error_msg, char* original_line) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
554 |
assert(error_msg != NULL, "Must have error_message"); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
555 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
556 |
ttyLocker ttyl; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
557 |
tty->print_cr("CompileCommand: An error occurred during parsing"); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
558 |
tty->print_cr("Line: %s", original_line); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
559 |
tty->print_cr("Error: %s", error_msg); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
560 |
CompilerOracle::print_tip(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
561 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
562 |
|
1 | 563 |
void CompilerOracle::parse_from_line(char* line) { |
564 |
if (line[0] == '\0') return; |
|
565 |
if (line[0] == '#') return; |
|
566 |
||
567 |
char* original_line = line; |
|
568 |
int bytes_read; |
|
569 |
OracleCommand command = parse_command_name(line, &bytes_read); |
|
570 |
line += bytes_read; |
|
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
571 |
ResourceMark rm; |
1 | 572 |
|
7701
766eb9258574
6765546: Wrong sscanf used to parse CompilerOracle command >= 32 characters could lead to crash
never
parents:
7397
diff
changeset
|
573 |
if (command == UnknownCommand) { |
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
574 |
ttyLocker ttyl; |
28496
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
575 |
tty->print_cr("CompileCommand: unrecognized command"); |
7701
766eb9258574
6765546: Wrong sscanf used to parse CompilerOracle command >= 32 characters could lead to crash
never
parents:
7397
diff
changeset
|
576 |
tty->print_cr(" \"%s\"", original_line); |
28496
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
577 |
CompilerOracle::print_tip(); |
7701
766eb9258574
6765546: Wrong sscanf used to parse CompilerOracle command >= 32 characters could lead to crash
never
parents:
7397
diff
changeset
|
578 |
return; |
766eb9258574
6765546: Wrong sscanf used to parse CompilerOracle command >= 32 characters could lead to crash
never
parents:
7397
diff
changeset
|
579 |
} |
766eb9258574
6765546: Wrong sscanf used to parse CompilerOracle command >= 32 characters could lead to crash
never
parents:
7397
diff
changeset
|
580 |
|
1 | 581 |
if (command == QuietCommand) { |
582 |
_quiet = true; |
|
583 |
return; |
|
584 |
} |
|
585 |
||
586 |
if (command == HelpCommand) { |
|
587 |
usage(); |
|
588 |
return; |
|
589 |
} |
|
590 |
||
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
591 |
const char* error_msg = NULL; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
592 |
if (command == OptionCommand) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
593 |
// Look for trailing options. |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
594 |
// |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
595 |
// Two types of trailing options are |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
596 |
// supported: |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
597 |
// |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
598 |
// (1) CompileCommand=option,Klass::method,flag |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
599 |
// (2) CompileCommand=option,Klass::method,type,flag,value |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
600 |
// |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
601 |
// Type (1) is used to enable a boolean flag for a method. |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
602 |
// |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
603 |
// Type (2) is used to support options with a value. Values can have the |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
604 |
// the following types: intx, uintx, bool, ccstr, ccstrlist, and double. |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
605 |
// |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
606 |
// For future extensions: extend scan_flag_and_value() |
1 | 607 |
|
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
608 |
char option[256]; // stores flag for Type (1) and type of Type (2) |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
609 |
line++; // skip the ',' |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
610 |
TypedMethodOptionMatcher* archetype = TypedMethodOptionMatcher::parse_method_pattern(line, error_msg); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
611 |
if (archetype == NULL) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
612 |
assert(error_msg != NULL, "Must have error_message"); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
613 |
print_parse_error(error_msg, original_line); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
614 |
return; |
1 | 615 |
} |
616 |
||
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
617 |
line += skip_whitespace(line); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
618 |
|
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
619 |
// This is unnecessarily complex. Should retire multi-option lines and skip while loop |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
620 |
while (sscanf(line, "%255[a-zA-Z0-9]%n", option, &bytes_read) == 1) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
621 |
line += bytes_read; |
28721
b9655115bf4e
8069035: compiler/oracle/CheckCompileCommandOption.java nightly failure
neliasso
parents:
28720
diff
changeset
|
622 |
|
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
623 |
// typed_matcher is used as a blueprint for each option, deleted at the end |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
624 |
TypedMethodOptionMatcher* typed_matcher = archetype->clone(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
625 |
if (strcmp(option, "intx") == 0 |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
626 |
|| strcmp(option, "uintx") == 0 |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
627 |
|| strcmp(option, "bool") == 0 |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
628 |
|| strcmp(option, "ccstr") == 0 |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
629 |
|| strcmp(option, "ccstrlist") == 0 |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
630 |
|| strcmp(option, "double") == 0 |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
631 |
) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
632 |
char errorbuf[1024] = {0}; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
633 |
// Type (2) option: parse flag name and value. |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
634 |
scan_flag_and_value(option, line, bytes_read, typed_matcher, errorbuf, sizeof(errorbuf)); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
635 |
if (*errorbuf != '\0') { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
636 |
error_msg = errorbuf; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
637 |
print_parse_error(error_msg, original_line); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
638 |
return; |
1 | 639 |
} |
640 |
line += bytes_read; |
|
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
641 |
} else { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
642 |
// Type (1) option |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
643 |
add_option_string(typed_matcher, option, true); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
644 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
645 |
if (typed_matcher != NULL && !_quiet) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
646 |
// Print out the last match added |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
647 |
assert(error_msg == NULL, "No error here"); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
648 |
ttyLocker ttyl; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
649 |
tty->print("CompileCommand: %s ", command_names[command]); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
650 |
typed_matcher->print(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
651 |
} |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
652 |
line += skip_whitespace(line); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
653 |
} // while( |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
654 |
delete archetype; |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
655 |
} else { // not an OptionCommand) |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
656 |
assert(error_msg == NULL, "Don't call here with error_msg already set"); |
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
657 |
|
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
658 |
BasicMatcher* matcher = BasicMatcher::parse_method_pattern(line, error_msg); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
659 |
if (error_msg != NULL) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
660 |
assert(matcher == NULL, "consistency"); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
661 |
print_parse_error(error_msg, original_line); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
662 |
return; |
1 | 663 |
} |
664 |
||
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
665 |
add_predicate(command, matcher); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
666 |
if (!_quiet) { |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
667 |
ttyLocker ttyl; |
28496
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
668 |
tty->print("CompileCommand: %s ", command_names[command]); |
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
669 |
matcher->print(tty); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
670 |
tty->cr(); |
26430
7f20c536cd5b
8055286: Extend CompileCommand=option to handle numeric parameters
zmajo
parents:
25949
diff
changeset
|
671 |
} |
1 | 672 |
} |
673 |
} |
|
674 |
||
28496
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
675 |
void CompilerOracle::print_tip() { |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
676 |
tty->cr(); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
677 |
tty->print_cr("Usage: '-XX:CompileCommand=command,\"package/Class.method()\"'"); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
678 |
tty->print_cr("Use: '-XX:CompileCommand=help' for more information."); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
679 |
tty->cr(); |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
680 |
} |
f9753412d4f5
8027829: CompileCommand does not accept all JLS-conformant class/method names
neliasso
parents:
27143
diff
changeset
|
681 |
|
13194
603ef19adcb8
7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents:
12981
diff
changeset
|
682 |
static const char* default_cc_file = ".hotspot_compiler"; |
603ef19adcb8
7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents:
12981
diff
changeset
|
683 |
|
1 | 684 |
static const char* cc_file() { |
12981
b557c10f5444
7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents:
8921
diff
changeset
|
685 |
#ifdef ASSERT |
1 | 686 |
if (CompileCommandFile == NULL) |
13194
603ef19adcb8
7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents:
12981
diff
changeset
|
687 |
return default_cc_file; |
12981
b557c10f5444
7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents:
8921
diff
changeset
|
688 |
#endif |
1 | 689 |
return CompileCommandFile; |
690 |
} |
|
12981
b557c10f5444
7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents:
8921
diff
changeset
|
691 |
|
b557c10f5444
7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents:
8921
diff
changeset
|
692 |
bool CompilerOracle::has_command_file() { |
b557c10f5444
7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents:
8921
diff
changeset
|
693 |
return cc_file() != NULL; |
b557c10f5444
7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents:
8921
diff
changeset
|
694 |
} |
b557c10f5444
7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents:
8921
diff
changeset
|
695 |
|
1 | 696 |
bool CompilerOracle::_quiet = false; |
697 |
||
698 |
void CompilerOracle::parse_from_file() { |
|
12981
b557c10f5444
7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents:
8921
diff
changeset
|
699 |
assert(has_command_file(), "command file must be specified"); |
1 | 700 |
FILE* stream = fopen(cc_file(), "rt"); |
701 |
if (stream == NULL) return; |
|
702 |
||
703 |
char token[1024]; |
|
704 |
int pos = 0; |
|
705 |
int c = getc(stream); |
|
14139 | 706 |
while(c != EOF && pos < (int)(sizeof(token)-1)) { |
1 | 707 |
if (c == '\n') { |
708 |
token[pos++] = '\0'; |
|
709 |
parse_from_line(token); |
|
710 |
pos = 0; |
|
711 |
} else { |
|
712 |
token[pos++] = c; |
|
713 |
} |
|
714 |
c = getc(stream); |
|
715 |
} |
|
716 |
token[pos++] = '\0'; |
|
717 |
parse_from_line(token); |
|
718 |
||
719 |
fclose(stream); |
|
720 |
} |
|
721 |
||
722 |
void CompilerOracle::parse_from_string(const char* str, void (*parse_line)(char*)) { |
|
723 |
char token[1024]; |
|
724 |
int pos = 0; |
|
725 |
const char* sp = str; |
|
726 |
int c = *sp++; |
|
14139 | 727 |
while (c != '\0' && pos < (int)(sizeof(token)-1)) { |
1 | 728 |
if (c == '\n') { |
729 |
token[pos++] = '\0'; |
|
730 |
parse_line(token); |
|
731 |
pos = 0; |
|
732 |
} else { |
|
733 |
token[pos++] = c; |
|
734 |
} |
|
735 |
c = *sp++; |
|
736 |
} |
|
737 |
token[pos++] = '\0'; |
|
738 |
parse_line(token); |
|
739 |
} |
|
740 |
||
741 |
void CompilerOracle::append_comment_to_file(const char* message) { |
|
12981
b557c10f5444
7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents:
8921
diff
changeset
|
742 |
assert(has_command_file(), "command file must be specified"); |
1 | 743 |
fileStream stream(fopen(cc_file(), "at")); |
744 |
stream.print("# "); |
|
745 |
for (int index = 0; message[index] != '\0'; index++) { |
|
746 |
stream.put(message[index]); |
|
747 |
if (message[index] == '\n') stream.print("# "); |
|
748 |
} |
|
749 |
stream.cr(); |
|
750 |
} |
|
751 |
||
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33069
diff
changeset
|
752 |
void CompilerOracle::append_exclude_to_file(const methodHandle& method) { |
12981
b557c10f5444
7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents:
8921
diff
changeset
|
753 |
assert(has_command_file(), "command file must be specified"); |
1 | 754 |
fileStream stream(fopen(cc_file(), "at")); |
755 |
stream.print("exclude "); |
|
14391
df0a1573d5bd
8000725: NPG: method_holder() and pool_holder() and pool_holder field should be InstanceKlass
coleenp
parents:
14147
diff
changeset
|
756 |
method->method_holder()->name()->print_symbol_on(&stream); |
1 | 757 |
stream.print("."); |
758 |
method->name()->print_symbol_on(&stream); |
|
759 |
method->signature()->print_symbol_on(&stream); |
|
760 |
stream.cr(); |
|
761 |
stream.cr(); |
|
762 |
} |
|
763 |
||
764 |
||
765 |
void compilerOracle_init() { |
|
766 |
CompilerOracle::parse_from_string(CompileCommand, CompilerOracle::parse_from_line); |
|
767 |
CompilerOracle::parse_from_string(CompileOnly, CompilerOracle::parse_compile_only); |
|
12981
b557c10f5444
7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents:
8921
diff
changeset
|
768 |
if (CompilerOracle::has_command_file()) { |
b557c10f5444
7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents:
8921
diff
changeset
|
769 |
CompilerOracle::parse_from_file(); |
13194
603ef19adcb8
7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents:
12981
diff
changeset
|
770 |
} else { |
603ef19adcb8
7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents:
12981
diff
changeset
|
771 |
struct stat buf; |
603ef19adcb8
7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents:
12981
diff
changeset
|
772 |
if (os::stat(default_cc_file, &buf) == 0) { |
603ef19adcb8
7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents:
12981
diff
changeset
|
773 |
warning("%s file is present but has been ignored. " |
603ef19adcb8
7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents:
12981
diff
changeset
|
774 |
"Run with -XX:CompileCommandFile=%s to load the file.", |
603ef19adcb8
7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents:
12981
diff
changeset
|
775 |
default_cc_file, default_cc_file); |
603ef19adcb8
7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents:
12981
diff
changeset
|
776 |
} |
12981
b557c10f5444
7110720: Issue with vm config file loadingIssue with vm config file loading
kamg
parents:
8921
diff
changeset
|
777 |
} |
4584
e2a449e8cc6f
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1
diff
changeset
|
778 |
if (lists[PrintCommand] != NULL) { |
e2a449e8cc6f
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1
diff
changeset
|
779 |
if (PrintAssembly) { |
13194
603ef19adcb8
7167142: Consider a warning when finding a .hotspotrc or .hotspot_compiler file that isn't used
kamg
parents:
12981
diff
changeset
|
780 |
warning("CompileCommand and/or %s file contains 'print' commands, but PrintAssembly is also enabled", default_cc_file); |
4584
e2a449e8cc6f
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1
diff
changeset
|
781 |
} else if (FLAG_IS_DEFAULT(DebugNonSafepoints)) { |
e2a449e8cc6f
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1
diff
changeset
|
782 |
warning("printing of assembly code is enabled; turning on DebugNonSafepoints to gain additional output"); |
e2a449e8cc6f
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1
diff
changeset
|
783 |
DebugNonSafepoints = true; |
e2a449e8cc6f
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1
diff
changeset
|
784 |
} |
e2a449e8cc6f
6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents:
1
diff
changeset
|
785 |
} |
1 | 786 |
} |
787 |
||
788 |
||
789 |
void CompilerOracle::parse_compile_only(char * line) { |
|
790 |
int i; |
|
791 |
char name[1024]; |
|
792 |
const char* className = NULL; |
|
793 |
const char* methodName = NULL; |
|
794 |
||
795 |
bool have_colon = (strstr(line, "::") != NULL); |
|
796 |
char method_sep = have_colon ? ':' : '.'; |
|
797 |
||
798 |
if (Verbose) { |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23185
diff
changeset
|
799 |
tty->print_cr("%s", line); |
1 | 800 |
} |
801 |
||
802 |
ResourceMark rm; |
|
803 |
while (*line != '\0') { |
|
804 |
MethodMatcher::Mode c_match = MethodMatcher::Exact; |
|
805 |
MethodMatcher::Mode m_match = MethodMatcher::Exact; |
|
806 |
||
807 |
for (i = 0; |
|
808 |
i < 1024 && *line != '\0' && *line != method_sep && *line != ',' && !isspace(*line); |
|
809 |
line++, i++) { |
|
810 |
name[i] = *line; |
|
811 |
if (name[i] == '.') name[i] = '/'; // package prefix uses '/' |
|
812 |
} |
|
813 |
||
814 |
if (i > 0) { |
|
815 |
char* newName = NEW_RESOURCE_ARRAY( char, i + 1); |
|
816 |
if (newName == NULL) |
|
817 |
return; |
|
818 |
strncpy(newName, name, i); |
|
819 |
newName[i] = '\0'; |
|
820 |
||
821 |
if (className == NULL) { |
|
822 |
className = newName; |
|
823 |
} else { |
|
824 |
methodName = newName; |
|
825 |
} |
|
826 |
} |
|
827 |
||
828 |
if (*line == method_sep) { |
|
829 |
if (className == NULL) { |
|
830 |
className = ""; |
|
831 |
c_match = MethodMatcher::Any; |
|
832 |
} |
|
833 |
} else { |
|
834 |
// got foo or foo/bar |
|
835 |
if (className == NULL) { |
|
836 |
ShouldNotReachHere(); |
|
837 |
} else { |
|
40079
40d48ddc12bc
8071652: -XX:CompileOnly does not behave as documented
dpochepk
parents:
35138
diff
changeset
|
838 |
// missing class name handled as "Any" class match |
40d48ddc12bc
8071652: -XX:CompileOnly does not behave as documented
dpochepk
parents:
35138
diff
changeset
|
839 |
if (className[0] == '\0') { |
1 | 840 |
c_match = MethodMatcher::Any; |
841 |
} |
|
842 |
} |
|
843 |
} |
|
844 |
||
845 |
// each directive is terminated by , or NUL or . followed by NUL |
|
846 |
if (*line == ',' || *line == '\0' || (line[0] == '.' && line[1] == '\0')) { |
|
847 |
if (methodName == NULL) { |
|
848 |
methodName = ""; |
|
849 |
if (*line != method_sep) { |
|
850 |
m_match = MethodMatcher::Any; |
|
851 |
} |
|
852 |
} |
|
853 |
||
854 |
EXCEPTION_MARK; |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7701
diff
changeset
|
855 |
Symbol* c_name = SymbolTable::new_symbol(className, CHECK); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7701
diff
changeset
|
856 |
Symbol* m_name = SymbolTable::new_symbol(methodName, CHECK); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7701
diff
changeset
|
857 |
Symbol* signature = NULL; |
1 | 858 |
|
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
859 |
BasicMatcher* bm = new BasicMatcher(); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
860 |
bm->init(c_name, c_match, m_name, m_match, signature); |
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
861 |
add_predicate(CompileOnlyCommand, bm); |
1 | 862 |
if (PrintVMOptions) { |
863 |
tty->print("CompileOnly: compileonly "); |
|
33069
d8eed614f298
8135068: Extract method matchers from CompilerOracle
neliasso
parents:
31615
diff
changeset
|
864 |
lists[CompileOnlyCommand]->print_all(tty); |
1 | 865 |
} |
866 |
||
867 |
className = NULL; |
|
868 |
methodName = NULL; |
|
869 |
} |
|
870 |
||
871 |
line = *line == '\0' ? line : line + 1; |
|
872 |
} |
|
873 |
} |