author | stuefe |
Thu, 28 Apr 2016 15:40:45 +0200 | |
changeset 38215 | fe1677e95252 |
parent 36851 | 03e2f4d0a421 |
child 40059 | c2304140ed64 |
permissions | -rw-r--r-- |
34202
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
1 |
/* |
35594 | 2 |
* Copyright (c) 2015 SAP SE. All rights reserved. |
34202
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
4 |
* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
8 |
* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
13 |
* accompanied this code). |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
14 |
* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
18 |
* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
21 |
* questions. |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
22 |
*/ |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
23 |
|
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
24 |
/* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
25 |
* @test |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
26 |
* @bug 8141551 |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
27 |
* @summary C2 can not handle returns with inccompatible interface arrays |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
28 |
* @modules java.base/jdk.internal.org.objectweb.asm |
36851 | 29 |
* java.base/jdk.internal.misc |
35753
ee7921f045d2
8148012: get rid of slash-dot-dot in @library directives
iignatyev
parents:
35594
diff
changeset
|
30 |
* @library /testlibrary /test/lib |
34202
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
31 |
* @build sun.hotspot.WhiteBox |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
32 |
* @run main ClassFileInstaller sun.hotspot.WhiteBox |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
33 |
* sun.hotspot.WhiteBox$WhiteBoxPermission |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
34 |
* @run main/othervm |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
35 |
* -Xbootclasspath/a:. |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
36 |
* -XX:+UnlockDiagnosticVMOptions |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
37 |
* -XX:+WhiteBoxAPI |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
38 |
* -Xbatch |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
39 |
* -XX:CompileThreshold=1 |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
40 |
* -XX:-TieredCompilation |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
41 |
* -XX:CICompilerCount=1 |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
42 |
* -XX:+PrintCompilation |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
43 |
* -XX:+PrintInlining |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
44 |
* -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*.run |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
45 |
* -XX:CompileCommand=dontinline,TestMeetIncompatibleInterfaceArrays$Helper.createI2* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
46 |
* -XX:CompileCommand=quiet |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
47 |
* TestMeetIncompatibleInterfaceArrays 0 |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
48 |
* @run main/othervm |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
49 |
* -Xbootclasspath/a:. |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
50 |
* -XX:+UnlockDiagnosticVMOptions |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
51 |
* -XX:+WhiteBoxAPI |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
52 |
* -Xbatch |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
53 |
* -XX:CompileThreshold=1 |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
54 |
* -XX:-TieredCompilation |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
55 |
* -XX:CICompilerCount=1 |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
56 |
* -XX:+PrintCompilation |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
57 |
* -XX:+PrintInlining |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
58 |
* -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*.run |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
59 |
* -XX:CompileCommand=inline,TestMeetIncompatibleInterfaceArrays$Helper.createI2* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
60 |
* -XX:CompileCommand=quiet |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
61 |
* TestMeetIncompatibleInterfaceArrays 1 |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
62 |
* @run main/othervm |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
63 |
* -Xbootclasspath/a:. |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
64 |
* -XX:+UnlockDiagnosticVMOptions |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
65 |
* -XX:+WhiteBoxAPI |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
66 |
* -Xbatch |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
67 |
* -XX:CompileThreshold=1 |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
68 |
* -XX:Tier0InvokeNotifyFreqLog=0 -XX:Tier2InvokeNotifyFreqLog=0 -XX:Tier3InvokeNotifyFreqLog=0 -XX:Tier23InlineeNotifyFreqLog=0 |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
69 |
* -XX:Tier3InvocationThreshold=2 -XX:Tier3MinInvocationThreshold=2 -XX:Tier3CompileThreshold=2 |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
70 |
* -XX:Tier4InvocationThreshold=1 -XX:Tier4MinInvocationThreshold=1 -XX:Tier4CompileThreshold=1 |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
71 |
* -XX:+TieredCompilation |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
72 |
* -XX:CICompilerCount=2 |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
73 |
* -XX:+PrintCompilation |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
74 |
* -XX:+PrintInlining |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
75 |
* -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*.run |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
76 |
* -XX:CompileCommand=compileonly,TestMeetIncompatibleInterfaceArrays$Helper.createI2* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
77 |
* -XX:CompileCommand=inline,TestMeetIncompatibleInterfaceArrays$Helper.createI2* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
78 |
* -XX:CompileCommand=quiet |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
79 |
* TestMeetIncompatibleInterfaceArrays 2 |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
80 |
* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
81 |
* @author volker.simonis@gmail.com |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
82 |
*/ |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
83 |
|
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
84 |
import java.io.FileOutputStream; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
85 |
import java.lang.reflect.InvocationTargetException; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
86 |
import java.lang.reflect.Method; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
87 |
import jdk.internal.org.objectweb.asm.ClassWriter; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
88 |
import jdk.internal.org.objectweb.asm.MethodVisitor; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
89 |
import static jdk.internal.org.objectweb.asm.Opcodes.*; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
90 |
import sun.hotspot.WhiteBox; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
91 |
|
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
92 |
public class TestMeetIncompatibleInterfaceArrays extends ClassLoader { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
93 |
|
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
94 |
private static final WhiteBox WB = WhiteBox.getWhiteBox(); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
95 |
|
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
96 |
public static interface I1 { public String getName(); } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
97 |
public static interface I2 { public String getName(); } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
98 |
public static class I2C implements I2 { public String getName() { return "I2";} } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
99 |
public static class I21C implements I2, I1 { public String getName() { return "I2 and I1";} } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
100 |
|
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
101 |
public static class Helper { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
102 |
public static I2 createI2Array0() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
103 |
return new I2C(); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
104 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
105 |
public static I2[] createI2Array1() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
106 |
return new I2C[] { new I2C() }; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
107 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
108 |
public static I2[][] createI2Array2() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
109 |
return new I2C[][] { new I2C[] { new I2C() } }; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
110 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
111 |
public static I2[][][] createI2Array3() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
112 |
return new I2C[][][] { new I2C[][] { new I2C[] { new I2C() } } }; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
113 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
114 |
public static I2[][][][] createI2Array4() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
115 |
return new I2C[][][][] { new I2C[][][] { new I2C[][] { new I2C[] { new I2C() } } } }; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
116 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
117 |
public static I2[][][][][] createI2Array5() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
118 |
return new I2C[][][][][] { new I2C[][][][] { new I2C[][][] { new I2C[][] { new I2C[] { new I2C() } } } } }; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
119 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
120 |
public static I2 createI21Array0() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
121 |
return new I21C(); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
122 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
123 |
public static I2[] createI21Array1() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
124 |
return new I21C[] { new I21C() }; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
125 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
126 |
public static I2[][] createI21Array2() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
127 |
return new I21C[][] { new I21C[] { new I21C() } }; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
128 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
129 |
public static I2[][][] createI21Array3() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
130 |
return new I21C[][][] { new I21C[][] { new I21C[] { new I21C() } } }; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
131 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
132 |
public static I2[][][][] createI21Array4() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
133 |
return new I21C[][][][] { new I21C[][][] { new I21C[][] { new I21C[] { new I21C() } } } }; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
134 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
135 |
public static I2[][][][][] createI21Array5() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
136 |
return new I21C[][][][][] { new I21C[][][][] { new I21C[][][] { new I21C[][] { new I21C[] { new I21C() } } } } }; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
137 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
138 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
139 |
|
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
140 |
// Location for the generated class files |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
141 |
public static final String PATH = System.getProperty("test.classes", ".") + java.io.File.separator; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
142 |
|
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
143 |
/* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
144 |
* With 'good == false' this helper method creates the following classes |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
145 |
* (using the nested 'Helper' class and the nested interfaces 'I1' and 'I2'). |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
146 |
* For brevity I omit the enclosing class 'TestMeetIncompatibleInterfaceArrays' in the |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
147 |
* following examples: |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
148 |
* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
149 |
* public class MeetIncompatibleInterfaceArrays0ASM { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
150 |
* public static I1 run() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
151 |
* return Helper.createI2Array0(); // returns I2 |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
152 |
* } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
153 |
* public static void test() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
154 |
* I1 i1 = run(); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
155 |
* System.out.println(i1.getName()); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
156 |
* } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
157 |
* } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
158 |
* public class MeetIncompatibleInterfaceArrays1ASM { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
159 |
* public static I1[] run() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
160 |
* return Helper.createI2Array1(); // returns I2[] |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
161 |
* } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
162 |
* public static void test() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
163 |
* I1[] i1 = run(); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
164 |
* System.out.println(i1[0].getName()); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
165 |
* } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
166 |
* } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
167 |
* ... |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
168 |
* // MeetIncompatibleInterfaceArrays4ASM is special because it creates |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
169 |
* // an illegal class which will be rejected by the verifier. |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
170 |
* public class MeetIncompatibleInterfaceArrays4ASM { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
171 |
* public static I1[][][][] run() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
172 |
* return Helper.createI2Array3(); // returns I1[][][] which gives a verifier error because return expects I1[][][][] |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
173 |
* } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
174 |
* public static void test() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
175 |
* I1[][][][][] i1 = run(); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
176 |
* System.out.println(i1[0][0][0][0][0].getName()); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
177 |
* } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
178 |
* ... |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
179 |
* public class MeetIncompatibleInterfaceArrays5ASM { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
180 |
* public static I1[][][][][] run() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
181 |
* return Helper.createI2Array5(); // returns I2[][][][][] |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
182 |
* } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
183 |
* public static void test() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
184 |
* I1[][][][][] i1 = run(); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
185 |
* System.out.println(i1[0][0][0][0][0].getName()); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
186 |
* } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
187 |
* } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
188 |
* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
189 |
* Notice that this is not legal Java code. We would have to use a cast in "run()" to make it legal: |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
190 |
* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
191 |
* public static I1[] run() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
192 |
* return (I1[])Helper.createI2Array1(); // returns I2[] |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
193 |
* } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
194 |
* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
195 |
* But in pure bytecode, the "run()" methods are perfectly legal: |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
196 |
* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
197 |
* public static I1[] run(); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
198 |
* Code: |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
199 |
* 0: invokestatic #16 // Method Helper.createI2Array1:()[LI2; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
200 |
* 3: areturn |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
201 |
* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
202 |
* The "test()" method calls the "getName()" function from I1 on the objects returned by "run()". |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
203 |
* This will epectedly fail with an "IncompatibleClassChangeError" because the objects returned |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
204 |
* by "run()" (and by createI2Array()) are actually of type "I2C" and only implement "I2" but not "I1". |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
205 |
* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
206 |
* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
207 |
* With 'good == true' this helper method will create the following classes: |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
208 |
* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
209 |
* public class MeetIncompatibleInterfaceArraysGood0ASM { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
210 |
* public static I1 run() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
211 |
* return Helper.createI21Array0(); // returns I2 |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
212 |
* } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
213 |
* public static void test() { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
214 |
* I1 i1 = run(); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
215 |
* System.out.println(i1.getName()); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
216 |
* } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
217 |
* } |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
218 |
* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
219 |
* Calling "test()" on these objects will succeed and output "I2 and I1" because now the "run()" |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
220 |
* method calls "createI21Array()" which actually return an object (or an array of objects) of |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
221 |
* type "I21C" which implements both "I2" and "I1". |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
222 |
* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
223 |
* Notice that at the bytecode level, the code for the "run()" and "test()" methods in |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
224 |
* "MeetIncompatibleInterfaceArraysASM" and "MeetIncompatibleInterfaceArraysGoodASM" look exactly |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
225 |
* the same. I.e. the verifier has no chance to verify if the I2 object returned by "createI1Array()" |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
226 |
* or "createI21Array()" implements "I1" or not. That's actually the reason why both versions of |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
227 |
* generated classes are legal from a verifier point of view. |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
228 |
* |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
229 |
*/ |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
230 |
static void generateTestClass(int dim, boolean good) throws Exception { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
231 |
String baseClassName = "MeetIncompatibleInterfaceArrays"; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
232 |
if (good) |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
233 |
baseClassName += "Good"; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
234 |
String createName = "createI2" + (good ? "1" : "") + "Array"; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
235 |
String a = ""; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
236 |
for (int i = 0; i < dim; i++) |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
237 |
a += "["; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
238 |
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
239 |
cw.visit(V1_8, ACC_PUBLIC, baseClassName + dim + "ASM", null, "java/lang/Object", null); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
240 |
MethodVisitor constr = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
241 |
constr.visitCode(); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
242 |
constr.visitVarInsn(ALOAD, 0); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
243 |
constr.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
244 |
constr.visitInsn(RETURN); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
245 |
constr.visitMaxs(0, 0); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
246 |
constr.visitEnd(); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
247 |
MethodVisitor run = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "run", |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
248 |
"()" + a + "LTestMeetIncompatibleInterfaceArrays$I1;", null, null); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
249 |
run.visitCode(); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
250 |
if (dim == 4) { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
251 |
run.visitMethodInsn(INVOKESTATIC, "TestMeetIncompatibleInterfaceArrays$Helper", createName + 3, |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
252 |
"()" + "[[[" + "LTestMeetIncompatibleInterfaceArrays$I2;", false); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
253 |
} else { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
254 |
run.visitMethodInsn(INVOKESTATIC, "TestMeetIncompatibleInterfaceArrays$Helper", createName + dim, |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
255 |
"()" + a + "LTestMeetIncompatibleInterfaceArrays$I2;", false); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
256 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
257 |
run.visitInsn(ARETURN); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
258 |
run.visitMaxs(0, 0); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
259 |
run.visitEnd(); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
260 |
MethodVisitor test = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "test", "()V", null, null); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
261 |
test.visitCode(); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
262 |
test.visitMethodInsn(INVOKESTATIC, baseClassName + dim + "ASM", "run", |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
263 |
"()" + a + "LTestMeetIncompatibleInterfaceArrays$I1;", false); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
264 |
test.visitVarInsn(ASTORE, 0); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
265 |
if (dim > 0) { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
266 |
test.visitVarInsn(ALOAD, 0); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
267 |
for (int i = 1; i <= dim; i++) { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
268 |
test.visitInsn(ICONST_0); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
269 |
test.visitInsn(AALOAD); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
270 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
271 |
test.visitVarInsn(ASTORE, 1); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
272 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
273 |
test.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
274 |
test.visitVarInsn(ALOAD, dim > 0 ? 1 : 0); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
275 |
test.visitMethodInsn(INVOKEINTERFACE, "TestMeetIncompatibleInterfaceArrays$I1", "getName", |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
276 |
"()Ljava/lang/String;", true); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
277 |
test.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/Object;)V", false); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
278 |
test.visitInsn(RETURN); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
279 |
test.visitMaxs(0, 0); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
280 |
test.visitEnd(); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
281 |
|
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
282 |
// Get the bytes of the class.. |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
283 |
byte[] b = cw.toByteArray(); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
284 |
// ..and write them into a class file (for debugging) |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
285 |
FileOutputStream fos = new FileOutputStream(PATH + baseClassName + dim + "ASM.class"); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
286 |
fos.write(b); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
287 |
fos.close(); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
288 |
|
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
289 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
290 |
|
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
291 |
public static String[][] tier = { { "interpreted", "C2 (tier 4) without inlining", "C2 (tier4) without inlining" }, |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
292 |
{ "interpreted", "C2 (tier 4) with inlining", "C2 (tier4) with inlining" }, |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
293 |
{ "interpreted", "C1 (tier 3) with inlining", "C2 (tier4) with inlining" } }; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
294 |
|
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
295 |
public static void main(String[] args) throws Exception { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
296 |
final int pass = Integer.parseInt(args.length > 0 ? args[0] : "0"); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
297 |
|
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
298 |
// Load and initialize some classes required for compilation |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
299 |
Class.forName("TestMeetIncompatibleInterfaceArrays$I1"); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
300 |
Class.forName("TestMeetIncompatibleInterfaceArrays$I2"); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
301 |
Class.forName("TestMeetIncompatibleInterfaceArrays$Helper"); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
302 |
|
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
303 |
for (int g = 0; g < 2; g++) { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
304 |
String baseClassName = "MeetIncompatibleInterfaceArrays"; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
305 |
boolean good = (g == 0) ? false : true; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
306 |
if (good) |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
307 |
baseClassName += "Good"; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
308 |
for (int i = 0; i < 6; i++) { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
309 |
System.out.println(); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
310 |
System.out.println("Creating " + baseClassName + i + "ASM.class"); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
311 |
System.out.println("========================================" + "=" + "========="); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
312 |
// Create the "MeetIncompatibleInterfaceArrays<i>ASM" class |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
313 |
generateTestClass(i, good); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
314 |
Class<?> c = null; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
315 |
try { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
316 |
c = Class.forName(baseClassName + i + "ASM"); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
317 |
} catch (VerifyError ve) { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
318 |
if (i == 4) { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
319 |
System.out.println("OK - must be (" + ve.getMessage() + ")."); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
320 |
} else { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
321 |
throw ve; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
322 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
323 |
continue; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
324 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
325 |
// Call MeetIncompatibleInterfaceArrays<i>ASM.test() |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
326 |
Method m = c.getMethod("test"); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
327 |
Method r = c.getMethod("run"); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
328 |
for (int j = 0; j < 3; j++) { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
329 |
System.out.println((j + 1) + ". invokation of " + baseClassName + i + "ASM.test() [should be " |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
330 |
+ tier[pass][j] + "]"); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
331 |
try { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
332 |
m.invoke(null); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
333 |
} catch (InvocationTargetException ite) { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
334 |
if (good) { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
335 |
throw ite; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
336 |
} else { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
337 |
if (ite.getCause() instanceof IncompatibleClassChangeError) { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
338 |
System.out.println(" OK - catched InvocationTargetException(" |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
339 |
+ ite.getCause().getMessage() + ")."); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
340 |
} else { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
341 |
throw ite; |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
342 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
343 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
344 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
345 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
346 |
System.out.println("Method " + r + (WB.isMethodCompiled(r) ? " has" : " has not") + " been compiled."); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
347 |
if (!WB.isMethodCompiled(r)) { |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
348 |
throw new Exception("Method " + r + " must be compiled!"); |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
349 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
350 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
351 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
352 |
} |
5d19ca9c25a8
8141551: C2 can not handle returns with inccompatible interface arrays
simonis
parents:
diff
changeset
|
353 |
} |