8302781: CDS archive heap not reproducible after JDK-8296344

Reviewed-by: dcubed
This commit is contained in:
Ioi Lam 2023-02-19 05:59:12 +00:00
parent d6716d2e54
commit 7abe26935a

@ -286,6 +286,11 @@ bool HeapShared::archive_object(oop obj) {
count_allocation(obj->size());
ArchiveHeapWriter::add_source_obj(obj);
// The archived objects are discovered in a predictable order. Compute
// their identity_hash() as soon as we see them. This ensures that the
// the identity_hash in the object header will have a predictable value,
// making the archive reproducible.
obj->identity_hash();
CachedOopInfo info = make_cached_oop_info();
archived_object_cache()->put(obj, info);
mark_native_pointers(obj);