Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitC1.java
41152 views
1
/*
2
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
3
* Copyright 2016 Azul Systems, Inc. All Rights Reserved.
4
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
*
6
* This code is free software; you can redistribute it and/or modify it
7
* under the terms of the GNU General Public License version 2 only, as
8
* published by the Free Software Foundation.
9
*
10
* This code is distributed in the hope that it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13
* version 2 for more details (a copy is included in the LICENSE file that
14
* accompanied this code).
15
*
16
* You should have received a copy of the GNU General Public License version
17
* 2 along with this work; if not, write to the Free Software Foundation,
18
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19
*
20
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21
* or visit www.oracle.com if you need additional information or have any
22
* questions.
23
*/
24
25
/**
26
* @test TestOnSpinWaitC1
27
* @summary (x86 only) checks that java.lang.Thread.onSpinWait is intrinsified
28
* @bug 8147844
29
* @library /test/lib
30
*
31
* @requires vm.flagless
32
* @requires os.arch=="x86" | os.arch=="amd64" | os.arch=="x86_64"
33
* @requires vm.compiler1.enabled
34
*
35
* @run driver compiler.onSpinWait.TestOnSpinWaitC1
36
*/
37
38
package compiler.onSpinWait;
39
40
import jdk.test.lib.process.OutputAnalyzer;
41
import jdk.test.lib.process.ProcessTools;
42
43
public class TestOnSpinWaitC1 {
44
45
public static void main(String[] args) throws Exception {
46
47
// Test C1 compiler
48
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
49
"-XX:+IgnoreUnrecognizedVMOptions", "-showversion",
50
"-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1", "-Xbatch",
51
"-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions",
52
"-XX:+PrintInlining", Launcher.class.getName());
53
54
OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
55
56
analyzer.shouldHaveExitValue(0);
57
analyzer.shouldContain("java.lang.Thread::onSpinWait (1 bytes) intrinsic");
58
}
59
60
static class Launcher {
61
62
public static void main(final String[] args) throws Exception {
63
int end = 20_000;
64
65
for (int i=0; i < end; i++) {
66
test();
67
}
68
}
69
static void test() {
70
java.lang.Thread.onSpinWait();
71
}
72
}
73
}
74
75