changeset 13398:297678e133e6 mvt

8186049: Remove vgetfield support from interpreter Reviewed-by: mcimadamore, acorn
author fparain
date Wed, 09 Aug 2017 16:00:52 -0400
parents a7148b46058c
children bc075a2f87ad
files src/cpu/x86/vm/interp_masm_x86.cpp src/cpu/x86/vm/templateTable_x86.cpp src/share/vm/interpreter/bytecodeTracer.cpp src/share/vm/interpreter/bytecodes.cpp src/share/vm/interpreter/bytecodes.hpp src/share/vm/interpreter/interpreterRuntime.cpp src/share/vm/interpreter/linkResolver.cpp src/share/vm/interpreter/rewriter.cpp src/share/vm/interpreter/rewriter.hpp src/share/vm/interpreter/templateInterpreterGenerator.cpp src/share/vm/interpreter/templateTable.cpp src/share/vm/interpreter/templateTable.hpp src/share/vm/oops/cpCache.hpp src/share/vm/utilities/globalDefinitions.hpp
diffstat 14 files changed, 21 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/x86/vm/interp_masm_x86.cpp	Wed Aug 02 09:54:10 2017 +0200
+++ b/src/cpu/x86/vm/interp_masm_x86.cpp	Wed Aug 09 16:00:52 2017 -0400
@@ -629,6 +629,7 @@
 
 void InterpreterMacroAssembler::pop(TosState state) {
   switch (state) {
+  case ptos: // Fall through
   case qtos: // Fall through
   case atos: pop_ptr();                 break;
   case btos:
--- a/src/cpu/x86/vm/templateTable_x86.cpp	Wed Aug 02 09:54:10 2017 +0200
+++ b/src/cpu/x86/vm/templateTable_x86.cpp	Wed Aug 09 16:00:52 2017 -0400
@@ -2864,7 +2864,7 @@
   __ verify_oop(r);
 }
 
-void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteControl rc, bool is_vgetfield) {
+void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteControl rc) {
   transition(vtos, vtos);
 
   const Register cache = rcx;
@@ -2916,9 +2916,6 @@
     __ verify_oop(rax);
     __ bind(initialized);
     __ push(qtos);
-    //    if (!is_static && !is_vgetfield) {
-    //      patch_bytecode(Bytecodes::_fast_qgetfield, bc, rbx);
-    //    }
   } else {
     pop_and_check_object(obj);
     call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::qgetfield),
@@ -3066,10 +3063,6 @@
   getfield_or_static(byte_no, true);
 }
 
