# HG changeset patch # User redestad # Date 1572385699 -3600 # Tue Oct 29 22:48:19 2019 +0100 # Node ID 37b2c86ef1f98389c8088faa54ac1fe0d62b1fee # Parent 5ec8aeda451e83733383217c33b2e7f513e8f483 8233159: Method::result_type should use calculated value in constMethod Reviewed-by: lfoltan diff --git a/src/hotspot/share/interpreter/bytecode.cpp b/src/hotspot/share/interpreter/bytecode.cpp --- a/src/hotspot/share/interpreter/bytecode.cpp +++ b/src/hotspot/share/interpreter/bytecode.cpp @@ -147,7 +147,6 @@ BasicType Bytecode_member_ref::result_type() const { ResultTypeFinder rts(signature()); - rts.iterate(); return rts.type(); } diff --git a/src/hotspot/share/oops/constMethod.hpp b/src/hotspot/share/oops/constMethod.hpp --- a/src/hotspot/share/oops/constMethod.hpp +++ b/src/hotspot/share/oops/constMethod.hpp @@ -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 --git a/src/hotspot/share/oops/method.cpp b/src/hotspot/share/oops/method.cpp --- a/src/hotspot/share/oops/method.cpp +++ b/src/hotspot/share/oops/method.cpp @@ -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 --git a/src/hotspot/share/oops/method.hpp b/src/hotspot/share/oops/method.hpp --- a/src/hotspot/share/oops/method.hpp +++ b/src/hotspot/share/oops/method.hpp @@ -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); }