1059 void StringTable::write_shared_table(const DumpedInternedStrings* dumped_interned_strings) {
1060 _shared_table.reset();
1061 CompactHashtableWriter writer((int)_items_count, ArchiveBuilder::string_stats());
1062
1063 int index = 0;
1064 auto copy_into_shared_table = [&] (oop string, bool value_ignored) {
1065 unsigned int hash = java_lang_String::hash_code(string);
1066 writer.add(hash, index);
1067 index ++;
1068 };
1069 dumped_interned_strings->iterate_all(copy_into_shared_table);
1070
1071 writer.dump(&_shared_table, "string");
1072 }
1073
1074 void StringTable::set_shared_strings_array_index(int root_index) {
1075 _shared_strings_array_root_index = root_index;
1076 }
1077
1078 void StringTable::serialize_shared_table_header(SerializeClosure* soc) {
1079 _shared_table.serialize_header(soc);
1080
1081 if (soc->writing()) {
1082 // Sanity. Make sure we don't use the shared table at dump time
1083 _shared_table.reset();
1084 } else if (!ArchiveHeapLoader::is_in_use()) {
1085 _shared_table.reset();
1086 }
1087
1088 soc->do_bool(&_is_two_dimensional_shared_strings_array);
1089 soc->do_int(&_shared_strings_array_root_index);
1090 }
1091 #endif //INCLUDE_CDS_JAVA_HEAP
|
1059 void StringTable::write_shared_table(const DumpedInternedStrings* dumped_interned_strings) {
1060 _shared_table.reset();
1061 CompactHashtableWriter writer((int)_items_count, ArchiveBuilder::string_stats());
1062
1063 int index = 0;
1064 auto copy_into_shared_table = [&] (oop string, bool value_ignored) {
1065 unsigned int hash = java_lang_String::hash_code(string);
1066 writer.add(hash, index);
1067 index ++;
1068 };
1069 dumped_interned_strings->iterate_all(copy_into_shared_table);
1070
1071 writer.dump(&_shared_table, "string");
1072 }
1073
1074 void StringTable::set_shared_strings_array_index(int root_index) {
1075 _shared_strings_array_root_index = root_index;
1076 }
1077
1078 void StringTable::serialize_shared_table_header(SerializeClosure* soc) {
1079 if (soc->writing() && !CDSConfig::is_dumping_heap()) {
1080 _shared_table.reset();
1081 _is_two_dimensional_shared_strings_array = false;
1082 _shared_strings_array_root_index = -1;
1083 }
1084
1085 _shared_table.serialize_header(soc);
1086
1087 if (soc->writing()) {
1088 // Sanity. Make sure we don't use the shared table at dump time
1089 _shared_table.reset();
1090 } else if (!ArchiveHeapLoader::is_in_use()) {
1091 _shared_table.reset();
1092 }
1093
1094 soc->do_bool(&_is_two_dimensional_shared_strings_array);
1095 soc->do_int(&_shared_strings_array_root_index);
1096 }
1097 #endif //INCLUDE_CDS_JAVA_HEAP
|