Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.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 UseRTMLocking option processing on CPU and OS with rtm support and
28
* on VM with rtm locking 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.TestUseRTMLockingOptionOnSupportedConfig
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 TestUseRTMLockingOptionOnSupportedConfig {
43
private static final String DEFAULT_VALUE = "false";
44
45
public void runTestCases() throws Throwable {
46
String unrecongnizedOption
47
= CommandLineOptionTest.getUnrecognizedOptionErrorMessage(
48
"UseRTMLocking");
49
String shouldPassMessage = "VM option 'UseRTMLocking' is experimental"
50
+ "%nJVM startup should pass with "
51
+ "-XX:+UnlockExperimentalVMOptions flag";
52
// verify that there are no warning or error in VM output
53
CommandLineOptionTest.verifySameJVMStartup(null,
54
new String[]{
55
RTMGenericCommandLineOptionTest.RTM_INSTR_ERROR,
56
unrecongnizedOption
57
}, shouldPassMessage, "There should not be any warning when use"
58
+ "with -XX:+UnlockExperimentalVMOptions", ExitCode.OK,
59
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
60
"-XX:+UseRTMLocking"
61
);
62
63
CommandLineOptionTest.verifySameJVMStartup(null,
64
new String[]{
65
RTMGenericCommandLineOptionTest.RTM_INSTR_ERROR,
66
unrecongnizedOption
67
}, shouldPassMessage, "There should not be any warning when use"
68
+ "with -XX:+UnlockExperimentalVMOptions", ExitCode.OK,
69
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
70
"-XX:-UseRTMLocking"
71
);
72
// verify that UseRTMLocking is of by default
73
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking",
74
TestUseRTMLockingOptionOnSupportedConfig.DEFAULT_VALUE,
75
String.format("Default value of option 'UseRTMLocking' should "
76
+ "be '%s'", DEFAULT_VALUE),
77
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS);
78
// verify that we can change UseRTMLocking value
79
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking",
80
TestUseRTMLockingOptionOnSupportedConfig.DEFAULT_VALUE,
81
String.format("Default value of option 'UseRTMLocking' should "
82
+ "be '%s'", DEFAULT_VALUE),
83
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
84
"-XX:-UseRTMLocking");
85
CommandLineOptionTest.verifyOptionValueForSameVM("UseRTMLocking",
86
"true", "Value of 'UseRTMLocking' should be set "
87
+ "to 'true' if -XX:+UseRTMLocking flag set",
88
CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS,
89
"-XX:+UseRTMLocking");
90
}
91
92
public static void main(String args[]) throws Throwable {
93
new TestUseRTMLockingOptionOnSupportedConfig().runTestCases();
94
}
95
}
96
97