提交 2cfc22cf 编写于 作者: I iignatyev

8039496: Add sanity tests on RTM-related command line options

Reviewed-by: kvn, iignatyev
Contributed-by: filipp.zhinkin@oracle.com
上级 153c42ff
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
import com.oracle.java.testlibrary.*;
import com.oracle.java.testlibrary.cli.*;
import java.util.function.BooleanSupplier;
/**
* Base for all RTM-related CLI tests.
*/
public abstract class RTMGenericCommandLineOptionTest
extends CommandLineOptionTest {
protected static final String RTM_INSTR_ERROR
= "RTM instructions are not available on this CPU";
protected static final String RTM_UNSUPPORTED_VM_ERROR
= "RTM locking optimization is not supported in this VM";
protected static final String RTM_ABORT_RATIO_WARNING
= "RTMAbortRatio must be in the range 0 to 100, resetting it to 50";
protected static final String RTM_FOR_STACK_LOCKS_WARNING
= "UseRTMForStackLocks flag should be off when UseRTMLocking "
+ "flag is off";
protected static final String RTM_COUNT_INCR_WARNING
= "RTMTotalCountIncrRate must be a power of 2, resetting it to 64";
protected static final String RTM_BIASED_LOCKING_WARNING
= "Biased locking is not supported with RTM locking; "
+ "ignoring UseBiasedLocking flag";
protected final String optionName;
protected final String errorMessage;
protected final String experimentalOptionError;
protected final boolean isExperimental;
protected final boolean isBoolean;
protected final String defaultValue;
protected final String[] optionValues;
/**
* Constructs new genetic RTM CLI test, for option {@code optionName} which
* has default value {@code defaultValue}. Test cases will use option's
* values passed via {@code optionValues} for verification of correct
* option processing.
*
* Test constructed using this ctor will be started on any cpu regardless
* it's architecture and supported/unsupported features.
*
* @param predicate predicate responsible for test's preconditions check
* @param optionName name of option to be tested
* @param isBoolean {@code true} if option is binary
* @param isExperimental {@code true} if option is experimental
* @param defaultValue default value of tested option
* @param optionValues different option values
*/
public RTMGenericCommandLineOptionTest(BooleanSupplier predicate,
String optionName, boolean isBoolean, boolean isExperimental,
String defaultValue, String... optionValues) {
super(predicate);
this.optionName = optionName;
this.isExperimental = isExperimental;
this.isBoolean = isBoolean;
this.defaultValue = defaultValue;
this.optionValues = optionValues;
this.errorMessage = CommandLineOptionTest.
getUnrecognizedOptionErrorMessage(optionName);
this.experimentalOptionError = CommandLineOptionTest.
getExperimentalOptionErrorMessage(optionName);
}
@Override
public void runTestCases() throws Throwable {
if (Platform.isX86() || Platform.isX64()) {
if (Platform.isServer() && !Platform.isEmbedded()) {
runX86SupportedVMTestCases();
} else {
runX86UnsupportedVMTestCases();
}
} else {
runNonX86TestCases();
}
}
/**
* Runs test cases on X86 CPU if VM supports RTM locking.
* @throws Throwable
*/
protected void runX86SupportedVMTestCases() throws Throwable {
runGenericX86TestCases();
}
/**
* Runs test cases on non-X86 CPU if VM does not support RTM locking.
* @throws Throwable
*/
protected void runX86UnsupportedVMTestCases() throws Throwable {
runGenericX86TestCases();
}
/**
* Runs test cases on non-X86 CPU.
* @throws Throwable
*/
protected void runNonX86TestCases() throws Throwable {
CommandLineOptionTest.verifySameJVMStartup(
new String[] { errorMessage }, null, ExitCode.FAIL,
prepareOptionValue(defaultValue));
}
/**
* Runs generic X86 test cases.
* @throws Throwable
*/
protected void runGenericX86TestCases() throws Throwable {
verifyJVMStartup();
verifyOptionValues();
}
protected void verifyJVMStartup() throws Throwable {
String optionValue = prepareOptionValue(defaultValue);
if (isExperimental) {
// verify that option is experimental
CommandLineOptionTest.verifySameJVMStartup(
new String[] { experimentalOptionError },
new String[] { errorMessage }, ExitCode.FAIL,
optionValue);
// verify that it could be passed if experimental options
// are unlocked
CommandLineOptionTest.verifySameJVMStartup(null,
new String[] {
experimentalOptionError,
errorMessage
},
ExitCode.OK,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
optionValue);
} else {
// verify that option could be passed
CommandLineOptionTest.verifySameJVMStartup(null,
new String[]{errorMessage}, ExitCode.OK, optionValue);
}
}
protected void verifyOptionValues() throws Throwable {
// verify default value
if (isExperimental) {
CommandLineOptionTest.verifyOptionValueForSameVM(optionName,
defaultValue,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS);
} else {
CommandLineOptionTest.verifyOptionValueForSameVM(optionName,
defaultValue);
}
// verify other specified option values
if (optionValues == null) {
return;
}
for (String value : optionValues) {
if (isExperimental) {
CommandLineOptionTest.verifyOptionValueForSameVM(optionName,
value,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
prepareOptionValue(value));
} else {
CommandLineOptionTest.verifyOptionValueForSameVM(optionName,
value, prepareOptionValue(value));
}
}
}
protected String prepareOptionValue(String value) {
if (isBoolean) {
return CommandLineOptionTest.prepareBooleanFlag(optionName,
Boolean.valueOf(value));
} else {
return String.format("-XX:%s=%s", optionName, value);
}
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
import java.util.Collections;
import java.util.List;
import java.util.LinkedList;
import com.oracle.java.testlibrary.ExitCode;
import com.oracle.java.testlibrary.cli.*;
import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
import rtm.predicate.SupportedCPU;
import rtm.predicate.SupportedVM;
/**
* Base for all RTM-related CLI tests on options whose processing depends
* on UseRTMLocking value.
*
* Since UseRTMLocking option could be used when both CPU and VM supports RTM
* locking, this test will be skipped on all unsupported configurations.
*/
public abstract class RTMLockingAwareTest
extends RTMGenericCommandLineOptionTest {
protected final String warningMessage;
protected final String[] correctValues;
protected final String[] incorrectValues;
/**
* Constructs new test for option {@code optionName} that should be executed
* only on CPU with RTM support.
* Test will be executed using set of correct values from
* {@code correctValues} and set of incorrect values from
* {@code incorrectValues}.
*
* @param optionName name of option to be tested
* @param isBoolean {@code true} if tested option is binary
* @param isExperimental {@code true} if tested option is experimental
* @param defaultValue default value of tested option
* @param correctValues array with correct values, that should not emit
* {@code warningMessage} to VM output
* @param incorrectValues array with incorrect values, that should emit
* {@code waningMessage} to VM output
* @param warningMessage warning message associated with tested option
*/
protected RTMLockingAwareTest(String optionName, boolean isBoolean,
boolean isExperimental, String defaultValue,
String[] correctValues, String[] incorrectValues,
String warningMessage) {
super(new AndPredicate(new SupportedCPU(), new SupportedVM()),
optionName, isBoolean, isExperimental, defaultValue);
this.correctValues = correctValues;
this.incorrectValues = incorrectValues;
this.warningMessage = warningMessage;
}
@Override
protected void verifyJVMStartup() throws Throwable {
// Run generic sanity checks
super.verifyJVMStartup();
// Verify how option values will be processed depending on
// UseRTMLocking value.
if (correctValues != null) {
for (String correctValue : correctValues) {
// For correct values it is expected to see no warnings
// regardless to UseRTMLocking
verifyStartupWarning(correctValue, true, false);
verifyStartupWarning(correctValue, false, false);
}
}
if (incorrectValues != null) {
for (String incorrectValue : incorrectValues) {
// For incorrect values it is expected to see warning
// only with -XX:+UseRTMLocking
verifyStartupWarning(incorrectValue, true, true);
verifyStartupWarning(incorrectValue, false, false);
}
}
}
@Override
protected void verifyOptionValues() throws Throwable {
super.verifyOptionValues();
// Verify how option values will be setup after processing
// depending on UseRTMLocking value
if (correctValues != null) {
for (String correctValue : correctValues) {
// Correct value could be set up regardless to UseRTMLocking
verifyOptionValues(correctValue, false, correctValue);
verifyOptionValues(correctValue, true, correctValue);
}
}
if (incorrectValues != null) {
for (String incorrectValue : incorrectValues) {
// With -XX:+UseRTMLocking, incorrect value will be changed to
// default value.
verifyOptionValues(incorrectValue, false, incorrectValue);
verifyOptionValues(incorrectValue, true, defaultValue);
}
}
}
private void verifyStartupWarning(String value, boolean useRTMLocking,
boolean isWarningExpected) throws Throwable {
String warnings[] = new String[] { warningMessage };
List<String> options = new LinkedList<>();
Collections.addAll(options,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
CommandLineOptionTest.prepareBooleanFlag("UseRTMLocking",
useRTMLocking));
options.add(prepareOptionValue(value));
CommandLineOptionTest.verifySameJVMStartup(
(isWarningExpected ? warnings : null),
(isWarningExpected ? null : warnings),
ExitCode.OK, options.toArray(new String[options.size()]));
}
private void verifyOptionValues(String value, boolean useRTMLocking,
String expectedValue) throws Throwable {
List<String> options = new LinkedList<>();
Collections.addAll(options,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
CommandLineOptionTest.prepareBooleanFlag("UseRTMLocking",
useRTMLocking));
options.add(prepareOptionValue(value));
CommandLineOptionTest.verifyOptionValueForSameVM(optionName,
expectedValue, options.toArray(new String[options.size()]));
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
import com.oracle.java.testlibrary.*;
import com.oracle.java.testlibrary.cli.*;
import java.util.function.BooleanSupplier;
public abstract class TestPrintPreciseRTMLockingStatisticsBase
extends RTMGenericCommandLineOptionTest {
protected static final String DEFAULT_VALUE = "false";
protected TestPrintPreciseRTMLockingStatisticsBase(
BooleanSupplier predicate) {
super(predicate, "PrintPreciseRTMLockingStatistics", true, false,
TestPrintPreciseRTMLockingStatisticsBase.DEFAULT_VALUE);
}
@Override
protected void runNonX86TestCases() throws Throwable {
verifyJVMStartup();
verifyOptionValues();
}
@Override
protected void verifyJVMStartup() throws Throwable {
if (Platform.isServer()) {
if (!Platform.isDebugBuild()) {
String errorMessage = CommandLineOptionTest.
getDiagnosticOptionErrorMessage(optionName);
// verify that option is actually diagnostic
CommandLineOptionTest.verifySameJVMStartup(
new String[] { errorMessage }, null, ExitCode.FAIL,
prepareOptionValue("true"));
CommandLineOptionTest.verifySameJVMStartup(null,
new String[] { errorMessage }, ExitCode.OK,
CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS,
prepareOptionValue("true"));
} else {
CommandLineOptionTest.verifySameJVMStartup(
null, null, ExitCode.OK, prepareOptionValue("true"));
}
} else {
String errorMessage = CommandLineOptionTest.
getUnrecognizedOptionErrorMessage(optionName);
CommandLineOptionTest.verifySameJVMStartup(
new String[]{errorMessage}, null, ExitCode.FAIL,
CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS,
prepareOptionValue("true"));
}
}
@Override
protected void verifyOptionValues() throws Throwable {
if (Platform.isServer()) {
// Verify default value
CommandLineOptionTest.verifyOptionValueForSameVM(optionName,
TestPrintPreciseRTMLockingStatisticsBase.DEFAULT_VALUE,
CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS);
}
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8031320
* @summary Verify PrintPreciseRTMLockingStatistics on CPUs with
* rtm support and on VM with rtm locking support,
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary
* @build TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig
*/
import com.oracle.java.testlibrary.cli.*;
import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
import rtm.predicate.SupportedCPU;
import rtm.predicate.SupportedVM;
public class TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig
extends TestPrintPreciseRTMLockingStatisticsBase {
private TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig() {
super(new AndPredicate(new SupportedVM(), new SupportedCPU()));
}
@Override
protected void verifyOptionValues() throws Throwable {
super.verifyOptionValues();
// verify default value
CommandLineOptionTest.verifyOptionValueForSameVM(optionName,
TestPrintPreciseRTMLockingStatisticsBase.DEFAULT_VALUE,
CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMLocking");
CommandLineOptionTest.verifyOptionValueForSameVM(optionName,
TestPrintPreciseRTMLockingStatisticsBase.DEFAULT_VALUE,
CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:-UseRTMLocking", prepareOptionValue("true"));
// verify that option could be turned on
CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "true",
CommandLineOptionTest.UNLOCK_DIAGNOSTIC_VM_OPTIONS,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMLocking", prepareOptionValue("true"));
}
public static void main(String args[]) throws Throwable {
new TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig()
.test();
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8031320
* @summary Verify PrintPreciseRTMLockingStatistics on CPUs without
* rtm support and/or unsupported VM.
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary
* @build TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig
*/
import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
import com.oracle.java.testlibrary.cli.predicate.NotPredicate;
import rtm.predicate.SupportedCPU;
import rtm.predicate.SupportedVM;
public class TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig
extends TestPrintPreciseRTMLockingStatisticsBase {
private TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig() {
super(new NotPredicate(new AndPredicate(new SupportedCPU(),
new SupportedVM())));
}
public static void main(String args[]) throws Throwable {
new TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig()
.test();
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8031320
* @summary Verify RTMAbortRatio option processing on CPU with rtm
* support and on VM with rtm locking support.
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary
* @build TestRTMAbortRatioOptionOnSupportedConfig
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestRTMAbortRatioOptionOnSupportedConfig
*/
public class TestRTMAbortRatioOptionOnSupportedConfig
extends RTMLockingAwareTest {
private static final String DEFAULT_VALUE = "50";
private TestRTMAbortRatioOptionOnSupportedConfig() {
super("RTMAbortRatio", false, true,
TestRTMAbortRatioOptionOnSupportedConfig.DEFAULT_VALUE,
/* correct values */
new String[] { "0", "20", "100" },
/* incorrect values */
new String[] { "-1", "101" },
RTMGenericCommandLineOptionTest.RTM_ABORT_RATIO_WARNING);
}
public static void main(String args[]) throws Throwable {
new TestRTMAbortRatioOptionOnSupportedConfig().test();
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8031320
* @summary Verify RTMAbortRatio option processing on CPU without rtm
* support or on VM that does not support rtm locking.
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary
* @build TestRTMAbortRatioOptionOnUnsupportedConfig
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestRTMAbortRatioOptionOnUnsupportedConfig
*/
import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
import com.oracle.java.testlibrary.cli.predicate.NotPredicate;
import rtm.predicate.SupportedCPU;
import rtm.predicate.SupportedVM;
public class TestRTMAbortRatioOptionOnUnsupportedConfig
extends RTMGenericCommandLineOptionTest {
private static final String DEFAULT_VALUE = "50";
private TestRTMAbortRatioOptionOnUnsupportedConfig() {
super(new NotPredicate(new AndPredicate(new SupportedVM(),
new SupportedCPU())),
"RTMAbortRatio", false, true,
TestRTMAbortRatioOptionOnUnsupportedConfig.DEFAULT_VALUE,
"0", "10", "100", "200");
}
public static void main(String args[]) throws Throwable {
new TestRTMAbortRatioOptionOnUnsupportedConfig().test();
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8031320
* @summary Verify processing of RTMAbortThreshold option.
* @library /testlibrary
* @build TestRTMAbortThresholdOption
* @run main/othervm TestRTMAbortThresholdOption
*/
public class TestRTMAbortThresholdOption
extends RTMGenericCommandLineOptionTest {
private static final String DEFAULT_VALUE = "1000";
private TestRTMAbortThresholdOption() {
super(Boolean.TRUE::booleanValue, "RTMAbortThreshold", false, true,
TestRTMAbortThresholdOption.DEFAULT_VALUE,
"0", "42", "100", "10000");
}
public static void main(String args[]) throws Throwable {
new TestRTMAbortThresholdOption().test();
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8031320
* @summary Verify processing of RTMLockingCalculationDelay option.
* @library /testlibrary
* @build TestRTMLockingCalculationDelayOption
* @run main/othervm TestRTMLockingCalculationDelayOption
*/
public class TestRTMLockingCalculationDelayOption
extends RTMGenericCommandLineOptionTest {
private static final String DEFAULT_VALUE = "0";
private TestRTMLockingCalculationDelayOption() {
super(Boolean.TRUE::booleanValue, "RTMLockingCalculationDelay", false,
true, TestRTMLockingCalculationDelayOption.DEFAULT_VALUE);
}
public static void main(String agrs[]) throws Throwable {
new TestRTMLockingCalculationDelayOption().test();
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8031320
* @summary Verify processing of RTMLockingThreshold option.
* @library /testlibrary
* @build TestRTMLockingThresholdOption
* @run main/othervm TestRTMLockingThresholdOption
*/
public class TestRTMLockingThresholdOption
extends RTMGenericCommandLineOptionTest {
private static final String DEFAULT_VALUE = "10000";
private TestRTMLockingThresholdOption() {
super(Boolean.TRUE::booleanValue, "RTMLockingThreshold", false, true,
TestRTMLockingThresholdOption.DEFAULT_VALUE);
}
public static void main(String args[]) throws Throwable {
new TestRTMLockingThresholdOption().test();
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8031320
* @summary Verify processing of RTMSpinLoopCount option.
* @library /testlibrary
* @build TestRTMSpinLoopCountOption
* @run main/othervm TestRTMSpinLoopCountOption
*/
public class TestRTMSpinLoopCountOption
extends RTMGenericCommandLineOptionTest {
private static final String DEFAULT_VALUE = "100";
private TestRTMSpinLoopCountOption() {
super(Boolean.TRUE::booleanValue, "RTMSpinLoopCount", false, true,
TestRTMSpinLoopCountOption.DEFAULT_VALUE,
"0", "10", "42", "1000");
}
public static void main(String args[]) throws Throwable {
new TestRTMSpinLoopCountOption().test();
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8031320
* @summary Verify RTMTotalCountIncrRate option processing on CPU with
* rtm support and on VM with rtm locking support.
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary
* @build TestRTMTotalCountIncrRateOptionOnSupportedConfig
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestRTMTotalCountIncrRateOptionOnSupportedConfig
*/
public class TestRTMTotalCountIncrRateOptionOnSupportedConfig
extends RTMLockingAwareTest {
private static final String DEFAULT_VALUE = "64";
private TestRTMTotalCountIncrRateOptionOnSupportedConfig() {
super("RTMTotalCountIncrRate", false, true,
TestRTMTotalCountIncrRateOptionOnSupportedConfig.DEFAULT_VALUE,
/* correct values */
new String[] { "1", "2", "128", "1024" },
/* incorrect values */
new String[] { "-1", "0", "3", "42" },
RTMGenericCommandLineOptionTest.RTM_COUNT_INCR_WARNING);
}
public static void main(String args[]) throws Throwable {
new TestRTMTotalCountIncrRateOptionOnSupportedConfig().test();
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
import com.oracle.java.testlibrary.cli.predicate.NotPredicate;
import rtm.predicate.SupportedCPU;
import rtm.predicate.SupportedVM;
/**
* @test
* @bug 8031320
* @summary Verify RTMTotalCountIncrRate option processing on CPU without
* rtm support and/or on VM without rtm locking support.
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary
* @build TestRTMTotalCountIncrRateOptionOnUnsupportedConfig
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestRTMTotalCountIncrRateOptionOnUnsupportedConfig
*/
public class TestRTMTotalCountIncrRateOptionOnUnsupportedConfig
extends RTMGenericCommandLineOptionTest {
private static final String DEFAULT_VALUE = "64";
private TestRTMTotalCountIncrRateOptionOnUnsupportedConfig() {
super(new NotPredicate(new AndPredicate(new SupportedCPU(),
new SupportedVM())),
"RTMTotalCountIncrRate", false, true,
TestRTMTotalCountIncrRateOptionOnUnsupportedConfig
.DEFAULT_VALUE,
"-1", "0", "42", "128");
}
public static void main(String args[]) throws Throwable {
new TestRTMTotalCountIncrRateOptionOnUnsupportedConfig().test();
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8031320
* @summary Verify UseRTMDeopt option processing on CPUs with rtm support
* when rtm locking is supported by VM.
* @library /testlibrary /testlibrary/whitebox
* @build TestUseRTMDeoptOptionOnSupportedConfig
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseRTMDeoptOptionOnSupportedConfig
*/
import com.oracle.java.testlibrary.ExitCode;
import com.oracle.java.testlibrary.cli.CommandLineOptionTest;
import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
import rtm.predicate.SupportedCPU;
import rtm.predicate.SupportedVM;
public class TestUseRTMDeoptOptionOnSupportedConfig
extends CommandLineOptionTest {
private static final String DEFAULT_VALUE = "false";
private TestUseRTMDeoptOptionOnSupportedConfig() {
super(new AndPredicate(new SupportedVM(), new SupportedCPU()));
}
@Override
public void runTestCases() throws Throwable {
String experimentalOptionError
= CommandLineOptionTest.getExperimentalOptionErrorMessage(
"UseRTMDeopt");
// verify that option is experimental
CommandLineOptionTest.verifySameJVMStartup(
new String[] { experimentalOptionError }, null, ExitCode.FAIL,
"-XX:+UseRTMDeopt");
// verify that option could be turned on
CommandLineOptionTest.verifySameJVMStartup(null, null, ExitCode.OK,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMDeopt");
// verify that option could be turned off
CommandLineOptionTest.verifySameJVMStartup(null, null, ExitCode.OK,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:-UseRTMDeopt");
// verify default value
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt",
TestUseRTMDeoptOptionOnSupportedConfig.DEFAULT_VALUE,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS);
// verify default value
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt",
TestUseRTMDeoptOptionOnSupportedConfig.DEFAULT_VALUE,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMLocking");
// verify that option is off when UseRTMLocking is off
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt", "false",
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:-UseRTMLocking", "-XX:+UseRTMDeopt");
// verify that option could be turned on
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt", "true",
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMLocking", "-XX:+UseRTMDeopt");
}
public static void main(String args[]) throws Throwable {
new TestUseRTMDeoptOptionOnSupportedConfig().test();
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8031320
* @summary Verify UseRTMDeopt option processing on CPUs without rtm support
* or on VMs without rtm locking support.
* @library /testlibrary /testlibrary/whitebox
* @build TestUseRTMDeoptOptionOnUnsupportedConfig
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseRTMDeoptOptionOnUnsupportedConfig
*/
import com.oracle.java.testlibrary.cli.CommandLineOptionTest;
import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
import com.oracle.java.testlibrary.cli.predicate.NotPredicate;
import rtm.predicate.SupportedCPU;
import rtm.predicate.SupportedVM;
public class TestUseRTMDeoptOptionOnUnsupportedConfig
extends RTMGenericCommandLineOptionTest {
private static final String DEFAULT_VALUE = "false";
private TestUseRTMDeoptOptionOnUnsupportedConfig() {
super(new NotPredicate(new AndPredicate(new SupportedCPU(),
new SupportedVM())),
"UseRTMDeopt", true, true,
TestUseRTMDeoptOptionOnUnsupportedConfig.DEFAULT_VALUE, "true");
}
@Override
protected void runX86SupportedVMTestCases() throws Throwable {
super.verifyJVMStartup();
// verify default value
CommandLineOptionTest.verifyOptionValueForSameVM(optionName,
defaultValue,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS);
// verify that until RTMLocking is not used, value
// will be set to default false.
CommandLineOptionTest.verifyOptionValueForSameVM(optionName,
defaultValue,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMDeopt");
}
public static void main(String args[]) throws Throwable {
new TestUseRTMDeoptOptionOnUnsupportedConfig().test();
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8031320
* @summary Verify UseRTMForStackLocks option processing on CPU with
* rtm support when VM supports rtm locking.
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary
* @build TestUseRTMForStackLocksOptionOnSupportedConfig
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestUseRTMForStackLocksOptionOnSupportedConfig
*/
import com.oracle.java.testlibrary.*;
import com.oracle.java.testlibrary.cli.*;
import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
import rtm.predicate.SupportedCPU;
import rtm.predicate.SupportedVM;
public class TestUseRTMForStackLocksOptionOnSupportedConfig
extends CommandLineOptionTest {
private static final String DEFAULT_VALUE = "false";
private TestUseRTMForStackLocksOptionOnSupportedConfig() {
super(new AndPredicate(new SupportedVM(), new SupportedCPU()));
}
@Override
public void runTestCases() throws Throwable {
String errorMessage
= CommandLineOptionTest.getExperimentalOptionErrorMessage(
"UseRTMForStackLocks");
String warningMessage
= RTMGenericCommandLineOptionTest.RTM_FOR_STACK_LOCKS_WARNING;
CommandLineOptionTest.verifySameJVMStartup(
new String[] { errorMessage }, null, ExitCode.FAIL,
"-XX:+UseRTMForStackLocks");
// verify that we get a warning when trying to use rtm for stack
// lock, but not using rtm locking.
CommandLineOptionTest.verifySameJVMStartup(
new String[] { warningMessage }, null, ExitCode.OK,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMForStackLocks",
"-XX:-UseRTMLocking");
// verify that we don't get a warning when no using rtm for stack
// lock and not using rtm locking.
CommandLineOptionTest.verifySameJVMStartup(null,
new String[] { warningMessage }, ExitCode.OK,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:-UseRTMForStackLocks",
"-XX:-UseRTMLocking");
// verify that we don't get a warning when using rtm for stack
// lock and using rtm locking.
CommandLineOptionTest.verifySameJVMStartup(null,
new String[] { warningMessage }, ExitCode.OK,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMForStackLocks",
"-XX:+UseRTMLocking");
// verify that default value if false
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMForStackLocks",
TestUseRTMForStackLocksOptionOnSupportedConfig.DEFAULT_VALUE,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS);
// verify that default value is false even with +UseRTMLocking
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMForStackLocks",
TestUseRTMForStackLocksOptionOnSupportedConfig.DEFAULT_VALUE,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMLocking");
// verify that we can turn the option on
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMForStackLocks",
"true", CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMLocking", "-XX:+UseRTMForStackLocks");
}
public static void main(String args[]) throws Throwable {
new TestUseRTMForStackLocksOptionOnSupportedConfig().test();
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8031320
* @summary Verify UseRTMForStackLocks option processing on CPUs without
* rtm support and/or on VMs without rtm locking support.
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary
* @build TestUseRTMForStackLocksOptionOnUnsupportedConfig
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* TestUseRTMForStackLocksOptionOnUnsupportedConfig
*/
import com.oracle.java.testlibrary.ExitCode;
import com.oracle.java.testlibrary.cli.CommandLineOptionTest;
import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
import com.oracle.java.testlibrary.cli.predicate.NotPredicate;
import rtm.predicate.SupportedCPU;
import rtm.predicate.SupportedVM;
public class TestUseRTMForStackLocksOptionOnUnsupportedConfig
extends RTMGenericCommandLineOptionTest {
private static final String DEFAULT_VALUE = "false";
private TestUseRTMForStackLocksOptionOnUnsupportedConfig() {
super(new NotPredicate(new AndPredicate(new SupportedCPU(),
new SupportedVM())),
"UseRTMForStackLocks", true, true,
TestUseRTMForStackLocksOptionOnUnsupportedConfig.DEFAULT_VALUE,
"true");
}
@Override
protected void runX86SupportedVMTestCases() throws Throwable {
// verify that option is experimental
CommandLineOptionTest.verifySameJVMStartup(
new String[]{ experimentalOptionError },
null, ExitCode.FAIL, prepareOptionValue("true"));
CommandLineOptionTest.verifySameJVMStartup(
new String[]{ experimentalOptionError },
null, ExitCode.FAIL, prepareOptionValue("false"));
// verify that if we turn it on, then VM output will contain
// warning saying that this option could be turned on only
// when we use rtm locking
CommandLineOptionTest.verifySameJVMStartup(
new String[]{
RTMGenericCommandLineOptionTest.RTM_FOR_STACK_LOCKS_WARNING
},
null, ExitCode.OK,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
prepareOptionValue("true")
);
// verify that options is turned off by default
CommandLineOptionTest.verifyOptionValueForSameVM(optionName,
TestUseRTMForStackLocksOptionOnUnsupportedConfig.DEFAULT_VALUE,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS);
// verify that it could not be turned on without rtm locking
CommandLineOptionTest.verifyOptionValueForSameVM(optionName,
TestUseRTMForStackLocksOptionOnUnsupportedConfig.DEFAULT_VALUE,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
prepareOptionValue("true"));
}
public static void main(String args[]) throws Throwable {
new TestUseRTMForStackLocksOptionOnUnsupportedConfig().test();
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8031320
* @summary Verify UseRTMLocking option processing on CPU with rtm support and
* on VM with rtm-locking support.
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary
* @build TestUseRTMLockingOptionOnSupportedConfig
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseRTMLockingOptionOnSupportedConfig
*/
import com.oracle.java.testlibrary.ExitCode;
import com.oracle.java.testlibrary.cli.*;
import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
import rtm.predicate.SupportedCPU;
import rtm.predicate.SupportedVM;
public class TestUseRTMLockingOptionOnSupportedConfig
extends CommandLineOptionTest {
private static final String DEFAULT_VALUE = "false";
private TestUseRTMLockingOptionOnSupportedConfig() {
super(new AndPredicate(new SupportedVM(), new SupportedCPU()));
}
@Override
public void runTestCases() throws Throwable {
String unrecongnizedOption
= CommandLineOptionTest.getUnrecognizedOptionErrorMessage(
"UseRTMLocking");
String experimentalOptionError
= CommandLineOptionTest.getExperimentalOptionErrorMessage(
"UseRTMLocking");
// verify that options is experimental
CommandLineOptionTest.verifySameJVMStartup(
new String[] { experimentalOptionError }, null, ExitCode.FAIL,
"-XX:+UseRTMLocking");
// verify that there are no warning or error in VM output
CommandLineOptionTest.verifySameJVMStartup(null,
new String[]{
RTMGenericCommandLineOptionTest.RTM_INSTR_ERROR,
unrecongnizedOption
}, ExitCode.OK,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMLocking");
CommandLineOptionTest.verifySameJVMStartup(null,
new String[]{
RTMGenericCommandLineOptionTest.RTM_INSTR_ERROR,
unrecongnizedOption
}, ExitCode.OK,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:-UseRTMLocking");
// verify that UseRTMLocking is of by default
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking",
TestUseRTMLockingOptionOnSupportedConfig.DEFAULT_VALUE,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS);
// verify that we can change UseRTMLocking value
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking",
TestUseRTMLockingOptionOnSupportedConfig.DEFAULT_VALUE,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:-UseRTMLocking");
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking",
"true", CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMLocking");
}
public static void main(String args[]) throws Throwable {
new TestUseRTMLockingOptionOnSupportedConfig().test();
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8031320
* @summary Verify UseRTMLocking option processing on CPU without
* rtm support.
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary
* @build TestUseRTMLockingOptionOnUnsupportedCPU
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseRTMLockingOptionOnUnsupportedCPU
*/
import com.oracle.java.testlibrary.*;
import com.oracle.java.testlibrary.cli.*;
import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
import com.oracle.java.testlibrary.cli.predicate.NotPredicate;
import rtm.predicate.SupportedCPU;
import rtm.predicate.SupportedVM;
public class TestUseRTMLockingOptionOnUnsupportedCPU
extends CommandLineOptionTest {
private static final String DEFAULT_VALUE = "false";
private TestUseRTMLockingOptionOnUnsupportedCPU() {
super(new AndPredicate(new NotPredicate(new SupportedCPU()),
new SupportedVM()));
}
@Override
public void runTestCases() throws Throwable {
String unrecongnizedOption
= CommandLineOptionTest.getUnrecognizedOptionErrorMessage(
"UseRTMLocking");
String errorMessage = RTMGenericCommandLineOptionTest.RTM_INSTR_ERROR;
if (Platform.isX86() || Platform.isX64()) {
// verify that we get an error when use +UseRTMLocking
// on unsupported CPU
CommandLineOptionTest.verifySameJVMStartup(
new String[] { errorMessage },
new String[] { unrecongnizedOption },
ExitCode.FAIL,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMLocking");
// verify that we can pass -UseRTMLocking without
// getting any error messages
CommandLineOptionTest.verifySameJVMStartup(
null,
new String[]{
errorMessage,
unrecongnizedOption
}, ExitCode.OK,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:-UseRTMLocking");
// verify that UseRTMLocking is false by default
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking",
TestUseRTMLockingOptionOnUnsupportedCPU.DEFAULT_VALUE,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS);
} else {
// verify that on non-x86 CPUs RTMLocking could not be used
CommandLineOptionTest.verifySameJVMStartup(
new String[] { unrecongnizedOption },
null, ExitCode.FAIL,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMLocking");
CommandLineOptionTest.verifySameJVMStartup(
new String[] { unrecongnizedOption },
null, ExitCode.FAIL,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:-UseRTMLocking");
}
}
public static void main(String args[]) throws Throwable {
new TestUseRTMLockingOptionOnUnsupportedCPU().test();
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8031320
* @summary Verify UseRTMLocking option processing on CPU with rtm support
* in case when VM should not support this option.
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary
* @build TestUseRTMLockingOptionOnUnsupportedVM
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseRTMLockingOptionOnUnsupportedVM
*/
import com.oracle.java.testlibrary.ExitCode;
import com.oracle.java.testlibrary.cli.*;
import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
import com.oracle.java.testlibrary.cli.predicate.NotPredicate;
import rtm.predicate.SupportedCPU;
import rtm.predicate.SupportedVM;
public class TestUseRTMLockingOptionOnUnsupportedVM
extends CommandLineOptionTest {
private static final String DEFAULT_VALUE = "false";
private TestUseRTMLockingOptionOnUnsupportedVM() {
super(new AndPredicate(new SupportedCPU(),
new NotPredicate(new SupportedVM())));
}
@Override
public void runTestCases() throws Throwable {
String errorMessage
= RTMGenericCommandLineOptionTest.RTM_UNSUPPORTED_VM_ERROR;
String experimentalOptionError
= CommandLineOptionTest.getExperimentalOptionErrorMessage(
"UseRTMLocking");
// verify that options is experimental
CommandLineOptionTest.verifySameJVMStartup(
new String[] { experimentalOptionError }, null, ExitCode.FAIL,
"-XX:+UseRTMLocking");
// verify that we can't use +UseRTMLocking
CommandLineOptionTest.verifySameJVMStartup(
new String[] { errorMessage }, null, ExitCode.FAIL,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMLocking");
// verify that we can turn it off
CommandLineOptionTest.verifySameJVMStartup(null,
new String[] { errorMessage }, ExitCode.OK,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:-UseRTMLocking");
// verify that it is off by default
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking",
TestUseRTMLockingOptionOnUnsupportedVM.DEFAULT_VALUE);
}
public static void main(String args[]) throws Throwable {
new TestUseRTMLockingOptionOnUnsupportedVM().test();
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8031320
* @summary Verify processing of UseRTMLocking and UseBiasedLocking
* options combination on CPU and VM with rtm support.
* @library /testlibrary /testlibrary/whitebox /compiler/testlibrary
* @build TestUseRTMLockingOptionWithBiasedLocking
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI TestUseRTMLockingOptionWithBiasedLocking
*/
import com.oracle.java.testlibrary.*;
import com.oracle.java.testlibrary.cli.*;
import com.oracle.java.testlibrary.cli.predicate.AndPredicate;
import rtm.predicate.SupportedCPU;
import rtm.predicate.SupportedVM;
public class TestUseRTMLockingOptionWithBiasedLocking
extends CommandLineOptionTest {
private TestUseRTMLockingOptionWithBiasedLocking() {
super(new AndPredicate(new SupportedCPU(), new SupportedVM()));
}
@Override
public void runTestCases() throws Throwable {
String warningMessage
= RTMGenericCommandLineOptionTest.RTM_BIASED_LOCKING_WARNING;
// verify that we will not get a warning
CommandLineOptionTest.verifySameJVMStartup(null,
new String[] { warningMessage }, ExitCode.OK,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMLocking", "-XX:-UseBiasedLocking");
// verify that we will get a warning
CommandLineOptionTest.verifySameJVMStartup(
new String[] { warningMessage }, null, ExitCode.OK,
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMLocking", "-XX:+UseBiasedLocking");
// verify that UseBiasedLocking is false when we use rtm locking
CommandLineOptionTest.verifyOptionValueForSameVM("UseBiasedLocking",
"false", CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMLocking");
// verify that we can't turn on biased locking when
// using rtm locking
CommandLineOptionTest.verifyOptionValueForSameVM("UseBiasedLocking",
"false", CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
"-XX:+UseRTMLocking", "-XX:+UseBiasedLocking");
}
public static void main(String args[]) throws Throwable {
new TestUseRTMLockingOptionWithBiasedLocking().test();
}
}
/*
* Copyright (c) 2014, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8031320
* @summary Verify processing of UseRTMXendForLockBusy option.
* @library /testlibrary
* @build TestUseRTMXendForLockBusyOption
* @run main/othervm TestUseRTMXendForLockBusyOption
*/
public class TestUseRTMXendForLockBusyOption
extends RTMGenericCommandLineOptionTest {
private static final String DEFAULT_VALUE = "true";
public TestUseRTMXendForLockBusyOption() {
super(Boolean.TRUE::booleanValue, "UseRTMXendForLockBusy", true, true,
TestUseRTMXendForLockBusyOption.DEFAULT_VALUE, "true");
}
public static void main(String agrs[]) throws Throwable {
new TestUseRTMXendForLockBusyOption().test();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册