< prev index next >

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

Print this page




  45 
  46 public class IncompatibleOptions {
  47     static final String COOPS_DUMP_WARNING =
  48         "Cannot dump shared archive when UseCompressedOops or UseCompressedClassPointers is off";
  49     static final String COOPS_EXEC_WARNING =
  50         "UseCompressedOops and UseCompressedClassPointers must be on for UseSharedSpaces";
  51     static final String GC_WARNING =
  52         "Archived java heap is not supported";
  53     static final String OBJ_ALIGNMENT_MISMATCH =
  54         "The shared archive file's ObjectAlignmentInBytes of .* does not equal the current ObjectAlignmentInBytes of";
  55     static final String COMPACT_STRING_MISMATCH =
  56         "The shared archive file's CompactStrings setting .* does not equal the current CompactStrings setting";
  57 
  58     static String appJar;
  59 
  60     public static void main(String[] args) throws Exception {
  61         appJar = JarBuilder.build("IncompatibleOptions", "HelloString");
  62 
  63         // Uncompressed OOPs
  64         testDump(1, "-XX:+UseG1GC", "-XX:-UseCompressedOops", COOPS_DUMP_WARNING, true);

  65 
  66         // incompatible GCs
  67         testDump(2, "-XX:+UseParallelGC", "", GC_WARNING, false);
  68         testDump(3, "-XX:+UseSerialGC", "", GC_WARNING, false);
  69         if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
  70             testDump(4, "-XX:+UseConcMarkSweepGC", "", GC_WARNING, false);
  71         }
  72 
  73         // ======= archive with compressed oops, run w/o
  74         testDump(5, "-XX:+UseG1GC", "-XX:+UseCompressedOops", null, false);
  75         testExec(5, "-XX:+UseG1GC", "-XX:-UseCompressedOops",
  76                  COOPS_EXEC_WARNING, true);
  77 
  78         // NOTE: No warning is displayed, by design
  79         // Still run, to ensure no crash or exception
  80         testExec(6, "-XX:+UseParallelGC", "", "", false);
  81         testExec(7, "-XX:+UseSerialGC", "", "", false);
  82         if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
  83             testExec(8, "-XX:+UseConcMarkSweepGC", "", "", false);
  84         }




  45 
  46 public class IncompatibleOptions {
  47     static final String COOPS_DUMP_WARNING =
  48         "Cannot dump shared archive when UseCompressedOops or UseCompressedClassPointers is off";
  49     static final String COOPS_EXEC_WARNING =
  50         "UseCompressedOops and UseCompressedClassPointers must be on for UseSharedSpaces";
  51     static final String GC_WARNING =
  52         "Archived java heap is not supported";
  53     static final String OBJ_ALIGNMENT_MISMATCH =
  54         "The shared archive file's ObjectAlignmentInBytes of .* does not equal the current ObjectAlignmentInBytes of";
  55     static final String COMPACT_STRING_MISMATCH =
  56         "The shared archive file's CompactStrings setting .* does not equal the current CompactStrings setting";
  57 
  58     static String appJar;
  59 
  60     public static void main(String[] args) throws Exception {
  61         appJar = JarBuilder.build("IncompatibleOptions", "HelloString");
  62 
  63         // Uncompressed OOPs
  64         testDump(1, "-XX:+UseG1GC", "-XX:-UseCompressedOops", COOPS_DUMP_WARNING, true);
  65         testDump(1, "-XX:+UnlockExperimentalVMOptions", "-XX:+UseZGC", COOPS_DUMP_WARNING, true);
  66 
  67         // incompatible GCs
  68         testDump(2, "-XX:+UseParallelGC", "", GC_WARNING, false);
  69         testDump(3, "-XX:+UseSerialGC", "", GC_WARNING, false);
  70         if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
  71             testDump(4, "-XX:+UseConcMarkSweepGC", "", GC_WARNING, false);
  72         }
  73 
  74         // ======= archive with compressed oops, run w/o
  75         testDump(5, "-XX:+UseG1GC", "-XX:+UseCompressedOops", null, false);
  76         testExec(5, "-XX:+UseG1GC", "-XX:-UseCompressedOops",
  77                  COOPS_EXEC_WARNING, true);
  78 
  79         // NOTE: No warning is displayed, by design
  80         // Still run, to ensure no crash or exception
  81         testExec(6, "-XX:+UseParallelGC", "", "", false);
  82         testExec(7, "-XX:+UseSerialGC", "", "", false);
  83         if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
  84             testExec(8, "-XX:+UseConcMarkSweepGC", "", "", false);
  85         }


< prev index next >