929 }
930 StringWrapper wrapped_name(name, len);
931 // len is required but is already part of StringWrapper, so 0 is used
932 return _shared_table.lookup(wrapped_name, java_lang_String::hash_code(name, len), 0);
933 }
934
935 void StringTable::init_shared_table() {
936 assert(SafepointSynchronize::is_at_safepoint(), "inside AOT safepoint");
937 precond(CDSConfig::is_dumping_heap());
938 assert(HeapShared::is_writing_mapping_mode(), "not used for streamed oops");
939
940 int n = 0;
941 auto copy_into_aot_heap = [&] (WeakHandle* val) {
942 oop string = val->peek();
943 if (string != nullptr && !HeapShared::is_string_too_large_to_archive(string)) {
944 // If string is too large, don't put it into the string table.
945 // - If there are no other references to it, it won't be stored into the archive,
946 // so we are all good.
947 // - If there's a reference to it, we will report an error inside HeapShared.cpp and
948 // dumping will fail.
949 HeapShared::add_to_dumped_interned_strings(string);
950 }
951 n++;
952 return true;
953 };
954
955 _local_table->do_safepoint_scan(copy_into_aot_heap);
956 log_info(aot)("Archived %d interned strings", n);
957 };
958
959 void StringTable::write_shared_table() {
960 assert(SafepointSynchronize::is_at_safepoint(), "inside AOT safepoint");
961 precond(CDSConfig::is_dumping_heap());
962 assert(HeapShared::is_writing_mapping_mode(), "not used for streamed oops");
963
964 _shared_table.reset();
965 CompactHashtableWriter writer((int)items_count_acquire(), ArchiveBuilder::string_stats());
966
967 auto copy_into_shared_table = [&] (WeakHandle* val) {
968 oop string = val->peek();
969 if (string != nullptr && !HeapShared::is_string_too_large_to_archive(string)) {
|
929 }
930 StringWrapper wrapped_name(name, len);
931 // len is required but is already part of StringWrapper, so 0 is used
932 return _shared_table.lookup(wrapped_name, java_lang_String::hash_code(name, len), 0);
933 }
934
935 void StringTable::init_shared_table() {
936 assert(SafepointSynchronize::is_at_safepoint(), "inside AOT safepoint");
937 precond(CDSConfig::is_dumping_heap());
938 assert(HeapShared::is_writing_mapping_mode(), "not used for streamed oops");
939
940 int n = 0;
941 auto copy_into_aot_heap = [&] (WeakHandle* val) {
942 oop string = val->peek();
943 if (string != nullptr && !HeapShared::is_string_too_large_to_archive(string)) {
944 // If string is too large, don't put it into the string table.
945 // - If there are no other references to it, it won't be stored into the archive,
946 // so we are all good.
947 // - If there's a reference to it, we will report an error inside HeapShared.cpp and
948 // dumping will fail.
949 HeapShared::archive_interned_string(string);
950 }
951 n++;
952 return true;
953 };
954
955 _local_table->do_safepoint_scan(copy_into_aot_heap);
956 log_info(aot)("Archived %d interned strings", n);
957 };
958
959 void StringTable::write_shared_table() {
960 assert(SafepointSynchronize::is_at_safepoint(), "inside AOT safepoint");
961 precond(CDSConfig::is_dumping_heap());
962 assert(HeapShared::is_writing_mapping_mode(), "not used for streamed oops");
963
964 _shared_table.reset();
965 CompactHashtableWriter writer((int)items_count_acquire(), ArchiveBuilder::string_stats());
966
967 auto copy_into_shared_table = [&] (WeakHandle* val) {
968 oop string = val->peek();
969 if (string != nullptr && !HeapShared::is_string_too_large_to_archive(string)) {
|