Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/jdk17u
Path: blob/master/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitNoneAArch64.java
64474 views
1
/*
2
* Copyright (c) 2021, Amazon.com Inc. 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 TestOnSpinWaitNoneAArch64
26
* @summary Checks that java.lang.Thread.onSpinWait is not intrinsified when '-XX:OnSpinWaitInst=none' is used
27
* @bug 8186670
28
* @library /test/lib
29
*
30
* @requires vm.flagless
31
* @requires os.arch=="aarch64"
32
*
33
* @run driver compiler.onSpinWait.TestOnSpinWaitNoneAArch64
34
*/
35
36
package compiler.onSpinWait;
37
38
import java.util.ArrayList;
39
import jdk.test.lib.process.OutputAnalyzer;
40
import jdk.test.lib.process.ProcessTools;
41
42
public class TestOnSpinWaitNoneAArch64 {
43
44
public static void main(String[] args) throws Exception {
45
ArrayList<String> command = new ArrayList<String>();
46
command.add("-XX:+IgnoreUnrecognizedVMOptions");
47
command.add("-showversion");
48
command.add("-XX:-TieredCompilation");
49
command.add("-Xbatch");
50
command.add("-XX:+PrintCompilation");
51
command.add("-XX:+UnlockDiagnosticVMOptions");
52
command.add("-XX:+PrintInlining");
53
command.add("-XX:OnSpinWaitInst=none");
54
command.add(Launcher.class.getName());
55
56
// Test C2 compiler
57
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(command);
58
59
OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
60
61
analyzer.shouldHaveExitValue(0);
62
63
// The test is applicable only to C2 (present in Server VM).
64
if (analyzer.getStderr().contains("Server VM")) {
65
analyzer.shouldNotContain("java.lang.Thread::onSpinWait (1 bytes) (intrinsic)");
66
}
67
}
68
69
static class Launcher {
70
71
public static void main(final String[] args) throws Exception {
72
int end = 20_000;
73
74
for (int i=0; i < end; i++) {
75
test();
76
}
77
}
78
static void test() {
79
java.lang.Thread.onSpinWait();
80
}
81
}
82
}
83
84