< prev index next >

src/hotspot/share/classfile/verifier.cpp

Print this page


2661     // incoming stackmap (before initialize_object() changes them to outgoing
2662     // state).
2663     if (in_try_block) {
2664       if (was_recursively_verified()) return;
2665       verify_exception_handler_targets(bci, *this_uninit, current_frame,
2666                                        stackmap_table, CHECK_VERIFY(this));
2667     }
2668     current_frame->initialize_object(type, new_class_type);
2669   } else {
2670     verify_error(ErrorContext::bad_type(bci, current_frame->stack_top_ctx()),
2671         "Bad operand type when invoking <init>");
2672     return;
2673   }
2674 }
2675 
2676 bool ClassVerifier::is_same_or_direct_interface(
2677     InstanceKlass* klass,
2678     VerificationType klass_type,
2679     VerificationType ref_class_type) {
2680   if (ref_class_type.equals(klass_type)) return true;
2681   Array<Klass*>* local_interfaces = klass->local_interfaces();
2682   if (local_interfaces != NULL) {
2683     for (int x = 0; x < local_interfaces->length(); x++) {
2684       Klass* k = local_interfaces->at(x);
2685       assert (k != NULL && k->is_interface(), "invalid interface");
2686       if (ref_class_type.equals(VerificationType::reference_type(k->name()))) {
2687         return true;
2688       }
2689     }
2690   }
2691   return false;
2692 }
2693 
2694 void ClassVerifier::verify_invoke_instructions(
2695     RawBytecodeStream* bcs, u4 code_length, StackMapFrame* current_frame,
2696     bool in_try_block, bool *this_uninit, VerificationType return_type,
2697     const constantPoolHandle& cp, StackMapTable* stackmap_table, TRAPS) {
2698   // Make sure the constant pool item is the right type
2699   u2 index = bcs->get_index_u2();
2700   Bytecodes::Code opcode = bcs->raw_code();
2701   unsigned int types = 0;
2702   switch (opcode) {
2703     case Bytecodes::_invokeinterface:
2704       types = 1 << JVM_CONSTANT_InterfaceMethodref;




2661     // incoming stackmap (before initialize_object() changes them to outgoing
2662     // state).
2663     if (in_try_block) {
2664       if (was_recursively_verified()) return;
2665       verify_exception_handler_targets(bci, *this_uninit, current_frame,
2666                                        stackmap_table, CHECK_VERIFY(this));
2667     }
2668     current_frame->initialize_object(type, new_class_type);
2669   } else {
2670     verify_error(ErrorContext::bad_type(bci, current_frame->stack_top_ctx()),
2671         "Bad operand type when invoking <init>");
2672     return;
2673   }
2674 }
2675 
2676 bool ClassVerifier::is_same_or_direct_interface(
2677     InstanceKlass* klass,
2678     VerificationType klass_type,
2679     VerificationType ref_class_type) {
2680   if (ref_class_type.equals(klass_type)) return true;
2681   Array<InstanceKlass*>* local_interfaces = klass->local_interfaces();
2682   if (local_interfaces != NULL) {
2683     for (int x = 0; x < local_interfaces->length(); x++) {
2684       InstanceKlass* k = local_interfaces->at(x);
2685       assert (k != NULL && k->is_interface(), "invalid interface");
2686       if (ref_class_type.equals(VerificationType::reference_type(k->name()))) {
2687         return true;
2688       }
2689     }
2690   }
2691   return false;
2692 }
2693 
2694 void ClassVerifier::verify_invoke_instructions(
2695     RawBytecodeStream* bcs, u4 code_length, StackMapFrame* current_frame,
2696     bool in_try_block, bool *this_uninit, VerificationType return_type,
2697     const constantPoolHandle& cp, StackMapTable* stackmap_table, TRAPS) {
2698   // Make sure the constant pool item is the right type
2699   u2 index = bcs->get_index_u2();
2700   Bytecodes::Code opcode = bcs->raw_code();
2701   unsigned int types = 0;
2702   switch (opcode) {
2703     case Bytecodes::_invokeinterface:
2704       types = 1 << JVM_CONSTANT_InterfaceMethodref;


< prev index next >