Sat, 28 Mar 2009 15:47:29 -0700
6819891: ParNew: Fix work queue overflow code to deal correctly with +UseCompressedOops
Summary: When using compressed oops, rather than chaining the overflowed grey objects' pre-images through their klass words, we use GC-worker thread-local overflow stacks.
Reviewed-by: jcoomes, jmasa
duke@435 | 1 | /* |
duke@435 | 2 | * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | // SignatureIterators iterate over a Java signature (or parts of it). |
duke@435 | 26 | // (Syntax according to: "The Java Virtual Machine Specification" by |
duke@435 | 27 | // Tim Lindholm & Frank Yellin; section 4.3 Descriptors; p. 89ff.) |
duke@435 | 28 | // |
duke@435 | 29 | // Example: Iterating over ([Lfoo;D)I using |
duke@435 | 30 | // 0123456789 |
duke@435 | 31 | // |
duke@435 | 32 | // iterate_parameters() calls: do_array(2, 7); do_double(); |
duke@435 | 33 | // iterate_returntype() calls: do_int(); |
duke@435 | 34 | // iterate() calls: do_array(2, 7); do_double(); do_int(); |
duke@435 | 35 | // |
duke@435 | 36 | // is_return_type() is: false ; false ; true |
duke@435 | 37 | // |
duke@435 | 38 | // NOTE: The new optimizer has an alternate, for-loop based signature |
duke@435 | 39 | // iterator implemented in opto/type.cpp, TypeTuple::make(). |
duke@435 | 40 | |
duke@435 | 41 | class SignatureIterator: public ResourceObj { |
duke@435 | 42 | protected: |
duke@435 | 43 | symbolHandle _signature; // the signature to iterate over |
duke@435 | 44 | int _index; // the current character index (only valid during iteration) |
duke@435 | 45 | int _parameter_index; // the current parameter index (0 outside iteration phase) |
duke@435 | 46 | BasicType _return_type; |
duke@435 | 47 | |
duke@435 | 48 | void expect(char c); |
duke@435 | 49 | void skip_optional_size(); |
duke@435 | 50 | int parse_type(); // returns the parameter size in words (0 for void) |
duke@435 | 51 | void check_signature_end(); |
duke@435 | 52 | |
duke@435 | 53 | public: |
duke@435 | 54 | // Definitions used in generating and iterating the |
duke@435 | 55 | // bit field form of the signature generated by the |
duke@435 | 56 | // Fingerprinter. |
duke@435 | 57 | enum { |
duke@435 | 58 | static_feature_size = 1, |
duke@435 | 59 | result_feature_size = 4, |
duke@435 | 60 | result_feature_mask = 0xF, |
duke@435 | 61 | parameter_feature_size = 4, |
duke@435 | 62 | parameter_feature_mask = 0xF, |
duke@435 | 63 | |
duke@435 | 64 | bool_parm = 1, |
duke@435 | 65 | byte_parm = 2, |
duke@435 | 66 | char_parm = 3, |
duke@435 | 67 | short_parm = 4, |
duke@435 | 68 | int_parm = 5, |
duke@435 | 69 | long_parm = 6, |
duke@435 | 70 | float_parm = 7, |
duke@435 | 71 | double_parm = 8, |
duke@435 | 72 | obj_parm = 9, |
duke@435 | 73 | done_parm = 10, // marker for end of parameters |
duke@435 | 74 | |
duke@435 | 75 | // max parameters is wordsize minus |
duke@435 | 76 | // The sign bit, termination field, the result and static bit fields |
duke@435 | 77 | max_size_of_parameters = (BitsPerLong-1 - |
duke@435 | 78 | result_feature_size - parameter_feature_size - |
duke@435 | 79 | static_feature_size) / parameter_feature_size |
duke@435 | 80 | }; |
duke@435 | 81 | |
duke@435 | 82 | // Constructors |
duke@435 | 83 | SignatureIterator(symbolOop signature); |
duke@435 | 84 | SignatureIterator(Thread *thread, symbolOop signature); |
duke@435 | 85 | SignatureIterator(symbolHandle signature); |
duke@435 | 86 | |
duke@435 | 87 | // Iteration |
duke@435 | 88 | void dispatch_field(); // dispatches once for field signatures |
duke@435 | 89 | void iterate_parameters(); // iterates over parameters only |
duke@435 | 90 | void iterate_parameters( uint64_t fingerprint ); |
duke@435 | 91 | void iterate_returntype(); // iterates over returntype only |
duke@435 | 92 | void iterate(); // iterates over whole signature |
duke@435 | 93 | // Returns the word index of the current parameter; |
duke@435 | 94 | int parameter_index() const { return _parameter_index; } |
duke@435 | 95 | bool is_return_type() const { return parameter_index() < 0; } |
duke@435 | 96 | BasicType get_ret_type() const { return _return_type; } |
duke@435 | 97 | |
duke@435 | 98 | // Basic types |
duke@435 | 99 | virtual void do_bool () = 0; |
duke@435 | 100 | virtual void do_char () = 0; |
duke@435 | 101 | virtual void do_float () = 0; |
duke@435 | 102 | virtual void do_double() = 0; |
duke@435 | 103 | virtual void do_byte () = 0; |
duke@435 | 104 | virtual void do_short () = 0; |
duke@435 | 105 | virtual void do_int () = 0; |
duke@435 | 106 | virtual void do_long () = 0; |
duke@435 | 107 | virtual void do_void () = 0; |
duke@435 | 108 | |
duke@435 | 109 | // Object types (begin indexes the first character of the entry, end indexes the first character after the entry) |
duke@435 | 110 | virtual void do_object(int begin, int end) = 0; |
duke@435 | 111 | virtual void do_array (int begin, int end) = 0; |
duke@435 | 112 | }; |
duke@435 | 113 | |
duke@435 | 114 | |
duke@435 | 115 | // Specialized SignatureIterators: Used to compute signature specific values. |
duke@435 | 116 | |
duke@435 | 117 | class SignatureTypeNames : public SignatureIterator { |
duke@435 | 118 | protected: |
duke@435 | 119 | virtual void type_name(const char* name) = 0; |
duke@435 | 120 | |
duke@435 | 121 | void do_bool() { type_name("jboolean"); } |
duke@435 | 122 | void do_char() { type_name("jchar" ); } |
duke@435 | 123 | void do_float() { type_name("jfloat" ); } |
duke@435 | 124 | void do_double() { type_name("jdouble" ); } |
duke@435 | 125 | void do_byte() { type_name("jbyte" ); } |
duke@435 | 126 | void do_short() { type_name("jshort" ); } |
duke@435 | 127 | void do_int() { type_name("jint" ); } |
duke@435 | 128 | void do_long() { type_name("jlong" ); } |
duke@435 | 129 | void do_void() { type_name("void" ); } |
duke@435 | 130 | void do_object(int begin, int end) { type_name("jobject" ); } |
duke@435 | 131 | void do_array (int begin, int end) { type_name("jobject" ); } |
duke@435 | 132 | |
duke@435 | 133 | public: |
duke@435 | 134 | SignatureTypeNames(symbolHandle signature) : SignatureIterator(signature) {} |
duke@435 | 135 | }; |
duke@435 | 136 | |
duke@435 | 137 | |
duke@435 | 138 | class SignatureInfo: public SignatureIterator { |
duke@435 | 139 | protected: |
duke@435 | 140 | bool _has_iterated; // need this because iterate cannot be called in constructor (set is virtual!) |
duke@435 | 141 | bool _has_iterated_return; |
duke@435 | 142 | int _size; |
duke@435 | 143 | |
duke@435 | 144 | void lazy_iterate_parameters() { if (!_has_iterated) { iterate_parameters(); _has_iterated = true; } } |
duke@435 | 145 | void lazy_iterate_return() { if (!_has_iterated_return) { iterate_returntype(); _has_iterated_return = true; } } |
duke@435 | 146 | |
duke@435 | 147 | virtual void set(int size, BasicType type) = 0; |
duke@435 | 148 | |
duke@435 | 149 | void do_bool () { set(T_BOOLEAN_size, T_BOOLEAN); } |
duke@435 | 150 | void do_char () { set(T_CHAR_size , T_CHAR ); } |
duke@435 | 151 | void do_float () { set(T_FLOAT_size , T_FLOAT ); } |
duke@435 | 152 | void do_double() { set(T_DOUBLE_size , T_DOUBLE ); } |
duke@435 | 153 | void do_byte () { set(T_BYTE_size , T_BYTE ); } |
duke@435 | 154 | void do_short () { set(T_SHORT_size , T_SHORT ); } |
duke@435 | 155 | void do_int () { set(T_INT_size , T_INT ); } |
duke@435 | 156 | void do_long () { set(T_LONG_size , T_LONG ); } |
duke@435 | 157 | void do_void () { set(T_VOID_size , T_VOID ); } |
duke@435 | 158 | void do_object(int begin, int end) { set(T_OBJECT_size , T_OBJECT ); } |
duke@435 | 159 | void do_array (int begin, int end) { set(T_ARRAY_size , T_ARRAY ); } |
duke@435 | 160 | |
duke@435 | 161 | public: |
duke@435 | 162 | SignatureInfo(symbolHandle signature) : SignatureIterator(signature) { |
duke@435 | 163 | _has_iterated = _has_iterated_return = false; |
duke@435 | 164 | _size = 0; |
duke@435 | 165 | _return_type = T_ILLEGAL; |
duke@435 | 166 | } |
duke@435 | 167 | |
duke@435 | 168 | }; |
duke@435 | 169 | |
duke@435 | 170 | |
duke@435 | 171 | // Specialized SignatureIterator: Used to compute the argument size. |
duke@435 | 172 | |
duke@435 | 173 | class ArgumentSizeComputer: public SignatureInfo { |
duke@435 | 174 | private: |
duke@435 | 175 | void set(int size, BasicType type) { _size += size; } |
duke@435 | 176 | public: |
duke@435 | 177 | ArgumentSizeComputer(symbolHandle signature) : SignatureInfo(signature) {} |
duke@435 | 178 | |
duke@435 | 179 | int size() { lazy_iterate_parameters(); return _size; } |
duke@435 | 180 | }; |
duke@435 | 181 | |
duke@435 | 182 | |
duke@435 | 183 | class ArgumentCount: public SignatureInfo { |
duke@435 | 184 | private: |
duke@435 | 185 | void set(int size, BasicType type) { _size ++; } |
duke@435 | 186 | public: |
duke@435 | 187 | ArgumentCount(symbolHandle signature) : SignatureInfo(signature) {} |
duke@435 | 188 | |
duke@435 | 189 | int size() { lazy_iterate_parameters(); return _size; } |
duke@435 | 190 | }; |
duke@435 | 191 | |
duke@435 | 192 | |
duke@435 | 193 | // Specialized SignatureIterator: Used to compute the result type. |
duke@435 | 194 | |
duke@435 | 195 | class ResultTypeFinder: public SignatureInfo { |
duke@435 | 196 | private: |
duke@435 | 197 | void set(int size, BasicType type) { _return_type = type; } |
duke@435 | 198 | public: |
duke@435 | 199 | BasicType type() { lazy_iterate_return(); return _return_type; } |
duke@435 | 200 | |
duke@435 | 201 | ResultTypeFinder(symbolHandle signature) : SignatureInfo(signature) {} |
duke@435 | 202 | }; |
duke@435 | 203 | |
duke@435 | 204 | |
duke@435 | 205 | // Fingerprinter computes a unique ID for a given method. The ID |
duke@435 | 206 | // is a bitvector characterizing the methods signature (incl. the receiver). |
duke@435 | 207 | class Fingerprinter: public SignatureIterator { |
duke@435 | 208 | private: |
duke@435 | 209 | uint64_t _fingerprint; |
duke@435 | 210 | int _shift_count; |
duke@435 | 211 | methodHandle mh; |
duke@435 | 212 | |
duke@435 | 213 | public: |
duke@435 | 214 | |
duke@435 | 215 | void do_bool() { _fingerprint |= (((uint64_t)bool_parm) << _shift_count); _shift_count += parameter_feature_size; } |
duke@435 | 216 | void do_char() { _fingerprint |= (((uint64_t)char_parm) << _shift_count); _shift_count += parameter_feature_size; } |
duke@435 | 217 | void do_byte() { _fingerprint |= (((uint64_t)byte_parm) << _shift_count); _shift_count += parameter_feature_size; } |
duke@435 | 218 | void do_short() { _fingerprint |= (((uint64_t)short_parm) << _shift_count); _shift_count += parameter_feature_size; } |
duke@435 | 219 | void do_int() { _fingerprint |= (((uint64_t)int_parm) << _shift_count); _shift_count += parameter_feature_size; } |
duke@435 | 220 | void do_long() { _fingerprint |= (((uint64_t)long_parm) << _shift_count); _shift_count += parameter_feature_size; } |
duke@435 | 221 | void do_float() { _fingerprint |= (((uint64_t)float_parm) << _shift_count); _shift_count += parameter_feature_size; } |
duke@435 | 222 | void do_double() { _fingerprint |= (((uint64_t)double_parm) << _shift_count); _shift_count += parameter_feature_size; } |
duke@435 | 223 | |
duke@435 | 224 | void do_object(int begin, int end) { _fingerprint |= (((uint64_t)obj_parm) << _shift_count); _shift_count += parameter_feature_size; } |
duke@435 | 225 | void do_array (int begin, int end) { _fingerprint |= (((uint64_t)obj_parm) << _shift_count); _shift_count += parameter_feature_size; } |
duke@435 | 226 | |
duke@435 | 227 | void do_void() { ShouldNotReachHere(); } |
duke@435 | 228 | |
duke@435 | 229 | Fingerprinter(methodHandle method) : SignatureIterator(method->signature()) { |
duke@435 | 230 | mh = method; |
duke@435 | 231 | _fingerprint = 0; |
duke@435 | 232 | } |
duke@435 | 233 | |
duke@435 | 234 | Fingerprinter(Thread *thread, methodHandle method) : SignatureIterator(thread, method->signature()) { |
duke@435 | 235 | mh = method; |
duke@435 | 236 | _fingerprint = 0; |
duke@435 | 237 | } |
duke@435 | 238 | |
duke@435 | 239 | uint64_t fingerprint() { |
duke@435 | 240 | // See if we fingerprinted this method already |
duke@435 | 241 | if (mh->constMethod()->fingerprint() != CONST64(0)) { |
duke@435 | 242 | return mh->constMethod()->fingerprint(); |
duke@435 | 243 | } |
duke@435 | 244 | |
duke@435 | 245 | if (mh->size_of_parameters() > max_size_of_parameters ) { |
duke@435 | 246 | _fingerprint = UCONST64(-1); |
duke@435 | 247 | mh->constMethod()->set_fingerprint(_fingerprint); |
duke@435 | 248 | return _fingerprint; |
duke@435 | 249 | } |
duke@435 | 250 | |
duke@435 | 251 | assert( (int)mh->result_type() <= (int)result_feature_mask, "bad result type"); |
duke@435 | 252 | _fingerprint = mh->result_type(); |
duke@435 | 253 | _fingerprint <<= static_feature_size; |
duke@435 | 254 | if (mh->is_static()) _fingerprint |= 1; |
duke@435 | 255 | _shift_count = result_feature_size + static_feature_size; |
duke@435 | 256 | iterate_parameters(); |
duke@435 | 257 | _fingerprint |= ((uint64_t)done_parm) << _shift_count;// mark end of sig |
duke@435 | 258 | mh->constMethod()->set_fingerprint(_fingerprint); |
duke@435 | 259 | return _fingerprint; |
duke@435 | 260 | } |
duke@435 | 261 | }; |
duke@435 | 262 | |
duke@435 | 263 | |
duke@435 | 264 | // Specialized SignatureIterator: Used for native call purposes |
duke@435 | 265 | |
duke@435 | 266 | class NativeSignatureIterator: public SignatureIterator { |
duke@435 | 267 | private: |
duke@435 | 268 | methodHandle _method; |
twisti@1040 | 269 | // We need separate JNI and Java offset values because in 64 bit mode, |
duke@435 | 270 | // the argument offsets are not in sync with the Java stack. |
duke@435 | 271 | // For example a long takes up 1 "C" stack entry but 2 Java stack entries. |
duke@435 | 272 | int _offset; // The java stack offset |
duke@435 | 273 | int _prepended; // number of prepended JNI parameters (1 JNIEnv, plus 1 mirror if static) |
duke@435 | 274 | int _jni_offset; // the current parameter offset, starting with 0 |
duke@435 | 275 | |
duke@435 | 276 | void do_bool () { pass_int(); _jni_offset++; _offset++; } |
duke@435 | 277 | void do_char () { pass_int(); _jni_offset++; _offset++; } |
duke@435 | 278 | #ifdef _LP64 |
duke@435 | 279 | void do_float () { pass_float(); _jni_offset++; _offset++; } |
duke@435 | 280 | void do_double() { pass_double(); _jni_offset++; _offset += 2; } |
duke@435 | 281 | #else |
duke@435 | 282 | void do_float () { pass_int(); _jni_offset++; _offset++; } |
duke@435 | 283 | void do_double() { pass_double(); _jni_offset += 2; _offset += 2; } |
duke@435 | 284 | #endif |
duke@435 | 285 | void do_byte () { pass_int(); _jni_offset++; _offset++; } |
duke@435 | 286 | void do_short () { pass_int(); _jni_offset++; _offset++; } |
duke@435 | 287 | void do_int () { pass_int(); _jni_offset++; _offset++; } |
duke@435 | 288 | #ifdef _LP64 |
duke@435 | 289 | void do_long () { pass_long(); _jni_offset++; _offset += 2; } |
duke@435 | 290 | #else |
duke@435 | 291 | void do_long () { pass_long(); _jni_offset += 2; _offset += 2; } |
duke@435 | 292 | #endif |
duke@435 | 293 | void do_void () { ShouldNotReachHere(); } |
duke@435 | 294 | void do_object(int begin, int end) { pass_object(); _jni_offset++; _offset++; } |
duke@435 | 295 | void do_array (int begin, int end) { pass_object(); _jni_offset++; _offset++; } |
duke@435 | 296 | |
duke@435 | 297 | public: |
duke@435 | 298 | methodHandle method() const { return _method; } |
duke@435 | 299 | int offset() const { return _offset; } |
duke@435 | 300 | int jni_offset() const { return _jni_offset + _prepended; } |
duke@435 | 301 | // int java_offset() const { return method()->size_of_parameters() - _offset - 1; } |
duke@435 | 302 | bool is_static() const { return method()->is_static(); } |
duke@435 | 303 | virtual void pass_int() = 0; |
duke@435 | 304 | virtual void pass_long() = 0; |
duke@435 | 305 | virtual void pass_object() = 0; |
duke@435 | 306 | #ifdef _LP64 |
duke@435 | 307 | virtual void pass_float() = 0; |
duke@435 | 308 | virtual void pass_double() = 0; |
duke@435 | 309 | #else |
duke@435 | 310 | virtual void pass_double() { pass_long(); } // may be same as long |
duke@435 | 311 | #endif |
duke@435 | 312 | |
duke@435 | 313 | NativeSignatureIterator(methodHandle method) : SignatureIterator(method->signature()) { |
duke@435 | 314 | _method = method; |
duke@435 | 315 | _offset = 0; |
duke@435 | 316 | _jni_offset = 0; |
duke@435 | 317 | |
duke@435 | 318 | const int JNIEnv_words = 1; |
duke@435 | 319 | const int mirror_words = 1; |
duke@435 | 320 | _prepended = !is_static() ? JNIEnv_words : JNIEnv_words + mirror_words; |
duke@435 | 321 | } |
duke@435 | 322 | |
duke@435 | 323 | // iterate() calles the 2 virtual methods according to the following invocation syntax: |
duke@435 | 324 | // |
duke@435 | 325 | // {pass_int | pass_long | pass_object} |
duke@435 | 326 | // |
duke@435 | 327 | // Arguments are handled from left to right (receiver first, if any). |
duke@435 | 328 | // The offset() values refer to the Java stack offsets but are 0 based and increasing. |
duke@435 | 329 | // The java_offset() values count down to 0, and refer to the Java TOS. |
duke@435 | 330 | // The jni_offset() values increase from 1 or 2, and refer to C arguments. |
duke@435 | 331 | |
duke@435 | 332 | void iterate() { iterate(Fingerprinter(method()).fingerprint()); |
duke@435 | 333 | } |
duke@435 | 334 | |
duke@435 | 335 | |
duke@435 | 336 | // Optimized path if we have the bitvector form of signature |
duke@435 | 337 | void iterate( uint64_t fingerprint ) { |
duke@435 | 338 | |
duke@435 | 339 | if (!is_static()) { |
duke@435 | 340 | // handle receiver (not handled by iterate because not in signature) |
duke@435 | 341 | pass_object(); _jni_offset++; _offset++; |
duke@435 | 342 | } |
duke@435 | 343 | |
duke@435 | 344 | SignatureIterator::iterate_parameters( fingerprint ); |
duke@435 | 345 | } |
duke@435 | 346 | }; |
duke@435 | 347 | |
duke@435 | 348 | |
duke@435 | 349 | // Handy stream for iterating over signature |
duke@435 | 350 | |
duke@435 | 351 | class SignatureStream : public StackObj { |
duke@435 | 352 | private: |
duke@435 | 353 | symbolHandle _signature; |
duke@435 | 354 | int _begin; |
duke@435 | 355 | int _end; |
duke@435 | 356 | BasicType _type; |
duke@435 | 357 | bool _at_return_type; |
duke@435 | 358 | |
duke@435 | 359 | public: |
duke@435 | 360 | bool at_return_type() const { return _at_return_type; } |
duke@435 | 361 | bool is_done() const; |
duke@435 | 362 | void next_non_primitive(int t); |
duke@435 | 363 | void next() { |
duke@435 | 364 | symbolOop sig = _signature(); |
duke@435 | 365 | int len = sig->utf8_length(); |
duke@435 | 366 | if (_end >= len) { |
duke@435 | 367 | _end = len + 1; |
duke@435 | 368 | return; |
duke@435 | 369 | } |
duke@435 | 370 | |
duke@435 | 371 | _begin = _end; |
duke@435 | 372 | int t = sig->byte_at(_begin); |
duke@435 | 373 | switch (t) { |
duke@435 | 374 | case 'B': _type = T_BYTE; break; |
duke@435 | 375 | case 'C': _type = T_CHAR; break; |
duke@435 | 376 | case 'D': _type = T_DOUBLE; break; |
duke@435 | 377 | case 'F': _type = T_FLOAT; break; |
duke@435 | 378 | case 'I': _type = T_INT; break; |
duke@435 | 379 | case 'J': _type = T_LONG; break; |
duke@435 | 380 | case 'S': _type = T_SHORT; break; |
duke@435 | 381 | case 'Z': _type = T_BOOLEAN; break; |
duke@435 | 382 | case 'V': _type = T_VOID; break; |
duke@435 | 383 | default : next_non_primitive(t); |
duke@435 | 384 | return; |
duke@435 | 385 | } |
duke@435 | 386 | _end++; |
duke@435 | 387 | } |
duke@435 | 388 | |
duke@435 | 389 | SignatureStream(symbolHandle signature, |
duke@435 | 390 | bool is_method = true) : |
duke@435 | 391 | _signature(signature), _at_return_type(false) { |
duke@435 | 392 | _begin = _end = (is_method ? 1 : 0); // skip first '(' in method signatures |
duke@435 | 393 | next(); |
duke@435 | 394 | } |
duke@435 | 395 | |
duke@435 | 396 | bool is_object() const; // True if this argument is an object |
duke@435 | 397 | bool is_array() const; // True if this argument is an array |
duke@435 | 398 | BasicType type() const { return _type; } |
duke@435 | 399 | symbolOop as_symbol(TRAPS); |
duke@435 | 400 | |
duke@435 | 401 | // return same as_symbol except allocation of new symbols is avoided. |
duke@435 | 402 | symbolOop as_symbol_or_null(); |
duke@435 | 403 | }; |
duke@435 | 404 | |
duke@435 | 405 | class SignatureVerifier : public StackObj { |
duke@435 | 406 | public: |
duke@435 | 407 | // Returns true if the symbol is valid method or type signature |
duke@435 | 408 | static bool is_valid_signature(symbolHandle sig); |
duke@435 | 409 | |
duke@435 | 410 | static bool is_valid_method_signature(symbolHandle sig); |
duke@435 | 411 | static bool is_valid_type_signature(symbolHandle sig); |
duke@435 | 412 | private: |
duke@435 | 413 | |
duke@435 | 414 | static ssize_t is_valid_type(const char*, ssize_t); |
duke@435 | 415 | static bool invalid_name_char(char); |
duke@435 | 416 | }; |