657 } 658 659 void SymbolTable::write_to_archive() { 660 _shared_table.reset(); 661 662 int num_buckets = CompactHashtableWriter::default_num_buckets( 663 SymbolTable::the_table()->_items_count); 664 CompactHashtableWriter writer(num_buckets, 665 &MetaspaceShared::stats()->symbol); 666 copy_shared_symbol_table(&writer); 667 writer.dump(&_shared_table, "symbol"); 668 669 // Verify table is correct 670 Symbol* sym = vmSymbols::java_lang_Object(); 671 const char* name = (const char*)sym->bytes(); 672 int len = sym->utf8_length(); 673 unsigned int hash = hash_symbol(name, len, SymbolTable::_alt_hash); 674 assert(sym == _shared_table.lookup(name, hash, len), "sanity"); 675 } 676 677 void SymbolTable::serialize(SerializeClosure* soc) { 678 _shared_table.serialize(soc); 679 680 if (soc->writing()) { 681 // Sanity. Make sure we don't use the shared table at dump time 682 _shared_table.reset(); 683 } 684 } 685 #endif //INCLUDE_CDS 686 687 // Concurrent work 688 void SymbolTable::grow(JavaThread* jt) { 689 SymbolTableHash::GrowTask gt(_local_table); 690 if (!gt.prepare(jt)) { 691 return; 692 } 693 log_trace(symboltable)("Started to grow"); 694 { 695 TraceTime timer("Grow", TRACETIME_LOG(Debug, symboltable, perf)); 696 while (gt.do_task(jt)) { 697 gt.pause(jt); 698 { | 657 } 658 659 void SymbolTable::write_to_archive() { 660 _shared_table.reset(); 661 662 int num_buckets = CompactHashtableWriter::default_num_buckets( 663 SymbolTable::the_table()->_items_count); 664 CompactHashtableWriter writer(num_buckets, 665 &MetaspaceShared::stats()->symbol); 666 copy_shared_symbol_table(&writer); 667 writer.dump(&_shared_table, "symbol"); 668 669 // Verify table is correct 670 Symbol* sym = vmSymbols::java_lang_Object(); 671 const char* name = (const char*)sym->bytes(); 672 int len = sym->utf8_length(); 673 unsigned int hash = hash_symbol(name, len, SymbolTable::_alt_hash); 674 assert(sym == _shared_table.lookup(name, hash, len), "sanity"); 675 } 676 677 void SymbolTable::serialize_shared_table_header(SerializeClosure* soc) { 678 _shared_table.serialize_header(soc); 679 680 if (soc->writing()) { 681 // Sanity. Make sure we don't use the shared table at dump time 682 _shared_table.reset(); 683 } 684 } 685 #endif //INCLUDE_CDS 686 687 // Concurrent work 688 void SymbolTable::grow(JavaThread* jt) { 689 SymbolTableHash::GrowTask gt(_local_table); 690 if (!gt.prepare(jt)) { 691 return; 692 } 693 log_trace(symboltable)("Started to grow"); 694 { 695 TraceTime timer("Grow", TRACETIME_LOG(Debug, symboltable, perf)); 696 while (gt.do_task(jt)) { 697 gt.pause(jt); 698 { |