1043 void StringTable::write_shared_table(const DumpedInternedStrings* dumped_interned_strings) {
1044 _shared_table.reset();
1045 CompactHashtableWriter writer((int)_items_count, ArchiveBuilder::string_stats());
1046
1047 int index = 0;
1048 auto copy_into_shared_table = [&] (oop string, bool value_ignored) {
1049 unsigned int hash = java_lang_String::hash_code(string);
1050 writer.add(hash, index);
1051 index ++;
1052 };
1053 dumped_interned_strings->iterate_all(copy_into_shared_table);
1054
1055 writer.dump(&_shared_table, "string");
1056 }
1057
1058 void StringTable::set_shared_strings_array_index(int root_index) {
1059 _shared_strings_array_root_index = root_index;
1060 }
1061
1062 void StringTable::serialize_shared_table_header(SerializeClosure* soc) {
1063 _shared_table.serialize_header(soc);
1064
1065 if (soc->writing()) {
1066 // Sanity. Make sure we don't use the shared table at dump time
1067 _shared_table.reset();
1068 } else if (!ArchiveHeapLoader::is_in_use()) {
1069 _shared_table.reset();
1070 }
1071
1072 soc->do_bool(&_is_two_dimensional_shared_strings_array);
1073 soc->do_int(&_shared_strings_array_root_index);
1074 }
1075 #endif //INCLUDE_CDS_JAVA_HEAP
|
1043 void StringTable::write_shared_table(const DumpedInternedStrings* dumped_interned_strings) {
1044 _shared_table.reset();
1045 CompactHashtableWriter writer((int)_items_count, ArchiveBuilder::string_stats());
1046
1047 int index = 0;
1048 auto copy_into_shared_table = [&] (oop string, bool value_ignored) {
1049 unsigned int hash = java_lang_String::hash_code(string);
1050 writer.add(hash, index);
1051 index ++;
1052 };
1053 dumped_interned_strings->iterate_all(copy_into_shared_table);
1054
1055 writer.dump(&_shared_table, "string");
1056 }
1057
1058 void StringTable::set_shared_strings_array_index(int root_index) {
1059 _shared_strings_array_root_index = root_index;
1060 }
1061
1062 void StringTable::serialize_shared_table_header(SerializeClosure* soc) {
1063 if (soc->writing() && !CDSConfig::is_dumping_heap()) {
1064 _shared_table.reset();
1065 _is_two_dimensional_shared_strings_array = false;
1066 _shared_strings_array_root_index = -1;
1067 }
1068
1069 _shared_table.serialize_header(soc);
1070
1071 if (soc->writing()) {
1072 // Sanity. Make sure we don't use the shared table at dump time
1073 _shared_table.reset();
1074 } else if (!ArchiveHeapLoader::is_in_use()) {
1075 _shared_table.reset();
1076 }
1077
1078 soc->do_bool(&_is_two_dimensional_shared_strings_array);
1079 soc->do_int(&_shared_strings_array_root_index);
1080 }
1081 #endif //INCLUDE_CDS_JAVA_HEAP
|