提交 1414fd1c 编写于 作者: T tonyp

6920977: G1: guarantee(k == probe->klass(),"klass should be in dictionary") fails

Summary: the guarantee is too strict and the test will fail (incorrectly) if the class is not in the system dictionary but in the placeholders.
Reviewed-by: acorn, phh
上级 0873bab8
...@@ -457,7 +457,8 @@ void LoaderConstraintTable::merge_loader_constraints( ...@@ -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(); Thread *thread = Thread::current();
for (int cindex = 0; cindex < _loader_constraint_size; cindex++) { for (int cindex = 0; cindex < _loader_constraint_size; cindex++) {
for (LoaderConstraintEntry* probe = bucket(cindex); for (LoaderConstraintEntry* probe = bucket(cindex);
...@@ -472,7 +473,23 @@ void LoaderConstraintTable::verify(Dictionary* dictionary) { ...@@ -472,7 +473,23 @@ void LoaderConstraintTable::verify(Dictionary* dictionary) {
unsigned int d_hash = dictionary->compute_hash(name, loader); unsigned int d_hash = dictionary->compute_hash(name, loader);
int d_index = dictionary->hash_to_index(d_hash); int d_index = dictionary->hash_to_index(d_hash);
klassOop k = dictionary->find_class(d_index, d_hash, name, loader); 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++) { for (int n = 0; n< probe->num_loaders(); n++) {
guarantee(probe->loader(n)->is_oop_or_null(), "should be oop"); guarantee(probe->loader(n)->is_oop_or_null(), "should be oop");
......
...@@ -84,7 +84,7 @@ public: ...@@ -84,7 +84,7 @@ public:
void purge_loader_constraints(BoolObjectClosure* is_alive); void purge_loader_constraints(BoolObjectClosure* is_alive);
void verify(Dictionary* dictionary); void verify(Dictionary* dictionary, PlaceholderTable* placeholders);
#ifndef PRODUCT #ifndef PRODUCT
void print(); void print();
#endif #endif
......
...@@ -2573,7 +2573,7 @@ void SystemDictionary::verify() { ...@@ -2573,7 +2573,7 @@ void SystemDictionary::verify() {
// Verify constraint table // Verify constraint table
guarantee(constraints() != NULL, "Verify of loader constraints failed"); guarantee(constraints() != NULL, "Verify of loader constraints failed");
constraints()->verify(dictionary()); constraints()->verify(dictionary(), placeholders());
} }
......
...@@ -2654,6 +2654,7 @@ loaderConstraints.cpp resourceArea.hpp ...@@ -2654,6 +2654,7 @@ loaderConstraints.cpp resourceArea.hpp
loaderConstraints.cpp safepoint.hpp loaderConstraints.cpp safepoint.hpp
loaderConstraints.hpp dictionary.hpp loaderConstraints.hpp dictionary.hpp
loaderConstraints.hpp placeholders.hpp
loaderConstraints.hpp hashtable.hpp loaderConstraints.hpp hashtable.hpp
location.cpp debugInfo.hpp location.cpp debugInfo.hpp
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册