--- old/src/hotspot/share/runtime/signature.hpp 2019-03-11 14:27:20.218354131 +0100 +++ new/src/hotspot/share/runtime/signature.hpp 2019-03-11 14:27:19.982354134 +0100 @@ -25,6 +25,7 @@ #ifndef SHARE_RUNTIME_SIGNATURE_HPP #define SHARE_RUNTIME_SIGNATURE_HPP +#include "classfile/symbolTable.hpp" #include "memory/allocation.hpp" #include "oops/method.hpp" @@ -113,6 +114,7 @@ // 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) { @@ -142,6 +144,7 @@ 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: @@ -170,6 +173,7 @@ 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: @@ -236,6 +240,7 @@ 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(); } @@ -301,6 +306,7 @@ 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; } @@ -311,6 +317,7 @@ 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; @@ -428,4 +435,63 @@ static bool invalid_name_char(char); }; +class SigEntryFilter; +typedef GrowableArrayFilterIterator 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* sig, BasicType bt, int offset = -1); + static void insert_reserved_entry(GrowableArray* sig, int i, BasicType bt); + static bool is_reserved_entry(const GrowableArray* sig, int i); + static bool skip_value_delimiters(const GrowableArray* sig, int i); + static int fill_sig_bt(const GrowableArray* sig, BasicType* sig_bt); + static TempNewSymbol create_symbol(const GrowableArray* 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; } +}; + #endif // SHARE_RUNTIME_SIGNATURE_HPP