Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8195828

[Nestmates] Remove leftover changes to invokespecial handling that are not needed

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: repo-valhalla
    • Fix Version/s: repo-valhalla
    • Component/s: hotspot
    • Labels:

      Description

      Delete this addition:

      *** 1147,1156 ****
      --- 1163,1192 ----
                                                          resolved_method->name(),
                                                          resolved_method->signature()));
            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);
          }
        

      Delete this addition:

      *** 1182,1192 ****
                // b) check if the class of the resolved_klass is a superclass
                // (not supertype in order to exclude interface classes) of the current class.
                // 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) {
              // Lookup super method
              Klass* super_klass = current_klass->super();
              sel_method = lookup_instance_method_in_klasses(super_klass,
                                   resolved_method->name(),
                                   resolved_method->signature(), CHECK);
      --- 1218,1231 ----
                // b) check if the class of the resolved_klass is a superclass
                // (not supertype in order to exclude interface classes) of the current class.
                // 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()
      ! ) {
              // Lookup super method
              Klass* super_klass = current_klass->super();
              sel_method = lookup_instance_method_in_klasses(super_klass,
                                   resolved_method->name(),
                                   resolved_method->signature(), CHECK);

      Delete this leftover minor edit:

      *** 1207,1218 ****
            // or a subtype of the current class or interface (the sender), otherwise invokespecial
            // throws IllegalAccessError.
            // 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* 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)) {
                ResourceMark rm(THREAD);
                char buf[500];
      --- 1246,1257 ----
            // or a subtype of the current class or interface (the sender), otherwise invokespecial
            // throws IllegalAccessError.
            // 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;
            if (sender->is_interface() && recv.not_null()) {
              Klass* receiver_klass = recv->klass();
              if (!receiver_klass->is_subtype_of(sender)) {
                ResourceMark rm(THREAD);
                char buf[500];

        Attachments

          Activity

            People

            • Assignee:
              dholmes David Holmes
              Reporter:
              dholmes David Holmes
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: