Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/runtime/Test7196199.java
41152 views
1
/*
2
* Copyright (c) 2012, 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 7196199
27
* @summary java/text/Bidi/Bug6665028.java failed: Bidi run count incorrect
28
*
29
* @run main/othervm/timeout=400 -Xmx128m -Xbatch -XX:+IgnoreUnrecognizedVMOptions
30
* -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation
31
* -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100
32
* -XX:CompileCommand=exclude,compiler.runtime.Test7196199::test
33
* compiler.runtime.Test7196199
34
*/
35
36
package compiler.runtime;
37
38
public class Test7196199 {
39
private static final int ARRLEN = 97;
40
private static final int ITERS = 5000;
41
private static final int INI_ITERS = 1000;
42
private static final int SFP_ITERS = 10000;
43
private static final float SFP_ITERS_F = 10000.f;
44
private static final float VALUE = 15.f;
45
46
public static void main(String args[]) {
47
int errn = test();
48
if (errn > 0) {
49
System.err.println("FAILED: " + errn + " errors");
50
System.exit(97);
51
}
52
System.out.println("PASSED");
53
}
54
55
static int test() {
56
float[] a0 = new float[ARRLEN];
57
float[] a1 = new float[ARRLEN];
58
// Initialize
59
for (int i = 0; i < ARRLEN; i++) {
60
a0[i] = 0.f;
61
a1[i] = (float) i;
62
}
63
System.out.println("Warmup");
64
for (int i = 0; i < INI_ITERS; i++) {
65
test_incrc(a0);
66
test_incrv(a0, VALUE);
67
test_addc(a0, a1);
68
test_addv(a0, a1, VALUE);
69
}
70
// Test and verify results
71
System.out.println("Verification");
72
int errn = 0;
73
for (int i = 0; i < ARRLEN; i++)
74
a0[i] = 0.f;
75
76
System.out.println(" test_incrc");
77
for (int j = 0; j < ITERS; j++) {
78
test_incrc(a0);
79
for (int i = 0; i < ARRLEN; i++) {
80
errn += verify("test_incrc: ", i, a0[i], VALUE * SFP_ITERS_F);
81
a0[i] = 0.f; // Reset
82
}
83
}
84
85
System.out.println(" test_incrv");
86
for (int j = 0; j < ITERS; j++) {
87
test_incrv(a0, VALUE);
88
for (int i = 0; i < ARRLEN; i++) {
89
errn += verify("test_incrv: ", i, a0[i], VALUE * SFP_ITERS_F);
90
a0[i] = 0.f; // Reset
91
}
92
}
93
94
System.out.println(" test_addc");
95
for (int j = 0; j < ITERS; j++) {
96
test_addc(a0, a1);
97
for (int i = 0; i < ARRLEN; i++) {
98
errn += verify("test_addc: ", i, a0[i], ((float) i + VALUE) * SFP_ITERS_F);
99
a0[i] = 0.f; // Reset
100
}
101
}
102
103
System.out.println(" test_addv");
104
for (int j = 0; j < ITERS; j++) {
105
test_addv(a0, a1, VALUE);
106
for (int i = 0; i < ARRLEN; i++) {
107
errn += verify("test_addv: ", i, a0[i], ((float) i + VALUE) * SFP_ITERS_F);
108
a0[i] = 0.f; // Reset
109
}
110
}
111
112
if (errn > 0)
113
return errn;
114
115
System.out.println("Time");
116
long start, end;
117
118
start = System.currentTimeMillis();
119
for (int i = 0; i < INI_ITERS; i++) {
120
test_incrc(a0);
121
}
122
end = System.currentTimeMillis();
123
System.out.println("test_incrc: " + (end - start));
124
125
start = System.currentTimeMillis();
126
for (int i = 0; i < INI_ITERS; i++) {
127
test_incrv(a0, VALUE);
128
}
129
end = System.currentTimeMillis();
130
System.out.println("test_incrv: " + (end - start));
131
132
start = System.currentTimeMillis();
133
for (int i = 0; i < INI_ITERS; i++) {
134
test_addc(a0, a1);
135
}
136
end = System.currentTimeMillis();
137
System.out.println("test_addc: " + (end - start));
138
139
start = System.currentTimeMillis();
140
for (int i = 0; i < INI_ITERS; i++) {
141
test_addv(a0, a1, VALUE);
142
}
143
end = System.currentTimeMillis();
144
System.out.println("test_addv: " + (end - start));
145
146
return errn;
147
}
148
149
static void test_incrc(float[] a0) {
150
// Non-counted loop with safepoint.
151
for (long l = 0; l < SFP_ITERS; l++) {
152
// Counted and vectorized loop.
153
for (int i = 0; i < a0.length; i += 1) {
154
a0[i] += VALUE;
155
}
156
}
157
}
158
159
static void test_incrv(float[] a0, float b) {
160
// Non-counted loop with safepoint.
161
for (long l = 0; l < SFP_ITERS; l++) {
162
// Counted and vectorized loop.
163
for (int i = 0; i < a0.length; i += 1) {
164
a0[i] += b;
165
}
166
}
167
}
168
169
static void test_addc(float[] a0, float[] a1) {
170
// Non-counted loop with safepoint.
171
for (long l = 0; l < SFP_ITERS; l++) {
172
// Counted and vectorized loop.
173
for (int i = 0; i < a0.length; i += 1) {
174
a0[i] += a1[i] + VALUE;
175
}
176
}
177
}
178
179
static void test_addv(float[] a0, float[] a1, float b) {
180
// Non-counted loop with safepoint.
181
for (long l = 0; l < SFP_ITERS; l++) {
182
// Counted and vectorized loop.
183
for (int i = 0; i < a0.length; i += 1) {
184
a0[i] += a1[i] + b;
185
}
186
}
187
}
188
189
static int verify(String text, int i, float elem, float val) {
190
if (elem != val) {
191
System.err.println(text + "[" + i + "] = " + elem + " != " + val);
192
return 1;
193
}
194
return 0;
195
}
196
}
197
198