< prev index next >

test/hotspot/jtreg/runtime/cds/DeterministicDump.java

Print this page

 57         doTest(false);
 58 
 59         if (Platform.is64bit()) {
 60             // There's no oop/klass compression on 32-bit.
 61             doTest(true);
 62         }
 63     }
 64 
 65     public static void doTest(boolean compressed) throws Exception {
 66         ArrayList<String> baseArgs = new ArrayList<>();
 67 
 68         // Try to reduce indeterminism of GC heap sizing and evacuation.
 69         baseArgs.add("-Xmx128M");
 70         baseArgs.add("-Xms128M");
 71         baseArgs.add("-Xmn120M");
 72 
 73         if (Platform.is64bit()) {
 74             // This option is available only on 64-bit.
 75             String sign = (compressed) ?  "+" : "-";
 76             baseArgs.add("-XX:" + sign + "UseCompressedOops");


 77         }
 78 
 79         String baseArchive = dump(baseArgs);
 80         File baseArchiveFile = new File(baseArchive + ".jsa");
 81         HEADER_SIZE = CDSArchiveUtils.fileHeaderSize(baseArchiveFile);
 82 
 83         // (1) Dump with the same args. Should produce the same archive.
 84         String baseArchive2 = dump(baseArgs);
 85         compare(baseArchive, baseArchive2, baseArchiveFile);
 86 
 87         // (2) This will cause the archive to be relocated during dump time. We should
 88         //     still get the same bits. This simulates relocation that happens when
 89         //     Address Space Layout Randomization prevents the archive space to
 90         //     be mapped at the default location.
 91         String relocatedArchive = dump(baseArgs, "-XX:+UnlockDiagnosticVMOptions", "-XX:ArchiveRelocationMode=1");
 92         compare(baseArchive, relocatedArchive, baseArchiveFile);
 93     }
 94 
 95     static int id = 0;
 96     static String dump(ArrayList<String> args, String... more) throws Exception {

 57         doTest(false);
 58 
 59         if (Platform.is64bit()) {
 60             // There's no oop/klass compression on 32-bit.
 61             doTest(true);
 62         }
 63     }
 64 
 65     public static void doTest(boolean compressed) throws Exception {
 66         ArrayList<String> baseArgs = new ArrayList<>();
 67 
 68         // Try to reduce indeterminism of GC heap sizing and evacuation.
 69         baseArgs.add("-Xmx128M");
 70         baseArgs.add("-Xms128M");
 71         baseArgs.add("-Xmn120M");
 72 
 73         if (Platform.is64bit()) {
 74             // This option is available only on 64-bit.
 75             String sign = (compressed) ?  "+" : "-";
 76             baseArgs.add("-XX:" + sign + "UseCompressedOops");
 77             baseArgs.add("-XX:+UnlockExperimentalVMOptions");
 78             baseArgs.add("-XX:-UseCompactObjectHeaders");
 79         }
 80 
 81         String baseArchive = dump(baseArgs);
 82         File baseArchiveFile = new File(baseArchive + ".jsa");
 83         HEADER_SIZE = CDSArchiveUtils.fileHeaderSize(baseArchiveFile);
 84 
 85         // (1) Dump with the same args. Should produce the same archive.
 86         String baseArchive2 = dump(baseArgs);
 87         compare(baseArchive, baseArchive2, baseArchiveFile);
 88 
 89         // (2) This will cause the archive to be relocated during dump time. We should
 90         //     still get the same bits. This simulates relocation that happens when
 91         //     Address Space Layout Randomization prevents the archive space to
 92         //     be mapped at the default location.
 93         String relocatedArchive = dump(baseArgs, "-XX:+UnlockDiagnosticVMOptions", "-XX:ArchiveRelocationMode=1");
 94         compare(baseArchive, relocatedArchive, baseArchiveFile);
 95     }
 96 
 97     static int id = 0;
 98     static String dump(ArrayList<String> args, String... more) throws Exception {
< prev index next >