changeset 12967:c031bb257839

Removing invokedirect
author fparain
date Fri, 28 Apr 2017 09:43:04 -0400
parents 5fc96d441cc7
children 27cd39c61646
files src/cpu/x86/vm/templateTable_x86.cpp src/share/vm/ci/ciEnv.cpp src/share/vm/ci/ciMethod.cpp src/share/vm/ci/ciStreams.cpp src/share/vm/ci/ciTypeFlow.cpp src/share/vm/interpreter/abstractInterpreter.cpp src/share/vm/interpreter/bytecode.hpp 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/templateInterpreter.cpp src/share/vm/interpreter/templateTable.cpp src/share/vm/interpreter/templateTable.hpp src/share/vm/oops/cpCache.cpp src/share/vm/oops/cpCache.hpp src/share/vm/oops/generateOopMap.cpp src/share/vm/oops/methodData.cpp
diffstat 20 files changed, 5 insertions(+), 73 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/x86/vm/templateTable_x86.cpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/cpu/x86/vm/templateTable_x86.cpp	Fri Apr 28 09:43:04 2017 -0400
@@ -3661,12 +3661,11 @@
   const bool is_invokedynamic    = code == Bytecodes::_invokedynamic;
   const bool is_invokehandle     = code == Bytecodes::_invokehandle;
   const bool is_invokevirtual    = code == Bytecodes::_invokevirtual;
-  const bool is_invokedirect     = code == Bytecodes::_invokedirect;
   const bool is_invokespecial    = code == Bytecodes::_invokespecial;
   const bool load_receiver       = (recv  != noreg);
   const bool save_flags          = (flags != noreg);
   assert(load_receiver == (code != Bytecodes::_invokestatic && code != Bytecodes::_invokedynamic), "");
-  assert(save_flags    == (is_invokeinterface || is_invokevirtual || is_invokedirect), "need flags for vfinal");
+  assert(save_flags    == (is_invokeinterface || is_invokevirtual), "need flags for vfinal");
   assert(flags == noreg || flags == rdx, "");
   assert(recv  == noreg || recv  == rcx, "");
 
@@ -3678,9 +3677,7 @@
   // save 'interpreter return address'
   __ save_bcp();
 
-  load_invoke_cp_cache_entry(byte_no, method, index, flags,
-                             is_invokevirtual || is_invokedirect,
-                             false, is_invokedynamic);
+  load_invoke_cp_cache_entry(byte_no, method, index, flags, is_invokevirtual, false, is_invokedynamic);
 
   // maybe push appendix to arguments (just before return address)
   if (is_invokedynamic || is_invokehandle) {
@@ -3800,36 +3797,6 @@
   invokevirtual_helper(rbx, rcx, rdx);
 }
 
