8233159: Method::result_type should use calculated value in constMethod
authorredestad
Wed, 30 Oct 2019 16:14:56 +0100
changeset 58861 2c3cc4b01880
parent 58860 506bd2e1f840
child 58863 c16ac7a2eba4
8233159: Method::result_type should use calculated value in constMethod Reviewed-by: lfoltan, iklam, coleenp
src/hotspot/share/interpreter/bytecode.cpp
src/hotspot/share/oops/constMethod.hpp
src/hotspot/share/oops/method.cpp
src/hotspot/share/oops/method.hpp
--- 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();
 }
 
--- 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
--- 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 "<init>" "()V" method
   // which only calls the superclass vanilla constructor and possibly does stores of
--- 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); }