< prev index next >

src/hotspot/share/runtime/signature.hpp

Print this page

        

*** 23,32 **** --- 23,33 ---- */ #ifndef SHARE_RUNTIME_SIGNATURE_HPP #define SHARE_RUNTIME_SIGNATURE_HPP + #include "classfile/symbolTable.hpp" #include "memory/allocation.hpp" #include "oops/method.hpp" // SignatureIterators iterate over a Java signature (or parts of it). // (Syntax according to: "The Java Virtual Machine Specification" by
*** 110,119 **** --- 111,121 ---- virtual void do_long () = 0; virtual void do_void () = 0; // Object types (begin indexes the first character of the entry, end indexes the first character after the entry) virtual void do_object(int begin, int end) = 0; + virtual void do_valuetype(int begin, int end) = 0; virtual void do_array (int begin, int end) = 0; static bool is_static(uint64_t fingerprint) { assert(fingerprint != (uint64_t)CONST64(-1), "invalid fingerprint"); return fingerprint & is_static_bit;
*** 139,148 **** --- 141,151 ---- void do_short() { type_name("jshort" ); } void do_int() { type_name("jint" ); } void do_long() { type_name("jlong" ); } void do_void() { type_name("void" ); } void do_object(int begin, int end) { type_name("jobject" ); } + void do_valuetype(int begin, int end) { type_name("jobject"); } void do_array (int begin, int end) { type_name("jobject" ); } public: SignatureTypeNames(Symbol* signature) : SignatureIterator(signature) {} };
*** 167,176 **** --- 170,180 ---- void do_short () { set(T_SHORT_size , T_SHORT ); } void do_int () { set(T_INT_size , T_INT ); } void do_long () { set(T_LONG_size , T_LONG ); } void do_void () { set(T_VOID_size , T_VOID ); } void do_object(int begin, int end) { set(T_OBJECT_size , T_OBJECT ); } + void do_valuetype(int begin, int end) { set(T_VALUETYPE_size, T_VALUETYPE ); } void do_array (int begin, int end) { set(T_ARRAY_size , T_ARRAY ); } public: SignatureInfo(Symbol* signature) : SignatureIterator(signature) { _has_iterated = _has_iterated_return = false;
*** 233,242 **** --- 237,247 ---- void do_long() { _fingerprint |= (((uint64_t)long_parm) << _shift_count); _shift_count += parameter_feature_size; } void do_float() { _fingerprint |= (((uint64_t)float_parm) << _shift_count); _shift_count += parameter_feature_size; } void do_double() { _fingerprint |= (((uint64_t)double_parm) << _shift_count); _shift_count += parameter_feature_size; } void do_object(int begin, int end) { _fingerprint |= (((uint64_t)obj_parm) << _shift_count); _shift_count += parameter_feature_size; } + void do_valuetype(int begin, int end) { _fingerprint |= (((uint64_t)obj_parm) << _shift_count); _shift_count += parameter_feature_size; } void do_array (int begin, int end) { _fingerprint |= (((uint64_t)obj_parm) << _shift_count); _shift_count += parameter_feature_size; } void do_void() { ShouldNotReachHere(); } Fingerprinter(const methodHandle& method) : SignatureIterator(method->signature()) {
*** 298,317 **** --- 303,324 ---- void do_long () { pass_long(); _jni_offset += 2; _offset += 2; } #endif void do_void () { ShouldNotReachHere(); } void do_object(int begin, int end) { pass_object(); _jni_offset++; _offset++; } void do_array (int begin, int end) { pass_object(); _jni_offset++; _offset++; } + void do_valuetype(int begin, int end){ pass_valuetype(); _jni_offset++; _offset++; } public: methodHandle method() const { return _method; } int offset() const { return _offset; } int jni_offset() const { return _jni_offset + _prepended; } // int java_offset() const { return method()->size_of_parameters() - _offset - 1; } bool is_static() const { return method()->is_static(); } virtual void pass_int() = 0; virtual void pass_long() = 0; virtual void pass_object() = 0; + virtual void pass_valuetype() = 0; virtual void pass_float() = 0; #ifdef _LP64 virtual void pass_double() = 0; #else virtual void pass_double() { pass_long(); } // may be same as long
*** 400,409 **** --- 407,417 ---- bool is_object() const; // True if this argument is an object bool is_array() const; // True if this argument is an array BasicType type() const { return _type; } Symbol* as_symbol(); enum FailureMode { ReturnNull, NCDFError }; + ValueKlass* as_value_klass(InstanceKlass* holder); Klass* as_klass(Handle class_loader, Handle protection_domain, FailureMode failure_mode, TRAPS); oop as_java_mirror(Handle class_loader, Handle protection_domain, FailureMode failure_mode, TRAPS); const u1* raw_bytes() { return _signature->bytes() + _begin; } int raw_length() { return _end - _begin; }
*** 412,426 **** // count the number of references in the signature int reference_parameter_count(); }; #ifdef ASSERT class SignatureVerifier : public StackObj { public: ! static bool is_valid_method_signature(Symbol* sig); ! static bool is_valid_type_signature(Symbol* sig); private: static ssize_t is_valid_type(const char*, ssize_t); }; #endif #endif // SHARE_RUNTIME_SIGNATURE_HPP --- 420,493 ---- // count the number of references in the signature int reference_parameter_count(); }; + class SigEntryFilter; + typedef GrowableArrayFilterIterator<SigEntry, SigEntryFilter> ExtendedSignature; + + // Used for adapter generation. One SigEntry is used per element of + // the signature of the method. Value type arguments are treated + // specially. See comment for ValueKlass::collect_fields(). + class SigEntry { + public: + BasicType _bt; + int _offset; + + enum { ReservedOffset = -2 }; // Special offset to mark the reserved entry + + SigEntry() + : _bt(T_ILLEGAL), _offset(-1) { + } + SigEntry(BasicType bt, int offset) + : _bt(bt), _offset(offset) {} + + SigEntry(BasicType bt) + : _bt(bt), _offset(-1) {} + + static int compare(SigEntry* e1, SigEntry* e2) { + if (e1->_offset != e2->_offset) { + return e1->_offset - e2->_offset; + } + assert((e1->_bt == T_LONG && (e2->_bt == T_LONG || e2->_bt == T_VOID)) || + (e1->_bt == T_DOUBLE && (e2->_bt == T_DOUBLE || e2->_bt == T_VOID)) || + e1->_bt == T_VALUETYPE || e2->_bt == T_VALUETYPE || e1->_bt == T_VOID || e2->_bt == T_VOID, "bad bt"); + if (e1->_bt == e2->_bt) { + assert(e1->_bt == T_VALUETYPE || e1->_bt == T_VOID, "only ones with duplicate offsets"); + return 0; + } + if (e1->_bt == T_VOID || + e2->_bt == T_VALUETYPE) { + return 1; + } + if (e1->_bt == T_VALUETYPE || + e2->_bt == T_VOID) { + return -1; + } + ShouldNotReachHere(); + return 0; + } + static void add_entry(GrowableArray<SigEntry>* sig, BasicType bt, int offset = -1); + static void insert_reserved_entry(GrowableArray<SigEntry>* sig, int i, BasicType bt); + static bool is_reserved_entry(const GrowableArray<SigEntry>* sig, int i); + static bool skip_value_delimiters(const GrowableArray<SigEntry>* sig, int i); + static int fill_sig_bt(const GrowableArray<SigEntry>* sig, BasicType* sig_bt); + static TempNewSymbol create_symbol(const GrowableArray<SigEntry>* sig); + + static bool next_is_reserved(ExtendedSignature& sig, BasicType& bt, bool can_be_void = false); + }; + + class SigEntryFilter { + public: + bool operator()(const SigEntry& entry) { return entry._bt != T_VALUETYPE && entry._bt != T_VOID; } + }; + #ifdef ASSERT class SignatureVerifier : public StackObj { public: ! static bool is_valid_method_signature(const Symbol* sig); ! static bool is_valid_type_signature(const Symbol* sig); private: static ssize_t is_valid_type(const char*, ssize_t); }; #endif #endif // SHARE_RUNTIME_SIGNATURE_HPP
< prev index next >