< prev index next >

test/hotspot/jtreg/runtime/cds/appcds/aotCache/AOTMapTest.java

Print this page

 30  * @build AOTMapTest Hello
 31  * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar app.jar AOTMapTestApp
 32  * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar cust.jar Hello
 33  * @run driver/timeout=240 AOTMapTest AOT --two-step-training
 34  */
 35 
 36 /**
 37  * @test id=dynamic
 38  * @bug 8362566
 39  * @summary Test the contents of -Xlog:aot+map with dynamic CDS archive
 40  * @requires vm.cds.supports.aot.class.linking
 41  * @library /test/lib /test/hotspot/jtreg/runtime/cds /test/hotspot/jtreg/runtime/cds/appcds/test-classes
 42  * @build jdk.test.whitebox.WhiteBox
 43  * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
 44  * @build AOTMapTest Hello
 45  * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar app.jar AOTMapTestApp
 46  * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar cust.jar Hello
 47  * @run main/othervm/timeout=240 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. AOTMapTest DYNAMIC
 48  */
 49 















 50 import java.io.File;
 51 import java.net.URL;
 52 import java.net.URLClassLoader;
 53 import java.util.ArrayList;
 54 import jdk.test.lib.cds.CDSAppTester;
 55 import jdk.test.lib.helpers.ClassFileInstaller;
 56 import jdk.test.lib.Platform;
 57 
 58 public class AOTMapTest {
 59     static final String appJar = ClassFileInstaller.getJarPath("app.jar");
 60     static final String mainClass = "AOTMapTestApp";
 61     static final String classLoadLogFile = "production.class.load.log";
 62 
 63     public static void main(String[] args) throws Exception {
 64         doTest(args);
 65     }
 66 
 67     public static void doTest(String[] args) throws Exception {
 68         Tester tester = new Tester();
 69         tester.run(args);

 95 
 96         public Tester() {
 97             super(mainClass);
 98 
 99             dumpMapFile = "test" + "0" + ".dump.aotmap";
100             runMapFile  = "test" + "0" + ".run.aotmap";
101         }
102 
103         @Override
104         public String classpath(RunMode runMode) {
105             return appJar;
106         }
107 
108         @Override
109         public String[] vmArgs(RunMode runMode) {
110             ArrayList<String> vmArgs = new ArrayList<>();
111 
112             vmArgs.add("-Xmx128M");
113             vmArgs.add("-Xlog:aot=debug");
114 










115             // filesize=0 ensures that a large map file not broken up in multiple files.
116             String logMapPrefix = "-Xlog:aot+map=debug,aot+map+oops=trace:file=";
117             String logSuffix = ":none:filesize=0";
118 
119             if (runMode == RunMode.ASSEMBLY || runMode == RunMode.DUMP_DYNAMIC) {
120                 vmArgs.add(logMapPrefix + dumpMapFile + logSuffix);
121             } else if (runMode == RunMode.PRODUCTION) {
122                 vmArgs.add(logMapPrefix + runMapFile + logSuffix);
123                 vmArgs.add("-Xlog:class+load:file=" + classLoadLogFile + logSuffix);
124             }
125 
126             return vmArgs.toArray(new String[vmArgs.size()]);
127         }
128 
129         @Override
130         public String[] appCommandLine(RunMode runMode) {
131             return new String[] {
132                 mainClass,
133             };
134         }
135     }
136 }
137 
138 class AOTMapTestApp {
139     static URLClassLoader loader; // keep Hello class alive

 30  * @build AOTMapTest Hello
 31  * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar app.jar AOTMapTestApp
 32  * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar cust.jar Hello
 33  * @run driver/timeout=240 AOTMapTest AOT --two-step-training
 34  */
 35 
 36 /**
 37  * @test id=dynamic
 38  * @bug 8362566
 39  * @summary Test the contents of -Xlog:aot+map with dynamic CDS archive
 40  * @requires vm.cds.supports.aot.class.linking
 41  * @library /test/lib /test/hotspot/jtreg/runtime/cds /test/hotspot/jtreg/runtime/cds/appcds/test-classes
 42  * @build jdk.test.whitebox.WhiteBox
 43  * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
 44  * @build AOTMapTest Hello
 45  * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar app.jar AOTMapTestApp
 46  * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar cust.jar Hello
 47  * @run main/othervm/timeout=240 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. AOTMapTest DYNAMIC
 48  */
 49 
 50 /**
 51  * @test id=valhalla
 52  * @bug 8362566
 53  * @summary Test the contents of -Xlog:aot+map with AOT workflow and flat arrays
 54  * @enablePreview
 55  * @requires vm.cds.supports.aot.class.linking & vm.debug & vm.cds.write.archived.java.heap
 56  * @library /test/lib /test/hotspot/jtreg/runtime/cds /test/hotspot/jtreg/runtime/cds/appcds/test-classes
 57  * @modules java.base/jdk.internal.value java.base/jdk.internal.misc java.base/jdk.internal.vm.annotation
 58  * @build Hello
 59  * @compile test-classes/AOTMapTestApp.java
 60  * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar app.jar AOTMapTestApp AOTMapTestApp$Wrapper AOTMapTestApp$WrapperWrapper
 61  *                                                                  AOTMapTestApp$ArchivedData Hello
 62  * @run main/othervm/timeout=240 AOTMapTest STATIC
 63  */
 64 
 65 import java.io.File;
 66 import java.net.URL;
 67 import java.net.URLClassLoader;
 68 import java.util.ArrayList;
 69 import jdk.test.lib.cds.CDSAppTester;
 70 import jdk.test.lib.helpers.ClassFileInstaller;
 71 import jdk.test.lib.Platform;
 72 
 73 public class AOTMapTest {
 74     static final String appJar = ClassFileInstaller.getJarPath("app.jar");
 75     static final String mainClass = "AOTMapTestApp";
 76     static final String classLoadLogFile = "production.class.load.log";
 77 
 78     public static void main(String[] args) throws Exception {
 79         doTest(args);
 80     }
 81 
 82     public static void doTest(String[] args) throws Exception {
 83         Tester tester = new Tester();
 84         tester.run(args);

110 
111         public Tester() {
112             super(mainClass);
113 
114             dumpMapFile = "test" + "0" + ".dump.aotmap";
115             runMapFile  = "test" + "0" + ".run.aotmap";
116         }
117 
118         @Override
119         public String classpath(RunMode runMode) {
120             return appJar;
121         }
122 
123         @Override
124         public String[] vmArgs(RunMode runMode) {
125             ArrayList<String> vmArgs = new ArrayList<>();
126 
127             vmArgs.add("-Xmx128M");
128             vmArgs.add("-Xlog:aot=debug");
129 
130             if (isStaticWorkflow()) {
131                 vmArgs.add("--enable-preview");
132                 vmArgs.add("--add-exports");
133                 vmArgs.add("java.base/jdk.internal.value=ALL-UNNAMED");
134                 vmArgs.add("--add-exports");
135                 vmArgs.add("java.base/jdk.internal.misc=ALL-UNNAMED");
136                 vmArgs.add("-Xbootclasspath/a:" + appJar);
137                 vmArgs.add("-XX:ArchiveHeapTestClass=AOTMapTestApp");
138             }
139 
140             // filesize=0 ensures that a large map file not broken up in multiple files.
141             String logMapPrefix = "-Xlog:aot+map=trace,aot+map+oops=trace:file=";
142             String logSuffix = ":none:filesize=0";
143 
144             if (runMode == RunMode.ASSEMBLY || runMode == RunMode.DUMP_DYNAMIC || runMode == RunMode.DUMP_STATIC) {
145                 vmArgs.add(logMapPrefix + dumpMapFile + logSuffix);
146             } else if (runMode == RunMode.PRODUCTION) {
147                 vmArgs.add(logMapPrefix + runMapFile + logSuffix);
148                 vmArgs.add("-Xlog:class+load:file=" + classLoadLogFile + logSuffix);
149             }
150 
151             return vmArgs.toArray(new String[vmArgs.size()]);
152         }
153 
154         @Override
155         public String[] appCommandLine(RunMode runMode) {
156             return new String[] {
157                 mainClass,
158             };
159         }
160     }
161 }
162 
163 class AOTMapTestApp {
164     static URLClassLoader loader; // keep Hello class alive
< prev index next >