8181450: assert in BasicHashtable::verify_table
Remove assert as it has small probability of happening and added logging Reviewed-by: kbarrett, sspitsyn
This commit is contained in:
parent
ea15e1ac26
commit
af0b8d46d2
@ -218,27 +218,19 @@ void PlaceholderEntry::verify() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlaceholderTable::verify() {
|
void PlaceholderTable::verify() {
|
||||||
int element_count = 0;
|
verify_table<PlaceholderEntry>("Placeholder Table");
|
||||||
for (int pindex = 0; pindex < table_size(); pindex++) {
|
|
||||||
for (PlaceholderEntry* probe = bucket(pindex);
|
|
||||||
probe != NULL;
|
|
||||||
probe = probe->next()) {
|
|
||||||
probe->verify();
|
|
||||||
element_count++; // both klasses and place holders count
|
|
||||||
}
|
|
||||||
}
|
|
||||||
guarantee(number_of_entries() == element_count,
|
|
||||||
"Verify of system dictionary failed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
void PlaceholderTable::print() {
|
void PlaceholderTable::print() {
|
||||||
|
tty->print_cr("Placeholder table table_size=%d, entries=%d",
|
||||||
|
table_size(), number_of_entries());
|
||||||
for (int pindex = 0; pindex < table_size(); pindex++) {
|
for (int pindex = 0; pindex < table_size(); pindex++) {
|
||||||
for (PlaceholderEntry* probe = bucket(pindex);
|
for (PlaceholderEntry* probe = bucket(pindex);
|
||||||
probe != NULL;
|
probe != NULL;
|
||||||
probe = probe->next()) {
|
probe = probe->next()) {
|
||||||
if (Verbose) tty->print("%4d: ", pindex);
|
tty->print("%4d: ", pindex);
|
||||||
tty->print(" place holder ");
|
tty->print(" place holder ");
|
||||||
|
|
||||||
probe->print();
|
probe->print();
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "classfile/javaClasses.inline.hpp"
|
#include "classfile/javaClasses.inline.hpp"
|
||||||
#include "classfile/moduleEntry.hpp"
|
#include "classfile/moduleEntry.hpp"
|
||||||
#include "classfile/packageEntry.hpp"
|
#include "classfile/packageEntry.hpp"
|
||||||
|
#include "classfile/placeholders.hpp"
|
||||||
#include "classfile/protectionDomainCache.hpp"
|
#include "classfile/protectionDomainCache.hpp"
|
||||||
#include "classfile/stringTable.hpp"
|
#include "classfile/stringTable.hpp"
|
||||||
#include "memory/allocation.inline.hpp"
|
#include "memory/allocation.inline.hpp"
|
||||||
@ -307,11 +308,11 @@ template <class T, MEMFLAGS F> void Hashtable<T, F>::print() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <MEMFLAGS F>
|
template <MEMFLAGS F>
|
||||||
template <class T> void BasicHashtable<F>::verify_table(const char* table_name) {
|
template <class T> void BasicHashtable<F>::verify_table(const char* table_name) {
|
||||||
int element_count = 0;
|
int element_count = 0;
|
||||||
int max_bucket_count = 0;
|
int max_bucket_count = 0;
|
||||||
|
int max_bucket_number = 0;
|
||||||
for (int index = 0; index < table_size(); index++) {
|
for (int index = 0; index < table_size(); index++) {
|
||||||
int bucket_count = 0;
|
int bucket_count = 0;
|
||||||
for (T* probe = (T*)bucket(index); probe != NULL; probe = probe->next()) {
|
for (T* probe = (T*)bucket(index); probe != NULL; probe = probe->next()) {
|
||||||
@ -319,29 +320,32 @@ template <class T> void BasicHashtable<F>::verify_table(const char* table_name)
|
|||||||
bucket_count++;
|
bucket_count++;
|
||||||
}
|
}
|
||||||
element_count += bucket_count;
|
element_count += bucket_count;
|
||||||
max_bucket_count = MAX2(max_bucket_count, bucket_count);
|
if (bucket_count > max_bucket_count) {
|
||||||
|
max_bucket_count = bucket_count;
|
||||||
|
max_bucket_number = index;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
guarantee(number_of_entries() == element_count,
|
guarantee(number_of_entries() == element_count,
|
||||||
"Verify of %s failed", table_name);
|
"Verify of %s failed", table_name);
|
||||||
DEBUG_ONLY(verify_lookup_length(max_bucket_count, table_name));
|
|
||||||
|
// Log some statistics about the hashtable
|
||||||
|
log_info(hashtables)("%s max bucket size %d bucket %d element count %d table size %d", table_name,
|
||||||
|
max_bucket_count, max_bucket_number, _number_of_entries, _table_size);
|
||||||
|
if (_number_of_entries > 0 && log_is_enabled(Debug, hashtables)) {
|
||||||
|
for (int index = 0; index < table_size(); index++) {
|
||||||
|
int bucket_count = 0;
|
||||||
|
for (T* probe = (T*)bucket(index); probe != NULL; probe = probe->next()) {
|
||||||
|
log_debug(hashtables)("bucket %d hash " INTPTR_FORMAT, index, (intptr_t)probe->hash());
|
||||||
|
bucket_count++;
|
||||||
|
}
|
||||||
|
if (bucket_count > 0) {
|
||||||
|
log_debug(hashtables)("bucket %d count %d", index, bucket_count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // PRODUCT
|
#endif // PRODUCT
|
||||||
|
|
||||||
#ifdef ASSERT
|
|
||||||
|
|
||||||
// Assert if the longest bucket is 10x longer than the average bucket size.
|
|
||||||
// Could change back to a warning, but warnings are not noticed.
|
|
||||||
template <MEMFLAGS F> void BasicHashtable<F>::verify_lookup_length(int max_bucket_count, const char *table_name) {
|
|
||||||
log_info(hashtables)("%s max bucket size %d element count %d table size %d", table_name,
|
|
||||||
max_bucket_count, _number_of_entries, _table_size);
|
|
||||||
assert (max_bucket_count < ((1 + number_of_entries()/table_size())*10), "Table is unbalanced");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Explicitly instantiate these types
|
// Explicitly instantiate these types
|
||||||
#if INCLUDE_ALL_GCS
|
#if INCLUDE_ALL_GCS
|
||||||
template class Hashtable<nmethod*, mtGC>;
|
template class Hashtable<nmethod*, mtGC>;
|
||||||
@ -383,3 +387,5 @@ template void BasicHashtable<mtClass>::verify_table<DictionaryEntry>(char const*
|
|||||||
template void BasicHashtable<mtModule>::verify_table<ModuleEntry>(char const*);
|
template void BasicHashtable<mtModule>::verify_table<ModuleEntry>(char const*);
|
||||||
template void BasicHashtable<mtModule>::verify_table<PackageEntry>(char const*);
|
template void BasicHashtable<mtModule>::verify_table<PackageEntry>(char const*);
|
||||||
template void BasicHashtable<mtClass>::verify_table<ProtectionDomainCacheEntry>(char const*);
|
template void BasicHashtable<mtClass>::verify_table<ProtectionDomainCacheEntry>(char const*);
|
||||||
|
template void BasicHashtable<mtClass>::verify_table<PlaceholderEntry>(char const*);
|
||||||
|
|
||||||
|
@ -170,10 +170,6 @@ private:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
#ifdef ASSERT
|
|
||||||
void verify_lookup_length(int max_bucket_count, const char *table_name);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void initialize(int table_size, int entry_size, int number_of_entries);
|
void initialize(int table_size, int entry_size, int number_of_entries);
|
||||||
|
|
||||||
// Accessor
|
// Accessor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user