< prev index next >

src/hotspot/share/classfile/verifier.cpp

Print this page




2792       verify_error(ErrorContext::bad_code(bci),
2793           "Inconsistent args count operand in invokeinterface");
2794       return;
2795     }
2796     if (*(bcp+4) != 0) {
2797       verify_error(ErrorContext::bad_code(bci),
2798           "Fourth operand byte of invokeinterface must be zero");
2799       return;
2800     }
2801   }
2802 
2803   if (opcode == Bytecodes::_invokedynamic) {
2804     address bcp = bcs->bcp();
2805     if (*(bcp+3) != 0 || *(bcp+4) != 0) {
2806       verify_error(ErrorContext::bad_code(bci),
2807           "Third and fourth operand bytes of invokedynamic must be zero");
2808       return;
2809     }
2810   }
2811 
2812   if (method_name->byte_at(0) == '<') {
2813     // Make sure <init> can only be invoked by invokespecial
2814     if (opcode != Bytecodes::_invokespecial ||
2815         method_name != vmSymbols::object_initializer_name()) {
2816       verify_error(ErrorContext::bad_code(bci),
2817           "Illegal call to internal method");
2818       return;
2819     }
2820   } else if (opcode == Bytecodes::_invokespecial
2821              && !is_same_or_direct_interface(current_class(), current_type(), ref_class_type)
2822              && !ref_class_type.equals(VerificationType::reference_type(
2823                   current_class()->super()->name()))) {
2824     bool subtype = false;
2825     bool have_imr_indirect = cp->tag_at(index).value() == JVM_CONSTANT_InterfaceMethodref;
2826     if (!current_class()->is_unsafe_anonymous()) {
2827       subtype = ref_class_type.is_assignable_from(
2828                  current_type(), this, false, CHECK_VERIFY(this));
2829     } else {
2830       VerificationType unsafe_anonymous_host_type =
2831                         VerificationType::reference_type(current_class()->unsafe_anonymous_host()->name());
2832       subtype = ref_class_type.is_assignable_from(unsafe_anonymous_host_type, this, false, CHECK_VERIFY(this));




2792       verify_error(ErrorContext::bad_code(bci),
2793           "Inconsistent args count operand in invokeinterface");
2794       return;
2795     }
2796     if (*(bcp+4) != 0) {
2797       verify_error(ErrorContext::bad_code(bci),
2798           "Fourth operand byte of invokeinterface must be zero");
2799       return;
2800     }
2801   }
2802 
2803   if (opcode == Bytecodes::_invokedynamic) {
2804     address bcp = bcs->bcp();
2805     if (*(bcp+3) != 0 || *(bcp+4) != 0) {
2806       verify_error(ErrorContext::bad_code(bci),
2807           "Third and fourth operand bytes of invokedynamic must be zero");
2808       return;
2809     }
2810   }
2811 
2812   if (method_name->char_at(0) == '<') {
2813     // Make sure <init> can only be invoked by invokespecial
2814     if (opcode != Bytecodes::_invokespecial ||
2815         method_name != vmSymbols::object_initializer_name()) {
2816       verify_error(ErrorContext::bad_code(bci),
2817           "Illegal call to internal method");
2818       return;
2819     }
2820   } else if (opcode == Bytecodes::_invokespecial
2821              && !is_same_or_direct_interface(current_class(), current_type(), ref_class_type)
2822              && !ref_class_type.equals(VerificationType::reference_type(
2823                   current_class()->super()->name()))) {
2824     bool subtype = false;
2825     bool have_imr_indirect = cp->tag_at(index).value() == JVM_CONSTANT_InterfaceMethodref;
2826     if (!current_class()->is_unsafe_anonymous()) {
2827       subtype = ref_class_type.is_assignable_from(
2828                  current_type(), this, false, CHECK_VERIFY(this));
2829     } else {
2830       VerificationType unsafe_anonymous_host_type =
2831                         VerificationType::reference_type(current_class()->unsafe_anonymous_host()->name());
2832       subtype = ref_class_type.is_assignable_from(unsafe_anonymous_host_type, this, false, CHECK_VERIFY(this));


< prev index next >