< prev index next >

src/hotspot/share/classfile/symbolTable.cpp

Print this page
@@ -66,16 +66,11 @@
  }
  
  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;
  
  // --------------------------------------------------------------------------
  
  typedef ConcurrentHashTable<SymbolTableConfig, mtSymbol> SymbolTableHash;
  static SymbolTableHash* _local_table = nullptr;

@@ -702,33 +697,28 @@
  }
  
  void SymbolTable::write_to_archive(GrowableArray<Symbol*>* 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<const char*, Symbol*, symbol_equals_compact_hashtable_entry> * 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
  
  // Concurrent work
  void SymbolTable::grow(JavaThread* jt) {
< prev index next >