diff --git a/src/share/vm/classfile/loaderConstraints.cpp b/src/share/vm/classfile/loaderConstraints.cpp index daaaa3275560104715794c56a752dae71ba2ecdc..0a8693403d11007f87e71830c8abe924e2d4e9ca 100644 --- a/src/share/vm/classfile/loaderConstraints.cpp +++ b/src/share/vm/classfile/loaderConstraints.cpp @@ -457,7 +457,8 @@ void LoaderConstraintTable::merge_loader_constraints( } -void LoaderConstraintTable::verify(Dictionary* dictionary) { +void LoaderConstraintTable::verify(Dictionary* dictionary, + PlaceholderTable* placeholders) { Thread *thread = Thread::current(); for (int cindex = 0; cindex < _loader_constraint_size; cindex++) { for (LoaderConstraintEntry* probe = bucket(cindex); @@ -472,7 +473,23 @@ void LoaderConstraintTable::verify(Dictionary* dictionary) { unsigned int d_hash = dictionary->compute_hash(name, loader); int d_index = dictionary->hash_to_index(d_hash); klassOop k = dictionary->find_class(d_index, d_hash, name, loader); - guarantee(k == probe->klass(), "klass should be in dictionary"); + if (k != NULL) { + // We found the class in the system dictionary, so we should + // make sure that the klassOop matches what we already have. + guarantee(k == probe->klass(), "klass should be in dictionary"); + } else { + // If we don't find the class in the system dictionary, it + // has to be in the placeholders table. + unsigned int p_hash = placeholders->compute_hash(name, loader); + int p_index = placeholders->hash_to_index(p_hash); + PlaceholderEntry* entry = placeholders->get_entry(p_index, p_hash, + name, loader); + + // The instanceKlass might not be on the entry, so the only + // thing we can check here is whether we were successful in + // finding the class in the placeholders table. + guarantee(entry != NULL, "klass should be in the placeholders"); + } } for (int n = 0; n< probe->num_loaders(); n++) { guarantee(probe->loader(n)->is_oop_or_null(), "should be oop"); diff --git a/src/share/vm/classfile/loaderConstraints.hpp b/src/share/vm/classfile/loaderConstraints.hpp index 6928180d22adc041cd937bb34c2a7e4b521f23a0..53ce146b168f97821c20030dbbfffed90d226790 100644 --- a/src/share/vm/classfile/loaderConstraints.hpp +++ b/src/share/vm/classfile/loaderConstraints.hpp @@ -84,7 +84,7 @@ public: void purge_loader_constraints(BoolObjectClosure* is_alive); - void verify(Dictionary* dictionary); + void verify(Dictionary* dictionary, PlaceholderTable* placeholders); #ifndef PRODUCT void print(); #endif diff --git a/src/share/vm/classfile/systemDictionary.cpp b/src/share/vm/classfile/systemDictionary.cpp index fb22282e97ce895bd847f1423e74679ed5e0bccf..1db0a5cfb155fa325151cf422886fbdebac2d84f 100644 --- a/src/share/vm/classfile/systemDictionary.cpp +++ b/src/share/vm/classfile/systemDictionary.cpp @@ -2573,7 +2573,7 @@ void SystemDictionary::verify() { // Verify constraint table guarantee(constraints() != NULL, "Verify of loader constraints failed"); - constraints()->verify(dictionary()); + constraints()->verify(dictionary(), placeholders()); } diff --git a/src/share/vm/includeDB_core b/src/share/vm/includeDB_core index 675a6657e0b55d6201827c9af5a43de63fada047..bf99452203067aa8935220f1aa22ba489b91c1e0 100644 --- a/src/share/vm/includeDB_core +++ b/src/share/vm/includeDB_core @@ -2654,6 +2654,7 @@ loaderConstraints.cpp resourceArea.hpp loaderConstraints.cpp safepoint.hpp loaderConstraints.hpp dictionary.hpp +loaderConstraints.hpp placeholders.hpp loaderConstraints.hpp hashtable.hpp location.cpp debugInfo.hpp