mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 01:54:47 +02:00
8298612: Refactor archiving of java String objects
Reviewed-by: ccheung
This commit is contained in:
parent
d4e9f5e5f2
commit
1ff4646ed5
4 changed files with 45 additions and 48 deletions
|
@ -457,7 +457,7 @@ void HeapShared::archive_java_mirrors() {
|
|||
if (rr != nullptr && !is_too_large_to_archive(rr)) {
|
||||
oop archived_obj = HeapShared::archive_reachable_objects_from(1, _default_subgraph_info, rr,
|
||||
/*is_closed_archive=*/false);
|
||||
assert(archived_obj != NULL, "already checked not too large to archive");
|
||||
assert(archived_obj != nullptr, "already checked not too large to archive");
|
||||
int root_index = append_root(archived_obj);
|
||||
ik->constants()->cache()->set_archived_references(root_index);
|
||||
}
|
||||
|
@ -630,6 +630,27 @@ void HeapShared::archive_objects(GrowableArray<MemRegion>* closed_regions,
|
|||
}
|
||||
|
||||
G1HeapVerifier::verify_archive_regions();
|
||||
StringTable::write_shared_table(_dumped_interned_strings);
|
||||
}
|
||||
|
||||
void HeapShared::copy_interned_strings() {
|
||||
init_seen_objects_table();
|
||||
|
||||
auto copier = [&] (oop s, bool value_ignored) {
|
||||
assert(s != nullptr, "sanity");
|
||||
typeArrayOop value = java_lang_String::value_no_keepalive(s);
|
||||
if (!HeapShared::is_too_large_to_archive(value)) {
|
||||
oop archived_s = archive_reachable_objects_from(1, _default_subgraph_info,
|
||||
s, /*is_closed_archive=*/true);
|
||||
assert(archived_s != nullptr, "already checked not too large to archive");
|
||||
// Prevent string deduplication from changing the value field to
|
||||
// something not in the archive.
|
||||
java_lang_String::set_deduplication_forbidden(archived_s);
|
||||
}
|
||||
};
|
||||
_dumped_interned_strings->iterate_all(copier);
|
||||
|
||||
delete_seen_objects_table();
|
||||
}
|
||||
|
||||
void HeapShared::copy_closed_objects(GrowableArray<MemRegion>* closed_regions) {
|
||||
|
@ -638,7 +659,7 @@ void HeapShared::copy_closed_objects(GrowableArray<MemRegion>* closed_regions) {
|
|||
G1CollectedHeap::heap()->begin_archive_alloc_range();
|
||||
|
||||
// Archive interned string objects
|
||||
StringTable::write_to_archive(_dumped_interned_strings);
|
||||
copy_interned_strings();
|
||||
|
||||
archive_object_subgraphs(closed_archive_subgraph_entry_fields,
|
||||
true /* is_closed_archive */,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue