changeset 48760:b08ab29605ef nestmates

8195828: [Nestmates] Remove leftover changes to invokespecial handling that are not needed Reviewed-by: acorn
author dholmes
date Wed, 24 Jan 2018 23:11:22 -0500
parents 209ed71e4cb8
children f2ca4cada742
files src/hotspot/share/interpreter/linkResolver.cpp
diffstat 1 files changed, 5 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/interpreter/linkResolver.cpp	Wed Jan 24 23:10:05 2018 -0500
+++ b/src/hotspot/share/interpreter/linkResolver.cpp	Wed Jan 24 23:11:22 2018 -0500
@@ -1128,7 +1128,8 @@
     return NULL;
   }
 
-  // check that invokespecial's interface method reference is in an indirect superinterface
+  // ensure that invokespecial's interface method reference is in
+  // a direct superinterface, not an indirect superinterface
   Klass* current_klass = link_info.current_klass();
   if (current_klass != NULL && resolved_klass->is_interface()) {
     InstanceKlass* ck = InstanceKlass::cast(current_klass);
@@ -1165,26 +1166,6 @@
     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
   }
 
-  // For private method invocation we should only find the method in the resolved class.
-  // If that is not the case then we have a found a supertype method that we have nestmate
-  // access to.
-  // FIXME: the "ignoring xxx" part is for debugging only
-  if (resolved_method->is_private() && resolved_method->method_holder() != resolved_klass) {
-    ResourceMark rm(THREAD);
-    DEBUG_ONLY(bool is_nestmate = InstanceKlass::cast(link_info.current_klass())->has_nestmate_access_to(InstanceKlass::cast(resolved_klass), THREAD);)
-    assert(is_nestmate, "was only expecting nestmates here!");
-    Exceptions::fthrow(
-      THREAD_AND_LOCATION,
-      vmSymbols::java_lang_NoSuchMethodError(),
-      "%s: method %s%s not found (ignoring %s)",
-      resolved_klass->external_name(),
-      resolved_method->name()->as_C_string(),
-      resolved_method->signature()->as_C_string(),
-      resolved_method->method_holder()->external_name()
-    );
-    return NULL;
-  }
-
   if (log_develop_is_enabled(Trace, itables)) {
     trace_method_resolution("invokespecial resolved method: caller-class:",
                             current_klass, resolved_klass, resolved_method, true);
@@ -1220,9 +1201,7 @@
         // This check is not performed for super.invoke for interface methods
         // in super interfaces.
         current_klass->is_subclass_of(resolved_klass) &&
-        current_klass != resolved_klass &&
-        // c) check the method is not private - we don't re-resolve private methods
-        !resolved_method->is_private()
+        current_klass != resolved_klass
         ) {
       // Lookup super method
       Klass* super_klass = current_klass->super();
@@ -1248,8 +1227,8 @@
     // The verifier checks that the sender is a subtype of the class in the I/MR operand.
     // The verifier also checks that the receiver is a subtype of the sender, if the sender is
     // a class.  If the sender is an interface, the check has to be performed at runtime.
-    InstanceKlass* cur_ik = InstanceKlass::cast(current_klass);
-    InstanceKlass* sender = cur_ik->is_anonymous() ? cur_ik->host_klass() : cur_ik;
+    InstanceKlass* sender = InstanceKlass::cast(current_klass);
+    sender = sender->is_anonymous() ? sender->host_klass() : sender;
     if (sender->is_interface() && recv.not_null()) {
       Klass* receiver_klass = recv->klass();
       if (!receiver_klass->is_subtype_of(sender)) {