--- a/src/hotspot/share/classfile/stringTable.cpp Wed May 23 09:42:42 2018 +0200
+++ b/src/hotspot/share/classfile/stringTable.cpp Wed May 23 09:43:41 2018 +0200
@@ -434,7 +434,7 @@
void StringTable::dump(outputStream* st, bool verbose) {
if (!verbose) {
- the_table()->print_table_statistics(st, "StringTable");
+ the_table()->print_table_statistics(st, "StringTable", string_object_no_keepalive);
} else {
Thread* THREAD = Thread::current();
st->print_cr("VERSION: 1.1");
--- a/src/hotspot/share/utilities/hashtable.cpp Wed May 23 09:42:42 2018 +0200
+++ b/src/hotspot/share/utilities/hashtable.cpp Wed May 23 09:43:41 2018 +0200
@@ -320,7 +320,8 @@
// literals.
template <class T, MEMFLAGS F> void Hashtable<T, F>::print_table_statistics(outputStream* st,
- const char *table_name) {
+ const char *table_name,
+ T (*literal_load_barrier)(HashtableEntry<T, F>*)) {
NumberSeq summary;
int literal_bytes = 0;
for (int i = 0; i < this->table_size(); ++i) {
@@ -328,7 +329,8 @@
for (HashtableEntry<T, F>* e = this->bucket(i);
e != NULL; e = e->next()) {
count++;
- literal_bytes += literal_size(e->literal());
+ T l = (literal_load_barrier != NULL) ? literal_load_barrier(e) : e->literal();
+ literal_bytes += literal_size(l);
}
summary.add((double)count);
}
--- a/src/hotspot/share/utilities/hashtable.hpp Wed May 23 09:42:42 2018 +0200
+++ b/src/hotspot/share/utilities/hashtable.hpp Wed May 23 09:43:41 2018 +0200
@@ -265,7 +265,7 @@
return this->hash_to_index(compute_hash(name));
}
- void print_table_statistics(outputStream* st, const char *table_name);
+ void print_table_statistics(outputStream* st, const char *table_name, T (*literal_load_barrier)(HashtableEntry<T, F>*) = NULL);
protected: