comparison src/share/vm/classfile/verifier.cpp @ 6934:4735d2c84362

7200776: Implement default methods in interfaces Summary: Add generic type analysis and default method selection algorithms Reviewed-by: coleenp, acorn
author kamg
date Thu, 11 Oct 2012 12:25:42 -0400
parents da91efe96a93
children 18fb7da42534
comparison
equal deleted inserted replaced
6921:a1b8cf9cf970 6934:4735d2c84362
553 for (int index = 0; index < num_methods; index++) { 553 for (int index = 0; index < num_methods; index++) {
554 // Check for recursive re-verification before each method. 554 // Check for recursive re-verification before each method.
555 if (was_recursively_verified()) return; 555 if (was_recursively_verified()) return;
556 556
557 Method* m = methods->at(index); 557 Method* m = methods->at(index);
558 if (m->is_native() || m->is_abstract()) { 558 if (m->is_native() || m->is_abstract() || m->is_overpass()) {
559 // If m is native or abstract, skip it. It is checked in class file 559 // If m is native or abstract, skip it. It is checked in class file
560 // parser that methods do not override a final method. 560 // parser that methods do not override a final method. Overpass methods
561 // are trusted since the VM generates them.
561 continue; 562 continue;
562 } 563 }
563 verify_method(methodHandle(THREAD, m), CHECK_VERIFY(this)); 564 verify_method(methodHandle(THREAD, m), CHECK_VERIFY(this));
564 } 565 }
565 566
2302 bool *this_uninit, VerificationType return_type, 2303 bool *this_uninit, VerificationType return_type,
2303 constantPoolHandle cp, TRAPS) { 2304 constantPoolHandle cp, TRAPS) {
2304 // Make sure the constant pool item is the right type 2305 // Make sure the constant pool item is the right type
2305 u2 index = bcs->get_index_u2(); 2306 u2 index = bcs->get_index_u2();
2306 Bytecodes::Code opcode = bcs->raw_code(); 2307 Bytecodes::Code opcode = bcs->raw_code();
2307 unsigned int types = (opcode == Bytecodes::_invokeinterface 2308 unsigned int types;
2308 ? 1 << JVM_CONSTANT_InterfaceMethodref 2309 switch (opcode) {
2309 : opcode == Bytecodes::_invokedynamic 2310 case Bytecodes::_invokeinterface:
2310 ? 1 << JVM_CONSTANT_InvokeDynamic 2311 types = 1 << JVM_CONSTANT_InterfaceMethodref;
2311 : 1 << JVM_CONSTANT_Methodref); 2312 break;
2313 case Bytecodes::_invokedynamic:
2314 types = 1 << JVM_CONSTANT_InvokeDynamic;
2315 break;
2316 case Bytecodes::_invokespecial:
2317 types = (1 << JVM_CONSTANT_InterfaceMethodref) |
2318 (1 << JVM_CONSTANT_Methodref);
2319 break;
2320 default:
2321 types = 1 << JVM_CONSTANT_Methodref;
2322 }
2312 verify_cp_type(bcs->bci(), index, cp, types, CHECK_VERIFY(this)); 2323 verify_cp_type(bcs->bci(), index, cp, types, CHECK_VERIFY(this));
2313 2324
2314 // Get method name and signature 2325 // Get method name and signature
2315 Symbol* method_name = cp->name_ref_at(index); 2326 Symbol* method_name = cp->name_ref_at(index);
2316 Symbol* method_sig = cp->signature_ref_at(index); 2327 Symbol* method_sig = cp->signature_ref_at(index);