-void TemplateTable::vgetfield() {
-  getfield_or_static(f1_byte, false, may_not_rewrite, true);
-}
-
 void TemplateTable::vwithfield() {
   transition(vtos, qtos);
 
--- a/src/share/vm/interpreter/bytecodeTracer.cpp	Wed Aug 02 09:54:10 2017 +0200
+++ b/src/share/vm/interpreter/bytecodeTracer.cpp	Wed Aug 09 16:00:52 2017 -0400
@@ -548,7 +548,6 @@
     case Bytecodes::_getstatic:
     case Bytecodes::_putfield:
     case Bytecodes::_getfield:
-    case Bytecodes::_vgetfield:
     case Bytecodes::_vwithfield:
       print_field_or_method(get_index_u2_cpcache(), st);
       break;
--- a/src/share/vm/interpreter/bytecodes.cpp	Wed Aug 02 09:54:10 2017 +0200
+++ b/src/share/vm/interpreter/bytecodes.cpp	Wed Aug 09 16:00:52 2017 -0400
@@ -542,7 +542,6 @@
 
   def(_nofast_aload_0      , "nofast_aload_0"      , "b"    , NULL    , T_ILLEGAL,  1, true , _aload_0        );
   def(_nofast_iload        , "nofast_iload"        , "bi"   , NULL    , T_ILLEGAL,  1, false, _iload          );
-  def(_vgetfield           , "vgetfield"           , "bJJ"  , NULL    , T_ILLEGAL,  0, true , _getfield       );
 
   def(_shouldnotreachhere  , "_shouldnotreachhere" , "b"    , NULL    , T_VOID   ,  0, false);
 
--- a/src/share/vm/interpreter/bytecodes.hpp	Wed Aug 02 09:54:10 2017 +0200
+++ b/src/share/vm/interpreter/bytecodes.hpp	Wed Aug 09 16:00:52 2017 -0400
@@ -313,10 +313,6 @@
     _nofast_aload_0       ,          //  <- _aload_0
     _nofast_iload         ,          //  <- _iload
 
-    // Value type support
-
-    _vgetfield            ,          //  <- _getfield
-
     _shouldnotreachhere   ,          // For debugging
 
 
--- a/src/share/vm/interpreter/interpreterRuntime.cpp	Wed Aug 02 09:54:10 2017 +0200
+++ b/src/share/vm/interpreter/interpreterRuntime.cpp	Wed Aug 09 16:00:52 2017 -0400
@@ -930,7 +930,7 @@
   bool is_put    = (bytecode == Bytecodes::_putfield  || bytecode == Bytecodes::_nofast_putfield ||
                     bytecode == Bytecodes::_putstatic || bytecode == Bytecodes::_vwithfield);
   bool is_static = (bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic);
-  bool is_value  = (bytecode == Bytecodes::_vgetfield || bytecode == Bytecodes::_vwithfield);
+  bool is_value  = bytecode == Bytecodes::_vwithfield;
 
   {
     JvmtiHideSingleStepping jhss(thread);
@@ -977,7 +977,7 @@
     if (is_static) {
       get_code = Bytecodes::_getstatic;
     } else {
-      get_code = ((is_value) ? Bytecodes::_vgetfield : Bytecodes::_getfield);
+      get_code = Bytecodes::_getfield;
     }
     if (is_put && is_value) {
         put_code = ((is_static) ? Bytecodes::_putstatic : Bytecodes::_vwithfield);
@@ -1248,7 +1248,6 @@
   case Bytecodes::_putstatic:
   case Bytecodes::_getfield:
   case Bytecodes::_putfield:
-  case Bytecodes::_vgetfield:
   case Bytecodes::_vwithfield:
     resolve_get_put(thread, bytecode);
     break;
--- a/src/share/vm/interpreter/linkResolver.cpp	Wed Aug 02 09:54:10 2017 +0200
+++ b/src/share/vm/interpreter/linkResolver.cpp	Wed Aug 09 16:00:52 2017 -0400
@@ -901,7 +901,7 @@
                                  TRAPS) {
   assert(byte == Bytecodes::_getstatic || byte == Bytecodes::_putstatic ||
          byte == Bytecodes::_getfield  || byte == Bytecodes::_putfield  ||
-         byte == Bytecodes::_vgetfield || byte == Bytecodes::_vwithfield ||
+         byte == Bytecodes::_vwithfield ||
          byte == Bytecodes::_nofast_getfield  || byte == Bytecodes::_nofast_putfield  ||
          (byte == Bytecodes::_nop && !link_info.check_access()), "bad field access bytecode");
 
--- a/src/share/vm/interpreter/rewriter.cpp	Wed Aug 02 09:54:10 2017 +0200
+++ b/src/share/vm/interpreter/rewriter.cpp	Wed Aug 09 16:00:52 2017 -0400
@@ -59,9 +59,6 @@
           saw_mh_symbol = true;
         }
         break;
-      case JVM_CONSTANT_UnresolvedValue:
-        _saw_constant_value = true;
-        break;
     }
   }
 
@@ -157,16 +154,12 @@
     Bytes::put_native_u2(p, cache_index);
     if (!_method_handle_invokers.is_empty())
       maybe_rewrite_invokehandle(p - 1, cp_index, cache_index, reverse);
-    if (_saw_constant_value)
-      maybe_rewrite_getfield(p - 1, cp_index, reverse);
   } else {
     int cache_index = Bytes::get_native_u2(p);
     int pool_index = cp_cache_entry_pool_index(cache_index);
     Bytes::put_Java_u2(p, pool_index);
     if (!_method_handle_invokers.is_empty())
       maybe_rewrite_invokehandle(p - 1, pool_index, cache_index, reverse);
-    if (_saw_constant_value)
-      maybe_rewrite_getfield(p - 1, pool_index, reverse);
   }
 }
 
@@ -192,24 +185,6 @@
   }
 }
 
