mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-06 21:18:42 +00:00
gc/g1/TestSharedArchiveWithPreTouch.java, gc/metaspace/TestSizeTransitions.java, instrument/GetObjectSizeIntrinsicsTest.java
This commit is contained in:
parent
d69715096a
commit
4cfcd1dead
@ -53,7 +53,7 @@ public class TestSharedArchiveWithPreTouch {
|
||||
List<String> dump_args = new ArrayList<String>(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<String> load_args = new ArrayList<String>(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" }));
|
||||
|
||||
|
||||
@ -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: <use-coops> <gc-arg>
|
||||
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<String> 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<String> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user