src/share/vm/classfile/verifier.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File bug_8058575.hs.3 Sdiff src/share/vm/classfile

src/share/vm/classfile/verifier.cpp

Print this page




2769       return;
2770     }
2771   } else if (opcode == Bytecodes::_invokespecial
2772              && !is_same_or_direct_interface(current_class(), current_type(), ref_class_type)
2773              && !ref_class_type.equals(VerificationType::reference_type(
2774                   current_class()->super()->name()))) {
2775     bool subtype = false;
2776     bool have_imr_indirect = cp->tag_at(index).value() == JVM_CONSTANT_InterfaceMethodref;
2777     if (!current_class()->is_anonymous()) {
2778       subtype = ref_class_type.is_assignable_from(
2779                  current_type(), this, false, CHECK_VERIFY(this));
2780     } else {
2781       VerificationType host_klass_type =
2782                         VerificationType::reference_type(current_class()->host_klass()->name());
2783       subtype = ref_class_type.is_assignable_from(host_klass_type, this, false, CHECK_VERIFY(this));
2784 
2785       // If invokespecial of IMR, need to recheck for same or
2786       // direct interface relative to the host class
2787       have_imr_indirect = (have_imr_indirect &&
2788                            !is_same_or_direct_interface(
2789                              InstanceKlass::cast(current_class()->host_klass()),
2790                              host_klass_type, ref_class_type));
2791     }
2792     if (!subtype) {
2793       verify_error(ErrorContext::bad_code(bci),
2794           "Bad invokespecial instruction: "
2795           "current class isn't assignable to reference class.");
2796        return;
2797     } else if (have_imr_indirect) {
2798       verify_error(ErrorContext::bad_code(bci),
2799           "Bad invokespecial instruction: "
2800           "interface method reference is in an indirect superinterface.");
2801       return;
2802     }
2803 
2804   }
2805   // Match method descriptor with operand stack
2806   for (int i = nargs - 1; i >= 0; i--) {  // Run backwards
2807     current_frame->pop_stack(sig_types[i], CHECK_VERIFY(this));
2808   }
2809   // Check objectref on operand stack




2769       return;
2770     }
2771   } else if (opcode == Bytecodes::_invokespecial
2772              && !is_same_or_direct_interface(current_class(), current_type(), ref_class_type)
2773              && !ref_class_type.equals(VerificationType::reference_type(
2774                   current_class()->super()->name()))) {
2775     bool subtype = false;
2776     bool have_imr_indirect = cp->tag_at(index).value() == JVM_CONSTANT_InterfaceMethodref;
2777     if (!current_class()->is_anonymous()) {
2778       subtype = ref_class_type.is_assignable_from(
2779                  current_type(), this, false, CHECK_VERIFY(this));
2780     } else {
2781       VerificationType host_klass_type =
2782                         VerificationType::reference_type(current_class()->host_klass()->name());
2783       subtype = ref_class_type.is_assignable_from(host_klass_type, this, false, CHECK_VERIFY(this));
2784 
2785       // If invokespecial of IMR, need to recheck for same or
2786       // direct interface relative to the host class
2787       have_imr_indirect = (have_imr_indirect &&
2788                            !is_same_or_direct_interface(
2789                              current_class()->host_klass(),
2790                              host_klass_type, ref_class_type));
2791     }
2792     if (!subtype) {
2793       verify_error(ErrorContext::bad_code(bci),
2794           "Bad invokespecial instruction: "
2795           "current class isn't assignable to reference class.");
2796        return;
2797     } else if (have_imr_indirect) {
2798       verify_error(ErrorContext::bad_code(bci),
2799           "Bad invokespecial instruction: "
2800           "interface method reference is in an indirect superinterface.");
2801       return;
2802     }
2803 
2804   }
2805   // Match method descriptor with operand stack
2806   for (int i = nargs - 1; i >= 0; i--) {  // Run backwards
2807     current_frame->pop_stack(sig_types[i], CHECK_VERIFY(this));
2808   }
2809   // Check objectref on operand stack


src/share/vm/classfile/verifier.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File