Path: blob/master/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java
41152 views
/*1* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* @test25* @bug 803132026* @summary Verify UseRTMDeopt option processing on CPUs with rtm support27* when rtm locking is supported by VM.28* @library /test/lib /29* @modules java.base/jdk.internal.misc30* java.management31* @requires vm.flagless32* @requires vm.rtm.cpu & vm.rtm.compiler33* @run driver compiler.rtm.cli.TestUseRTMDeoptOptionOnSupportedConfig34*/3536package compiler.rtm.cli;3738import jdk.test.lib.process.ExitCode;39import jdk.test.lib.cli.CommandLineOptionTest;4041public class TestUseRTMDeoptOptionOnSupportedConfig {42private static final String DEFAULT_VALUE = "false";4344public void runTestCases() throws Throwable {45String shouldPassMessage = " JVM should startup with option '"46+ "-XX:+UseRTMDeopt' without any warnings";47// verify that option could be turned on48CommandLineOptionTest.verifySameJVMStartup(49null, null, shouldPassMessage, shouldPassMessage, ExitCode.OK,50"-XX:+UseRTMDeopt");51shouldPassMessage = " JVM should startup with option '"52+ "-XX:-UseRTMDeopt' without any warnings";53// verify that option could be turned off54CommandLineOptionTest.verifySameJVMStartup(55null, null, shouldPassMessage, shouldPassMessage, ExitCode.OK,56"-XX:-UseRTMDeopt");57String defValMessage = String.format("UseRTMDeopt should have '%s'"58+ "default value",59TestUseRTMDeoptOptionOnSupportedConfig.DEFAULT_VALUE);60// verify default value61CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt",62TestUseRTMDeoptOptionOnSupportedConfig.DEFAULT_VALUE,63defValMessage);64// verify default value65CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt",66TestUseRTMDeoptOptionOnSupportedConfig.DEFAULT_VALUE,67defValMessage,68CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,69"-XX:+UseRTMLocking");70// verify that option is off when UseRTMLocking is off71CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt",72"false", "UseRTMDeopt should be off when UseRTMLocking is off",73CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,74"-XX:-UseRTMLocking", "-XX:+UseRTMDeopt");75// verify that option could be turned on76CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMDeopt", "true",77"UseRTMDeopt should be on when UseRTMLocking is on and "78+ "'-XX:+UseRTMDeopt' flag set",79CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,80"-XX:+UseRTMLocking", "-XX:+UseRTMDeopt");81}8283public static void main(String args[]) throws Throwable {84new TestUseRTMDeoptOptionOnSupportedConfig().runTestCases();85}86}878889