< prev index next >

src/hotspot/share/classfile/stringTable.cpp

Print this page

1074 
1075   int index = 0;
1076   auto copy_into_shared_table = [&] (WeakHandle* val) {
1077     oop string = val->peek();
1078     if (string != nullptr && !ArchiveHeapWriter::is_string_too_large_to_archive(string)) {
1079       unsigned int hash = java_lang_String::hash_code(string);
1080       writer.add(hash, index);
1081       index ++;
1082     }
1083     return true;
1084   };
1085   _local_table->do_safepoint_scan(copy_into_shared_table);
1086   writer.dump(&_shared_table, "string");
1087 }
1088 
1089 void StringTable::set_shared_strings_array_index(int root_index) {
1090   _shared_strings_array_root_index = root_index;
1091 }
1092 
1093 void StringTable::serialize_shared_table_header(SerializeClosure* soc) {






1094   _shared_table.serialize_header(soc);
1095 
1096   if (soc->writing()) {
1097     // Sanity. Make sure we don't use the shared table at dump time
1098     _shared_table.reset();
1099   } else if (!ArchiveHeapLoader::is_in_use()) {
1100     _shared_table.reset();
1101   }
1102 
1103   soc->do_bool(&_is_two_dimensional_shared_strings_array);
1104   soc->do_int(&_shared_strings_array_root_index);
1105 }
1106 #endif //INCLUDE_CDS_JAVA_HEAP

1074 
1075   int index = 0;
1076   auto copy_into_shared_table = [&] (WeakHandle* val) {
1077     oop string = val->peek();
1078     if (string != nullptr && !ArchiveHeapWriter::is_string_too_large_to_archive(string)) {
1079       unsigned int hash = java_lang_String::hash_code(string);
1080       writer.add(hash, index);
1081       index ++;
1082     }
1083     return true;
1084   };
1085   _local_table->do_safepoint_scan(copy_into_shared_table);
1086   writer.dump(&_shared_table, "string");
1087 }
1088 
1089 void StringTable::set_shared_strings_array_index(int root_index) {
1090   _shared_strings_array_root_index = root_index;
1091 }
1092 
1093 void StringTable::serialize_shared_table_header(SerializeClosure* soc) {
1094   if (soc->writing() && !CDSConfig::is_dumping_heap()) {
1095     _shared_table.reset();
1096     _is_two_dimensional_shared_strings_array = false;
1097     _shared_strings_array_root_index = -1;
1098   }
1099 
1100   _shared_table.serialize_header(soc);
1101 
1102   if (soc->writing()) {
1103     // Sanity. Make sure we don't use the shared table at dump time
1104     _shared_table.reset();
1105   } else if (!ArchiveHeapLoader::is_in_use()) {
1106     _shared_table.reset();
1107   }
1108 
1109   soc->do_bool(&_is_two_dimensional_shared_strings_array);
1110   soc->do_int(&_shared_strings_array_root_index);
1111 }
1112 #endif //INCLUDE_CDS_JAVA_HEAP
< prev index next >