< prev index next >

src/hotspot/share/classfile/stringTable.cpp

Print this page

1096   auto copy_into_shared_table = [&] (WeakHandle* val) {
1097     oop string = val->peek();
1098     if (string != nullptr && !ArchiveHeapWriter::is_string_too_large_to_archive(string)) {
1099       unsigned int hash = java_lang_String::hash_code(string);
1100       writer.add(hash, index);
1101       index ++;
1102     }
1103     return true;
1104   };
1105   _local_table->do_safepoint_scan(copy_into_shared_table);
1106   writer.dump(&_shared_table, "string");
1107 
1108   DEBUG_ONLY(Atomic::release_store(&_disable_interning_during_cds_dump, false));
1109 }
1110 
1111 void StringTable::set_shared_strings_array_index(int root_index) {
1112   _shared_strings_array_root_index = root_index;
1113 }
1114 
1115 void StringTable::serialize_shared_table_header(SerializeClosure* soc) {






1116   _shared_table.serialize_header(soc);
1117 
1118   if (soc->writing()) {
1119     // Sanity. Make sure we don't use the shared table at dump time
1120     _shared_table.reset();
1121   } else if (!ArchiveHeapLoader::is_in_use()) {
1122     _shared_table.reset();
1123   }
1124 
1125   soc->do_bool(&_is_two_dimensional_shared_strings_array);
1126   soc->do_int(&_shared_strings_array_root_index);
1127 }
1128 #endif //INCLUDE_CDS_JAVA_HEAP

1096   auto copy_into_shared_table = [&] (WeakHandle* val) {
1097     oop string = val->peek();
1098     if (string != nullptr && !ArchiveHeapWriter::is_string_too_large_to_archive(string)) {
1099       unsigned int hash = java_lang_String::hash_code(string);
1100       writer.add(hash, index);
1101       index ++;
1102     }
1103     return true;
1104   };
1105   _local_table->do_safepoint_scan(copy_into_shared_table);
1106   writer.dump(&_shared_table, "string");
1107 
1108   DEBUG_ONLY(Atomic::release_store(&_disable_interning_during_cds_dump, false));
1109 }
1110 
1111 void StringTable::set_shared_strings_array_index(int root_index) {
1112   _shared_strings_array_root_index = root_index;
1113 }
1114 
1115 void StringTable::serialize_shared_table_header(SerializeClosure* soc) {
1116   if (soc->writing() && !CDSConfig::is_dumping_heap()) {
1117     _shared_table.reset();
1118     _is_two_dimensional_shared_strings_array = false;
1119     _shared_strings_array_root_index = -1;
1120   }
1121 
1122   _shared_table.serialize_header(soc);
1123 
1124   if (soc->writing()) {
1125     // Sanity. Make sure we don't use the shared table at dump time
1126     _shared_table.reset();
1127   } else if (!ArchiveHeapLoader::is_in_use()) {
1128     _shared_table.reset();
1129   }
1130 
1131   soc->do_bool(&_is_two_dimensional_shared_strings_array);
1132   soc->do_int(&_shared_strings_array_root_index);
1133 }
1134 #endif //INCLUDE_CDS_JAVA_HEAP
< prev index next >