1.1 --- a/src/share/vm/classfile/verifier.cpp Tue May 25 13:18:49 2010 -0700 1.2 +++ b/src/share/vm/classfile/verifier.cpp Thu May 27 09:54:07 2010 -0700 1.3 @@ -254,6 +254,9 @@ 1.4 int num_methods = methods->length(); 1.5 1.6 for (int index = 0; index < num_methods; index++) { 1.7 + // Check for recursive re-verification before each method. 1.8 + if (was_recursively_verified()) return; 1.9 + 1.10 methodOop m = (methodOop)methods->obj_at(index); 1.11 if (m->is_native() || m->is_abstract()) { 1.12 // If m is native or abstract, skip it. It is checked in class file 1.13 @@ -262,6 +265,12 @@ 1.14 } 1.15 verify_method(methodHandle(THREAD, m), CHECK_VERIFY(this)); 1.16 } 1.17 + 1.18 + if (_verify_verbose || TraceClassInitialization) { 1.19 + if (was_recursively_verified()) 1.20 + tty->print_cr("Recursive verification detected for: %s", 1.21 + _klass->external_name()); 1.22 + } 1.23 } 1.24 1.25 void ClassVerifier::verify_method(methodHandle m, TRAPS) { 1.26 @@ -326,6 +335,9 @@ 1.27 // instruction in sequence 1.28 Bytecodes::Code opcode; 1.29 while (!bcs.is_last_bytecode()) { 1.30 + // Check for recursive re-verification before each bytecode. 1.31 + if (was_recursively_verified()) return; 1.32 + 1.33 opcode = bcs.raw_next(); 1.34 u2 bci = bcs.bci(); 1.35 1.36 @@ -1470,20 +1482,9 @@ 1.37 1.38 // In some situations, bytecode rewriting may occur while we're verifying. 1.39 // In this case, a constant pool cache exists and some indices refer to that 1.40 - // instead. Get the original index for the tag check 1.41 - constantPoolCacheOop cache = cp->cache(); 1.42 - if (cache != NULL && 1.43 - ((types == (1 << JVM_CONSTANT_InterfaceMethodref)) || 1.44 - (types == (1 << JVM_CONSTANT_Methodref)) || 1.45 - (types == (1 << JVM_CONSTANT_Fieldref)))) { 1.46 - int native_index = index; 1.47 - if (Bytes::is_Java_byte_ordering_different()) { 1.48 - native_index = Bytes::swap_u2(index); 1.49 - } 1.50 - assert((native_index >= 0) && (native_index < cache->length()), 1.51 - "Must be a legal index into the cp cache"); 1.52 - index = cache->entry_at(native_index)->constant_pool_index(); 1.53 - } 1.54 + // instead. Be sure we don't pick up such indices by accident. 1.55 + // We must check was_recursively_verified() before we get here. 1.56 + guarantee(cp->cache() == NULL, "not rewritten yet"); 1.57 1.58 verify_cp_index(cp, index, CHECK_VERIFY(this)); 1.59 unsigned int tag = cp->tag_at(index).value();