8214719: Deprecate -Xverify:none option

Deprecate -Xverify:none and -noverify and remove them from tests

Reviewed-by: dholmes, mikael
This commit is contained in:
Harold Seigel 2019-02-20 13:21:36 -05:00
parent ea42bbcd24
commit dd7e50dc01
12 changed files with 70 additions and 29 deletions
src
hotspot/share
jdk.jdi/share/classes/com/sun/tools/example/debug/tty
test
hotspot/jtreg
jdk/java/lang/instrument/appendToClassLoaderSearch
langtools/tools/javac/lambda

@ -49,7 +49,7 @@ class Verifier : AllStatic {
// 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.

@ -555,13 +555,13 @@ static SpecialFlag const special_jvm_flags[] = {
{ "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 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
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;
}

@ -931,7 +931,7 @@ public class TTY implements EventNotifier {
// 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") ||

@ -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 class TestLinkageErrorInGenerateOopMap {
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);

@ -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 {

@ -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 @@ public class VerifierTest implements Opcodes {
// 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 @@ public class VerifierTest implements Opcodes {
{"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 @@ public class VerifierTest implements Opcodes {
{"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 @@ public class VerifierTest implements Opcodes {
" 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 @@ public class VerifierTest implements Opcodes {
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 @@ public class VerifierTest implements Opcodes {
{"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 @@ public class VerifierTest implements Opcodes {
" 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 @@ public class VerifierTest implements Opcodes {
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;

@ -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:

@ -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:

@ -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:

@ -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 @@ interface I {
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

@ -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 @@ $JAR ${TESTTOOLVMOPTS} -cfm "${TESTCLASSES}"/ClassUnloadTest.jar "${MANIFEST}" \
# 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)

@ -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 {