author | stefank |
Tue, 12 Apr 2016 09:53:43 +0200 | |
changeset 37466 | 287c4ebd11b0 |
parent 33593 | 60764a78fa5c |
permissions | -rw-r--r-- |
1 | 1 |
/* |
31382
8d526a6991e1
8087133: Improve sharing of native wrappers in SignatureHandlerLibrary
bdelsart
parents:
27471
diff
changeset
|
2 |
* Copyright (c) 1997, 2015, 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:
5421
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5421
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:
5421
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_RUNTIME_SIGNATURE_HPP |
26 |
#define SHARE_VM_RUNTIME_SIGNATURE_HPP |
|
27 |
||
28 |
#include "memory/allocation.hpp" |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
29 |
#include "oops/method.hpp" |
7397 | 30 |
|
1 | 31 |
// SignatureIterators iterate over a Java signature (or parts of it). |
32 |
// (Syntax according to: "The Java Virtual Machine Specification" by |
|
33 |
// Tim Lindholm & Frank Yellin; section 4.3 Descriptors; p. 89ff.) |
|
34 |
// |
|
35 |
// Example: Iterating over ([Lfoo;D)I using |
|
36 |
// 0123456789 |
|
37 |
// |
|
38 |
// iterate_parameters() calls: do_array(2, 7); do_double(); |
|
39 |
// iterate_returntype() calls: do_int(); |
|
40 |
// iterate() calls: do_array(2, 7); do_double(); do_int(); |
|
41 |
// |
|
42 |
// is_return_type() is: false ; false ; true |
|
43 |
// |
|
44 |
// NOTE: The new optimizer has an alternate, for-loop based signature |
|
45 |
// iterator implemented in opto/type.cpp, TypeTuple::make(). |
|
46 |
||
47 |
class SignatureIterator: public ResourceObj { |
|
48 |
protected: |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
49 |
Symbol* _signature; // the signature to iterate over |
1 | 50 |
int _index; // the current character index (only valid during iteration) |
51 |
int _parameter_index; // the current parameter index (0 outside iteration phase) |
|
52 |
BasicType _return_type; |
|
53 |
||
54 |
void expect(char c); |
|
55 |
void skip_optional_size(); |
|
56 |
int parse_type(); // returns the parameter size in words (0 for void) |
|
57 |
void check_signature_end(); |
|
58 |
||
59 |
public: |
|
60 |
// Definitions used in generating and iterating the |
|
61 |
// bit field form of the signature generated by the |
|
62 |
// Fingerprinter. |
|
63 |
enum { |
|
64 |
static_feature_size = 1, |
|
31382
8d526a6991e1
8087133: Improve sharing of native wrappers in SignatureHandlerLibrary
bdelsart
parents:
27471
diff
changeset
|
65 |
is_static_bit = 1, |
8d526a6991e1
8087133: Improve sharing of native wrappers in SignatureHandlerLibrary
bdelsart
parents:
27471
diff
changeset
|
66 |
|
1 | 67 |
result_feature_size = 4, |
68 |
result_feature_mask = 0xF, |
|
69 |
parameter_feature_size = 4, |
|
70 |
parameter_feature_mask = 0xF, |
|
71 |
||
72 |
bool_parm = 1, |
|
73 |
byte_parm = 2, |
|
74 |
char_parm = 3, |
|
75 |
short_parm = 4, |
|
76 |
int_parm = 5, |
|
77 |
long_parm = 6, |
|
78 |
float_parm = 7, |
|
79 |
double_parm = 8, |
|
80 |
obj_parm = 9, |
|
81 |
done_parm = 10, // marker for end of parameters |
|
82 |
||
83 |
// max parameters is wordsize minus |
|
84 |
// The sign bit, termination field, the result and static bit fields |
|
85 |
max_size_of_parameters = (BitsPerLong-1 - |
|
86 |
result_feature_size - parameter_feature_size - |
|
87 |
static_feature_size) / parameter_feature_size |
|
88 |
}; |
|
89 |
||
90 |
// Constructors |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
91 |
SignatureIterator(Symbol* signature); |
1 | 92 |
|
93 |
// Iteration |
|
94 |
void dispatch_field(); // dispatches once for field signatures |
|
95 |
void iterate_parameters(); // iterates over parameters only |
|
96 |
void iterate_parameters( uint64_t fingerprint ); |
|
97 |
void iterate_returntype(); // iterates over returntype only |
|
98 |
void iterate(); // iterates over whole signature |
|
99 |
// Returns the word index of the current parameter; |
|
100 |
int parameter_index() const { return _parameter_index; } |
|
101 |
bool is_return_type() const { return parameter_index() < 0; } |
|
102 |
BasicType get_ret_type() const { return _return_type; } |
|
103 |
||
104 |
// Basic types |
|
105 |
virtual void do_bool () = 0; |
|
106 |
virtual void do_char () = 0; |
|
107 |
virtual void do_float () = 0; |
|
108 |
virtual void do_double() = 0; |
|
109 |
virtual void do_byte () = 0; |
|
110 |
virtual void do_short () = 0; |
|
111 |
virtual void do_int () = 0; |
|
112 |
virtual void do_long () = 0; |
|
113 |
virtual void do_void () = 0; |
|
114 |
||
115 |
// Object types (begin indexes the first character of the entry, end indexes the first character after the entry) |
|
116 |
virtual void do_object(int begin, int end) = 0; |
|
117 |
virtual void do_array (int begin, int end) = 0; |
|
31382
8d526a6991e1
8087133: Improve sharing of native wrappers in SignatureHandlerLibrary
bdelsart
parents:
27471
diff
changeset
|
118 |
|
8d526a6991e1
8087133: Improve sharing of native wrappers in SignatureHandlerLibrary
bdelsart
parents:
27471
diff
changeset
|
119 |
static bool is_static(uint64_t fingerprint) { |
8d526a6991e1
8087133: Improve sharing of native wrappers in SignatureHandlerLibrary
bdelsart
parents:
27471
diff
changeset
|
120 |
assert(fingerprint != (uint64_t)CONST64(-1), "invalid fingerprint"); |
8d526a6991e1
8087133: Improve sharing of native wrappers in SignatureHandlerLibrary
bdelsart
parents:
27471
diff
changeset
|
121 |
return fingerprint & is_static_bit; |
8d526a6991e1
8087133: Improve sharing of native wrappers in SignatureHandlerLibrary
bdelsart
parents:
27471
diff
changeset
|
122 |
} |
8d526a6991e1
8087133: Improve sharing of native wrappers in SignatureHandlerLibrary
bdelsart
parents:
27471
diff
changeset
|
123 |
static BasicType return_type(uint64_t fingerprint) { |
8d526a6991e1
8087133: Improve sharing of native wrappers in SignatureHandlerLibrary
bdelsart
parents:
27471
diff
changeset
|
124 |
assert(fingerprint != (uint64_t)CONST64(-1), "invalid fingerprint"); |
8d526a6991e1
8087133: Improve sharing of native wrappers in SignatureHandlerLibrary
bdelsart
parents:
27471
diff
changeset
|
125 |
return (BasicType) ((fingerprint >> static_feature_size) & result_feature_mask); |
8d526a6991e1
8087133: Improve sharing of native wrappers in SignatureHandlerLibrary
bdelsart
parents:
27471
diff
changeset
|
126 |
} |
1 | 127 |
}; |
128 |
||
129 |
||
130 |
// Specialized SignatureIterators: Used to compute signature specific values. |
|
131 |
||
132 |
class SignatureTypeNames : public SignatureIterator { |
|
133 |
protected: |
|
134 |
virtual void type_name(const char* name) = 0; |
|
135 |
||
136 |
void do_bool() { type_name("jboolean"); } |
|
137 |
void do_char() { type_name("jchar" ); } |
|
138 |
void do_float() { type_name("jfloat" ); } |
|
139 |
void do_double() { type_name("jdouble" ); } |
|
140 |
void do_byte() { type_name("jbyte" ); } |
|
141 |
void do_short() { type_name("jshort" ); } |
|
142 |
void do_int() { type_name("jint" ); } |
|
143 |
void do_long() { type_name("jlong" ); } |
|
144 |
void do_void() { type_name("void" ); } |
|
145 |
void do_object(int begin, int end) { type_name("jobject" ); } |
|
146 |
void do_array (int begin, int end) { type_name("jobject" ); } |
|
147 |
||
148 |
public: |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
149 |
SignatureTypeNames(Symbol* signature) : SignatureIterator(signature) {} |
1 | 150 |
}; |
151 |
||
152 |
||
153 |
class SignatureInfo: public SignatureIterator { |
|
154 |
protected: |
|
155 |
bool _has_iterated; // need this because iterate cannot be called in constructor (set is virtual!) |
|
156 |
bool _has_iterated_return; |
|
157 |
int _size; |
|
158 |
||
159 |
void lazy_iterate_parameters() { if (!_has_iterated) { iterate_parameters(); _has_iterated = true; } } |
|
160 |
void lazy_iterate_return() { if (!_has_iterated_return) { iterate_returntype(); _has_iterated_return = true; } } |
|
161 |
||
162 |
virtual void set(int size, BasicType type) = 0; |
|
163 |
||
164 |
void do_bool () { set(T_BOOLEAN_size, T_BOOLEAN); } |
|
165 |
void do_char () { set(T_CHAR_size , T_CHAR ); } |
|
166 |
void do_float () { set(T_FLOAT_size , T_FLOAT ); } |
|
167 |
void do_double() { set(T_DOUBLE_size , T_DOUBLE ); } |
|
168 |
void do_byte () { set(T_BYTE_size , T_BYTE ); } |
|
169 |
void do_short () { set(T_SHORT_size , T_SHORT ); } |
|
170 |
void do_int () { set(T_INT_size , T_INT ); } |
|
171 |
void do_long () { set(T_LONG_size , T_LONG ); } |
|
172 |
void do_void () { set(T_VOID_size , T_VOID ); } |
|
173 |
void do_object(int begin, int end) { set(T_OBJECT_size , T_OBJECT ); } |
|
174 |
void do_array (int begin, int end) { set(T_ARRAY_size , T_ARRAY ); } |
|
175 |
||
176 |
public: |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
177 |
SignatureInfo(Symbol* signature) : SignatureIterator(signature) { |
1 | 178 |
_has_iterated = _has_iterated_return = false; |
179 |
_size = 0; |
|
180 |
_return_type = T_ILLEGAL; |
|
181 |
} |
|
182 |
||
183 |
}; |
|
184 |
||
185 |
||
186 |
// Specialized SignatureIterator: Used to compute the argument size. |
|
187 |
||
188 |
class ArgumentSizeComputer: public SignatureInfo { |
|
189 |
private: |
|
190 |
void set(int size, BasicType type) { _size += size; } |
|
191 |
public: |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
192 |
ArgumentSizeComputer(Symbol* signature) : SignatureInfo(signature) {} |
1 | 193 |
|
194 |
int size() { lazy_iterate_parameters(); return _size; } |
|
195 |
}; |
|
196 |
||
197 |
||
198 |
class ArgumentCount: public SignatureInfo { |
|
199 |
private: |
|
200 |
void set(int size, BasicType type) { _size ++; } |
|
201 |
public: |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
202 |
ArgumentCount(Symbol* signature) : SignatureInfo(signature) {} |
1 | 203 |
|
204 |
int size() { lazy_iterate_parameters(); return _size; } |
|
205 |
}; |
|
206 |
||
207 |
||
208 |
// Specialized SignatureIterator: Used to compute the result type. |
|
209 |
||
210 |
class ResultTypeFinder: public SignatureInfo { |
|
211 |
private: |
|
212 |
void set(int size, BasicType type) { _return_type = type; } |
|
213 |
public: |
|
214 |
BasicType type() { lazy_iterate_return(); return _return_type; } |
|
215 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
216 |
ResultTypeFinder(Symbol* signature) : SignatureInfo(signature) {} |
1 | 217 |
}; |
218 |
||
219 |
||
220 |
// Fingerprinter computes a unique ID for a given method. The ID |
|
221 |
// is a bitvector characterizing the methods signature (incl. the receiver). |
|
222 |
class Fingerprinter: public SignatureIterator { |
|
223 |
private: |
|
224 |
uint64_t _fingerprint; |
|
225 |
int _shift_count; |
|
226 |
methodHandle mh; |
|
227 |
||
228 |
public: |
|
229 |
||
230 |
void do_bool() { _fingerprint |= (((uint64_t)bool_parm) << _shift_count); _shift_count += parameter_feature_size; } |
|
231 |
void do_char() { _fingerprint |= (((uint64_t)char_parm) << _shift_count); _shift_count += parameter_feature_size; } |
|
232 |
void do_byte() { _fingerprint |= (((uint64_t)byte_parm) << _shift_count); _shift_count += parameter_feature_size; } |
|
233 |
void do_short() { _fingerprint |= (((uint64_t)short_parm) << _shift_count); _shift_count += parameter_feature_size; } |
|
234 |
void do_int() { _fingerprint |= (((uint64_t)int_parm) << _shift_count); _shift_count += parameter_feature_size; } |
|
235 |
void do_long() { _fingerprint |= (((uint64_t)long_parm) << _shift_count); _shift_count += parameter_feature_size; } |
|
236 |
void do_float() { _fingerprint |= (((uint64_t)float_parm) << _shift_count); _shift_count += parameter_feature_size; } |
|
237 |
void do_double() { _fingerprint |= (((uint64_t)double_parm) << _shift_count); _shift_count += parameter_feature_size; } |
|
238 |
||
239 |
void do_object(int begin, int end) { _fingerprint |= (((uint64_t)obj_parm) << _shift_count); _shift_count += parameter_feature_size; } |
|
240 |
void do_array (int begin, int end) { _fingerprint |= (((uint64_t)obj_parm) << _shift_count); _shift_count += parameter_feature_size; } |
|
241 |
||
242 |
void do_void() { ShouldNotReachHere(); } |
|
243 |
||
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
31382
diff
changeset
|
244 |
Fingerprinter(const methodHandle& method) : SignatureIterator(method->signature()) { |
1 | 245 |
mh = method; |
246 |
_fingerprint = 0; |
|
247 |
} |
|
248 |
||
249 |
uint64_t fingerprint() { |
|
250 |
// See if we fingerprinted this method already |
|
251 |
if (mh->constMethod()->fingerprint() != CONST64(0)) { |
|
252 |
return mh->constMethod()->fingerprint(); |
|
253 |
} |
|
254 |
||
255 |
if (mh->size_of_parameters() > max_size_of_parameters ) { |
|
27471 | 256 |
_fingerprint = (uint64_t)CONST64(-1); |
1 | 257 |
mh->constMethod()->set_fingerprint(_fingerprint); |
258 |
return _fingerprint; |
|
259 |
} |
|
260 |
||
261 |
assert( (int)mh->result_type() <= (int)result_feature_mask, "bad result type"); |
|
262 |
_fingerprint = mh->result_type(); |
|
263 |
_fingerprint <<= static_feature_size; |
|
264 |
if (mh->is_static()) _fingerprint |= 1; |
|
265 |
_shift_count = result_feature_size + static_feature_size; |
|
266 |
iterate_parameters(); |
|
267 |
_fingerprint |= ((uint64_t)done_parm) << _shift_count;// mark end of sig |
|
268 |
mh->constMethod()->set_fingerprint(_fingerprint); |
|
269 |
return _fingerprint; |
|
270 |
} |
|
271 |
}; |
|
272 |
||
273 |
||
274 |
// Specialized SignatureIterator: Used for native call purposes |
|
275 |
||
276 |
class NativeSignatureIterator: public SignatureIterator { |
|
277 |
private: |
|
278 |
methodHandle _method; |
|
2131 | 279 |
// We need separate JNI and Java offset values because in 64 bit mode, |
1 | 280 |
// the argument offsets are not in sync with the Java stack. |
281 |
// For example a long takes up 1 "C" stack entry but 2 Java stack entries. |
|
282 |
int _offset; // The java stack offset |
|
283 |
int _prepended; // number of prepended JNI parameters (1 JNIEnv, plus 1 mirror if static) |
|
284 |
int _jni_offset; // the current parameter offset, starting with 0 |
|
285 |
||
286 |
void do_bool () { pass_int(); _jni_offset++; _offset++; } |
|
287 |
void do_char () { pass_int(); _jni_offset++; _offset++; } |
|
4013 | 288 |
void do_float () { pass_float(); _jni_offset++; _offset++; } |
1 | 289 |
#ifdef _LP64 |
290 |
void do_double() { pass_double(); _jni_offset++; _offset += 2; } |
|
291 |
#else |
|
292 |
void do_double() { pass_double(); _jni_offset += 2; _offset += 2; } |
|
293 |
#endif |
|
294 |
void do_byte () { pass_int(); _jni_offset++; _offset++; } |
|
295 |
void do_short () { pass_int(); _jni_offset++; _offset++; } |
|
296 |
void do_int () { pass_int(); _jni_offset++; _offset++; } |
|
297 |
#ifdef _LP64 |
|
298 |
void do_long () { pass_long(); _jni_offset++; _offset += 2; } |
|
299 |
#else |
|
300 |
void do_long () { pass_long(); _jni_offset += 2; _offset += 2; } |
|
301 |
#endif |
|
302 |
void do_void () { ShouldNotReachHere(); } |
|
303 |
void do_object(int begin, int end) { pass_object(); _jni_offset++; _offset++; } |
|
304 |
void do_array (int begin, int end) { pass_object(); _jni_offset++; _offset++; } |
|
305 |
||
306 |
public: |
|
307 |
methodHandle method() const { return _method; } |
|
308 |
int offset() const { return _offset; } |
|
309 |
int jni_offset() const { return _jni_offset + _prepended; } |
|
310 |
// int java_offset() const { return method()->size_of_parameters() - _offset - 1; } |
|
311 |
bool is_static() const { return method()->is_static(); } |
|
312 |
virtual void pass_int() = 0; |
|
313 |
virtual void pass_long() = 0; |
|
314 |
virtual void pass_object() = 0; |
|
4013 | 315 |
virtual void pass_float() = 0; |
1 | 316 |
#ifdef _LP64 |
317 |
virtual void pass_double() = 0; |
|
318 |
#else |
|
319 |
virtual void pass_double() { pass_long(); } // may be same as long |
|
320 |
#endif |
|
321 |
||
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
31382
diff
changeset
|
322 |
NativeSignatureIterator(const methodHandle& method) : SignatureIterator(method->signature()) { |
1 | 323 |
_method = method; |
324 |
_offset = 0; |
|
325 |
_jni_offset = 0; |
|
326 |
||
327 |
const int JNIEnv_words = 1; |
|
328 |
const int mirror_words = 1; |
|
329 |
_prepended = !is_static() ? JNIEnv_words : JNIEnv_words + mirror_words; |
|
330 |
} |
|
331 |
||
332 |
// iterate() calles the 2 virtual methods according to the following invocation syntax: |
|
333 |
// |
|
334 |
// {pass_int | pass_long | pass_object} |
|
335 |
// |
|
336 |
// Arguments are handled from left to right (receiver first, if any). |
|
337 |
// The offset() values refer to the Java stack offsets but are 0 based and increasing. |
|
338 |
// The java_offset() values count down to 0, and refer to the Java TOS. |
|
339 |
// The jni_offset() values increase from 1 or 2, and refer to C arguments. |
|
340 |
||
341 |
void iterate() { iterate(Fingerprinter(method()).fingerprint()); |
|
342 |
} |
|
343 |
||
344 |
||
345 |
// Optimized path if we have the bitvector form of signature |
|
346 |
void iterate( uint64_t fingerprint ) { |
|
347 |
||
348 |
if (!is_static()) { |
|
349 |
// handle receiver (not handled by iterate because not in signature) |
|
350 |
pass_object(); _jni_offset++; _offset++; |
|
351 |
} |
|
352 |
||
353 |
SignatureIterator::iterate_parameters( fingerprint ); |
|
354 |
} |
|
355 |
}; |
|
356 |
||
357 |
||
358 |
// Handy stream for iterating over signature |
|
359 |
||
360 |
class SignatureStream : public StackObj { |
|
361 |
private: |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
362 |
Symbol* _signature; |
1 | 363 |
int _begin; |
364 |
int _end; |
|
365 |
BasicType _type; |
|
366 |
bool _at_return_type; |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
367 |
GrowableArray<Symbol*>* _names; // symbols created while parsing signature |
1 | 368 |
|
369 |
public: |
|
370 |
bool at_return_type() const { return _at_return_type; } |
|
371 |
bool is_done() const; |
|
372 |
void next_non_primitive(int t); |
|
373 |
void next() { |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
374 |
Symbol* sig = _signature; |
1 | 375 |
int len = sig->utf8_length(); |
376 |
if (_end >= len) { |
|
377 |
_end = len + 1; |
|
378 |
return; |
|
379 |
} |
|
380 |
||
381 |
_begin = _end; |
|
382 |
int t = sig->byte_at(_begin); |
|
383 |
switch (t) { |
|
384 |
case 'B': _type = T_BYTE; break; |
|
385 |
case 'C': _type = T_CHAR; break; |
|
386 |
case 'D': _type = T_DOUBLE; break; |
|
387 |
case 'F': _type = T_FLOAT; break; |
|
388 |
case 'I': _type = T_INT; break; |
|
389 |
case 'J': _type = T_LONG; break; |
|
390 |
case 'S': _type = T_SHORT; break; |
|
391 |
case 'Z': _type = T_BOOLEAN; break; |
|
392 |
case 'V': _type = T_VOID; break; |
|
393 |
default : next_non_primitive(t); |
|
394 |
return; |
|
395 |
} |
|
396 |
_end++; |
|
397 |
} |
|
398 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
399 |
SignatureStream(Symbol* signature, bool is_method = true); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
400 |
~SignatureStream(); |
1 | 401 |
|
402 |
bool is_object() const; // True if this argument is an object |
|
403 |
bool is_array() const; // True if this argument is an array |
|
404 |
BasicType type() const { return _type; } |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
405 |
Symbol* as_symbol(TRAPS); |
5421
e294db54fc0d
6939196: method handle signatures off the boot class path get linkage errors
jrose
parents:
4013
diff
changeset
|
406 |
enum FailureMode { ReturnNull, CNFException, NCDFError }; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
407 |
Klass* as_klass(Handle class_loader, Handle protection_domain, FailureMode failure_mode, TRAPS); |
5421
e294db54fc0d
6939196: method handle signatures off the boot class path get linkage errors
jrose
parents:
4013
diff
changeset
|
408 |
oop as_java_mirror(Handle class_loader, Handle protection_domain, FailureMode failure_mode, TRAPS); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8921
diff
changeset
|
409 |
const jbyte* raw_bytes() { return _signature->bytes() + _begin; } |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
8921
diff
changeset
|
410 |
int raw_length() { return _end - _begin; } |
1 | 411 |
|
412 |
// return same as_symbol except allocation of new symbols is avoided. |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
413 |
Symbol* as_symbol_or_null(); |
20702
bbe0fcde6e13
8023657: New type profiling points: arguments to call
roland
parents:
13728
diff
changeset
|
414 |
|
bbe0fcde6e13
8023657: New type profiling points: arguments to call
roland
parents:
13728
diff
changeset
|
415 |
// count the number of references in the signature |
bbe0fcde6e13
8023657: New type profiling points: arguments to call
roland
parents:
13728
diff
changeset
|
416 |
int reference_parameter_count(); |
1 | 417 |
}; |
418 |
||
419 |
class SignatureVerifier : public StackObj { |
|
420 |
public: |
|
421 |
// Returns true if the symbol is valid method or type signature |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
422 |
static bool is_valid_signature(Symbol* sig); |
1 | 423 |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
424 |
static bool is_valid_method_signature(Symbol* sig); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
425 |
static bool is_valid_type_signature(Symbol* sig); |
1 | 426 |
private: |
427 |
||
428 |
static ssize_t is_valid_type(const char*, ssize_t); |
|
429 |
static bool invalid_name_char(char); |
|
430 |
}; |
|
7397 | 431 |
|
432 |
#endif // SHARE_VM_RUNTIME_SIGNATURE_HPP |