Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/c2/Test6832293.java
41149 views
1
/*
2
* Copyright (c) 2008, 2009, 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 6832293
27
* @summary JIT compiler got wrong result in type checking with -server
28
*
29
* @run main/othervm -Xcomp
30
* -XX:CompileCommand=compileonly,compiler.c2.Test6832293::run
31
* compiler.c2.Test6832293
32
*/
33
34
package compiler.c2;
35
36
import java.io.PrintStream;
37
38
public class Test6832293 {
39
static interface SomeInterface {
40
int SEVENS = 777;
41
}
42
43
static interface AnotherInterface {
44
int THIRDS = 33;
45
}
46
47
static class SomeClass implements SomeInterface {
48
int i;
49
50
SomeClass(int i) {
51
this.i = i;
52
}
53
}
54
55
static class ImmediateSubclass extends SomeClass implements SomeInterface {
56
float f;
57
58
ImmediateSubclass(int i, float f) {
59
super(i);
60
this.f = f;
61
}
62
}
63
64
static final class FinalSubclass extends ImmediateSubclass implements AnotherInterface {
65
double d;
66
67
FinalSubclass(int i, float f, double d) {
68
super(i, f);
69
this.d = d;
70
}
71
}
72
73
public static void main(String args[]) throws Exception{
74
/* try to pre initialize */
75
SomeClass[] a=new SomeClass[10];
76
String className = Test6832293.class.getName();
77
Class.forName(className + "$ImmediateSubclass");
78
Class.forName(className + "$FinalSubclass");
79
System.exit(run(args, System.out) + 95/*STATUS_TEMP*/);
80
}
81
82
static int errorStatus = 0/*STATUS_PASSED*/;
83
84
static void errorAlert(PrintStream out, int errorLevel) {
85
out.println("Test: failure #" + errorLevel);
86
errorStatus = 2/*STATUS_FAILED*/;
87
}
88
89
static SomeClass[] v2 = new FinalSubclass[4];
90
91
public static int run(String args[],PrintStream out) {
92
int i [], j [];
93
SomeInterface u [], v[] [];
94
AnotherInterface w [];
95
SomeClass x [] [];
96
97
i = new int [10];
98
i[0] = 777;
99
j = (int []) i;
100
if (j != i)
101
errorAlert(out, 2);
102
else if (j.length != 10)
103
errorAlert(out, 3);
104
else if (j[0] != 777)
105
errorAlert(out, 4);
106
107
v = new SomeClass [3] [];
108
x = (SomeClass [] []) v;
109
if (! (x instanceof SomeInterface [] []))
110
errorAlert(out, 5);
111
else if (! (x instanceof SomeClass [] []))
112
errorAlert(out, 6);
113
else if (x != v)
114
errorAlert(out, 7);
115
116
x[0] = (SomeClass []) new ImmediateSubclass [4];
117
if (! (x[0] instanceof ImmediateSubclass []))
118
errorAlert(out, 8);
119
else if (x[0].length != 4)
120
errorAlert(out, 9);
121
122
x[1] = (SomeClass []) v2;
123
if (! (x[1] instanceof FinalSubclass []))
124
errorAlert(out, 10);
125
else if (x[1].length != 4)
126
errorAlert(out, 11);
127
128
w = (AnotherInterface []) x[1];
129
if (! (w instanceof FinalSubclass []))
130
errorAlert(out, 12);
131
else if (w != x[1])
132
errorAlert(out, 13);
133
else if (w.length != 4)
134
errorAlert(out, 14);
135
136
return errorStatus;
137
}
138
}
139
140
141