< prev index next >

src/hotspot/share/classfile/verifier.cpp

Print this page

        

*** 2784,2807 **** "Illegal call to internal method"); return; } } else if (opcode == Bytecodes::_invokespecial && !is_same_or_direct_interface(current_class(), current_type(), ref_class_type) ! && !ref_class_type.equals(VerificationType::reference_type(current_class()->super()->name()))) { bool subtype = false; bool have_imr_indirect = cp->tag_at(index).value() == JVM_CONSTANT_InterfaceMethodref; if (!current_class()->is_anonymous()) { ! subtype = ref_class_type.is_assignable_from(current_type(), this, false, CHECK_VERIFY(this)); } else { VerificationType host_klass_type = VerificationType::reference_type(current_class()->host_klass()->name()); subtype = ref_class_type.is_assignable_from(host_klass_type, this, false, CHECK_VERIFY(this)); // If invokespecial of IMR, need to recheck for same or // direct interface relative to the host class have_imr_indirect = (have_imr_indirect && ! !is_same_or_direct_interface(current_class()->host_klass(), host_klass_type, ref_class_type)); } if (!subtype) { verify_error(ErrorContext::bad_code(bci), "Bad invokespecial instruction: " --- 2784,2810 ---- "Illegal call to internal method"); return; } } else if (opcode == Bytecodes::_invokespecial && !is_same_or_direct_interface(current_class(), current_type(), ref_class_type) ! && !ref_class_type.equals(VerificationType::reference_type( ! current_class()->super()->name()))) { bool subtype = false; bool have_imr_indirect = cp->tag_at(index).value() == JVM_CONSTANT_InterfaceMethodref; if (!current_class()->is_anonymous()) { ! subtype = ref_class_type.is_assignable_from( ! current_type(), this, false, CHECK_VERIFY(this)); } else { VerificationType host_klass_type = VerificationType::reference_type(current_class()->host_klass()->name()); subtype = ref_class_type.is_assignable_from(host_klass_type, this, false, CHECK_VERIFY(this)); // If invokespecial of IMR, need to recheck for same or // direct interface relative to the host class have_imr_indirect = (have_imr_indirect && ! !is_same_or_direct_interface( ! current_class()->host_klass(), host_klass_type, ref_class_type)); } if (!subtype) { verify_error(ErrorContext::bad_code(bci), "Bad invokespecial instruction: "
*** 2811,2822 **** verify_error(ErrorContext::bad_code(bci), "Bad invokespecial instruction: " "interface method reference is in an indirect superinterface."); return; } - } // Match method descriptor with operand stack for (int i = nargs - 1; i >= 0; i--) { // Run backwards current_frame->pop_stack(sig_types[i], CHECK_VERIFY(this)); } // Check objectref on operand stack --- 2814,2825 ---- verify_error(ErrorContext::bad_code(bci), "Bad invokespecial instruction: " "interface method reference is in an indirect superinterface."); return; } + } // Match method descriptor with operand stack for (int i = nargs - 1; i >= 0; i--) { // Run backwards current_frame->pop_stack(sig_types[i], CHECK_VERIFY(this)); } // Check objectref on operand stack
*** 2826,2836 **** verify_invoke_init(bcs, index, ref_class_type, current_frame, code_length, in_try_block, this_uninit, cp, stackmap_table, CHECK_VERIFY(this)); if (was_recursively_verified()) return; } else { // other methods ! // Ensures that target class is assignable to current class (4.9.2) if (opcode == Bytecodes::_invokespecial) { if (!current_class()->is_anonymous()) { current_frame->pop_stack(current_type(), CHECK_VERIFY(this)); } else { // anonymous class invokespecial calls: check if the --- 2829,2839 ---- verify_invoke_init(bcs, index, ref_class_type, current_frame, code_length, in_try_block, this_uninit, cp, stackmap_table, CHECK_VERIFY(this)); if (was_recursively_verified()) return; } else { // other methods ! // Ensures that target class is assignable to method class. if (opcode == Bytecodes::_invokespecial) { if (!current_class()->is_anonymous()) { current_frame->pop_stack(current_type(), CHECK_VERIFY(this)); } else { // anonymous class invokespecial calls: check if the
*** 2839,2849 **** VerificationType top = current_frame->pop_stack(CHECK_VERIFY(this)); VerificationType hosttype = VerificationType::reference_type(current_class()->host_klass()->name()); bool subtype = hosttype.is_assignable_from(top, this, false, CHECK_VERIFY(this)); if (!subtype) { ! verify_error(ErrorContext::bad_type(current_frame->offset(), current_frame->stack_top_ctx(), TypeOrigin::implicit(top)), "Bad type on operand stack"); return; } --- 2842,2852 ---- VerificationType top = current_frame->pop_stack(CHECK_VERIFY(this)); VerificationType hosttype = VerificationType::reference_type(current_class()->host_klass()->name()); bool subtype = hosttype.is_assignable_from(top, this, false, CHECK_VERIFY(this)); if (!subtype) { ! verify_error( ErrorContext::bad_type(current_frame->offset(), current_frame->stack_top_ctx(), TypeOrigin::implicit(top)), "Bad type on operand stack"); return; }
< prev index next >