--- old/src/hotspot/share/runtime/javaCalls.cpp 2020-01-24 19:19:08.482453789 +0000 +++ new/src/hotspot/share/runtime/javaCalls.cpp 2020-01-24 19:19:07.695176096 +0000 @@ -521,8 +521,6 @@ intptr_t* _value; public: - bool _is_return; - SignatureChekker(Symbol* signature, BasicType return_type, bool is_static, @@ -532,17 +530,19 @@ _pos(0), _return_type(return_type), _value_state(value_state), - _value(value), - _is_return(false) + _value(value) { if (!is_static) { check_value(true); // Receiver must be an oop } + do_parameters_on(this); + check_return_type(return_type); } - void check_value(bool type) { + private: + void check_value(bool is_reference) { uint state = _value_state[_pos++]; - if (type) { + if (is_reference) { guarantee(is_value_state_indirect_oop(state), "signature does not match pushed arguments: %u at %d", state, _pos - 1); @@ -553,38 +553,20 @@ } } - void check_doing_return(bool state) { _is_return = state; } - void check_return_type(BasicType t) { - guarantee(_is_return && t == _return_type, "return type does not match"); + guarantee(t == _return_type, "return type does not match"); } - void check_int(BasicType t) { - if (_is_return) { - check_return_type(t); - return; - } + void check_single_word() { check_value(false); } - void check_double(BasicType t) { check_long(t); } - - void check_long(BasicType t) { - if (_is_return) { - check_return_type(t); - return; - } - + void check_double_word() { check_value(false); check_value(false); } - void check_obj(BasicType t) { - if (_is_return) { - check_return_type(t); - return; - } - + void check_reference() { intptr_t v = _value[_pos]; if (v != 0) { // v is a "handle" referring to an oop, cast to integral type. @@ -601,17 +583,26 @@ check_value(true); // Verify value state. } - void do_bool() { check_int(T_BOOLEAN); } - void do_char() { check_int(T_CHAR); } - void do_float() { check_int(T_FLOAT); } - void do_double() { check_double(T_DOUBLE); } - void do_byte() { check_int(T_BYTE); } - void do_short() { check_int(T_SHORT); } - void do_int() { check_int(T_INT); } - void do_long() { check_long(T_LONG); } - void do_void() { check_return_type(T_VOID); } - void do_object(int begin, int end) { check_obj(T_OBJECT); } - void do_array(int begin, int end) { check_obj(T_OBJECT); } + friend class SignatureIterator; // so do_parameters_on can call do_type + void do_type(BasicType type) { + switch (type) { + case T_BYTE: + case T_BOOLEAN: + case T_CHAR: + case T_SHORT: + case T_INT: + case T_FLOAT: // this one also + check_single_word(); break; + case T_LONG: + case T_DOUBLE: + check_double_word(); break; + case T_ARRAY: + case T_OBJECT: + check_reference(); break; + default: + ShouldNotReachHere(); + } + } }; @@ -629,7 +620,4 @@ method->is_static(), _value_state, _value); - sc.iterate_parameters(); - sc.check_doing_return(true); - sc.iterate_returntype(); }