Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/jit/collapse/collapse.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/collapse.
28
* VM Testbase keywords: [jit, quick]
29
*
30
* @library /vmTestbase
31
* /test/lib
32
* @run main/othervm jit.collapse.collapse
33
*/
34
35
package jit.collapse;
36
37
import nsk.share.TestFailure;
38
import nsk.share.GoldChecker;
39
40
public class collapse {
41
public static final GoldChecker goldChecker = new GoldChecker( "collapse" );
42
43
public static void main( String[] argv )
44
{
45
int i;
46
int j=0, k=0;
47
long lj=0L, lk=0L;
48
float fj=0.0F, fk=0.0F;
49
double dj=0.0D, dk=0.0D;
50
int n = 4;
51
boolean boolPass = true;
52
for (i=1; i<n; i++) {
53
j = j + 6;
54
j = j + 6;
55
j = j + 6;
56
j = j + 6;
57
}
58
for (i=1; i<n; i++) {
59
k = k + 24;
60
}
61
boolPass &= j==k;
62
collapse.goldChecker.println("int + test: "+j+" should equal "+k);
63
for (i=1; i<n; i++) {
64
lj = lj + 6L;
65
lj = lj + 6L;
66
lj = lj + 6L;
67
lj = lj + 6L;
68
}
69
for (i=1; i<n; i++) {
70
lk = lk + 24L;
71
}
72
boolPass &= lj==lk;
73
collapse.goldChecker.println("long + test: "+lj+" should equal "+lk);
74
for (i=1; i<n; i++) {
75
dj = dj + 6;
76
dj = dj + 6;
77
dj = dj + 6;
78
dj = dj + 6;
79
}
80
for (i=1; i<n; i++) {
81
dk = dk + 24;
82
}
83
boolPass &= dj==dk;
84
collapse.goldChecker.println("double + test: "+dj+" should equal "+dk);
85
for (i=1; i<n; i++) {
86
fj = fj + 6;
87
fj = fj + 6;
88
fj = fj + 6;
89
fj = fj + 6;
90
}
91
for (i=1; i<n; i++) {
92
fk = fk + 24;
93
}
94
boolPass &= fj==fk;
95
collapse.goldChecker.println("float + test: "+fj+" should equal "+fk);
96
j=0; k=0;
97
lj=0L; lk=0L;
98
fj=0.0F; fk=0.0F;
99
dj=0.0D; dk=0.0D;
100
for (i=1; i<n; i++) {
101
j += 6;
102
j += 6;
103
j += 6;
104
j += 6;
105
}
106
for (i=1; i<n; i++) {
107
k += 24;
108
}
109
boolPass &= j==k;
110
collapse.goldChecker.println("int += test: "+j+" should equal "+k);
111
for (i=1; i<n; i++) {
112
lj += 6;
113
lj += 6;
114
lj += 6;
115
lj += 6;
116
}
117
for (i=1; i<n; i++) {
118
lk += 24;
119
}
120
boolPass &= lj==lk;
121
collapse.goldChecker.println("long += test: "+lj+" should equal "+lk);
122
for (i=1; i<n; i++) {
123
dj += 6;
124
dj += 6;
125
dj += 6;
126
dj += 6;
127
}
128
for (i=1; i<n; i++) {
129
dk += 24;
130
}
131
boolPass &= dj==dk;
132
collapse.goldChecker.println("double += test: "+dj+" should equal "+dk);
133
for (i=1; i<n; i++) {
134
fj += 6;
135
fj += 6;
136
fj += 6;
137
fj += 6;
138
}
139
for (i=1; i<n; i++) {
140
fk += 24;
141
}
142
boolPass &= fj==fk;
143
collapse.goldChecker.println("float += test: "+fj+" should equal "+fk);
144
145
if (!boolPass)
146
throw new TestFailure("Test failed.");
147
collapse.goldChecker.check();
148
}
149
}
150
151