3737 * @run driver TestParallelGCWithCDS
3838 */
3939
40+ // Below is exactly the same as above, except:
41+ // - requires vm.bits == "64"
42+ // - extra argument "false"
43+
44+ /*
45+ * @test Loading CDS archived heap objects into ParallelGC
46+ * @bug 8274788 8341371
47+ * @requires vm.cds
48+ * @requires vm.gc.Parallel
49+ * @requires vm.gc.G1
50+ * @requires vm.bits == "64"
51+ *
52+ * @comment don't run this test if any -XX::+Use???GC options are specified, since they will
53+ * interfere with the test.
54+ * @requires vm.gc == null
55+ *
56+ * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
57+ * @compile test-classes/Hello.java
58+ * @run driver TestParallelGCWithCDS false
59+ */
4060import jdk .test .lib .Platform ;
4161import jdk .test .lib .process .OutputAnalyzer ;
4262
4363public class TestParallelGCWithCDS {
4464 public final static String HELLO = "Hello World" ;
4565 static String helloJar ;
66+ static boolean useCompressedOops = true ;
4667
4768 public static void main (String ... args ) throws Exception {
4869 helloJar = JarBuilder .build ("hello" , "Hello" );
4970
71+ if (args .length > 0 && args [0 ].equals ("false" )) {
72+ useCompressedOops = false ;
73+ }
74+
5075 // Check if we can use ParallelGC during dump time, or run time, or both.
5176 test (false , true );
5277 test (true , false );
@@ -69,6 +94,8 @@ static void test(boolean dumpWithParallel, boolean execWithParallel, boolean use
6994 String execGC = execWithParallel ? Parallel : G1 ;
7095 String small1 = useSmallRegions ? "-Xmx256m" : "-showversion" ;
7196 String small2 = useSmallRegions ? "-XX:ObjectAlignmentInBytes=64" : "-showversion" ;
97+ String errMsg = "Cannot use CDS heap data. Selected GC not compatible -XX:-UseCompressedOops" ;
98+ String coops = useCompressedOops ? "-XX:+UseCompressedOops" : "-XX:-UseCompressedOops" ;
7299 OutputAnalyzer out ;
73100
74101 System .out .println ("0. Dump with " + dumpGC );
@@ -77,6 +104,7 @@ static void test(boolean dumpWithParallel, boolean execWithParallel, boolean use
77104 dumpGC ,
78105 small1 ,
79106 small2 ,
107+ coops ,
80108 "-Xlog:cds" );
81109 out .shouldContain ("Dumping shared data to file:" );
82110 out .shouldHaveExitValue (0 );
@@ -86,9 +114,11 @@ static void test(boolean dumpWithParallel, boolean execWithParallel, boolean use
86114 execGC ,
87115 small1 ,
88116 small2 ,
117+ coops ,
89118 "-Xlog:cds" ,
90119 "Hello" );
91120 out .shouldContain (HELLO );
121+ out .shouldNotContain (errMsg );
92122 out .shouldHaveExitValue (0 );
93123
94124 int n = 2 ;
@@ -109,10 +139,12 @@ static void test(boolean dumpWithParallel, boolean execWithParallel, boolean use
109139 small1 ,
110140 small2 ,
111141 xmx ,
142+ coops ,
112143 "-Xlog:cds" ,
113144 "Hello" );
114145 if (out .getExitValue () == 0 ) {
115146 out .shouldContain (HELLO );
147+ out .shouldNotContain (errMsg );
116148 } else {
117149 String pattern = "((Too small maximum heap)" +
118150 "|(GC triggered before VM initialization completed)" +
0 commit comments