Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/c1/Test7103261.java
41152 views
1
/*
2
* Copyright (c) 2011, 2016, 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 7103261
27
* @summary crash with jittester on sparc
28
*
29
* @run main compiler.c1.Test7103261
30
*/
31
32
package compiler.c1;
33
34
// exercise implicit null checking in the compiler for various field types
35
public class Test7103261 {
36
static Test7103261 null_value;
37
static Test7103261 nonnull_value = new Test7103261();
38
static Test7103261 nonnull_value2 = new Test7103261();
39
40
long l;
41
int i;
42
float f;
43
double d;
44
byte b;
45
char c;
46
short s;
47
boolean z;
48
Object o;
49
50
public static void main(String[] args) {
51
constantStore();
52
valueTest(false);
53
valueTest(true);
54
}
55
static void constantStore() {
56
for (int field = 0; field < 9; field++) {
57
try {
58
Test7103261 o = nonnull_value;
59
for (int i = 0; i < 100000; i++) {
60
switch (field) {
61
case 0: o.l = 0; break;
62
case 1: o.i = 0; break;
63
case 2: o.f = 0; break;
64
case 3: o.d = 0; break;
65
case 4: o.b = 0; break;
66
case 5: o.c = 0; break;
67
case 6: o.s = 0; break;
68
case 7: o.z = false; break;
69
case 8: o.o = null; break;
70
default: throw new InternalError();
71
}
72
if (i == 90000) {
73
// hide nullness from optimizer
74
o = null_value;
75
}
76
}
77
} catch (NullPointerException npe) {
78
}
79
}
80
}
81
static void valueTest(boolean store) {
82
for (int field = 0; field < 9; field++) {
83
try {
84
Test7103261 o = nonnull_value;
85
Test7103261 o2 = nonnull_value2;
86
for (int i = 0; i < 100000; i++) {
87
switch (field) {
88
case 0: o.l = o2.l; break;
89
case 1: o.i = o2.i; break;
90
case 2: o.f = o2.f; break;
91
case 3: o.d = o2.d; break;
92
case 4: o.b = o2.b; break;
93
case 5: o.c = o2.c; break;
94
case 6: o.s = o2.s; break;
95
case 7: o.z = o2.z; break;
96
case 8: o.o = o2.o; break;
97
default: throw new InternalError();
98
}
99
if (i == 90000) {
100
// hide nullness from optimizer
101
if (store)
102
o = null_value;
103
else
104
o2 = null_value;
105
}
106
}
107
} catch (NullPointerException npe) {
108
}
109
}
110
}
111
}
112
113