author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 41705 | hotspot/test/compiler/c2/Test6832293.java@332239c052cc |
permissions | -rw-r--r-- |
2870
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
1 |
/* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
2 |
* Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. |
2870
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
4 |
* |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
8 |
* |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
13 |
* accompanied this code). |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
14 |
* |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
18 |
* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
21 |
* questions. |
2870
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
22 |
*/ |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
23 |
|
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
24 |
/* |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
25 |
* @test |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
26 |
* @bug 6832293 |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
27 |
* @summary JIT compiler got wrong result in type checking with -server |
40059 | 28 |
* |
29 |
* @run main/othervm -Xcomp |
|
30 |
* -XX:CompileCommand=compileonly,compiler.c2.Test6832293::run |
|
31 |
* compiler.c2.Test6832293 |
|
2870
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
32 |
*/ |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
33 |
|
40059 | 34 |
package compiler.c2; |
35 |
||
2870
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
36 |
import java.io.PrintStream; |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
37 |
|
40059 | 38 |
public class Test6832293 { |
39 |
static interface SomeInterface { |
|
40 |
int SEVENS = 777; |
|
41 |
} |
|
2870
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
42 |
|
40059 | 43 |
static interface AnotherInterface { |
44 |
int THIRDS = 33; |
|
45 |
} |
|
2870
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
46 |
|
40059 | 47 |
static class SomeClass implements SomeInterface { |
48 |
int i; |
|
49 |
||
50 |
SomeClass(int i) { |
|
51 |
this.i = i; |
|
52 |
} |
|
2870
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
53 |
} |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
54 |
|
40059 | 55 |
static class ImmediateSubclass extends SomeClass implements SomeInterface { |
56 |
float f; |
|
2870
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
57 |
|
40059 | 58 |
ImmediateSubclass(int i, float f) { |
59 |
super(i); |
|
60 |
this.f = f; |
|
61 |
} |
|
2870
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
62 |
} |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
63 |
|
40059 | 64 |
static final class FinalSubclass extends ImmediateSubclass implements AnotherInterface { |
65 |
double d; |
|
2870
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
66 |
|
40059 | 67 |
FinalSubclass(int i, float f, double d) { |
68 |
super(i, f); |
|
69 |
this.d = d; |
|
70 |
} |
|
2870
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
71 |
} |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
72 |
|
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
73 |
public static void main(String args[]) throws Exception{ |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
74 |
/* try to pre initialize */ |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
75 |
SomeClass[] a=new SomeClass[10]; |
40059 | 76 |
String className = Test6832293.class.getName(); |
77 |
Class.forName(className + "$ImmediateSubclass"); |
|
78 |
Class.forName(className + "$FinalSubclass"); |
|
2870
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
79 |
System.exit(run(args, System.out) + 95/*STATUS_TEMP*/); |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
80 |
} |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
81 |
|
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
82 |
static int errorStatus = 0/*STATUS_PASSED*/; |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
83 |
|
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
84 |
static void errorAlert(PrintStream out, int errorLevel) { |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
85 |
out.println("Test: failure #" + errorLevel); |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
86 |
errorStatus = 2/*STATUS_FAILED*/; |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
87 |
} |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
88 |
|
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
89 |
static SomeClass[] v2 = new FinalSubclass[4]; |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
90 |
|
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
91 |
public static int run(String args[],PrintStream out) { |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
92 |
int i [], j []; |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
93 |
SomeInterface u [], v[] []; |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
94 |
AnotherInterface w []; |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
95 |
SomeClass x [] []; |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
96 |
|
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
97 |
i = new int [10]; |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
98 |
i[0] = 777; |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
99 |
j = (int []) i; |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
100 |
if (j != i) |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
101 |
errorAlert(out, 2); |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
102 |
else if (j.length != 10) |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
103 |
errorAlert(out, 3); |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
104 |
else if (j[0] != 777) |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
105 |
errorAlert(out, 4); |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
106 |
|
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
107 |
v = new SomeClass [3] []; |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
108 |
x = (SomeClass [] []) v; |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
109 |
if (! (x instanceof SomeInterface [] [])) |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
110 |
errorAlert(out, 5); |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
111 |
else if (! (x instanceof SomeClass [] [])) |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
112 |
errorAlert(out, 6); |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
113 |
else if (x != v) |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
114 |
errorAlert(out, 7); |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
115 |
|
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
116 |
x[0] = (SomeClass []) new ImmediateSubclass [4]; |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
117 |
if (! (x[0] instanceof ImmediateSubclass [])) |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
118 |
errorAlert(out, 8); |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
119 |
else if (x[0].length != 4) |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
120 |
errorAlert(out, 9); |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
121 |
|
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
122 |
x[1] = (SomeClass []) v2; |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
123 |
if (! (x[1] instanceof FinalSubclass [])) |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
124 |
errorAlert(out, 10); |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
125 |
else if (x[1].length != 4) |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
126 |
errorAlert(out, 11); |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
127 |
|
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
128 |
w = (AnotherInterface []) x[1]; |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
129 |
if (! (w instanceof FinalSubclass [])) |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
130 |
errorAlert(out, 12); |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
131 |
else if (w != x[1]) |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
132 |
errorAlert(out, 13); |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
133 |
else if (w.length != 4) |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
134 |
errorAlert(out, 14); |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
135 |
|
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
136 |
return errorStatus; |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
137 |
} |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
138 |
} |
52b70541d4d3
6832293: JIT compiler got wrong result in type checking with -server
kvn
parents:
diff
changeset
|
139 |