Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/jit/CEETest/CEETest.java
40948 views
1
/*
2
* Copyright (c) 2008, 2020, 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
*
27
* @summary converted from VM Testbase jit/CEETest.
28
* VM Testbase keywords: [jit, quick]
29
*
30
* @library /vmTestbase
31
* /test/lib
32
* @run main/othervm jit.CEETest.CEETest
33
*/
34
35
package jit.CEETest;
36
37
import java.io.PrintStream;
38
import nsk.share.TestFailure;
39
40
public class CEETest {
41
42
public static final long WarmUp = 1500;
43
public static final long Iterations = 100000;
44
45
public static void main(String args[]) {
46
boolean pass = true;
47
for (int i=0; ( i < WarmUp ) & pass; i++) {
48
pass = pass & doInt();
49
pass = pass & doBoolean();
50
pass = pass & doByte();
51
pass = pass & doChar();
52
pass = pass & doShort();
53
pass = pass & doLong();
54
pass = pass & doFloat();
55
pass = pass & doDouble();
56
pass = pass & doObject();
57
pass = pass & doBitOps();
58
}
59
60
long start = System.currentTimeMillis() ;
61
for (int i=0; i<Iterations & pass; i++) {
62
pass = pass & doInt();
63
pass = pass & doBoolean();
64
pass = pass & doByte();
65
pass = pass & doChar();
66
pass = pass & doShort();
67
pass = pass & doLong();
68
pass = pass & doFloat();
69
pass = pass & doDouble();
70
pass = pass & doObject();
71
pass = pass & doBitOps();
72
}
73
74
long duration = System.currentTimeMillis() - start;
75
76
if (true == pass) {
77
System.out.println ("CEETest PASSed in " + duration + " ms.");
78
}
79
else {
80
throw new TestFailure("CEETest FAILed in " + duration + " ms.");
81
}
82
}
83
84
public static boolean doInt () {
85
86
int x = 0;
87
int y = 1;
88
89
int a = (x == y) ? x : y;
90
int b = (x != y) ? y : x;
91
int c = (x < y) ? y : x;
92
int d = (x > y) ? x : y;
93
int e = (x <= y) ? y : x;
94
int f = (x >= y) ? x : y;
95
96
if ( (a != y) ||
97
(b != y) ||
98
(c != y) ||
99
(d != y) ||
100
(e != y) ||
101
(f != y) ) {
102
System.err.println ("doInt() failed");
103
return false;
104
}
105
else {
106
return true;
107
}
108
}
109
110
public static boolean doBoolean () {
111
112
boolean x = false;
113
boolean y = !x;
114
boolean a = (x == y) ? x : y;
115
boolean b = (x != y) ? y : x;
116
117
if ( (a == y) &&
118
(b == y) ) {
119
return true;
120
}
121
else {
122
System.err.println ("doBoolean() failed");
123
return false;
124
}
125
}
126
127
public static boolean doByte () {
128
129
byte x = 0;
130
byte y = 1;
131
132
byte a = (x == y) ? x : y;
133
byte b = (x != y) ? y : x;
134
byte c = (x < y) ? y : x;
135
byte d = (x > y) ? x : y;
136
byte e = (x <= y) ? y : x;
137
byte f = (x >= y) ? x : y;
138
139
if ( (a != y) ||
140
(b != y) ||
141
(c != y) ||
142
(d != y) ||
143
(e != y) ||
144
(f != y) ) {
145
System.err.println ("doByte() failed");
146
return false;
147
}
148
else {
149
return true;
150
}
151
}
152
153
public static boolean doChar () {
154
155
char x = 0;
156
char y = 1;
157
158
char a = (x == y) ? x : y;
159
char b = (x != y) ? y : x;
160
char c = (x < y) ? y : x;
161
char d = (x > y) ? x : y;
162
char e = (x <= y) ? y : x;
163
char f = (x >= y) ? x : y;
164
165
if ( (a == y) &&
166
(b == y) &&
167
(c == y) &&
168
(d == y) &&
169
(e == y) &&
170
(f == y) ) {
171
return true;
172
}
173
else {
174
System.err.println ("doChar() failed");
175
return false;
176
}
177
}
178
179
public static boolean doShort () {
180
181
short x = 0;
182
short y = 1;
183
184
short a = (x == y) ? x : y;
185
short b = (x != y) ? y : x;
186
short c = (x < y) ? y : x;
187
short d = (x > y) ? x : y;
188
short e = (x <= y) ? y : x;
189
short f = (x >= y) ? x : y;
190
191
if ( (a != y) ||
192
(b != y) ||
193
(c != y) ||
194
(d != y) ||
195
(e != y) ||
196
(f != y) ) {
197
System.err.println ("doShort() failed");
198
return false;
199
}
200
else {
201
return true;
202
}
203
}
204
205
public static boolean doLong () {
206
207
long x = 0;
208
long y = 1;
209
long a = (x == y) ? x : y;
210
long b = (x != y) ? y : x;
211
long c = (x < y) ? y : x;
212
long d = (x > y) ? x : y;
213
long e = (x <= y) ? y : x;
214
long f = (x >= y) ? x : y;
215
216
if ( (a == y) &&
217
(b == y) &&
218
(c == y) &&
219
(d == y) &&
220
(e == y) &&
221
(f == y) ) {
222
return true;
223
}
224
else {
225
System.err.println ("doLong() failed");
226
return false;
227
}
228
}
229
230
public static boolean doFloat () {
231
232
float x = 0.0f;
233
float y = 1.0f;
234
float a = (x == y) ? x : y;
235
float b = (x != y) ? y : x;
236
float c = (x < y) ? y : x;
237
float d = (x > y) ? x : y;
238
float e = (x <= y) ? y : x;
239
float f = (x >= y) ? x : y;
240
241
if ( (a != y) ||
242
(b != y) ||
243
(c != y) ||
244
(d != y) ||
245
(e != y) ||
246
(f != y) ) {
247
System.err.println ("doFloat() failed");
248
return false;
249
}
250
else {
251
return true;
252
}
253
}
254
255
public static boolean doDouble () {
256
257
double x = 0.0;
258
double y = 1.0;
259
double a = (x == y) ? x : y;
260
double b = (x != y) ? y : x;
261
double c = (x < y) ? y : x;
262
double d = (x <= y) ? y : x;
263
double e = (x > y) ? x : y;
264
double f = (x >= y) ? x : y;
265
266
if ( (a == y) &&
267
(b == y) &&
268
(c == y) &&
269
(d == y) &&
270
(e == y) &&
271
(f == y) ) {
272
return true;
273
}
274
else {
275
System.err.println ("doDouble() failed");
276
return false;
277
}
278
}
279
280
public static boolean doObject () {
281
282
String x = new String("x");
283
String y = new String("y");
284
String a = (x == y) ? x : y;
285
String b = (x != y) ? y : x;
286
String c = (x instanceof String) ? y : x;
287
288
if ( (a != y) ||
289
(b != y) ||
290
(c != y) ) {
291
System.err.println ("doBoolean() failed");
292
return false;
293
}
294
else {
295
return true;
296
}
297
}
298
299
public static boolean doBitOps () {
300
int x = 0;
301
int y = 1;
302
303
int a = x; a += y;
304
int b = (x == y) ? x : (x | y);
305
int c = (x == y) ? x : (x ^ y);
306
int d = (x == y) ? x : (y & y);
307
int e = (x == y) ? x : (y % 2);
308
int f = (x == y) ? x : (2 >> y);
309
int g = (x == y) ? x : (~-2);
310
311
if ( (a == y) &&
312
(b == y) &&
313
(c == y) &&
314
(d == y) &&
315
(e == y) &&
316
(f == y) &&
317
(g == y) ) {
318
return true;
319
} else {
320
System.err.println ("doBoolean() failed");
321
return false;
322
}
323
}
324
325
}
326
327