30 * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) |
30 * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) |
31 * @requires (vm.gc=="G1" | vm.gc=="null") |
31 * @requires (vm.gc=="G1" | vm.gc=="null") |
32 * @library /testlibrary /test/lib |
32 * @library /testlibrary /test/lib |
33 * @modules java.base/sun.misc |
33 * @modules java.base/sun.misc |
34 * java.management |
34 * java.management |
35 * jdk.jartool/sun.tools.jar |
35 * @build SharedStringsWb SharedStrings ClassFileInstaller sun.hotspot.WhiteBox |
36 * @build SharedStringsWb SharedStrings BasicJarBuilder sun.hotspot.WhiteBox |
36 * @run main ClassFileInstaller -jar whitebox.jar sun.hotspot.WhiteBox |
37 * @run main ClassFileInstaller sun.hotspot.WhiteBox |
|
38 * @run main SharedStrings |
37 * @run main SharedStrings |
39 */ |
38 */ |
40 import jdk.test.lib.*; |
39 import jdk.test.lib.*; |
41 |
40 |
42 public class SharedStrings { |
41 public class SharedStrings { |
43 public static void main(String[] args) throws Exception { |
42 public static void main(String[] args) throws Exception { |
44 BasicJarBuilder.build(true, "whitebox", "sun/hotspot/WhiteBox"); |
|
45 |
|
46 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( |
43 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( |
47 "-XX:+UnlockDiagnosticVMOptions", |
44 "-XX:+UnlockDiagnosticVMOptions", |
48 "-XX:SharedArchiveFile=./SharedStrings.jsa", |
45 "-XX:SharedArchiveFile=./SharedStrings.jsa", |
49 "-XX:+PrintSharedSpaces", |
46 "-XX:+PrintSharedSpaces", |
50 // Needed for bootclasspath match, for CDS to work with WhiteBox API |
47 // Needed for bootclasspath match, for CDS to work with WhiteBox API |
51 "-Xbootclasspath/a:" + BasicJarBuilder.getTestJar("whitebox.jar"), |
48 "-Xbootclasspath/a:" + ClassFileInstaller.getJarPath("whitebox.jar"), |
52 "-Xshare:dump"); |
49 "-Xshare:dump"); |
53 |
50 |
54 new OutputAnalyzer(pb.start()) |
51 new OutputAnalyzer(pb.start()) |
55 .shouldContain("Loading classes to share") |
52 .shouldContain("Loading classes to share") |
56 .shouldContain("Shared string table stats") |
53 .shouldContain("Shared string table stats") |
60 "-XX:+UnlockDiagnosticVMOptions", |
57 "-XX:+UnlockDiagnosticVMOptions", |
61 "-XX:SharedArchiveFile=./SharedStrings.jsa", |
58 "-XX:SharedArchiveFile=./SharedStrings.jsa", |
62 // these are required modes for shared strings |
59 // these are required modes for shared strings |
63 "-XX:+UseCompressedOops", "-XX:+UseG1GC", |
60 "-XX:+UseCompressedOops", "-XX:+UseG1GC", |
64 // needed for access to white box test API |
61 // needed for access to white box test API |
65 "-Xbootclasspath/a:" + BasicJarBuilder.getTestJar("whitebox.jar"), |
62 "-Xbootclasspath/a:" + ClassFileInstaller.getJarPath("whitebox.jar"), |
66 "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", |
63 "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", |
67 "-Xshare:on", "-showversion", "SharedStringsWb"); |
64 "-Xshare:on", "-showversion", "SharedStringsWb"); |
68 |
65 |
69 OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
66 OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
70 |
67 |