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 /*
26 * @test
27 * @bug 6832293
28 * @summary JIT compiler got wrong result in type checking with -server
29 * @run main/othervm -Xcomp -XX:CompileOnly=Test.run Test
30 */
31
32 import java.io.PrintStream;
33
34 interface SomeInterface {
35 int SEVENS = 777;
36 }
37
38 interface AnotherInterface {
39 int THIRDS = 33;
40 }
41
42 class SomeClass implements SomeInterface {
43 int i;
44
45 SomeClass(int i) {
46 this.i = i;
47 }
48 }
49
50 class ImmediateSubclass extends SomeClass implements SomeInterface {
51 float f;
52
53 ImmediateSubclass(int i, float f) {
54 super(i);
55 this.f = f;
56 }
57 }
58
59 final class FinalSubclass extends ImmediateSubclass implements AnotherInterface {
60 double d;
61
62 FinalSubclass(int i, float f, double d) {
63 super(i, f);
64 this.d = d;
65 }
66 }
67
68 public class Test {
69
70 public static void main(String args[]) throws Exception{
71 /* try to pre initialize */
72 SomeClass[] a=new SomeClass[10];
73 Class.forName("ImmediateSubclass");
74 Class.forName("FinalSubclass");
75 System.exit(run(args, System.out) + 95/*STATUS_TEMP*/);
76 }
77
78 static int errorStatus = 0/*STATUS_PASSED*/;
79
80 static void errorAlert(PrintStream out, int errorLevel) {
81 out.println("Test: failure #" + errorLevel);
82 errorStatus = 2/*STATUS_FAILED*/;
83 }
84
85 static SomeClass[] v2 = new FinalSubclass[4];
86
87 public static int run(String args[],PrintStream out) {
88 int i [], j [];
89 SomeInterface u [], v[] [];
90 AnotherInterface w [];
91 SomeClass x [] [];
92
93 i = new int [10];
94 i[0] = 777;
|
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 /*
26 * @test
27 * @bug 6832293
28 * @summary JIT compiler got wrong result in type checking with -server
29 *
30 * @run main/othervm -Xcomp
31 * -XX:CompileCommand=compileonly,compiler.c2.Test6832293::run
32 * compiler.c2.Test6832293
33 */
34
35 package compiler.c2;
36
37 import java.io.PrintStream;
38
39 public class Test6832293 {
40 static interface SomeInterface {
41 int SEVENS = 777;
42 }
43
44 static interface AnotherInterface {
45 int THIRDS = 33;
46 }
47
48 static class SomeClass implements SomeInterface {
49 int i;
50
51 SomeClass(int i) {
52 this.i = i;
53 }
54 }
55
56 static class ImmediateSubclass extends SomeClass implements SomeInterface {
57 float f;
58
59 ImmediateSubclass(int i, float f) {
60 super(i);
61 this.f = f;
62 }
63 }
64
65 static final class FinalSubclass extends ImmediateSubclass implements AnotherInterface {
66 double d;
67
68 FinalSubclass(int i, float f, double d) {
69 super(i, f);
70 this.d = d;
71 }
72 }
73
74 public static void main(String args[]) throws Exception{
75 /* try to pre initialize */
76 SomeClass[] a=new SomeClass[10];
77 String className = Test6832293.class.getName();
78 Class.forName(className + "$ImmediateSubclass");
79 Class.forName(className + "$FinalSubclass");
80 System.exit(run(args, System.out) + 95/*STATUS_TEMP*/);
81 }
82
83 static int errorStatus = 0/*STATUS_PASSED*/;
84
85 static void errorAlert(PrintStream out, int errorLevel) {
86 out.println("Test: failure #" + errorLevel);
87 errorStatus = 2/*STATUS_FAILED*/;
88 }
89
90 static SomeClass[] v2 = new FinalSubclass[4];
91
92 public static int run(String args[],PrintStream out) {
93 int i [], j [];
94 SomeInterface u [], v[] [];
95 AnotherInterface w [];
96 SomeClass x [] [];
97
98 i = new int [10];
99 i[0] = 777;
|