Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.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 UseRTMForStackLocks option processing on CPU and OS with
28
* rtm support when VM supports rtm locking.
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.TestUseRTMForStackLocksOptionOnSupportedConfig
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 TestUseRTMForStackLocksOptionOnSupportedConfig {
43
private static final String DEFAULT_VALUE = "false";
44
45
public void runTestCases() throws Throwable {
46
String errorMessage
47
= CommandLineOptionTest.getExperimentalOptionErrorMessage(
48
"UseRTMForStackLocks");
49
String warningMessage
50
= RTMGenericCommandLineOptionTest.RTM_FOR_STACK_LOCKS_WARNING;
51
52
String shouldFailMessage = " VM option 'UseRTMForStackLocks' is "
53
+ "experimental%nJVM startup should fail without "
54
+ "-XX:+UnlockExperimentalVMOptions flag";
55
56
CommandLineOptionTest.verifySameJVMStartup(
57
new String[] { errorMessage }, null, shouldFailMessage,
58
shouldFailMessage + "%nError message expected", ExitCode.FAIL,
59
"-XX:+UseRTMForStackLocks");
60
String shouldPassMessage = " VM option 'UseRTMForStackLocks'"
61
+ " is experimental%nJVM startup should pass with "
62
+ "-XX:+UnlockExperimentalVMOptions flag";
63
// verify that we get a warning when trying to use rtm for stack
64
// lock, but not using rtm locking.
65
CommandLineOptionTest.verifySameJVMStartup(
66
new String[] { warningMessage }, null, shouldPassMessage,
67
"There should be warning when trying to use rtm for stack "
68
+ "lock, but not using rtm locking", ExitCode.OK,
69
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
70
"-XX:+UseRTMForStackLocks",
71
"-XX:-UseRTMLocking");
72
// verify that we don't get a warning when no using rtm for stack
73
// lock and not using rtm locking.
74
CommandLineOptionTest.verifySameJVMStartup(null,
75
new String[] { warningMessage }, shouldPassMessage,
76
"There should not be any warning when use both "
77
+ "-XX:-UseRTMForStackLocks and -XX:-UseRTMLocking "
78
+ "flags",
79
ExitCode.OK,
80
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
81
"-XX:-UseRTMForStackLocks",
82
"-XX:-UseRTMLocking");
83
// verify that we don't get a warning when using rtm for stack
84
// lock and using rtm locking.
85
CommandLineOptionTest.verifySameJVMStartup(null,
86
new String[] { warningMessage }, shouldPassMessage,
87
"There should not be any warning when use both "
88
+ "-XX:+UseRTMForStackLocks and -XX:+UseRTMLocking"
89
+ " flags",
90
ExitCode.OK,
91
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
92
"-XX:+UseRTMForStackLocks",
93
"-XX:+UseRTMLocking");
94
// verify that default value if false
95
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMForStackLocks",
96
TestUseRTMForStackLocksOptionOnSupportedConfig.DEFAULT_VALUE,
97
"Default value of option 'UseRTMForStackLocks' should be false",
98
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS);
99
// verify that default value is false even with +UseRTMLocking
100
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMForStackLocks",
101
TestUseRTMForStackLocksOptionOnSupportedConfig.DEFAULT_VALUE,
102
"Default value of option 'UseRTMForStackLocks' should be false",
103
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
104
"-XX:+UseRTMLocking");
105
// verify that we can turn the option on
106
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMForStackLocks",
107
"true", "Value of option 'UseRTMForStackLocks' should "
108
+ "be able to be set as 'true' when both "
109
+ "-XX:+UseRTMForStackLocks and "
110
+ "-XX:+UseRTMLocking flags used",
111
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
112
"-XX:+UseRTMLocking", "-XX:+UseRTMForStackLocks");
113
}
114
115
public static void main(String args[]) throws Throwable {
116
new TestUseRTMForStackLocksOptionOnSupportedConfig().runTestCases();
117
}
118
}
119
120