8343298: Improve stability of runtime/cds/DeterministicDump.java test

Reviewed-by: shade, iklam
This commit is contained in:
Thomas Schatzl 2024-11-05 09:33:50 +00:00
parent dafa2e55ad
commit abf2dc7128
2 changed files with 10 additions and 3 deletions

View File

@ -558,9 +558,12 @@ void ArchiveHeapWriter::update_header_for_requested_obj(oop requested_obj, oop s
oop fake_oop = cast_to_oop(buffered_addr);
fake_oop->set_narrow_klass(nk);
if (src_obj == nullptr) {
return;
}
// We need to retain the identity_hash, because it may have been used by some hashtables
// in the shared heap.
if (src_obj != nullptr && !src_obj->fast_no_hash_check()) {
if (!src_obj->fast_no_hash_check()) {
intptr_t src_hash = src_obj->identity_hash();
fake_oop->set_mark(markWord::prototype().copy_set_hash(src_hash));
assert(fake_oop->mark().is_unlocked(), "sanity");
@ -568,6 +571,8 @@ void ArchiveHeapWriter::update_header_for_requested_obj(oop requested_obj, oop s
DEBUG_ONLY(intptr_t archived_hash = fake_oop->identity_hash());
assert(src_hash == archived_hash, "Different hash codes: original " INTPTR_FORMAT ", archived " INTPTR_FORMAT, src_hash, archived_hash);
}
// Strip age bits.
fake_oop->set_mark(fake_oop->mark().set_age(0));
}
class ArchiveHeapWriter::EmbeddedOopRelocator: public BasicOopIterateClosure {

View File

@ -50,8 +50,10 @@ public class DeterministicDump {
public static void doTest(boolean compressed) throws Exception {
ArrayList<String> baseArgs = new ArrayList<>();
// Use the same heap size as make/Images.gmk
// Try to reduce indeterminism of GC heap sizing and evacuation.
baseArgs.add("-Xmx128M");
baseArgs.add("-Xms128M");
baseArgs.add("-Xmn120M");
if (Platform.is64bit()) {
// This option is available only on 64-bit.
@ -80,7 +82,7 @@ public class DeterministicDump {
String mapName = logName + ".map";
CDSOptions opts = (new CDSOptions())
.addPrefix("-Xint") // Override any -Xmixed/-Xcomp flags from jtreg -vmoptions
.addPrefix("-Xlog:cds=debug")
.addPrefix("-Xlog:cds=debug,gc=debug")
.addPrefix("-Xlog:cds+map*=trace:file=" + mapName + ":none:filesize=0")
.setArchiveName(archiveName)
.addSuffix(args)