8067982: Some jcmd /gc/heap_dump tests failed: hprof output contains warning or error

Include shared symbols in SymbolTable::symbols_do(SymbolClosure).

Reviewed-by: minqi, farvidsson, coleenp
This commit is contained in:
Jiangli Zhou 2015-01-14 16:35:00 -05:00
parent 4e84bf1e93
commit f3c99841f9
3 changed files with 34 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -221,6 +221,30 @@ template <class T, class N> const char* CompactHashtable<T, N>::init(const char*
return (const char*)end;
}
template <class T, class N> void CompactHashtable<T, N>::symbols_do(SymbolClosure *cl) {
assert(!DumpSharedSpaces, "run-time only");
for (juint i = 0; i < _bucket_count; i ++) {
juint bucket_info = _buckets[i];
juint bucket_offset = BUCKET_OFFSET(bucket_info);
int bucket_type = BUCKET_TYPE(bucket_info);
juint* bucket = _buckets + bucket_offset;
juint* bucket_end = _buckets;
Symbol* sym;
if (bucket_type == COMPACT_BUCKET_TYPE) {
sym = (Symbol*)((void*)(_base_address + bucket[0]));
cl->do_symbol(&sym);
} else {
bucket_end += BUCKET_OFFSET(_buckets[i + 1]);
while (bucket < bucket_end) {
sym = (Symbol*)((void*)(_base_address + bucket[1]));
cl->do_symbol(&sym);
bucket += 2;
}
}
}
}
// Explicitly instantiate these types
template class CompactHashtable<Symbol*, char>;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -249,6 +249,9 @@ public:
}
return NULL;
}
// iterate over symbols
void symbols_do(SymbolClosure *cl);
};
////////////////////////////////////////////////////////////////////////

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -82,6 +82,10 @@ void SymbolTable::initialize_symbols(int arena_alloc_size) {
// Call function for all symbols in the symbol table.
void SymbolTable::symbols_do(SymbolClosure *cl) {
// all symbols from shared table
_shared_table.symbols_do(cl);
// all symbols from the dynamic table
const int n = the_table()->table_size();
for (int i = 0; i < n; i++) {
for (HashtableEntry<Symbol*, mtSymbol>* p = the_table()->bucket(i);