changeset 50817:48d4abe945f1

8203490: StringTable::dump lacks a load barrier Reviewed-by: coleenp, pliden
author stefank
date Wed, 23 May 2018 09:43:41 +0200
parents 3c6dc4b291cd
children 6ba3e32a9882
files src/hotspot/share/classfile/stringTable.cpp src/hotspot/share/utilities/hashtable.cpp src/hotspot/share/utilities/hashtable.hpp
diffstat 3 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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: