From 4cfcd1deadca55ac77c200e6c93b232d73a1b0ae Mon Sep 17 00:00:00 2001 From: tstuefe Date: Tue, 18 Nov 2025 06:37:56 +0100 Subject: [PATCH] gc/g1/TestSharedArchiveWithPreTouch.java, gc/metaspace/TestSizeTransitions.java, instrument/GetObjectSizeIntrinsicsTest.java --- .../gc/g1/TestSharedArchiveWithPreTouch.java | 4 +- .../gc/metaspace/TestSizeTransitions.java | 46 ++++++------------- .../GetObjectSizeIntrinsicsTest.java | 4 +- 3 files changed, 19 insertions(+), 35 deletions(-) diff --git a/test/hotspot/jtreg/gc/g1/TestSharedArchiveWithPreTouch.java b/test/hotspot/jtreg/gc/g1/TestSharedArchiveWithPreTouch.java index 29a34cde9de..c60d51a0be7 100644 --- a/test/hotspot/jtreg/gc/g1/TestSharedArchiveWithPreTouch.java +++ b/test/hotspot/jtreg/gc/g1/TestSharedArchiveWithPreTouch.java @@ -53,7 +53,7 @@ public class TestSharedArchiveWithPreTouch { List dump_args = new ArrayList(BaseOptions); if (Platform.is64bit()) { - dump_args.addAll(0, Arrays.asList(new String[] { "-XX:+USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE", "-XX:+UseCompressedOops" })); + dump_args.addFirst("-XX:+UseCompressedOops" ); } dump_args.addAll(Arrays.asList(new String[] { "-Xshare:dump", "-Xlog:cds" })); @@ -66,7 +66,7 @@ public class TestSharedArchiveWithPreTouch { List load_args = new ArrayList(BaseOptions); if (Platform.is64bit()) { - load_args.addAll(0, Arrays.asList(new String[] { "-XX:+USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE", "-XX:+UseCompressedOops" })); + dump_args.addFirst("-XX:+UseCompressedOops" ); } load_args.addAll(Arrays.asList(new String[] { "-Xshare:on", "-version" })); diff --git a/test/hotspot/jtreg/gc/metaspace/TestSizeTransitions.java b/test/hotspot/jtreg/gc/metaspace/TestSizeTransitions.java index 5e76d80ad5d..854e88073e0 100644 --- a/test/hotspot/jtreg/gc/metaspace/TestSizeTransitions.java +++ b/test/hotspot/jtreg/gc/metaspace/TestSizeTransitions.java @@ -35,24 +35,21 @@ import java.util.List; * @requires vm.gc.Serial * @summary Tests that the metaspace size transition logging is done correctly. * @library /test/lib - * @run driver gc.metaspace.TestSizeTransitions false -XX:+UseSerialGC - * @run driver gc.metaspace.TestSizeTransitions true -XX:+UseSerialGC + * @run driver gc.metaspace.TestSizeTransitions -XX:+UseSerialGC */ /* @test TestSizeTransitionsParallel * @requires vm.gc.Parallel * @summary Tests that the metaspace size transition logging is done correctly. * @library /test/lib - * @run driver gc.metaspace.TestSizeTransitions false -XX:+UseParallelGC - * @run driver gc.metaspace.TestSizeTransitions true -XX:+UseParallelGC + * @run driver gc.metaspace.TestSizeTransitions -XX:+UseParallelGC */ /* @test TestSizeTransitionsG1 * @requires vm.gc.G1 * @summary Tests that the metaspace size transition logging is done correctly. * @library /test/lib - * @run driver gc.metaspace.TestSizeTransitions false -XX:+UseG1GC - * @run driver gc.metaspace.TestSizeTransitions true -XX:+UseG1GC + * @run driver gc.metaspace.TestSizeTransitions -XX:+UseG1GC */ public class TestSizeTransitions { @@ -76,13 +73,13 @@ public class TestSizeTransitions { private static final String SIZE_TRANSITION_REGEX = "\\d+K\\(\\d+K\\)->\\d+K\\(\\d+K\\)"; // matches -coops metaspace size transitions - private static final String NO_COMPRESSED_KLASS_POINTERS_REGEX = + private static final String WITHOUT_CLASS_SPACE_REGEX = String.format("^%s.* Metaspace: %s$", LOG_TAGS_REGEX, SIZE_TRANSITION_REGEX); // matches +coops metaspace size transitions - private static final String COMPRESSED_KLASS_POINTERS_REGEX = + private static final String WITH_CLASS_SPACE_REGEX = String.format("^%s.* Metaspace: %s NonClass: %s Class: %s$", LOG_TAGS_REGEX, SIZE_TRANSITION_REGEX, @@ -90,26 +87,11 @@ public class TestSizeTransitions { SIZE_TRANSITION_REGEX); public static void main(String... args) throws Exception { - // args: - if (args.length != 2) { - throw new RuntimeException("wrong number of args: " + args.length); + if (args.length == 0) { + throw new RuntimeException("expected jvm args: " + args.length); } - final boolean hasCompressedKlassPointers = Platform.is64bit(); - final boolean useCompressedKlassPointers = Boolean.parseBoolean(args[0]); - final String gcArg = args[1]; - - if (!hasCompressedKlassPointers && useCompressedKlassPointers) { - // No need to run this configuration. - System.out.println("Skipping test."); - return; - } - - List jvmArgs = new ArrayList<>(); - if (hasCompressedKlassPointers) { - jvmArgs.add(useCompressedKlassPointers ? "-XX:+USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE" : "-XX:-USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE"); - } - jvmArgs.add(gcArg); + List jvmArgs = new ArrayList<>(List.of(args)); jvmArgs.add("-Xmx256m"); jvmArgs.add("-Xlog:gc,gc+metaspace=info"); jvmArgs.add(TestSizeTransitions.Run.class.getName()); @@ -123,12 +105,14 @@ public class TestSizeTransitions { System.out.println(output.getStdout()); output.shouldHaveExitValue(0); - if (useCompressedKlassPointers) { - output.stdoutShouldMatch(COMPRESSED_KLASS_POINTERS_REGEX); - output.stdoutShouldNotMatch(NO_COMPRESSED_KLASS_POINTERS_REGEX); + // 32-bit uses narrow Pointers but no class space + final boolean hasClassSpace = Platform.is64bit(); + if (hasClassSpace) { + output.stdoutShouldMatch(WITH_CLASS_SPACE_REGEX); + output.stdoutShouldNotMatch(WITHOUT_CLASS_SPACE_REGEX); } else { - output.stdoutShouldMatch(NO_COMPRESSED_KLASS_POINTERS_REGEX); - output.stdoutShouldNotMatch(COMPRESSED_KLASS_POINTERS_REGEX); + output.stdoutShouldMatch(WITHOUT_CLASS_SPACE_REGEX); + output.stdoutShouldNotMatch(WITH_CLASS_SPACE_REGEX); } } } diff --git a/test/jdk/java/lang/instrument/GetObjectSizeIntrinsicsTest.java b/test/jdk/java/lang/instrument/GetObjectSizeIntrinsicsTest.java index fe12a9ad2bc..749a4da274b 100644 --- a/test/jdk/java/lang/instrument/GetObjectSizeIntrinsicsTest.java +++ b/test/jdk/java/lang/instrument/GetObjectSizeIntrinsicsTest.java @@ -314,8 +314,8 @@ public class GetObjectSizeIntrinsicsTest extends ASimpleInstrumentationTestCase static final int LARGE_INT_ARRAY_SIZE = 1024*1024*1024 + 1024; static final int LARGE_OBJ_ARRAY_SIZE = (4096/(int)REF_SIZE)*1024*1024 + 1024; - static final boolean CCP = WhiteBox.getWhiteBox().getBooleanVMFlag("USE_COMPRESSED_CLASS_POINTERS_ALWAYS_TRUE"); - static final int ARRAY_HEADER_SIZE = CCP ? 16 : (Platform.is64bit() ? 20 : 16); + // Includes length, excludes alignment gap to base + static final int ARRAY_HEADER_SIZE = Platform.is64bit() ? 16 : 12; final String mode;