Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java
41152 views
1
/*
2
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/**
25
* @test
26
* @bug 8031320
27
* @summary Verify processing of UseRTMLocking and UseBiasedLocking
28
* options combination on CPU, OS, and VM with rtm support.
29
* @library /test/lib /
30
* @modules java.base/jdk.internal.misc
31
* java.management
32
* @requires vm.flagless
33
* @requires vm.rtm.cpu & vm.rtm.compiler
34
* @run driver compiler.rtm.cli.TestUseRTMLockingOptionWithBiasedLocking
35
*/
36
37
package compiler.rtm.cli;
38
39
import jdk.test.lib.process.ExitCode;
40
import jdk.test.lib.cli.CommandLineOptionTest;
41
42
public class TestUseRTMLockingOptionWithBiasedLocking {
43
44
public void runTestCases() throws Throwable {
45
String warningMessage
46
= RTMGenericCommandLineOptionTest.RTM_BIASED_LOCKING_WARNING;
47
String shouldPassMessage = "JVM startup should pass with both "
48
+ "-XX:+UseRTMLocking and "
49
+ "-XX:-UseBiasedLocking flags set without any warnings";
50
// verify that we will not get a warning
51
CommandLineOptionTest.verifySameJVMStartup(null,
52
new String[] { warningMessage }, shouldPassMessage,
53
shouldPassMessage, ExitCode.OK,
54
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
55
"-XX:+UseRTMLocking", "-XX:-UseBiasedLocking");
56
57
// verify that we will get a warning
58
CommandLineOptionTest.verifySameJVMStartup(
59
new String[] { warningMessage }, null,
60
"JVM startup should pass when both -XX:+UseRTMLocking and "
61
+ "-XX:+UseBiasedLocking flags set",
62
"Flags -XX:+UseRTMLocking"
63
+ " and -XX:+UseBiasedLocking conflicts. "
64
+ "Warning should be shown.", ExitCode.OK,
65
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
66
"-XX:+UseRTMLocking", "-XX:+UseBiasedLocking");
67
// verify that UseBiasedLocking is false when we use rtm locking
68
CommandLineOptionTest.verifyOptionValueForSameVM("UseBiasedLocking",
69
"false",
70
"Value of option 'UseBiasedLocking' should be false if"
71
+ "-XX:+UseRTMLocking flag set.",
72
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
73
"-XX:+UseRTMLocking");
74
// verify that we can't turn on biased locking when
75
// using rtm locking
76
CommandLineOptionTest
77
.verifyOptionValueForSameVM(
78
"UseBiasedLocking",
79
"false",
80
"Value of option 'UseBiasedLocking' should be false if"
81
+ "both -XX:+UseRTMLocking and "
82
+ "-XX:+UseBiasedLocking flags set.",
83
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
84
"-XX:+UseRTMLocking", "-XX:+UseBiasedLocking");
85
}
86
87
public static void main(String args[]) throws Throwable {
88
new TestUseRTMLockingOptionWithBiasedLocking().runTestCases();
89
}
90
}
91
92