-// Rewrite getfield pointing to constant value CP entries to vgetfield
-void Rewriter::maybe_rewrite_getfield(address bcp, int cp_index, bool reverse) {
-  if (!reverse) {
-    if ((*bcp) == (u1)Bytecodes::_getfield) {
-      int klass_idx = _pool->klass_ref_index_at(cp_index);
-      //rewrite getfield to vgetfield if cp entry is an unresolved value type
-      if (_pool->tag_at(klass_idx).is_unresolved_value_type()) {
-        (*bcp) = (u1)Bytecodes::_vgetfield;
-      }
-    }
-  } else {
-    if ((*bcp) == (u1)Bytecodes::_vgetfield) {
-      //no need to look at cp index
-      (*bcp) = (u1)Bytecodes::_getfield;
-    }
-  }
-}
-
 // Adjust the invocation bytecode for a signature-polymorphic method (MethodHandle.invoke, etc.)
 void Rewriter::maybe_rewrite_invokehandle(address opc, int cp_index, int cache_index, bool reverse) {
   if (!reverse) {
@@ -474,7 +449,6 @@
         case Bytecodes::_invokevirtual  : // fall through
         case Bytecodes::_invokestatic   :
         case Bytecodes::_invokeinterface:
-        case Bytecodes::_vgetfield      : // if reverse=true
         case Bytecodes::_invokehandle   : // if reverse=true
           rewrite_member_reference(bcp, prefix_length+1, reverse);
           break;
@@ -590,7 +564,6 @@
     _resolved_references_map(cpool->length() / 2),
     _invokedynamic_references_map(cpool->length() / 2),
     _method_handle_invokers(cpool->length()),
-    _saw_constant_value(false),
     _invokedynamic_cp_cache_map(cpool->length() / 4)
 {
 
--- a/src/share/vm/interpreter/rewriter.hpp	Wed Aug 02 09:54:10 2017 +0200
+++ b/src/share/vm/interpreter/rewriter.hpp	Wed Aug 09 16:00:52 2017 -0400
@@ -44,7 +44,6 @@
   GrowableArray<int>  _resolved_references_map; // for strings, methodHandle, methodType
   GrowableArray<int>  _invokedynamic_references_map; // for invokedynamic resolved refs
   GrowableArray<int>  _method_handle_invokers;
-  bool                _saw_constant_value;
   int                 _resolved_reference_limit;
 
   // For mapping invokedynamic bytecodes, which are discovered during method
@@ -196,7 +195,6 @@
   void scan_method(Method* m, bool reverse, bool* invokespecial_error);
   void rewrite_Object_init(methodHandle m, TRAPS);
   void rewrite_member_reference(address bcp, int offset, bool reverse);
-  void maybe_rewrite_getfield(address bcp, int cp_index, bool reverse);
   void maybe_rewrite_invokehandle(address opc, int cp_index, int cache_index, bool reverse);
   void rewrite_invokedynamic(address bcp, int offset, bool reverse);
   void maybe_rewrite_ldc(address bcp, int offset, bool is_wide, bool reverse);
--- a/src/share/vm/interpreter/templateInterpreterGenerator.cpp	Wed Aug 02 09:54:10 2017 +0200
+++ b/src/share/vm/interpreter/templateInterpreterGenerator.cpp	Wed Aug 09 16:00:52 2017 -0400
@@ -355,6 +355,7 @@
     case dtos: vep = __ pc(); __ pop(dtos); dep = __ pc(); generate_and_dispatch(t); break;
     case qtos: vep = __ pc(); __ pop(qtos); qep = __ pc(); generate_and_dispatch(t); break;
     case vtos: set_vtos_entry_points(t, bep, cep, sep, aep, iep, lep, fep, dep, qep, vep);     break;
+    case ptos: vep = __ pc(); __ pop(ptos); aep = __ pc(); qep = __ pc(); generate_and_dispatch(t); break;
     default  : ShouldNotReachHere();                                                 break;
   }
 }
--- a/src/share/vm/interpreter/templateTable.cpp	Wed Aug 02 09:54:10 2017 +0200
+++ b/src/share/vm/interpreter/templateTable.cpp	Wed Aug 09 16:00:52 2017 -0400
@@ -160,7 +160,9 @@
 // Implementation of TemplateTable: Debugging
 
 void TemplateTable::transition(TosState tos_in, TosState tos_out) {
-  assert(_desc->tos_in()  == tos_in , "inconsistent tos_in  information");
+  assert(_desc->tos_in()  == tos_in
+         || (_desc->tos_in() == ptos && (tos_in == atos || tos_in == qtos)),
+         "inconsistent tos_in  information");
   assert(_desc->tos_out() == tos_out, "inconsistent tos_out information");
 }
 
@@ -489,15 +491,15 @@
   def(Bytecodes::_breakpoint          , ubcp|disp|clvm|____, vtos, vtos, _breakpoint         ,  _           );
 
   // JVM bytecodes
-  def(Bytecodes::_fast_agetfield      , ubcp|____|____|____, atos, atos, fast_accessfield    ,  atos        );
-  def(Bytecodes::_fast_qgetfield      , ubcp|____|____|____, atos, qtos, fast_accessfield    ,  qtos        );
-  def(Bytecodes::_fast_bgetfield      , ubcp|____|____|____, atos, itos, fast_accessfield    ,  itos        );
-  def(Bytecodes::_fast_cgetfield      , ubcp|____|____|____, atos, itos, fast_accessfield    ,  itos        );
-  def(Bytecodes::_fast_dgetfield      , ubcp|____|____|____, atos, dtos, fast_accessfield    ,  dtos        );
-  def(Bytecodes::_fast_fgetfield      , ubcp|____|____|____, atos, ftos, fast_accessfield    ,  ftos        );
-  def(Bytecodes::_fast_igetfield      , ubcp|____|____|____, atos, itos, fast_accessfield    ,  itos        );
-  def(Bytecodes::_fast_lgetfield      , ubcp|____|____|____, atos, ltos, fast_accessfield    ,  ltos        );
-  def(Bytecodes::_fast_sgetfield      , ubcp|____|____|____, atos, itos, fast_accessfield    ,  itos        );
+  def(Bytecodes::_fast_agetfield      , ubcp|____|____|____, ptos, atos, fast_accessfield    ,  atos        );
+  def(Bytecodes::_fast_qgetfield      , ubcp|____|____|____, ptos, qtos, fast_accessfield    ,  qtos        );
+  def(Bytecodes::_fast_bgetfield      , ubcp|____|____|____, ptos, itos, fast_accessfield    ,  itos        );
+  def(Bytecodes::_fast_cgetfield      , ubcp|____|____|____, ptos, itos, fast_accessfield    ,  itos        );
+  def(Bytecodes::_fast_dgetfield      , ubcp|____|____|____, ptos, dtos, fast_accessfield    ,  dtos        );
+  def(Bytecodes::_fast_fgetfield      , ubcp|____|____|____, ptos, ftos, fast_accessfield    ,  ftos        );
+  def(Bytecodes::_fast_igetfield      , ubcp|____|____|____, ptos, itos, fast_accessfield    ,  itos        );
+  def(Bytecodes::_fast_lgetfield      , ubcp|____|____|____, ptos, ltos, fast_accessfield    ,  ltos        );
+  def(Bytecodes::_fast_sgetfield      , ubcp|____|____|____, ptos, itos, fast_accessfield    ,  itos        );
 
   def(Bytecodes::_fast_aputfield      , ubcp|____|____|____, atos, vtos, fast_storefield ,   atos        );
   def(Bytecodes::_fast_qputfield      , ubcp|____|____|____, qtos, vtos, fast_storefield ,   qtos        );
@@ -537,7 +539,6 @@
   def(Bytecodes::_nofast_aload_0      , ____|____|clvm|____, vtos, atos, nofast_aload_0      ,  _           );
   def(Bytecodes::_nofast_iload        , ubcp|____|clvm|____, vtos, itos, nofast_iload        ,  _           );
 
-  def(Bytecodes::_vgetfield           , ubcp|____|clvm|____, vtos, vtos, vgetfield           , _            );
 
   def(Bytecodes::_shouldnotreachhere   , ____|____|____|____, vtos, vtos, shouldnotreachhere ,  _           );
   // platform specific bytecodes
--- a/src/share/vm/interpreter/templateTable.hpp	Wed Aug 02 09:54:10 2017 +0200
+++ b/src/share/vm/interpreter/templateTable.hpp	Wed Aug 09 16:00:52 2017 -0400
@@ -291,7 +291,7 @@
   static void invokehandle(int byte_no);
   static void fast_invokevfinal(int byte_no);
 
-  static void getfield_or_static(int byte_no, bool is_static, RewriteControl rc = may_rewrite, bool is_vgetfield = false);
+  static void getfield_or_static(int byte_no, bool is_static, RewriteControl rc = may_rewrite);
   static void putfield_or_static(int byte_no, bool is_static, RewriteControl rc = may_rewrite);
 
   static void getfield(int byte_no);
@@ -301,7 +301,6 @@
   static void getstatic(int byte_no);
   static void putstatic(int byte_no);
   static void pop_and_check_object(Register obj);
-  static void vgetfield();
   static void vwithfield();
 
   static void _new();
--- a/src/share/vm/oops/cpCache.hpp	Wed Aug 02 09:54:10 2017 +0200
+++ b/src/share/vm/oops/cpCache.hpp	Wed Aug 09 16:00:52 2017 -0400
@@ -307,7 +307,6 @@
     switch (code) {
       case Bytecodes::_getstatic       :    // fall through
       case Bytecodes::_getfield        :    // fall through
-      case Bytecodes::_vgetfield       :    // fall through
       case Bytecodes::_invokespecial   :    // fall through
       case Bytecodes::_invokestatic    :    // fall through
       case Bytecodes::_invokehandle    :    // fall through
--- a/src/share/vm/utilities/globalDefinitions.hpp	Wed Aug 02 09:54:10 2017 +0200
+++ b/src/share/vm/utilities/globalDefinitions.hpp	Wed Aug 09 16:00:52 2017 -0400
@@ -856,8 +856,9 @@
   dtos = 7,             // double tos cached
   atos = 8,             // object cached
   qtos = 9,             // value type cached
-  vtos = 10,             // tos not cached
+  vtos = 10,            // tos not cached,
   number_of_states,
+  ptos = 12,            // polymorphic tos cache (atos or qtos)
   ilgl                  // illegal state: should not occur
 };