720 721 CompactHashtableWriter ch_table(CompactHashtable<oop, char>::_string_table, 722 the_table()->number_of_entries(), 723 &MetaspaceShared::stats()->string); 724 725 // Copy the interned strings into the "string space" within the java heap 726 if (!copy_shared_string(string_space, &ch_table)) { 727 return false; 728 } 729 730 for (int i = 0; i < string_space->length(); i++) { 731 *space_size += string_space->at(i).byte_size(); 732 } 733 734 // Now dump the compact table 735 if (*top + ch_table.get_required_bytes() > end) { 736 // not enough space left 737 return false; 738 } 739 ch_table.dump(top, end); 740 *top = (char*)align_pointer_up(*top, sizeof(void*)); 741 742 #endif 743 return true; 744 } 745 746 void StringTable::shared_oops_do(OopClosure* f) { 747 #if INCLUDE_CDS && defined(_LP64) && !defined(_WINDOWS) 748 _shared_table.oops_do(f); 749 #endif 750 } 751 752 const char* StringTable::init_shared_table(FileMapInfo *mapinfo, char *buffer) { 753 #if INCLUDE_CDS && defined(_LP64) && !defined(_WINDOWS) 754 if (mapinfo->space_capacity(MetaspaceShared::first_string) == 0) { 755 // no shared string data 756 return buffer; 757 } 758 759 // initialize the shared table 760 juint *p = (juint*)buffer; 761 const char* end = _shared_table.init( 762 CompactHashtable<oop, char>::_string_table, (char*)p); 763 const char* aligned_end = (const char*)align_pointer_up(end, sizeof(void*)); 764 765 if (_ignore_shared_strings) { 766 _shared_table.reset(); 767 } 768 769 return aligned_end; 770 #endif 771 772 return buffer; 773 } | 720 721 CompactHashtableWriter ch_table(CompactHashtable<oop, char>::_string_table, 722 the_table()->number_of_entries(), 723 &MetaspaceShared::stats()->string); 724 725 // Copy the interned strings into the "string space" within the java heap 726 if (!copy_shared_string(string_space, &ch_table)) { 727 return false; 728 } 729 730 for (int i = 0; i < string_space->length(); i++) { 731 *space_size += string_space->at(i).byte_size(); 732 } 733 734 // Now dump the compact table 735 if (*top + ch_table.get_required_bytes() > end) { 736 // not enough space left 737 return false; 738 } 739 ch_table.dump(top, end); 740 *top = (char*)align_ptr_up(*top, sizeof(void*)); 741 742 #endif 743 return true; 744 } 745 746 void StringTable::shared_oops_do(OopClosure* f) { 747 #if INCLUDE_CDS && defined(_LP64) && !defined(_WINDOWS) 748 _shared_table.oops_do(f); 749 #endif 750 } 751 752 const char* StringTable::init_shared_table(FileMapInfo *mapinfo, char *buffer) { 753 #if INCLUDE_CDS && defined(_LP64) && !defined(_WINDOWS) 754 if (mapinfo->space_capacity(MetaspaceShared::first_string) == 0) { 755 // no shared string data 756 return buffer; 757 } 758 759 // initialize the shared table 760 juint *p = (juint*)buffer; 761 const char* end = _shared_table.init( 762 CompactHashtable<oop, char>::_string_table, (char*)p); 763 const char* aligned_end = (const char*)align_ptr_up(end, sizeof(void*)); 764 765 if (_ignore_shared_strings) { 766 _shared_table.reset(); 767 } 768 769 return aligned_end; 770 #endif 771 772 return buffer; 773 } |