< prev index next >

test/hotspot/jtreg/runtime/CompressedOops/CompressedCPUSpecificClassSpaceReservation.java

Print this page

 38 import jdk.test.lib.process.ProcessTools;
 39 import jtreg.SkippedException;
 40 
 41 import java.io.IOException;
 42 
 43 public class CompressedCPUSpecificClassSpaceReservation {
 44     // Note: windows: On windows, we currently have the issue that os::reserve_memory_aligned relies on
 45     // os::attempt_reserve_memory_at because VirtualAlloc cannot be unmapped in parts; this precludes use of
 46     // +SimulateFullAddressSpace (VM won't be able to reserve heap). Therefore we exclude the test for windows
 47     // for now.
 48 
 49     private static void do_test(boolean CDS) throws IOException {
 50         // We start the VM with -XX:+SimulateFullAdressSpace, which means the JVM will go through all motions
 51         // of reserving the cds+class space, but never succeed. That means we see every single allocation attempt.
 52         // We start with -Xlog options enabled. The expected output goes like this:
 53         // [0.017s][debug][os,map] reserve_between (range [0x0000000000000000-0x0000000100000000), size 0x41000000, alignment 0x1000000, randomize: 1)
 54         ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
 55                 "-Xshare:" + (CDS ? "on" : "off"),
 56                 "-Xmx128m",
 57                 "-XX:CompressedClassSpaceSize=128m",

 58                 "-Xlog:metaspace*", "-Xlog:metaspace+map=trace", "-Xlog:os+map=trace",
 59                 "-XX:+SimulateFullAddressSpace", // So that no resevation attempt will succeed
 60                 "-version");
 61         OutputAnalyzer output = new OutputAnalyzer(pb.start());
 62 
 63         final String tryReserveForUnscaled = "reserve_between (range [0x0000000000000000-0x0000000100000000)";
 64         final String tryReserveForZeroBased = "reserve_between (range [0x0000000100000000-0x0000000800000000)";
 65         final String tryReserveFor16bitMoveIntoQ3 = "reserve_between (range [0x0000000100000000-0x0001000000000000)";
 66         if (Platform.isAArch64()) {
 67             if (CDS) {
 68                 output.shouldNotContain(tryReserveForUnscaled);
 69             } else {
 70                 output.shouldContain(tryReserveForUnscaled);
 71             }
 72             output.shouldContain("Trying to reserve at an EOR-compatible address");
 73             output.shouldNotContain(tryReserveForZeroBased);
 74             output.shouldContain(tryReserveFor16bitMoveIntoQ3);
 75         } else if (Platform.isPPC()) {
 76             if (CDS) {
 77                 output.shouldNotContain(tryReserveForUnscaled);

 38 import jdk.test.lib.process.ProcessTools;
 39 import jtreg.SkippedException;
 40 
 41 import java.io.IOException;
 42 
 43 public class CompressedCPUSpecificClassSpaceReservation {
 44     // Note: windows: On windows, we currently have the issue that os::reserve_memory_aligned relies on
 45     // os::attempt_reserve_memory_at because VirtualAlloc cannot be unmapped in parts; this precludes use of
 46     // +SimulateFullAddressSpace (VM won't be able to reserve heap). Therefore we exclude the test for windows
 47     // for now.
 48 
 49     private static void do_test(boolean CDS) throws IOException {
 50         // We start the VM with -XX:+SimulateFullAdressSpace, which means the JVM will go through all motions
 51         // of reserving the cds+class space, but never succeed. That means we see every single allocation attempt.
 52         // We start with -Xlog options enabled. The expected output goes like this:
 53         // [0.017s][debug][os,map] reserve_between (range [0x0000000000000000-0x0000000100000000), size 0x41000000, alignment 0x1000000, randomize: 1)
 54         ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
 55                 "-Xshare:" + (CDS ? "on" : "off"),
 56                 "-Xmx128m",
 57                 "-XX:CompressedClassSpaceSize=128m",
 58                 "-XX:+UnlockExperimentalVMOptions", "-XX:-UseCompactObjectHeaders",
 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);
< prev index next >