39 import jdk.test.lib.process.ProcessTools;
40 import jtreg.SkippedException;
41
42 import java.io.IOException;
43
44 public class CompressedCPUSpecificClassSpaceReservation {
45 // Note: windows: On windows, we currently have the issue that os::reserve_memory_aligned relies on
46 // os::attempt_reserve_memory_at because VirtualAlloc cannot be unmapped in parts; this precludes use of
47 // +SimulateFullAddressSpace (VM won't be able to reserve heap). Therefore we exclude the test for windows
48 // for now.
49
50 private static void do_test(boolean CDS) throws IOException {
51 // We start the VM with -XX:+SimulateFullAdressSpace, which means the JVM will go through all motions
52 // of reserving the cds+class space, but never succeed. That means we see every single allocation attempt.
53 // We start with -Xlog options enabled. The expected output goes like this:
54 // [0.017s][debug][os,map] reserve_between (range [0x0000000000000000-0x0000000100000000), size 0x41000000, alignment 0x1000000, randomize: 1)
55 ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
56 "-Xshare:" + (CDS ? "on" : "off"),
57 "-Xmx128m",
58 "-XX:CompressedClassSpaceSize=128m",
59 "-Xlog:metaspace*", "-Xlog:metaspace+map=trace", "-Xlog:os+map=trace",
60 "-XX:+SimulateFullAddressSpace", // So that no resevation attempt will succeed
61 "-version");
62 OutputAnalyzer output = new OutputAnalyzer(pb.start());
63
64 final String tryReserveForUnscaled = "reserve_between (range [0x0000000000000000-0x0000000100000000)";
65 final String tryReserveForZeroBased = "reserve_between (range [0x0000000100000000-0x0000000800000000)";
66 final String tryReserveFor16bitMoveIntoQ3 = "reserve_between (range [0x0000000100000000-0x0001000000000000)";
67 if (Platform.isAArch64()) {
68 if (CDS) {
69 output.shouldNotContain(tryReserveForUnscaled);
70 } else {
71 output.shouldContain(tryReserveForUnscaled);
72 }
73 output.shouldContain("Trying to reserve at an EOR-compatible address");
74 output.shouldNotContain(tryReserveForZeroBased);
75 output.shouldContain(tryReserveFor16bitMoveIntoQ3);
76 } else if (Platform.isPPC()) {
77 if (CDS) {
78 output.shouldNotContain(tryReserveForUnscaled);
|
39 import jdk.test.lib.process.ProcessTools;
40 import jtreg.SkippedException;
41
42 import java.io.IOException;
43
44 public class CompressedCPUSpecificClassSpaceReservation {
45 // Note: windows: On windows, we currently have the issue that os::reserve_memory_aligned relies on
46 // os::attempt_reserve_memory_at because VirtualAlloc cannot be unmapped in parts; this precludes use of
47 // +SimulateFullAddressSpace (VM won't be able to reserve heap). Therefore we exclude the test for windows
48 // for now.
49
50 private static void do_test(boolean CDS) throws IOException {
51 // We start the VM with -XX:+SimulateFullAdressSpace, which means the JVM will go through all motions
52 // of reserving the cds+class space, but never succeed. That means we see every single allocation attempt.
53 // We start with -Xlog options enabled. The expected output goes like this:
54 // [0.017s][debug][os,map] reserve_between (range [0x0000000000000000-0x0000000100000000), size 0x41000000, alignment 0x1000000, randomize: 1)
55 ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
56 "-Xshare:" + (CDS ? "on" : "off"),
57 "-Xmx128m",
58 "-XX:CompressedClassSpaceSize=128m",
59 "-XX:+UnlockExperimentalVMOptions", "-XX:-UseCompactObjectHeaders",
60 "-Xlog:metaspace*", "-Xlog:metaspace+map=trace", "-Xlog:os+map=trace",
61 "-XX:+SimulateFullAddressSpace", // So that no resevation attempt will succeed
62 "-version");
63 OutputAnalyzer output = new OutputAnalyzer(pb.start());
64
65 final String tryReserveForUnscaled = "reserve_between (range [0x0000000000000000-0x0000000100000000)";
66 final String tryReserveForZeroBased = "reserve_between (range [0x0000000100000000-0x0000000800000000)";
67 final String tryReserveFor16bitMoveIntoQ3 = "reserve_between (range [0x0000000100000000-0x0001000000000000)";
68 if (Platform.isAArch64()) {
69 if (CDS) {
70 output.shouldNotContain(tryReserveForUnscaled);
71 } else {
72 output.shouldContain(tryReserveForUnscaled);
73 }
74 output.shouldContain("Trying to reserve at an EOR-compatible address");
75 output.shouldNotContain(tryReserveForZeroBased);
76 output.shouldContain(tryReserveFor16bitMoveIntoQ3);
77 } else if (Platform.isPPC()) {
78 if (CDS) {
79 output.shouldNotContain(tryReserveForUnscaled);
|