author | twisti |
Thu, 08 Sep 2011 05:11:31 -0700 | |
changeset 10540 | 92d59dba2407 |
parent 8675 | e9fef2a9bef7 |
child 12263 | d20640f4f8fe |
permissions | -rw-r--r-- |
1 | 1 |
/* |
8675
e9fef2a9bef7
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
8076
diff
changeset
|
2 |
* Copyright (c) 1997, 2011, 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:
4567
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4567
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:
4567
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "classfile/vmSymbols.hpp" |
|
27 |
#include "memory/oopFactory.hpp" |
|
28 |
#include "oops/oop.inline.hpp" |
|
29 |
#include "runtime/handles.inline.hpp" |
|
30 |
#include "utilities/xmlstream.hpp" |
|
1 | 31 |
|
32 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
33 |
Symbol* vmSymbols::_symbols[vmSymbols::SID_LIMIT]; |
1 | 34 |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
35 |
Symbol* vmSymbols::_type_signatures[T_VOID+1] = { NULL /*, NULL...*/ }; |
1 | 36 |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
37 |
inline int compare_symbol(Symbol* a, Symbol* b) { |
1 | 38 |
if (a == b) return 0; |
39 |
// follow the natural address order: |
|
40 |
return (address)a > (address)b ? +1 : -1; |
|
41 |
} |
|
42 |
||
43 |
static vmSymbols::SID vm_symbol_index[vmSymbols::SID_LIMIT]; |
|
44 |
extern "C" { |
|
45 |
static int compare_vmsymbol_sid(const void* void_a, const void* void_b) { |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
46 |
Symbol* a = vmSymbols::symbol_at(*((vmSymbols::SID*) void_a)); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
47 |
Symbol* b = vmSymbols::symbol_at(*((vmSymbols::SID*) void_b)); |
1 | 48 |
return compare_symbol(a, b); |
49 |
} |
|
50 |
} |
|
51 |
||
52 |
#ifndef PRODUCT |
|
53 |
#define VM_SYMBOL_ENUM_NAME_BODY(name, string) #name "\0" |
|
54 |
static const char* vm_symbol_enum_names = |
|
55 |
VM_SYMBOLS_DO(VM_SYMBOL_ENUM_NAME_BODY, VM_ALIAS_IGNORE) |
|
56 |
"\0"; |
|
57 |
static const char* vm_symbol_enum_name(vmSymbols::SID sid) { |
|
58 |
const char* string = &vm_symbol_enum_names[0]; |
|
59 |
int skip = (int)sid - (int)vmSymbols::FIRST_SID; |
|
60 |
for (; skip != 0; skip--) { |
|
61 |
size_t skiplen = strlen(string); |
|
62 |
if (skiplen == 0) return "<unknown>"; // overflow |
|
63 |
string += skiplen+1; |
|
64 |
} |
|
65 |
return string; |
|
66 |
} |
|
67 |
#endif //PRODUCT |
|
68 |
||
69 |
// Put all the VM symbol strings in one place. |
|
70 |
// Makes for a more compact libjvm. |
|
71 |
#define VM_SYMBOL_BODY(name, string) string "\0" |
|
72 |
static const char* vm_symbol_bodies = VM_SYMBOLS_DO(VM_SYMBOL_BODY, VM_ALIAS_IGNORE); |
|
73 |
||
74 |
void vmSymbols::initialize(TRAPS) { |
|
75 |
assert((int)SID_LIMIT <= (1<<log2_SID_LIMIT), "must fit in this bitfield"); |
|
76 |
assert((int)SID_LIMIT*5 > (1<<log2_SID_LIMIT), "make the bitfield smaller, please"); |
|
4562
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
77 |
assert(vmIntrinsics::FLAG_LIMIT <= (1 << vmIntrinsics::log2_FLAG_LIMIT), "must fit in this bitfield"); |
1 | 78 |
|
79 |
if (!UseSharedSpaces) { |
|
80 |
const char* string = &vm_symbol_bodies[0]; |
|
81 |
for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) { |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
82 |
Symbol* sym = SymbolTable::new_symbol(string, CHECK); |
1 | 83 |
_symbols[index] = sym; |
84 |
string += strlen(string); // skip string body |
|
85 |
string += 1; // skip trailing null |
|
86 |
} |
|
87 |
||
88 |
_type_signatures[T_BYTE] = byte_signature(); |
|
89 |
_type_signatures[T_CHAR] = char_signature(); |
|
90 |
_type_signatures[T_DOUBLE] = double_signature(); |
|
91 |
_type_signatures[T_FLOAT] = float_signature(); |
|
92 |
_type_signatures[T_INT] = int_signature(); |
|
93 |
_type_signatures[T_LONG] = long_signature(); |
|
94 |
_type_signatures[T_SHORT] = short_signature(); |
|
95 |
_type_signatures[T_BOOLEAN] = bool_signature(); |
|
96 |
_type_signatures[T_VOID] = void_signature(); |
|
97 |
// no single signatures for T_OBJECT or T_ARRAY |
|
98 |
} |
|
99 |
||
100 |
#ifdef ASSERT |
|
101 |
// Check for duplicates: |
|
102 |
for (int i1 = (int)FIRST_SID; i1 < (int)SID_LIMIT; i1++) { |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
103 |
Symbol* sym = symbol_at((SID)i1); |
1 | 104 |
for (int i2 = (int)FIRST_SID; i2 < i1; i2++) { |
105 |
if (symbol_at((SID)i2) == sym) { |
|
106 |
tty->print("*** Duplicate VM symbol SIDs %s(%d) and %s(%d): \"", |
|
107 |
vm_symbol_enum_name((SID)i2), i2, |
|
108 |
vm_symbol_enum_name((SID)i1), i1); |
|
109 |
sym->print_symbol_on(tty); |
|
110 |
tty->print_cr("\""); |
|
111 |
} |
|
112 |
} |
|
113 |
} |
|
114 |
#endif //ASSERT |
|
115 |
||
116 |
// Create an index for find_id: |
|
117 |
{ |
|
118 |
for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) { |
|
119 |
vm_symbol_index[index] = (SID)index; |
|
120 |
} |
|
121 |
int num_sids = SID_LIMIT-FIRST_SID; |
|
122 |
qsort(&vm_symbol_index[FIRST_SID], num_sids, sizeof(vm_symbol_index[0]), |
|
123 |
compare_vmsymbol_sid); |
|
124 |
} |
|
125 |
||
126 |
#ifdef ASSERT |
|
127 |
{ |
|
128 |
// Spot-check correspondence between strings, symbols, and enums: |
|
129 |
assert(_symbols[NO_SID] == NULL, "must be"); |
|
130 |
const char* str = "java/lang/Object"; |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
131 |
TempNewSymbol jlo = SymbolTable::new_symbol(str, CHECK); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
132 |
assert(strncmp(str, (char*)jlo->base(), jlo->utf8_length()) == 0, ""); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
133 |
assert(jlo == java_lang_Object(), ""); |
1 | 134 |
SID sid = VM_SYMBOL_ENUM_NAME(java_lang_Object); |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
135 |
assert(find_sid(jlo) == sid, ""); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
136 |
assert(symbol_at(sid) == jlo, ""); |
1 | 137 |
|
138 |
// Make sure find_sid produces the right answer in each case. |
|
139 |
for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) { |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
140 |
Symbol* sym = symbol_at((SID)index); |
1 | 141 |
sid = find_sid(sym); |
142 |
assert(sid == (SID)index, "symbol index works"); |
|
143 |
// Note: If there are duplicates, this assert will fail. |
|
144 |
// A "Duplicate VM symbol" message will have already been printed. |
|
145 |
} |
|
146 |
||
147 |
// The string "format" happens (at the moment) not to be a vmSymbol, |
|
148 |
// though it is a method name in java.lang.String. |
|
149 |
str = "format"; |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
150 |
TempNewSymbol fmt = SymbolTable::new_symbol(str, CHECK); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
151 |
sid = find_sid(fmt); |
1 | 152 |
assert(sid == NO_SID, "symbol index works (negative test)"); |
153 |
} |
|
154 |
#endif |
|
155 |
} |
|
156 |
||
157 |
||
158 |
#ifndef PRODUCT |
|
159 |
const char* vmSymbols::name_for(vmSymbols::SID sid) { |
|
160 |
if (sid == NO_SID) |
|
161 |
return "NO_SID"; |
|
162 |
const char* string = &vm_symbol_bodies[0]; |
|
163 |
for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) { |
|
164 |
if (index == (int)sid) |
|
165 |
return string; |
|
166 |
string += strlen(string); // skip string body |
|
167 |
string += 1; // skip trailing null |
|
168 |
} |
|
169 |
return "BAD_SID"; |
|
170 |
} |
|
171 |
#endif |
|
172 |
||
173 |
||
174 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
175 |
void vmSymbols::symbols_do(SymbolClosure* f) { |
1 | 176 |
for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) { |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
177 |
f->do_symbol(&_symbols[index]); |
1 | 178 |
} |
179 |
for (int i = 0; i < T_VOID+1; i++) { |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
180 |
f->do_symbol(&_type_signatures[i]); |
1 | 181 |
} |
182 |
} |
|
183 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
184 |
void vmSymbols::serialize(SerializeOopClosure* soc) { |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
185 |
soc->do_region((u_char*)&_symbols[FIRST_SID], |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
186 |
(SID_LIMIT - FIRST_SID) * sizeof(_symbols[0])); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
187 |
soc->do_region((u_char*)_type_signatures, sizeof(_type_signatures)); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
188 |
} |
1 | 189 |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
190 |
|
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
191 |
BasicType vmSymbols::signature_type(Symbol* s) { |
1 | 192 |
assert(s != NULL, "checking"); |
193 |
for (int i = T_BOOLEAN; i < T_VOID+1; i++) { |
|
194 |
if (s == _type_signatures[i]) { |
|
195 |
return (BasicType)i; |
|
196 |
} |
|
197 |
} |
|
198 |
return T_OBJECT; |
|
199 |
} |
|
200 |
||
201 |
||
202 |
static int mid_hint = (int)vmSymbols::FIRST_SID+1; |
|
203 |
||
204 |
#ifndef PRODUCT |
|
205 |
static int find_sid_calls, find_sid_probes; |
|
206 |
// (Typical counts are calls=7000 and probes=17000.) |
|
207 |
#endif |
|
208 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
209 |
vmSymbols::SID vmSymbols::find_sid(Symbol* symbol) { |
1 | 210 |
// Handle the majority of misses by a bounds check. |
211 |
// Then, use a binary search over the index. |
|
212 |
// Expected trip count is less than log2_SID_LIMIT, about eight. |
|
213 |
// This is slow but acceptable, given that calls are not |
|
214 |
// dynamically common. (methodOop::intrinsic_id has a cache.) |
|
215 |
NOT_PRODUCT(find_sid_calls++); |
|
216 |
int min = (int)FIRST_SID, max = (int)SID_LIMIT - 1; |
|
217 |
SID sid = NO_SID, sid1; |
|
218 |
int cmp1; |
|
219 |
sid1 = vm_symbol_index[min]; |
|
220 |
cmp1 = compare_symbol(symbol, symbol_at(sid1)); |
|
221 |
if (cmp1 <= 0) { // before the first |
|
222 |
if (cmp1 == 0) sid = sid1; |
|
223 |
} else { |
|
224 |
sid1 = vm_symbol_index[max]; |
|
225 |
cmp1 = compare_symbol(symbol, symbol_at(sid1)); |
|
226 |
if (cmp1 >= 0) { // after the last |
|
227 |
if (cmp1 == 0) sid = sid1; |
|
228 |
} else { |
|
229 |
// After checking the extremes, do a binary search. |
|
230 |
++min; --max; // endpoints are done |
|
231 |
int mid = mid_hint; // start at previous success |
|
232 |
while (max >= min) { |
|
233 |
assert(mid >= min && mid <= max, ""); |
|
234 |
NOT_PRODUCT(find_sid_probes++); |
|
235 |
sid1 = vm_symbol_index[mid]; |
|
236 |
cmp1 = compare_symbol(symbol, symbol_at(sid1)); |
|
237 |
if (cmp1 == 0) { |
|
238 |
mid_hint = mid; |
|
239 |
sid = sid1; |
|
240 |
break; |
|
241 |
} |
|
242 |
if (cmp1 < 0) |
|
243 |
max = mid - 1; // symbol < symbol_at(sid) |
|
244 |
else |
|
245 |
min = mid + 1; |
|
246 |
||
247 |
// Pick a new probe point: |
|
248 |
mid = (max + min) / 2; |
|
249 |
} |
|
250 |
} |
|
251 |
} |
|
252 |
||
253 |
#ifdef ASSERT |
|
254 |
// Perform the exhaustive self-check the first 1000 calls, |
|
255 |
// and every 100 calls thereafter. |
|
256 |
static int find_sid_check_count = -2000; |
|
257 |
if ((uint)++find_sid_check_count > (uint)100) { |
|
258 |
if (find_sid_check_count > 0) find_sid_check_count = 0; |
|
259 |
||
260 |
// Make sure this is the right answer, using linear search. |
|
261 |
// (We have already proven that there are no duplicates in the list.) |
|
262 |
SID sid2 = NO_SID; |
|
263 |
for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) { |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
264 |
Symbol* sym2 = symbol_at((SID)index); |
1 | 265 |
if (sym2 == symbol) { |
266 |
sid2 = (SID)index; |
|
267 |
break; |
|
268 |
} |
|
269 |
} |
|
270 |
// Unless it's a duplicate, assert that the sids are the same. |
|
271 |
if (_symbols[sid] != _symbols[sid2]) { |
|
272 |
assert(sid == sid2, "binary same as linear search"); |
|
273 |
} |
|
274 |
} |
|
275 |
#endif //ASSERT |
|
276 |
||
277 |
return sid; |
|
278 |
} |
|
279 |
||
8675
e9fef2a9bef7
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
8076
diff
changeset
|
280 |
vmSymbols::SID vmSymbols::find_sid(const char* symbol_name) { |
e9fef2a9bef7
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
8076
diff
changeset
|
281 |
Symbol* symbol = SymbolTable::probe(symbol_name, (int) strlen(symbol_name)); |
e9fef2a9bef7
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
8076
diff
changeset
|
282 |
if (symbol == NULL) return NO_SID; |
e9fef2a9bef7
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
8076
diff
changeset
|
283 |
return find_sid(symbol); |
e9fef2a9bef7
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
8076
diff
changeset
|
284 |
} |
e9fef2a9bef7
6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
8076
diff
changeset
|
285 |
|
4562
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
286 |
static vmIntrinsics::ID wrapper_intrinsic(BasicType type, bool unboxing) { |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
287 |
#define TYPE2(type, unboxing) ((int)(type)*2 + ((unboxing) ? 1 : 0)) |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
288 |
switch (TYPE2(type, unboxing)) { |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
289 |
#define BASIC_TYPE_CASE(type, box, unbox) \ |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
290 |
case TYPE2(type, false): return vmIntrinsics::box; \ |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
291 |
case TYPE2(type, true): return vmIntrinsics::unbox |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
292 |
BASIC_TYPE_CASE(T_BOOLEAN, _Boolean_valueOf, _booleanValue); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
293 |
BASIC_TYPE_CASE(T_BYTE, _Byte_valueOf, _byteValue); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
294 |
BASIC_TYPE_CASE(T_CHAR, _Character_valueOf, _charValue); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
295 |
BASIC_TYPE_CASE(T_SHORT, _Short_valueOf, _shortValue); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
296 |
BASIC_TYPE_CASE(T_INT, _Integer_valueOf, _intValue); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
297 |
BASIC_TYPE_CASE(T_LONG, _Long_valueOf, _longValue); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
298 |
BASIC_TYPE_CASE(T_FLOAT, _Float_valueOf, _floatValue); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
299 |
BASIC_TYPE_CASE(T_DOUBLE, _Double_valueOf, _doubleValue); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
300 |
#undef BASIC_TYPE_CASE |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
301 |
} |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
302 |
#undef TYPE2 |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
303 |
return vmIntrinsics::_none; |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
304 |
} |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
305 |
|
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
306 |
vmIntrinsics::ID vmIntrinsics::for_boxing(BasicType type) { |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
307 |
return wrapper_intrinsic(type, false); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
308 |
} |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
309 |
vmIntrinsics::ID vmIntrinsics::for_unboxing(BasicType type) { |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
310 |
return wrapper_intrinsic(type, true); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
311 |
} |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
312 |
|
4567
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4562
diff
changeset
|
313 |
vmIntrinsics::ID vmIntrinsics::for_raw_conversion(BasicType src, BasicType dest) { |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4562
diff
changeset
|
314 |
#define SRC_DEST(s,d) (((int)(s) << 4) + (int)(d)) |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4562
diff
changeset
|
315 |
switch (SRC_DEST(src, dest)) { |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4562
diff
changeset
|
316 |
case SRC_DEST(T_INT, T_FLOAT): return vmIntrinsics::_intBitsToFloat; |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4562
diff
changeset
|
317 |
case SRC_DEST(T_FLOAT, T_INT): return vmIntrinsics::_floatToRawIntBits; |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4562
diff
changeset
|
318 |
|
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4562
diff
changeset
|
319 |
case SRC_DEST(T_LONG, T_DOUBLE): return vmIntrinsics::_longBitsToDouble; |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4562
diff
changeset
|
320 |
case SRC_DEST(T_DOUBLE, T_LONG): return vmIntrinsics::_doubleToRawLongBits; |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4562
diff
changeset
|
321 |
} |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4562
diff
changeset
|
322 |
#undef SRC_DEST |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4562
diff
changeset
|
323 |
|
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4562
diff
changeset
|
324 |
return vmIntrinsics::_none; |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4562
diff
changeset
|
325 |
} |
7fc02fbe5c7a
6893268: additional dynamic language related optimizations in C2
twisti
parents:
4562
diff
changeset
|
326 |
|
4562
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
327 |
methodOop vmIntrinsics::method_for(vmIntrinsics::ID id) { |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
328 |
if (id == _none) return NULL; |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
329 |
Symbol* cname = vmSymbols::symbol_at(class_for(id)); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
330 |
Symbol* mname = vmSymbols::symbol_at(name_for(id)); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
331 |
Symbol* msig = vmSymbols::symbol_at(signature_for(id)); |
4562
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
332 |
if (cname == NULL || mname == NULL || msig == NULL) return NULL; |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
333 |
klassOop k = SystemDictionary::find_well_known_klass(cname); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
334 |
if (k == NULL) return NULL; |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
335 |
return instanceKlass::cast(k)->find_method(mname, msig); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
336 |
} |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
337 |
|
1 | 338 |
|
339 |
#define VM_INTRINSIC_INITIALIZE(id, klass, name, sig, flags) #id "\0" |
|
340 |
static const char* vm_intrinsic_name_bodies = |
|
341 |
VM_INTRINSICS_DO(VM_INTRINSIC_INITIALIZE, |
|
342 |
VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE); |
|
343 |
||
344 |
static const char* vm_intrinsic_name_table[vmIntrinsics::ID_LIMIT]; |
|
345 |
||
346 |
const char* vmIntrinsics::name_at(vmIntrinsics::ID id) { |
|
347 |
const char** nt = &vm_intrinsic_name_table[0]; |
|
348 |
if (nt[_none] == NULL) { |
|
349 |
char* string = (char*) &vm_intrinsic_name_bodies[0]; |
|
350 |
for (int index = FIRST_ID; index < ID_LIMIT; index++) { |
|
351 |
nt[index] = string; |
|
352 |
string += strlen(string); // skip string body |
|
353 |
string += 1; // skip trailing null |
|
354 |
} |
|
355 |
assert(!strcmp(nt[_hashCode], "_hashCode"), "lined up"); |
|
356 |
nt[_none] = "_none"; |
|
357 |
} |
|
358 |
if ((uint)id < (uint)ID_LIMIT) |
|
359 |
return vm_intrinsic_name_table[(uint)id]; |
|
360 |
else |
|
361 |
return "(unknown intrinsic)"; |
|
362 |
} |
|
363 |
||
364 |
// These are flag-matching functions: |
|
365 |
inline bool match_F_R(jshort flags) { |
|
366 |
const int req = 0; |
|
367 |
const int neg = JVM_ACC_STATIC | JVM_ACC_SYNCHRONIZED; |
|
368 |
return (flags & (req | neg)) == req; |
|
369 |
} |
|
4450
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
670
diff
changeset
|
370 |
inline bool match_F_Y(jshort flags) { |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
670
diff
changeset
|
371 |
const int req = JVM_ACC_SYNCHRONIZED; |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
670
diff
changeset
|
372 |
const int neg = JVM_ACC_STATIC; |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
670
diff
changeset
|
373 |
return (flags & (req | neg)) == req; |
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
670
diff
changeset
|
374 |
} |
1 | 375 |
inline bool match_F_RN(jshort flags) { |
376 |
const int req = JVM_ACC_NATIVE; |
|
377 |
const int neg = JVM_ACC_STATIC | JVM_ACC_SYNCHRONIZED; |
|
378 |
return (flags & (req | neg)) == req; |
|
379 |
} |
|
380 |
inline bool match_F_S(jshort flags) { |
|
381 |
const int req = JVM_ACC_STATIC; |
|
382 |
const int neg = JVM_ACC_SYNCHRONIZED; |
|
383 |
return (flags & (req | neg)) == req; |
|
384 |
} |
|
385 |
inline bool match_F_SN(jshort flags) { |
|
386 |
const int req = JVM_ACC_STATIC | JVM_ACC_NATIVE; |
|
387 |
const int neg = JVM_ACC_SYNCHRONIZED; |
|
388 |
return (flags & (req | neg)) == req; |
|
389 |
} |
|
218
a0e996680b05
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
1
diff
changeset
|
390 |
inline bool match_F_RNY(jshort flags) { |
a0e996680b05
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
1
diff
changeset
|
391 |
const int req = JVM_ACC_NATIVE | JVM_ACC_SYNCHRONIZED; |
a0e996680b05
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
1
diff
changeset
|
392 |
const int neg = JVM_ACC_STATIC; |
a0e996680b05
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
1
diff
changeset
|
393 |
return (flags & (req | neg)) == req; |
a0e996680b05
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
1
diff
changeset
|
394 |
} |
1 | 395 |
|
396 |
// These are for forming case labels: |
|
4562
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
397 |
#define ID3(x, y, z) (( jlong)(z) + \ |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
398 |
((jlong)(y) << vmSymbols::log2_SID_LIMIT) + \ |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
399 |
((jlong)(x) << (2*vmSymbols::log2_SID_LIMIT)) ) |
1 | 400 |
#define SID_ENUM(n) vmSymbols::VM_SYMBOL_ENUM_NAME(n) |
401 |
||
4562
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
402 |
vmIntrinsics::ID vmIntrinsics::find_id_impl(vmSymbols::SID holder, |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
403 |
vmSymbols::SID name, |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
404 |
vmSymbols::SID sig, |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
405 |
jshort flags) { |
1 | 406 |
assert((int)vmSymbols::SID_LIMIT <= (1<<vmSymbols::log2_SID_LIMIT), "must fit"); |
407 |
||
408 |
// Let the C compiler build the decision tree. |
|
409 |
||
410 |
#define VM_INTRINSIC_CASE(id, klass, name, sig, fcode) \ |
|
411 |
case ID3(SID_ENUM(klass), SID_ENUM(name), SID_ENUM(sig)): \ |
|
412 |
if (!match_##fcode(flags)) break; \ |
|
413 |
return id; |
|
414 |
||
415 |
switch (ID3(holder, name, sig)) { |
|
416 |
VM_INTRINSICS_DO(VM_INTRINSIC_CASE, |
|
417 |
VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE); |
|
418 |
} |
|
419 |
return vmIntrinsics::_none; |
|
420 |
||
421 |
#undef VM_INTRINSIC_CASE |
|
422 |
} |
|
423 |
||
424 |
||
425 |
const char* vmIntrinsics::short_name_as_C_string(vmIntrinsics::ID id, char* buf, int buflen) { |
|
426 |
const char* str = name_at(id); |
|
427 |
#ifndef PRODUCT |
|
428 |
const char* kname = vmSymbols::name_for(class_for(id)); |
|
429 |
const char* mname = vmSymbols::name_for(name_for(id)); |
|
430 |
const char* sname = vmSymbols::name_for(signature_for(id)); |
|
431 |
const char* fname = ""; |
|
432 |
switch (flags_for(id)) { |
|
4450
6d700b859b3e
6892658: C2 should optimize some stringbuilder patterns
never
parents:
670
diff
changeset
|
433 |
case F_Y: fname = "synchronized "; break; |
1 | 434 |
case F_RN: fname = "native "; break; |
435 |
case F_SN: fname = "native static "; break; |
|
436 |
case F_S: fname = "static "; break; |
|
218
a0e996680b05
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
1
diff
changeset
|
437 |
case F_RNY:fname = "native synchronized "; break; |
1 | 438 |
} |
439 |
const char* kptr = strrchr(kname, '/'); |
|
440 |
if (kptr != NULL) kname = kptr + 1; |
|
441 |
int len = jio_snprintf(buf, buflen, "%s: %s%s.%s%s", |
|
442 |
str, fname, kname, mname, sname); |
|
443 |
if (len < buflen) |
|
444 |
str = buf; |
|
445 |
#endif //PRODUCT |
|
446 |
return str; |
|
447 |
} |
|
448 |
||
449 |
||
4562
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
450 |
// These are to get information about intrinsics. |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
451 |
|
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
452 |
#define ID4(x, y, z, f) ((ID3(x, y, z) << vmIntrinsics::log2_FLAG_LIMIT) | (jlong) (f)) |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
453 |
|
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
454 |
static const jlong intrinsic_info_array[vmIntrinsics::ID_LIMIT+1] = { |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
455 |
#define VM_INTRINSIC_INFO(ignore_id, klass, name, sig, fcode) \ |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
456 |
ID4(SID_ENUM(klass), SID_ENUM(name), SID_ENUM(sig), vmIntrinsics::fcode), |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
457 |
|
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
458 |
0, VM_INTRINSICS_DO(VM_INTRINSIC_INFO, |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
459 |
VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE) |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
460 |
0 |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
461 |
#undef VM_INTRINSIC_INFO |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
462 |
}; |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
463 |
|
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
464 |
inline jlong intrinsic_info(vmIntrinsics::ID id) { |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
465 |
return intrinsic_info_array[vmIntrinsics::ID_from((int)id)]; |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
466 |
} |
1 | 467 |
|
468 |
vmSymbols::SID vmIntrinsics::class_for(vmIntrinsics::ID id) { |
|
4562
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
469 |
jlong info = intrinsic_info(id); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
470 |
int shift = 2*vmSymbols::log2_SID_LIMIT + log2_FLAG_LIMIT, mask = right_n_bits(vmSymbols::log2_SID_LIMIT); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
471 |
assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 1021, ""); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
472 |
return vmSymbols::SID( (info >> shift) & mask ); |
1 | 473 |
} |
474 |
||
475 |
vmSymbols::SID vmIntrinsics::name_for(vmIntrinsics::ID id) { |
|
4562
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
476 |
jlong info = intrinsic_info(id); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
477 |
int shift = vmSymbols::log2_SID_LIMIT + log2_FLAG_LIMIT, mask = right_n_bits(vmSymbols::log2_SID_LIMIT); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
478 |
assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 1022, ""); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
479 |
return vmSymbols::SID( (info >> shift) & mask ); |
1 | 480 |
} |
481 |
||
482 |
vmSymbols::SID vmIntrinsics::signature_for(vmIntrinsics::ID id) { |
|
4562
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
483 |
jlong info = intrinsic_info(id); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
484 |
int shift = log2_FLAG_LIMIT, mask = right_n_bits(vmSymbols::log2_SID_LIMIT); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
485 |
assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 1023, ""); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
486 |
return vmSymbols::SID( (info >> shift) & mask ); |
1 | 487 |
} |
488 |
||
489 |
vmIntrinsics::Flags vmIntrinsics::flags_for(vmIntrinsics::ID id) { |
|
4562
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
490 |
jlong info = intrinsic_info(id); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
491 |
int shift = 0, mask = right_n_bits(log2_FLAG_LIMIT); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
492 |
assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 15, ""); |
5d93cb2d2090
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
4450
diff
changeset
|
493 |
return Flags( (info >> shift) & mask ); |
1 | 494 |
} |
495 |
||
496 |
||
497 |
#ifndef PRODUCT |
|
498 |
// verify_method performs an extra check on a matched intrinsic method |
|
499 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
500 |
static bool match_method(methodOop m, Symbol* n, Symbol* s) { |
1 | 501 |
return (m->name() == n && |
502 |
m->signature() == s); |
|
503 |
} |
|
504 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
505 |
static vmIntrinsics::ID match_method_with_klass(methodOop m, Symbol* mk) { |
1 | 506 |
#define VM_INTRINSIC_MATCH(id, klassname, namepart, sigpart, flags) \ |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
507 |
{ Symbol* k = vmSymbols::klassname(); \ |
1 | 508 |
if (mk == k) { \ |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
509 |
Symbol* n = vmSymbols::namepart(); \ |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
510 |
Symbol* s = vmSymbols::sigpart(); \ |
1 | 511 |
if (match_method(m, n, s)) \ |
512 |
return vmIntrinsics::id; \ |
|
513 |
} } |
|
514 |
VM_INTRINSICS_DO(VM_INTRINSIC_MATCH, |
|
515 |
VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE); |
|
516 |
return vmIntrinsics::_none; |
|
517 |
#undef VM_INTRINSIC_MATCH |
|
518 |
} |
|
519 |
||
520 |
void vmIntrinsics::verify_method(ID actual_id, methodOop m) { |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
521 |
Symbol* mk = Klass::cast(m->method_holder())->name(); |
1 | 522 |
ID declared_id = match_method_with_klass(m, mk); |
523 |
||
524 |
if (declared_id == actual_id) return; // success |
|
525 |
||
526 |
if (declared_id == _none && actual_id != _none && mk == vmSymbols::java_lang_StrictMath()) { |
|
527 |
// Here are a few special cases in StrictMath not declared in vmSymbols.hpp. |
|
528 |
switch (actual_id) { |
|
529 |
case _min: |
|
530 |
case _max: |
|
531 |
case _dsqrt: |
|
532 |
declared_id = match_method_with_klass(m, vmSymbols::java_lang_Math()); |
|
533 |
if (declared_id == actual_id) return; // acceptable alias |
|
534 |
break; |
|
535 |
} |
|
536 |
} |
|
537 |
||
538 |
const char* declared_name = name_at(declared_id); |
|
539 |
const char* actual_name = name_at(actual_id); |
|
540 |
methodHandle mh = m; |
|
541 |
m = NULL; |
|
542 |
ttyLocker ttyl; |
|
543 |
if (xtty != NULL) { |
|
544 |
xtty->begin_elem("intrinsic_misdeclared actual='%s' declared='%s'", |
|
545 |
actual_name, declared_name); |
|
546 |
xtty->method(mh); |
|
547 |
xtty->end_elem(""); |
|
548 |
} |
|
549 |
if (PrintMiscellaneous && (WizardMode || Verbose)) { |
|
550 |
tty->print_cr("*** misidentified method; %s(%d) should be %s(%d):", |
|
551 |
declared_name, declared_id, actual_name, actual_id); |
|
218
a0e996680b05
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
1
diff
changeset
|
552 |
mh()->print_short_name(tty); |
1 | 553 |
tty->cr(); |
554 |
} |
|
555 |
} |
|
556 |
#endif //PRODUCT |