8221685: -XX:BytecodeVerificationRemote and -XX:BytecodeVerificationLocal should be diagnostic options

Make the options diagnostic and add -XX:+UnlockDiagnosticVMOptions to tests where needed.

Reviewed-by: lfoltan, acorn, dholmes
This commit is contained in:
Harold Seigel 2019-04-24 08:27:00 -04:00
parent b440ac2586
commit ef40115621
10 changed files with 37 additions and 28 deletions

View File

@ -545,10 +545,10 @@ define_pd_global(uint64_t,MaxRAM, 1ULL*G);
"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, \

View File

@ -42,7 +42,8 @@ public class TestLinkageErrorInGenerateOopMap {
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*",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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
*/

View File

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

View File

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