-/*
- * The invokedirect bytecode is implemented as an invokevirtual bytecode:
- * The implementation blindly uses resolve_invokevirtual() and assumes
- * that a final call will be picked at the end. (Currently unsure about interfaces,
- * default methods, and about where "Value.equals(QValue;)Z" should live.)
- */
-void TemplateTable::invokedirect(int byte_no) {
-  transition(vtos, vtos);
-  assert(byte_no == f2_byte, "use this argument");
-  prepare_invoke(byte_no,
-      rbx,       // method (and not vtable index, as the method to be invoked should be final)
-      noreg,
-      rcx, rdx); // recv, flags
-
-  // Check if the method is final
-  Label notFinal;
-  __ movl(rax, rdx);
-  __ andl(rax, (1 << ConstantPoolCacheEntry::is_vfinal_shift));
-  __ jcc(Assembler::zero, notFinal);
-
-  __ verify_oop(rcx);
-  __ null_check(rcx);
-  __ profile_final_call(rax);
-  __ profile_arguments_type(rax, rbx, rbcp, true);
-  __ jump_from_interpreted(rbx, rax);
-
-  __ bind(notFinal);
-  __ stop("Interpreter observed a non-final method as a target of an invokedirect instruction");
-}
-
 void TemplateTable::invokespecial(int byte_no) {
   transition(vtos, vtos);
   assert(byte_no == f1_byte, "use this argument");
--- a/src/share/vm/ci/ciEnv.cpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/ci/ciEnv.cpp	Fri Apr 28 09:43:04 2017 -0400
@@ -736,7 +736,6 @@
       LinkResolver::linktime_resolve_interface_method_or_null(link_info);
     break;
   case Bytecodes::_invokevirtual:
-  case Bytecodes::_invokedirect:
     dest_method =
       LinkResolver::linktime_resolve_virtual_method_or_null(link_info);
     break;
@@ -792,7 +791,6 @@
       // if the names are not resolvable in the boot class loader (7056328).
       switch (bc) {
       case Bytecodes::_invokevirtual:
-      case Bytecodes::_invokedirect:
       case Bytecodes::_invokeinterface:
       case Bytecodes::_invokespecial:
       case Bytecodes::_invokestatic:
--- a/src/share/vm/ci/ciMethod.cpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/ci/ciMethod.cpp	Fri Apr 28 09:43:04 2017 -0400
@@ -578,7 +578,6 @@
 
 void ciMethod::assert_virtual_call_type_ok(int bci) {
   assert(java_code_at_bci(bci) == Bytecodes::_invokevirtual ||
-         java_code_at_bci(bci) == Bytecodes::_invokedirect ||
          java_code_at_bci(bci) == Bytecodes::_invokeinterface, "unexpected bytecode %s", Bytecodes::name(java_code_at_bci(bci)));
 }
 
--- a/src/share/vm/ci/ciStreams.cpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/ci/ciStreams.cpp	Fri Apr 28 09:43:04 2017 -0400
@@ -344,7 +344,6 @@
   switch (cur_bc()) {
   case Bytecodes::_invokeinterface:
   case Bytecodes::_invokevirtual:
-  case Bytecodes::_invokedirect:
   case Bytecodes::_invokespecial:
   case Bytecodes::_invokestatic:
   case Bytecodes::_invokedynamic:
--- a/src/share/vm/ci/ciTypeFlow.cpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/ci/ciTypeFlow.cpp	Fri Apr 28 09:43:04 2017 -0400
@@ -1377,7 +1377,6 @@
   case Bytecodes::_invokeinterface: do_invoke(str, true);           break;
   case Bytecodes::_invokespecial:   do_invoke(str, true);           break;
   case Bytecodes::_invokestatic:    do_invoke(str, false);          break;
-  case Bytecodes::_invokedirect:
   case Bytecodes::_invokevirtual:   do_invoke(str, true);           break;
   case Bytecodes::_invokedynamic:   do_invoke(str, false);          break;
 
--- a/src/share/vm/interpreter/abstractInterpreter.cpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/interpreter/abstractInterpreter.cpp	Fri Apr 28 09:43:04 2017 -0400
@@ -318,7 +318,6 @@
 
   switch (code) {
     case Bytecodes::_invokevirtual  :
-    case Bytecodes::_invokedirect   :
     case Bytecodes::_invokespecial  :
     case Bytecodes::_invokestatic   :
     case Bytecodes::_invokeinterface: {
--- a/src/share/vm/interpreter/bytecode.hpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/interpreter/bytecode.hpp	Fri Apr 28 09:43:04 2017 -0400
@@ -214,7 +214,6 @@
   // Testers
   bool is_invokeinterface() const                { return invoke_code() == Bytecodes::_invokeinterface; }
   bool is_invokevirtual() const                  { return invoke_code() == Bytecodes::_invokevirtual; }
-  bool is_invokedirect() const                   { return invoke_code() == Bytecodes::_invokedirect; }
   bool is_invokestatic() const                   { return invoke_code() == Bytecodes::_invokestatic; }
   bool is_invokespecial() const                  { return invoke_code() == Bytecodes::_invokespecial; }
   bool is_invokedynamic() const                  { return invoke_code() == Bytecodes::_invokedynamic; }
@@ -224,7 +223,6 @@
 
   bool is_valid() const                          { return is_invokeinterface() ||
                                                           is_invokevirtual()   ||
-                                                          is_invokedirect()    ||
                                                           is_invokestatic()    ||
                                                           is_invokespecial()   ||
                                                           is_invokedynamic()   ||
--- a/src/share/vm/interpreter/bytecodeTracer.cpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/interpreter/bytecodeTracer.cpp	Fri Apr 28 09:43:04 2017 -0400
@@ -552,7 +552,6 @@
       break;
 
     case Bytecodes::_invokevirtual:
-    case Bytecodes::_invokedirect:
     case Bytecodes::_invokespecial:
     case Bytecodes::_invokestatic:
       print_field_or_method(get_index_u2_cpcache(), st);
--- a/src/share/vm/interpreter/bytecodes.cpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/interpreter/bytecodes.cpp	Fri Apr 28 09:43:04 2017 -0400
@@ -487,7 +487,6 @@
   def(_vastore             , "vastore"             , "b"    , NULL    , T_VOID   , -3, true );
   def(_vreturn             , "vreturn"             , "b"    , NULL    , T_VALUETYPE, -1, true);
   def(_vgetfield           , "vgetfield"           , "bJJ"  , NULL    , T_ILLEGAL,  0, true );
-  def(_invokedirect        , "invokedirect"        , "bJJ"  , NULL    , T_ILLEGAL, -1, true);
   def(_vbox                , "vbox"                , "bkk"  , NULL    , T_OBJECT ,  0, true );
   def(_vunbox              , "vunbox"              , "bkk"  , NULL    , T_VALUETYPE,0, true );
   def(_vdefault            , "vdefault"            , "bkk"  , NULL    , T_VALUETYPE, 1, true);
--- a/src/share/vm/interpreter/bytecodes.hpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/interpreter/bytecodes.hpp	Fri Apr 28 09:43:04 2017 -0400
@@ -250,7 +250,6 @@
     _vastore              = 206, // 0xce
     _vreturn              = 210, // 0xd2
     _vgetfield            = 211, // 0xd3
-    _invokedirect         = 213, // 0xd5
     _vdefault             = 214, // 0xd6
     _vwithfield           = 215, // 0xd7
     _vbox                 = 216, // 0xd6
@@ -437,9 +436,8 @@
   static bool        is_zero_const  (Code code)    { return (code == _aconst_null || code == _iconst_0
                                                            || code == _fconst_0 || code == _dconst_0); }
   static bool        is_return      (Code code)    { return (_ireturn <= code && code <= _return); }
-  static bool        is_invoke      (Code code)    { return (_invokevirtual <= code && code <= _invokedynamic) || code == _invokedirect; }
+  static bool        is_invoke      (Code code)    { return (_invokevirtual <= code && code <= _invokedynamic); }
   static bool        has_receiver   (Code code)    { assert(is_invoke(code), "");  return code == _invokevirtual ||
-                                                                                          code == _invokedirect  ||
                                                                                           code == _invokespecial ||
                                                                                           code == _invokeinterface; }
   static bool        has_optional_appendix(Code code) { return code == _invokedynamic || code == _invokehandle; }
--- a/src/share/vm/interpreter/interpreterRuntime.cpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/interpreter/interpreterRuntime.cpp	Fri Apr 28 09:43:04 2017 -0400
@@ -978,9 +978,7 @@
   Thread* THREAD = thread;
   // extract receiver from the outgoing argument list if necessary
   Handle receiver(thread, NULL);
-  if (bytecode == Bytecodes::_invokevirtual ||
-      bytecode == Bytecodes::_invokeinterface ||
-      bytecode == Bytecodes::_invokedirect) {
+  if (bytecode == Bytecodes::_invokevirtual || bytecode == Bytecodes::_invokeinterface) {
     ResourceMark rm(thread);
     methodHandle m (thread, method(thread));
     Bytecode_invoke call(m, bci(thread));
@@ -1019,9 +1017,6 @@
     }
   } // end JvmtiHideSingleStepping
 
-  assert(!(bytecode == Bytecodes::_invokedirect && info.call_kind() != CallInfo::direct_call),
-         "the target of a invokedirect bytecode must be a direct call");
-
   // check if link resolution caused cpCache to be updated
   ConstantPoolCacheEntry* cp_cache_entry = cache_entry(thread);
   if (cp_cache_entry->is_resolved(bytecode)) return;
@@ -1129,7 +1124,6 @@
     resolve_get_put(thread, bytecode);
     break;
   case Bytecodes::_invokevirtual:
-  case Bytecodes::_invokedirect:
   case Bytecodes::_invokespecial:
   case Bytecodes::_invokestatic:
   case Bytecodes::_invokeinterface:
--- a/src/share/vm/interpreter/linkResolver.cpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/interpreter/linkResolver.cpp	Fri Apr 28 09:43:04 2017 -0400
@@ -1534,7 +1534,6 @@
     case Bytecodes::_invokestatic   : resolve_invokestatic   (result,       pool, index, CHECK); break;
     case Bytecodes::_invokespecial  : resolve_invokespecial  (result,       pool, index, CHECK); break;
     case Bytecodes::_invokevirtual  : resolve_invokevirtual  (result, recv, pool, index, CHECK); break;
-    case Bytecodes::_invokedirect   : resolve_invokespecial  (result,       pool, index, CHECK); break; // temp hack
     case Bytecodes::_invokehandle   : resolve_invokehandle   (result,       pool, index, CHECK); break;
     case Bytecodes::_invokedynamic  : resolve_invokedynamic  (result,       pool, index, CHECK); break;
     case Bytecodes::_invokeinterface: resolve_invokeinterface(result, recv, pool, index, CHECK); break;
--- a/src/share/vm/interpreter/rewriter.cpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/interpreter/rewriter.cpp	Fri Apr 28 09:43:04 2017 -0400
@@ -446,7 +446,6 @@
         case Bytecodes::_vgetfield      : // fall through
         case Bytecodes::_vwithfield     : // fall through but may require more checks for correctness
         case Bytecodes::_invokevirtual  : // fall through
-        case Bytecodes::_invokedirect   : // fall through
         case Bytecodes::_invokestatic   :
         case Bytecodes::_invokeinterface:
         case Bytecodes::_invokehandle   : // if reverse=true
--- a/src/share/vm/interpreter/templateInterpreter.cpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/interpreter/templateInterpreter.cpp	Fri Apr 28 09:43:04 2017 -0400
@@ -220,7 +220,6 @@
   case Bytecodes::_invokestatic:
   case Bytecodes::_invokespecial:
   case Bytecodes::_invokevirtual:
-  case Bytecodes::_invokedirect:
   case Bytecodes::_invokehandle:
     return Interpreter::invoke_return_entry_table();
   case Bytecodes::_invokeinterface:
@@ -243,7 +242,6 @@
   case Bytecodes::_invokestatic:
   case Bytecodes::_invokespecial:
   case Bytecodes::_invokevirtual:
-  case Bytecodes::_invokedirect:
   case Bytecodes::_invokehandle:
     return _invoke_return_entry[index];
   case Bytecodes::_invokeinterface:
--- a/src/share/vm/interpreter/templateTable.cpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/interpreter/templateTable.cpp	Fri Apr 28 09:43:04 2017 -0400
@@ -467,7 +467,6 @@
   def(Bytecodes::_vastore             , ____|____|clvm|____, vtos, vtos, vastore             ,  _           );
   def(Bytecodes::_vreturn             , ____|disp|clvm|____, qtos, qtos, _return             , qtos         );
   def(Bytecodes::_vgetfield           , ubcp|____|clvm|____, vtos, vtos, vgetfield           , _            );
-  def(Bytecodes::_invokedirect        , ubcp|disp|clvm|____, vtos, vtos, invokedirect        , f2_byte      );
   def(Bytecodes::_vdefault            , ubcp|____|clvm|____, vtos, qtos, vdefault            , _            );
   def(Bytecodes::_vwithfield          , ubcp|____|clvm|____, vtos, qtos, vwithfield          , _            );
   def(Bytecodes::_vbox                , ubcp|____|clvm|____, qtos, atos, _vbox               , _            );
--- a/src/share/vm/interpreter/templateTable.hpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/interpreter/templateTable.hpp	Fri Apr 28 09:43:04 2017 -0400
@@ -284,7 +284,6 @@
                                         Register flags,
                                         bool is_static);
   static void invokevirtual(int byte_no);
-  static void invokedirect(int byte_no);
   static void invokespecial(int byte_no);
   static void invokestatic(int byte_no);
   static void invokeinterface(int byte_no);
--- a/src/share/vm/oops/cpCache.cpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/oops/cpCache.cpp	Fri Apr 28 09:43:04 2017 -0400
@@ -158,7 +158,6 @@
 
       // ...and fall through as if we were handling invokevirtual:
     case Bytecodes::_invokevirtual:
-    case Bytecodes::_invokedirect:
       {
         if (!is_vtable_call) {
           assert(method->can_be_statically_bound(), "");
@@ -226,8 +225,7 @@
       if (method->is_public()) set_bytecode_1(invoke_code);
       invoke_code = Bytecodes::_invokevirtual;
     } else {
-      assert(invoke_code == Bytecodes::_invokevirtual ||
-             invoke_code == Bytecodes::_invokedirect, "");
+      assert(invoke_code == Bytecodes::_invokevirtual, "");
     }
     // set up for invokevirtual, even if linking for invokeinterface also:
     set_bytecode_2(invoke_code);
@@ -391,7 +389,6 @@
   if (invoke_code != (Bytecodes::Code)0) {
     switch (invoke_code) {
     case Bytecodes::_invokevirtual:
-    case Bytecodes::_invokedirect:
       if (is_vfinal()) {
         // invokevirtual
         Method* m = f2_as_vfinal_method();
--- a/src/share/vm/oops/cpCache.hpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/oops/cpCache.hpp	Fri Apr 28 09:43:04 2017 -0400
@@ -314,7 +314,6 @@
       case Bytecodes::_putstatic       :    // fall through
       case Bytecodes::_putfield        :    // fall through
       case Bytecodes::_vwithfield      :    // fall through
-      case Bytecodes::_invokedirect    :    // fall through
       case Bytecodes::_invokevirtual   : return 2;
       default                          : break;
     }
--- a/src/share/vm/oops/generateOopMap.cpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/oops/generateOopMap.cpp	Fri Apr 28 09:43:04 2017 -0400
@@ -1298,7 +1298,6 @@
     os->print("    %s", Bytecodes::name(currentBC->code()));
     switch(currentBC->code()) {
       case Bytecodes::_invokevirtual:
-      case Bytecodes::_invokedirect:
       case Bytecodes::_invokespecial:
       case Bytecodes::_invokestatic:
       case Bytecodes::_invokedynamic:
@@ -1331,7 +1330,6 @@
     }
     switch(currentBC->code()) {
       case Bytecodes::_invokevirtual:
-      case Bytecodes::_invokedirect:
       case Bytecodes::_invokespecial:
       case Bytecodes::_invokestatic:
       case Bytecodes::_invokedynamic:
@@ -1618,7 +1616,6 @@
     case Bytecodes::_invokeinterface:
     case Bytecodes::_invokevirtual:
     case Bytecodes::_invokespecial:     do_method(false, false, itr->get_index_u2_cpcache(), itr->bci()); break;
-    case Bytecodes::_invokedirect:      do_method(false, true , itr->get_index_u2_cpcache(), itr->bci()); break;
     case Bytecodes::_invokestatic:      do_method(true,  false, itr->get_index_u2_cpcache(), itr->bci()); break;
     case Bytecodes::_invokedynamic:     do_method(true,  false, itr->get_index_u4(),         itr->bci()); break;
     case Bytecodes::_newarray:
--- a/src/share/vm/oops/methodData.cpp	Thu Apr 27 13:04:18 2017 -0400
+++ b/src/share/vm/oops/methodData.cpp	Fri Apr 28 09:43:04 2017 -0400
@@ -742,7 +742,6 @@
   case Bytecodes::_jsr_w:
     return JumpData::static_cell_count();
   case Bytecodes::_invokevirtual:
-  case Bytecodes::_invokedirect:
   case Bytecodes::_invokeinterface:
     if (MethodData::profile_arguments() || MethodData::profile_return()) {
       return variable_cell_count;
@@ -806,7 +805,6 @@
       }
       break;
     case Bytecodes::_invokevirtual:
-    case Bytecodes::_invokedirect:
     case Bytecodes::_invokeinterface: {
       assert(MethodData::profile_arguments() || MethodData::profile_return(), "should be collecting args profile");
       if (profile_arguments_for_invoke(stream->method(), stream->bci()) ||
@@ -834,7 +832,6 @@
   case Bytecodes::_instanceof:
   case Bytecodes::_aastore:
   case Bytecodes::_invokevirtual:
-  case Bytecodes::_invokedirect:
   case Bytecodes::_invokeinterface:
   case Bytecodes::_if_acmpeq:
   case Bytecodes::_if_acmpne:
@@ -989,7 +986,6 @@
     tag = DataLayout::jump_data_tag;
     break;
   case Bytecodes::_invokevirtual:
-  case Bytecodes::_invokedirect:
   case Bytecodes::_invokeinterface: {
     int virtual_call_data_cell_count = VirtualCallData::static_cell_count();
     if (profile_arguments_for_invoke(stream->method(), stream->bci()) ||