8221685: -XX:BytecodeVerificationRemote and -XX:BytecodeVerificationLocal should be diagnostic options
authorhseigel
Wed, 24 Apr 2019 08:27:00 -0400
changeset 54607 b6db97903b69
parent 54606 24eb7720919c
child 54608 c604234be658
8221685: -XX:BytecodeVerificationRemote and -XX:BytecodeVerificationLocal should be diagnostic options Summary: Make the options diagnostic and add -XX:+UnlockDiagnosticVMOptions to tests where needed. Reviewed-by: lfoltan, acorn, dholmes
src/hotspot/share/runtime/globals.hpp
test/hotspot/jtreg/compiler/linkage/TestLinkageErrorInGenerateOopMap.java
test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java
test/hotspot/jtreg/runtime/appcds/VerifierTest.java
test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm
test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm
test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm
test/hotspot/jtreg/runtime/lambda-features/TestStaticandInstance.java
test/hotspot/jtreg/runtime/verifier/TestSigParse.java
test/hotspot/jtreg/vmTestbase/vm/mlvm/anonloader/stress/parallelLoad/Test.java
--- a/src/hotspot/share/runtime/globals.hpp	Wed Apr 24 11:40:04 2019 +0200
+++ b/src/hotspot/share/runtime/globals.hpp	Wed Apr 24 08:27:00 2019 -0400
@@ -545,10 +545,10 @@
           "Number of ring buffer event logs")                               \
           range(1, NOT_LP64(1*K) LP64_ONLY(1*M))                            \
                                                                             \
