8203490: StringTable::dump lacks a load barrier

Reviewed-by: coleenp, pliden
This commit is contained in:
Stefan Karlsson 2018-05-23 09:43:41 +02:00
parent 88aa1562f7
commit 6c2e9e1981
3 changed files with 6 additions and 4 deletions

View file

@ -434,7 +434,7 @@ void StringTable::verify() {
void StringTable::dump(outputStream* st, bool verbose) { void StringTable::dump(outputStream* st, bool verbose) {
if (!verbose) { if (!verbose) {
the_table()->print_table_statistics(st, "StringTable"); the_table()->print_table_statistics(st, "StringTable", string_object_no_keepalive);
} else { } else {
Thread* THREAD = Thread::current(); Thread* THREAD = Thread::current();
st->print_cr("VERSION: 1.1"); st->print_cr("VERSION: 1.1");

View file

@ -320,7 +320,8 @@ template <MEMFLAGS F> bool BasicHashtable<F>::resize(int new_size) {
// literals. // literals.
template <class T, MEMFLAGS F> void Hashtable<T, F>::print_table_statistics(outputStream* st, 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; NumberSeq summary;
int literal_bytes = 0; int literal_bytes = 0;
for (int i = 0; i < this->table_size(); ++i) { for (int i = 0; i < this->table_size(); ++i) {
@ -328,7 +329,8 @@ template <class T, MEMFLAGS F> void Hashtable<T, F>::print_table_statistics(outp
for (HashtableEntry<T, F>* e = this->bucket(i); for (HashtableEntry<T, F>* e = this->bucket(i);
e != NULL; e = e->next()) { e != NULL; e = e->next()) {
count++; 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); summary.add((double)count);
} }

View file

@ -265,7 +265,7 @@ public:
return this->hash_to_index(compute_hash(name)); 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: protected: