8214719: Deprecate -Xverify:none option
authorhseigel
Wed, 20 Feb 2019 13:21:36 -0500
changeset 53853 7ca9e625d6b2
parent 53851 cc4f5bf6b26b
child 53854 792c8a5fbb29
8214719: Deprecate -Xverify:none option Summary: Deprecate -Xverify:none and -noverify and remove them from tests Reviewed-by: dholmes, mikael
src/hotspot/share/classfile/verifier.hpp
src/hotspot/share/runtime/arguments.cpp
src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java
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/jdk/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh
test/langtools/tools/javac/lambda/MethodReference66.java
--- a/src/hotspot/share/classfile/verifier.hpp	Wed Feb 20 09:43:01 2019 -0800
+++ b/src/hotspot/share/classfile/verifier.hpp	Wed Feb 20 13:21:36 2019 -0500
@@ -49,7 +49,7 @@
 
   // Return false if the class is loaded by the bootstrap loader,
   // or if defineClass was called requesting skipping verification
-  // -Xverify:all/none override this value
+  // -Xverify:all overrides this value
   static bool should_verify_for(oop class_loader, bool should_verify_class);
 
   // Relax certain access checks to enable some broken 1.1 apps to run on 1.2.
--- a/src/hotspot/share/runtime/arguments.cpp	Wed Feb 20 09:43:01 2019 -0800
+++ b/src/hotspot/share/runtime/arguments.cpp	Wed Feb 20 13:21:36 2019 -0500
@@ -555,13 +555,13 @@
   { "UseImplicitStableValues",       JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) },
 
 #ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
+  // These entries will generate build errors.  Their purpose is to test the macros.
   { "dep > obs",                    JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() },
   { "dep > exp ",                   JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(8) },
   { "obs > exp ",                   JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(8) },
   { "not deprecated or obsolete",   JDK_Version::undefined(), JDK_Version::undefined(), JDK_Version::jdk(9) },
   { "dup option",                   JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
   { "dup option",                   JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
-  { "BytecodeVerificationRemote",   JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::undefined() },
 #endif
 
   { NULL, JDK_Version(0), JDK_Version(0) }
@@ -2749,6 +2749,7 @@
         if (FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, false) != JVMFlag::SUCCESS) {
           return JNI_EINVAL;
         }
+        warning("Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.");
       } else if (is_bad_option(option, args->ignoreUnrecognized, "verification")) {
         return JNI_EINVAL;
       }
--- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java	Wed Feb 20 09:43:01 2019 -0800
+++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java	Wed Feb 20 13:21:36 2019 -0500
@@ -931,7 +931,7 @@
                    // Old-style options (These should remain in place as long as
                    //  the standard VM accepts them)
                    token.equals("-noasyncgc") || token.equals("-prof") ||
-                   token.equals("-verify") || token.equals("-noverify") ||
+                   token.equals("-verify") ||
                    token.equals("-verifyremote") ||
                    token.equals("-verbosegc") ||
                    token.startsWith("-ms") || token.startsWith("-mx") ||
--- a/test/hotspot/jtreg/compiler/linkage/TestLinkageErrorInGenerateOopMap.java	Wed Feb 20 09:43:01 2019 -0800
+++ b/test/hotspot/jtreg/compiler/linkage/TestLinkageErrorInGenerateOopMap.java	Wed Feb 20 13:21:36 2019 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -42,7 +42,9 @@
     public static void main(String args[]) throws Exception {
         if (args.length == 0) {
             // Spawn new VM instance to execute test
-            String[] flags = {"-noverify", "-XX:-TieredCompilation",
+            String[] flags = {"-XX:-BytecodeVerificationRemote",
+                              "-XX:-BytecodeVerificationLocal",
+                              "-XX:-TieredCompilation",
                               "-XX:CompileCommand=dontinline,compiler/linkage/OSRWithBadOperandStack.m*",
                               "compiler.linkage.TestLinkageErrorInGenerateOopMap", "run"};
             ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flags);
--- a/test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java	Wed Feb 20 09:43:01 2019 -0800
+++ b/test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java	Wed Feb 20 13:21:36 2019 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -32,7 +32,7 @@
  *          MissingMethodWithSuper.jcod
  *          MissingNestHost.jcod
  * @run main TestInvokeErrors true
- * @run main/othervm -Xverify:none TestInvokeErrors false
+ * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal TestInvokeErrors false
  */
 
 public class TestInvokeErrors {
--- a/test/hotspot/jtreg/runtime/appcds/VerifierTest.java	Wed Feb 20 09:43:01 2019 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest.java	Wed Feb 20 13:21:36 2019 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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 @@
     // 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 = "-Xverify:none";
+    static final String VFY_NONE = "-XX:-BytecodeVerificationRemote, -XX:-BytecodeVerificationLocal";
 
     static final String ERR =
         "ERROR: class VerifierTestC was loaded unexpectedly";
@@ -140,7 +140,7 @@
             {"app",   VFY_ALL,    VFY_REMOTE, VFY_ERR },
             {"app",   VFY_ALL,    VFY_ALL,    VFY_ERR },
             {"app",   VFY_ALL,    VFY_NONE,   ERR },
-            // Dump app/ext with -Xverify:none
+            // Dump app/ext with verifier turned off
             {"app",   VFY_NONE,   VFY_REMOTE, VFY_ERR},
             {"app",   VFY_NONE,   VFY_ALL,    MAP_FAIL},
             {"app",   VFY_NONE,   VFY_NONE,   ERR },
@@ -152,7 +152,7 @@
             {"noApp", VFY_ALL, VFY_REMOTE,    VFY_ERR},
             {"noApp", VFY_ALL, VFY_ALL,       VFY_ERR},
             {"noApp", VFY_ALL, VFY_NONE,      ERR},
-            // Dump sys only with -Xverify:none
+            // Dump sys only with verifier turned off
             {"noApp", VFY_NONE, VFY_REMOTE,   VFY_ERR},
             {"noApp", VFY_NONE, VFY_ALL,      VFY_ERR},
             {"noApp", VFY_NONE, VFY_NONE,     ERR},
@@ -186,8 +186,19 @@
                                " with " + dump_setting +
                                ", run with " + runtime_setting);
             if (!dump_setting.equals(prev_dump_setting)) {
+                String dump_arg1;
+                String dump_arg2;
+                // Need to break this into two separate arguments.
+                if (dump_setting.equals(VFY_NONE)) {
+                    dump_arg1 = "-XX:-BytecodeVerificationRemote";
+                    dump_arg2 = "-XX:-BytecodeVerificationLocal";
+                } else {
+                    // Redundant args should be harmless.
+                    dump_arg1 = dump_arg2 = dump_setting;
+                }
+
                 OutputAnalyzer dumpOutput = TestCommon.dump(
-                                                            jar, dump_list, dump_setting,
+                                                            jar, dump_list, dump_arg1, dump_arg2,
                                                             CDS_LOGGING,
                                                             // FIXME: the following options are for working around a GC
                                                             // issue - assert failure when dumping archive with the -Xverify:all
@@ -198,8 +209,17 @@
                     dumpOutput.shouldContain(VFY_INFO_MESSAGE);
                 }
             }
+            String runtime_arg1;
+            String runtime_arg2;
+            if (runtime_setting.equals(VFY_NONE)) {
+                runtime_arg1 = "-XX:-BytecodeVerificationRemote";
+                runtime_arg2 = "-XX:-BytecodeVerificationLocal";
+            } else {
+                // Redundant args should be harmless.
+                runtime_arg1 = runtime_arg2 = runtime_setting;
+            }
             TestCommon.run("-cp", jar,
-                           runtime_setting,
+                           runtime_arg1, runtime_arg2,
                            "VerifierTest0")
                 .ifNoMappingFailure(output -> checkRuntimeOutput(output, expected_output_str));
             prev_dump_setting = dump_setting;
@@ -229,7 +249,7 @@
             {"app",   VFY_ALL,    VFY_REMOTE, PASS_RESULT },
             {"app",   VFY_ALL,    VFY_ALL,    PASS_RESULT },
             {"app",   VFY_ALL,    VFY_NONE,   PASS_RESULT },
-            // Dump app/ext with -Xverify:none
+            // Dump app/ext with verifier turned off
             {"app",   VFY_NONE,   VFY_REMOTE, PASS_RESULT},
             {"app",   VFY_NONE,   VFY_ALL,    MAP_FAIL},
             {"app",   VFY_NONE,   VFY_NONE,   PASS_RESULT },
@@ -244,8 +264,17 @@
                                " with " + dump_setting +
                                ", run with " + runtime_setting);
             if (!dump_setting.equals(prev_dump_setting)) {
+                String dump_arg1;
+                String dump_arg2;
+                if (dump_setting.equals(VFY_NONE)) {
+                    dump_arg1 = "-XX:-BytecodeVerificationRemote";
+                    dump_arg2 = "-XX:-BytecodeVerificationLocal";
+                } else {
+                    // Redundant args should be harmless.
+                    dump_arg1 = dump_arg2 = dump_setting;
+                }
                 OutputAnalyzer dumpOutput = TestCommon.dump(
-                                                            jar, appClasses, dump_setting,
+                                                            jar, appClasses, dump_arg1, dump_arg2,
                                                             CDS_LOGGING,
                                                             // FIXME: the following options are for working around a GC
                                                             // issue - assert failure when dumping archive with the -Xverify:all
@@ -256,8 +285,17 @@
                     dumpOutput.shouldContain(VFY_INFO_MESSAGE);
                 }
             }
+            String runtime_arg1;
+            String runtime_arg2;
+            if (runtime_setting.equals(VFY_NONE)) {
+                runtime_arg1 = "-XX:-BytecodeVerificationRemote";
+                runtime_arg2 = "-XX:-BytecodeVerificationLocal";
+            } else {
+                // Redundant args should be harmless.
+                runtime_arg1 = runtime_arg2 = runtime_setting;
+            }
             TestCommon.run("-cp", jar,
-                           runtime_setting,
+                           runtime_arg1, runtime_arg2,
                            "Hi")
                 .ifNoMappingFailure(output -> checkRuntimeOutput(output, expected_output_str));
            prev_dump_setting = dump_setting;
--- a/test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm	Wed Feb 20 09:43:01 2019 -0800
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm	Wed Feb 20 13:21:36 2019 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -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 -noverify HasLocalClone
+ * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal HasLocalClone
  */
 
 // The below .jasm code implements the following java code:
--- a/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm	Wed Feb 20 09:43:01 2019 -0800
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm	Wed Feb 20 13:21:36 2019 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -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 -noverify NoLocalClone
+ * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal NoLocalClone
  */
 
 // The below .jasm code implements the following java code:
--- a/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm	Wed Feb 20 09:43:01 2019 -0800
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm	Wed Feb 20 13:21:36 2019 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 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
@@ -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 -noverify NoLocalCloneAbstr
+ * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal NoLocalCloneAbstr
  */
 
 // The below .jasm code implements the following java code:
--- a/test/hotspot/jtreg/runtime/lambda-features/TestStaticandInstance.java	Wed Feb 20 09:43:01 2019 -0800
+++ b/test/hotspot/jtreg/runtime/lambda-features/TestStaticandInstance.java	Wed Feb 20 13:21:36 2019 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -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 -Xverify:none TestStaticandInstance
+ * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal TestStaticandInstance
  */
 
 
@@ -94,7 +94,7 @@
   default int q() { return 3; } // trigger defmeth processing: C gets AME overpass
 }
 
-// C gets static, private and AME overpass m()I with -Xverify:none
+// C gets static, private and AME overpass m()I with the verifier turned off
 class C implements I {
   static int m() { return 1;}  // javac with "n()" and patch to "m()"
   private int m() { return 2;} // javac with public and patch to private
--- a/test/jdk/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh	Wed Feb 20 09:43:01 2019 -0800
+++ b/test/jdk/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh	Wed Feb 20 13:21:36 2019 -0500
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -80,5 +80,5 @@
 
 # Finally we run the test
 (cd "${TESTCLASSES}"; \
-  $JAVA ${TESTVMOPTS} -Xverify:none -Xlog:class+unload \
+  $JAVA ${TESTVMOPTS} -Xlog:class+unload \
     -javaagent:ClassUnloadTest.jar ClassUnloadTest "${OTHERDIR}" Bar.jar)
--- a/test/langtools/tools/javac/lambda/MethodReference66.java	Wed Feb 20 09:43:01 2019 -0800
+++ b/test/langtools/tools/javac/lambda/MethodReference66.java	Wed Feb 20 13:21:36 2019 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 8009299
  * @summary Javac crashes when compiling method reference to static interface method
- * @run main/othervm -Xverify:none MethodReference66
+ * @run main/othervm MethodReference66
  */
 public class MethodReference66 {