-  product(bool, BytecodeVerificationRemote, true,                           \
+  diagnostic(bool, BytecodeVerificationRemote, true,                        \
           "Enable the Java bytecode verifier for remote classes")           \
                                                                             \
-  product(bool, BytecodeVerificationLocal, false,                           \
+  diagnostic(bool, BytecodeVerificationLocal, false,                        \
           "Enable the Java bytecode verifier for local classes")            \
                                                                             \
   develop(bool, ForceFloatExceptions, trueInDebug,                          \
--- a/test/hotspot/jtreg/compiler/linkage/TestLinkageErrorInGenerateOopMap.java	Wed Apr 24 11:40:04 2019 +0200
+++ b/test/hotspot/jtreg/compiler/linkage/TestLinkageErrorInGenerateOopMap.java	Wed Apr 24 08:27:00 2019 -0400
@@ -42,7 +42,8 @@
     public static void main(String args[]) throws Exception {
         if (args.length == 0) {
             // Spawn new VM instance to execute test
-            String[] flags = {"-XX:-BytecodeVerificationRemote",
+            String[] flags = {"-XX:+UnlockDiagnosticVMOptions",
+                              "-XX:-BytecodeVerificationRemote",
                               "-XX:-BytecodeVerificationLocal",
                               "-XX:-TieredCompilation",
                               "-XX:CompileCommand=dontinline,compiler/linkage/OSRWithBadOperandStack.m*",
--- a/test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java	Wed Apr 24 11:40:04 2019 +0200
+++ b/test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java	Wed Apr 24 08:27:00 2019 -0400
@@ -32,7 +32,7 @@
  *          MissingMethodWithSuper.jcod
  *          MissingNestHost.jcod
  * @run main TestInvokeErrors true
- * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal TestInvokeErrors false
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal TestInvokeErrors false
  */
 
 public class TestInvokeErrors {
--- a/test/hotspot/jtreg/runtime/appcds/VerifierTest.java	Wed Apr 24 11:40:04 2019 +0200
+++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest.java	Wed Apr 24 08:27:00 2019 -0400
@@ -38,7 +38,7 @@
     // Test verification settings for dumping & runtime
     static final String VFY_ALL = "-Xverify:all";
     static final String VFY_REMOTE = "-Xverify:remote"; // default
-    static final String VFY_NONE = "-XX:-BytecodeVerificationRemote, -XX:-BytecodeVerificationLocal";
+    static final String VFY_NONE = "-XX:+UnlockDiagnosticVMOptions, -XX:-BytecodeVerificationRemote, -XX:-BytecodeVerificationLocal";
 
     static final String ERR =
         "ERROR: class VerifierTestC was loaded unexpectedly";
@@ -188,18 +188,20 @@
             if (!dump_setting.equals(prev_dump_setting)) {
                 String dump_arg1;
                 String dump_arg2;
+                String dump_arg3;
                 // Need to break this into two separate arguments.
                 if (dump_setting.equals(VFY_NONE)) {
-                    dump_arg1 = "-XX:-BytecodeVerificationRemote";
-                    dump_arg2 = "-XX:-BytecodeVerificationLocal";
+                    dump_arg1 = "-XX:+UnlockDiagnosticVMOptions";
+                    dump_arg2 = "-XX:-BytecodeVerificationRemote";
+                    dump_arg3 = "-XX:-BytecodeVerificationLocal";
                 } else {
                     // Redundant args should be harmless.
-                    dump_arg1 = dump_arg2 = dump_setting;
+                    dump_arg1 = dump_arg2 = dump_arg3 = dump_setting;
                 }
 
                 OutputAnalyzer dumpOutput = TestCommon.dump(
                                                             jar, dump_list, dump_arg1, dump_arg2,
-                                                            CDS_LOGGING,
+                                                            dump_arg3, CDS_LOGGING,
                                                             // FIXME: the following options are for working around a GC
                                                             // issue - assert failure when dumping archive with the -Xverify:all
                                                             "-Xms256m",
@@ -211,15 +213,17 @@
             }
             String runtime_arg1;
             String runtime_arg2;
+            String runtime_arg3;
             if (runtime_setting.equals(VFY_NONE)) {
-                runtime_arg1 = "-XX:-BytecodeVerificationRemote";
-                runtime_arg2 = "-XX:-BytecodeVerificationLocal";
+                runtime_arg1 = "-XX:+UnlockDiagnosticVMOptions";
+                runtime_arg2 = "-XX:-BytecodeVerificationRemote";
+                runtime_arg3 = "-XX:-BytecodeVerificationLocal";
             } else {
                 // Redundant args should be harmless.
-                runtime_arg1 = runtime_arg2 = runtime_setting;
+                runtime_arg1 = runtime_arg2 = runtime_arg3 = runtime_setting;
             }
             TestCommon.run("-cp", jar,
-                           runtime_arg1, runtime_arg2,
+                           runtime_arg1, runtime_arg2, runtime_arg3,
                            "VerifierTest0")
                 .ifNoMappingFailure(output -> checkRuntimeOutput(output, expected_output_str));
             prev_dump_setting = dump_setting;
@@ -266,16 +270,18 @@
             if (!dump_setting.equals(prev_dump_setting)) {
                 String dump_arg1;
                 String dump_arg2;
+                String dump_arg3;
                 if (dump_setting.equals(VFY_NONE)) {
-                    dump_arg1 = "-XX:-BytecodeVerificationRemote";
-                    dump_arg2 = "-XX:-BytecodeVerificationLocal";
+                    dump_arg1 = "-XX:+UnlockDiagnosticVMOptions";
+                    dump_arg2 = "-XX:-BytecodeVerificationRemote";
+                    dump_arg3 = "-XX:-BytecodeVerificationLocal";
                 } else {
                     // Redundant args should be harmless.
-                    dump_arg1 = dump_arg2 = dump_setting;
+                    dump_arg1 = dump_arg2 = dump_arg3 = dump_setting;
                 }
                 OutputAnalyzer dumpOutput = TestCommon.dump(
                                                             jar, appClasses, dump_arg1, dump_arg2,
-                                                            CDS_LOGGING,
+                                                            dump_arg3, CDS_LOGGING,
                                                             // FIXME: the following options are for working around a GC
                                                             // issue - assert failure when dumping archive with the -Xverify:all
                                                             "-Xms256m",
@@ -287,15 +293,17 @@
             }
             String runtime_arg1;
             String runtime_arg2;
+            String runtime_arg3;
             if (runtime_setting.equals(VFY_NONE)) {
-                runtime_arg1 = "-XX:-BytecodeVerificationRemote";
-                runtime_arg2 = "-XX:-BytecodeVerificationLocal";
+                runtime_arg1 = "-XX:+UnlockDiagnosticVMOptions";
+                runtime_arg2 = "-XX:-BytecodeVerificationRemote";
+                runtime_arg3 = "-XX:-BytecodeVerificationLocal";
             } else {
                 // Redundant args should be harmless.
-                runtime_arg1 = runtime_arg2 = runtime_setting;
+                runtime_arg1 = runtime_arg2 = runtime_arg3 = runtime_setting;
             }
             TestCommon.run("-cp", jar,
-                           runtime_arg1, runtime_arg2,
+                           runtime_arg1, runtime_arg2, runtime_arg3,
                            "Hi")
                 .ifNoMappingFailure(output -> checkRuntimeOutput(output, expected_output_str));
            prev_dump_setting = dump_setting;
--- a/test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm	Wed Apr 24 11:40:04 2019 +0200
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm	Wed Apr 24 08:27:00 2019 -0400
@@ -28,7 +28,7 @@
  * @summary Check that invokevirtual of clone() finds the clone() method that
  *          is local to the calling class.
  * @compile DefMethClone.jasm SuperClass.jasm I1.java HasLocalClone.jasm
- * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal HasLocalClone
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal HasLocalClone
  */
 
 // The below .jasm code implements the following java code:
--- a/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm	Wed Apr 24 11:40:04 2019 +0200
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm	Wed Apr 24 08:27:00 2019 -0400
@@ -28,7 +28,7 @@
  * @summary Check that invokevirtual of clone() calls java.lang.Object.clone()
  *          even if a superinterface has a default method named clone().
  * @compile DefMethClone.jasm SuperClass.jasm I1.java NoLocalClone.jasm
- * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal NoLocalClone
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal NoLocalClone
  */
 
 // The below .jasm code implements the following java code:
--- a/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm	Wed Apr 24 11:40:04 2019 +0200
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm	Wed Apr 24 08:27:00 2019 -0400
@@ -28,7 +28,7 @@
  * @summary Check that invokevirtual of clone() calls java.lang.Object.clone()
  *          even if a superinterface has an abstract method named clone().
  * @compile DefMethClone.jasm SuperClass.jasm I1Abstr.java NoLocalCloneAbstr.jasm
- * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal NoLocalCloneAbstr
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal NoLocalCloneAbstr
  */
 
 // The below .jasm code implements the following java code:
--- a/test/hotspot/jtreg/runtime/lambda-features/TestStaticandInstance.java	Wed Apr 24 11:40:04 2019 +0200
+++ b/test/hotspot/jtreg/runtime/lambda-features/TestStaticandInstance.java	Wed Apr 24 08:27:00 2019 -0400
@@ -26,7 +26,7 @@
  * @bug 8087342
  * @summary Test linkresolver search static, instance and overpass duplicates
  * @modules java.base/jdk.internal.org.objectweb.asm
- * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal TestStaticandInstance
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal TestStaticandInstance
  */
 
 
--- a/test/hotspot/jtreg/runtime/verifier/TestSigParse.java	Wed Apr 24 11:40:04 2019 +0200
+++ b/test/hotspot/jtreg/runtime/verifier/TestSigParse.java	Wed Apr 24 08:27:00 2019 -0400
@@ -27,7 +27,7 @@
  * @summary Test that signatures are properly parsed when verification of local
  *          classes is requested but verification of remote classes is not.
  * @compile BadSignatures.jcod
- * @run main/othervm -XX:+BytecodeVerificationLocal -XX:-BytecodeVerificationRemote TestSigParse
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+BytecodeVerificationLocal -XX:-BytecodeVerificationRemote TestSigParse
  */
 
 public class TestSigParse {
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/anonloader/stress/parallelLoad/Test.java	Wed Apr 24 11:40:04 2019 +0200
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/anonloader/stress/parallelLoad/Test.java	Wed Apr 24 08:27:00 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
  * @run driver vm.mlvm.share.IndifiedClassesBuilder
  *
  * @run main/othervm
- *      -XX:+BytecodeVerificationLocal
+ *      -Xverify:all
  *      vm.mlvm.anonloader.stress.parallelLoad.Test
  *      -threadsPerCpu 4
  *      -threadsExtra 20