src/hotspot/share/runtime/sharedRuntime.cpp
changeset 50449 acdfeede95ff
parent 50375 bfbe7d8369bb
child 50666 3e66d204af9b
--- a/src/hotspot/share/runtime/sharedRuntime.cpp	Thu Jun 07 17:40:15 2018 +0200
+++ b/src/hotspot/share/runtime/sharedRuntime.cpp	Wed Jun 06 23:36:08 2018 +0300
@@ -1082,6 +1082,7 @@
 
   Bytecode_invoke bytecode(caller, bci);
   int bytecode_index = bytecode.index();
+  bc = bytecode.invoke_code();
 
   methodHandle attached_method = extract_attached_method(vfst);
   if (attached_method.not_null()) {
@@ -1095,6 +1096,11 @@
 
       // Adjust invocation mode according to the attached method.
       switch (bc) {
+        case Bytecodes::_invokevirtual:
+          if (attached_method->method_holder()->is_interface()) {
+            bc = Bytecodes::_invokeinterface;
+          }
+          break;
         case Bytecodes::_invokeinterface:
           if (!attached_method->method_holder()->is_interface()) {
             bc = Bytecodes::_invokevirtual;
@@ -1110,10 +1116,10 @@
           break;
       }
     }
-  } else {
-    bc = bytecode.invoke_code();
   }
 
+  assert(bc != Bytecodes::_illegal, "not initialized");
+
   bool has_receiver = bc != Bytecodes::_invokestatic &&
                       bc != Bytecodes::_invokedynamic &&
                       bc != Bytecodes::_invokehandle;