# HG changeset patch # User redestad # Date 1572448496 -3600 # Node ID 2c3cc4b018809697439cf420e87c34c733105247 # Parent 506bd2e1f840c202e732bd95c07123e5cdfa6600 8233159: Method::result_type should use calculated value in constMethod Reviewed-by: lfoltan, iklam, coleenp diff -r 506bd2e1f840 -r 2c3cc4b01880 src/hotspot/share/interpreter/bytecode.cpp --- a/src/hotspot/share/interpreter/bytecode.cpp Tue Oct 29 14:29:40 2019 +0100 +++ b/src/hotspot/share/interpreter/bytecode.cpp Wed Oct 30 16:14:56 2019 +0100 @@ -147,7 +147,6 @@ BasicType Bytecode_member_ref::result_type() const { ResultTypeFinder rts(signature()); - rts.iterate(); return rts.type(); } diff -r 506bd2e1f840 -r 2c3cc4b01880 src/hotspot/share/oops/constMethod.hpp --- a/src/hotspot/share/oops/constMethod.hpp Tue Oct 29 14:29:40 2019 +0100 +++ b/src/hotspot/share/oops/constMethod.hpp Wed Oct 30 16:14:56 2019 +0100 @@ -532,6 +532,10 @@ int size_of_parameters() const { return _size_of_parameters; } void set_size_of_parameters(int size) { _size_of_parameters = size; } + // result type (basic type of return value) + BasicType result_type() const { assert(_result_type >= T_BOOLEAN, "Must be set"); + return (BasicType)_result_type; } + void set_result_type(BasicType rt) { assert(rt < 16, "result type too large"); _result_type = (u1)rt; } // Deallocation for RedefineClasses diff -r 506bd2e1f840 -r 2c3cc4b01880 src/hotspot/share/oops/method.cpp --- a/src/hotspot/share/oops/method.cpp Tue Oct 29 14:29:40 2019 +0100 +++ b/src/hotspot/share/oops/method.cpp Wed Oct 30 16:14:56 2019 +0100 @@ -572,24 +572,16 @@ return extra_stack_entries() * Interpreter::stackElementSize; } - void Method::compute_size_of_parameters(Thread *thread) { ArgumentSizeComputer asc(signature()); set_size_of_parameters(asc.size() + (is_static() ? 0 : 1)); } -BasicType Method::result_type() const { - ResultTypeFinder rtf(signature()); - return rtf.type(); -} - - bool Method::is_empty_method() const { return code_size() == 1 && *code_base() == Bytecodes::_return; } - bool Method::is_vanilla_constructor() const { // Returns true if this method is a vanilla constructor, i.e. an "" "()V" method // which only calls the superclass vanilla constructor and possibly does stores of diff -r 506bd2e1f840 -r 2c3cc4b01880 src/hotspot/share/oops/method.hpp --- a/src/hotspot/share/oops/method.hpp Tue Oct 29 14:29:40 2019 +0100 +++ b/src/hotspot/share/oops/method.hpp Wed Oct 30 16:14:56 2019 +0100 @@ -608,7 +608,7 @@ void compute_size_of_parameters(Thread *thread); // word size of parameters (receiver if any + arguments) Symbol* klass_name() const; // returns the name of the method holder - BasicType result_type() const; // type of the method result + BasicType result_type() const { return constMethod()->result_type(); } bool is_returning_oop() const { BasicType r = result_type(); return is_reference_type(r); } bool is_returning_fp() const { BasicType r = result_type(); return (r == T_FLOAT || r == T_DOUBLE); }