< prev index next >

test/hotspot/jtreg/runtime/cds/appcds/sharedStrings/IncompatibleOptions.java

Print this page

  1 /*
  2  * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *

 91     static String appJar;
 92     static String[] vmOptionsPrefix = {};
 93 
 94     public static void main(String[] args) throws Exception {
 95         String[] noargs = {};
 96         SharedStringsUtils.run(Integer.parseInt(args[0]), 3, noargs, IncompatibleOptions::test);
 97         // Add a new @test block if you get an assert ----^ about this number. See
 98         // SharedStringsUtils.java for details.
 99     }
100 
101     public static void test(String[] args_ignored) throws Exception {
102         vmOptionsPrefix = SharedStringsUtils.getChildVMOptionsPrefix();
103         appJar = JarBuilder.build("IncompatibleOptions", "HelloString");
104 
105         // Uncompressed OOPs
106         testDump(1, "-XX:+UseG1GC", "-XX:-UseCompressedOops", null, false);
107         if (GC.Z.isSupported()) {
108             testDump(1, "-XX:+UseZGC", "-XX:-UseCompressedOops", null, false);
109         }
110 
111         // incompatible GCs
112         testDump(2, "-XX:+UseParallelGC", "", GC_WARNING, false);
113         testDump(3, "-XX:+UseSerialGC", "", GC_WARNING, false);
114 
115         // Explicitly archive with compressed oops, run without.
116         testDump(5, "-XX:+UseG1GC", "-XX:+UseCompressedOops", null, false);
117         testExec(5, "-XX:+UseG1GC", "-XX:-UseCompressedOops",
118                  COMPRESSED_OOPS_NOT_CONSISTENT, true);
119 
120         // NOTE: No warning is displayed, by design
121         // Still run, to ensure no crash or exception
122         testExec(6, "-XX:+UseParallelGC", "", "", false);
123         testExec(7, "-XX:+UseSerialGC", "", "", false);
124 
125         // Test various oops encodings, by varying ObjectAlignmentInBytes and heap sizes
126         testDump(9, "-XX:+UseG1GC", "-XX:ObjectAlignmentInBytes=8", null, false);
127         testExec(9, "-XX:+UseG1GC", "-XX:ObjectAlignmentInBytes=16",
128                  OBJ_ALIGNMENT_MISMATCH, true);
129 
130         // Implicitly archive with compressed oops, run without.
131         // Max heap size for compressed oops is around 31G.
132         // UseCompressedOops is turned on by default when heap
133         // size is under 31G, but will be turned off when heap

  1 /*
  2  * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *

 91     static String appJar;
 92     static String[] vmOptionsPrefix = {};
 93 
 94     public static void main(String[] args) throws Exception {
 95         String[] noargs = {};
 96         SharedStringsUtils.run(Integer.parseInt(args[0]), 3, noargs, IncompatibleOptions::test);
 97         // Add a new @test block if you get an assert ----^ about this number. See
 98         // SharedStringsUtils.java for details.
 99     }
100 
101     public static void test(String[] args_ignored) throws Exception {
102         vmOptionsPrefix = SharedStringsUtils.getChildVMOptionsPrefix();
103         appJar = JarBuilder.build("IncompatibleOptions", "HelloString");
104 
105         // Uncompressed OOPs
106         testDump(1, "-XX:+UseG1GC", "-XX:-UseCompressedOops", null, false);
107         if (GC.Z.isSupported()) {
108             testDump(1, "-XX:+UseZGC", "-XX:-UseCompressedOops", null, false);
109         }
110 
111         // ParallelGC and SerialGC now supports dumping heap objects
112         testDump(2, "-XX:+UseParallelGC", "", "", false);
113         testDump(3, "-XX:+UseSerialGC", "", "", false);
114 
115         // Explicitly archive with compressed oops, run without.
116         testDump(5, "-XX:+UseG1GC", "-XX:+UseCompressedOops", null, false);
117         testExec(5, "-XX:+UseG1GC", "-XX:-UseCompressedOops",
118                  COMPRESSED_OOPS_NOT_CONSISTENT, true);
119 
120         // NOTE: No warning is displayed, by design
121         // Still run, to ensure no crash or exception
122         testExec(6, "-XX:+UseParallelGC", "", "", false);
123         testExec(7, "-XX:+UseSerialGC", "", "", false);
124 
125         // Test various oops encodings, by varying ObjectAlignmentInBytes and heap sizes
126         testDump(9, "-XX:+UseG1GC", "-XX:ObjectAlignmentInBytes=8", null, false);
127         testExec(9, "-XX:+UseG1GC", "-XX:ObjectAlignmentInBytes=16",
128                  OBJ_ALIGNMENT_MISMATCH, true);
129 
130         // Implicitly archive with compressed oops, run without.
131         // Max heap size for compressed oops is around 31G.
132         // UseCompressedOops is turned on by default when heap
133         // size is under 31G, but will be turned off when heap
< prev index next >