diff --git a/src/hotspot/share/classfile/symbolTable.cpp b/src/hotspot/share/classfile/symbolTable.cpp index 04640b672f6..1fd28a1d4e9 100644 --- a/src/hotspot/share/classfile/symbolTable.cpp +++ b/src/hotspot/share/classfile/symbolTable.cpp @@ -67,12 +67,7 @@ inline bool symbol_equals_compact_hashtable_entry(Symbol* value, const char* key static OffsetCompactHashtable< const char*, Symbol*, symbol_equals_compact_hashtable_entry -> _shared_table; - -static OffsetCompactHashtable< - const char*, Symbol*, - symbol_equals_compact_hashtable_entry -> _dynamic_shared_table; +> _shared_table, _dynamic_shared_table, _shared_table_for_dumping; // -------------------------------------------------------------------------- @@ -708,29 +703,24 @@ void SymbolTable::copy_shared_symbol_table(GrowableArray* symbols, void SymbolTable::write_to_archive(GrowableArray* symbols) { CompactHashtableWriter writer(int(_items_count), ArchiveBuilder::symbol_stats()); copy_shared_symbol_table(symbols, &writer); - if (CDSConfig::is_dumping_static_archive()) { - _shared_table.reset(); - writer.dump(&_shared_table, "symbol"); - } else { - assert(CDSConfig::is_dumping_dynamic_archive(), "must be"); - _dynamic_shared_table.reset(); - writer.dump(&_dynamic_shared_table, "symbol"); - } + _shared_table_for_dumping.reset(); + writer.dump(&_shared_table_for_dumping, "symbol"); } void SymbolTable::serialize_shared_table_header(SerializeClosure* soc, bool is_static_archive) { OffsetCompactHashtable * table; - if (is_static_archive) { - table = &_shared_table; + if (soc->reading()) { + if (is_static_archive) { + table = &_shared_table; + } else { + table = &_dynamic_shared_table; + } } else { - table = &_dynamic_shared_table; + table = &_shared_table_for_dumping; } + table->serialize_header(soc); - if (soc->writing()) { - // Sanity. Make sure we don't use the shared table at dump time - table->reset(); - } } #endif //INCLUDE_CDS