author | hseigel |
Wed, 26 Jun 2019 09:06:32 -0400 | |
changeset 55497 | d3a33953b936 |
permissions | -rw-r--r-- |
55497
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
1 |
/* |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
2 |
* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved. |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
4 |
* |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
8 |
* |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
13 |
* accompanied this code). |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
14 |
* |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
18 |
* |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
21 |
* questions. |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
22 |
* |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
23 |
*/ |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
24 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
25 |
package invokevirtual; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
26 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
27 |
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_ABSTRACT; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
28 |
import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
29 |
import shared.AbstractGenerator; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
30 |
import shared.AccessType; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
31 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
32 |
import java.util.HashMap; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
33 |
import java.util.Map; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
34 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
35 |
public class Generator extends AbstractGenerator { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
36 |
public Generator(String[] args) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
37 |
super(args); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
38 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
39 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
40 |
public static void main (String[] args) throws Exception { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
41 |
new Generator(args).run(); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
42 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
43 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
44 |
protected Checker getChecker(Class paramClass, Class targetClass) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
45 |
return new Checker(paramClass, targetClass); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
46 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
47 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
48 |
private void run() throws Exception { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
49 |
// Specify package names |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
50 |
String pkg1 = "a."; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
51 |
String pkg2 = "b."; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
52 |
String pkg3 = "c."; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
53 |
String[] packages = new String[] { "", pkg1, pkg2, pkg3 }; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
54 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
55 |
boolean isPassed = true; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
56 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
57 |
// Hierarchy |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
58 |
// The following triples will be used during further |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
59 |
// hierarchy construction and will specify packages for A, B and C |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
60 |
String[][] packageSets = new String[][] { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
61 |
{ "", "", "" } |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
62 |
, { "", pkg1, pkg1 } |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
63 |
, { "", pkg1, pkg2 } |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
64 |
, { pkg1, pkg1, pkg1 } |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
65 |
, { pkg1, pkg1, pkg2 } |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
66 |
, { pkg1, pkg2, pkg1 } |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
67 |
, { pkg1, pkg2, pkg2 } |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
68 |
}; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
69 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
70 |
String [] header = new String[] { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
71 |
String.format("%30s %45s %20s", "Method access modifiers", "Call site location", "Status") |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
72 |
, String.format("%4s %-12s %-12s %-12s %7s %7s %7s %7s %7s %7s" |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
73 |
, " # " |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
74 |
, "A.m()" |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
75 |
, "B.m()" |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
76 |
, "C.m()" |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
77 |
, " A " |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
78 |
, "pkgA " |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
79 |
, " B " |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
80 |
, " pkgB" |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
81 |
, " C " |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
82 |
, "pkgC " |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
83 |
) |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
84 |
, "-------------------------------------------------------------------------------------------------" |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
85 |
}; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
86 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
87 |
for (String str : header) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
88 |
System.out.println(str); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
89 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
90 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
91 |
for (String[] pkgSet : packageSets) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
92 |
String packageA = pkgSet[0]; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
93 |
String packageB = pkgSet[1]; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
94 |
String packageC = pkgSet[2]; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
95 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
96 |
String classNameA = packageA + "A"; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
97 |
String classNameB = packageB + "B"; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
98 |
String classNameC = packageC + "C"; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
99 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
100 |
String staticCallerParam = classNameA; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
101 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
102 |
// For all possible access modifier combinations |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
103 |
for (AccessType accessA : AccessType.values()) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
104 |
for (AccessType accessB : AccessType.values()) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
105 |
for (AccessType accessC : AccessType.values()) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
106 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
107 |
if (accessA == AccessType.UNDEF) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
108 |
continue; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
109 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
110 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
111 |
for (int I = 0; I < 4; I++) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
112 |
boolean isAbstractA = ((I & 1) != 0); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
113 |
boolean isAbstractB = ((I & 2) != 0); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
114 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
115 |
Map<String, byte[]> classes = new HashMap<String, byte[]>(); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
116 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
117 |
// Generate class A |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
118 |
classes.put( |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
119 |
classNameA |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
120 |
, new ClassGenerator( classNameA |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
121 |
, "java.lang.Object" |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
122 |
, ACC_PUBLIC | (isAbstractA ? ACC_ABSTRACT : 0)) |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
123 |
.addTargetMethod( accessA |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
124 |
, (isAbstractA ? ACC_ABSTRACT : 0)) |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
125 |
.addCaller(staticCallerParam) |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
126 |
.getClassFile() |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
127 |
); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
128 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
129 |
// Generate class B |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
130 |
classes.put( |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
131 |
classNameB |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
132 |
, new ClassGenerator( classNameB |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
133 |
, classNameA |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
134 |
, ACC_PUBLIC | (isAbstractB ? ACC_ABSTRACT : 0)) |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
135 |
.addTargetMethod( accessB |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
136 |
, (isAbstractB ? ACC_ABSTRACT : 0)) |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
137 |
.addCaller(staticCallerParam) |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
138 |
.getClassFile() |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
139 |
); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
140 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
141 |
// Generate class C |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
142 |
classes.put( |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
143 |
classNameC |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
144 |
, new ClassGenerator(classNameC, classNameB) |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
145 |
.addTargetMethod(accessC) |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
146 |
.addCaller(staticCallerParam) |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
147 |
.getClassFile() |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
148 |
); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
149 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
150 |
// Generate package callers |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
151 |
for (String pkg : packages) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
152 |
classes.put( |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
153 |
pkg+"Caller" |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
154 |
, new ClassGenerator(pkg+"Caller") |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
155 |
.addCaller(staticCallerParam) |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
156 |
.getClassFile() |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
157 |
); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
158 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
159 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
160 |
String[] callSites = new String[] { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
161 |
classNameA |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
162 |
, packageA+"Caller" |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
163 |
, classNameB |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
164 |
, packageB+"Caller" |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
165 |
, classNameC |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
166 |
, packageC+"Caller" |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
167 |
}; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
168 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
169 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
170 |
String caseDescription = |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
171 |
String.format("%-12s %-12s %-12s| " |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
172 |
, (isAbstractA ? "! " : " ") + classNameA + " " + accessA |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
173 |
, (isAbstractB ? "! " : " ") + classNameB + " " + accessB |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
174 |
, classNameC + " " + accessC |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
175 |
); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
176 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
177 |
boolean result = exec(classes, caseDescription, staticCallerParam, classNameC, callSites); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
178 |
isPassed = isPassed && result; |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
179 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
180 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
181 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
182 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
183 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
184 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
185 |
// Print footer |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
186 |
for (int i = header.length-1; i >= 0; i--) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
187 |
System.out.println(header[i]); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
188 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
189 |
|
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
190 |
if (executeTests) { |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
191 |
System.out.printf("\nEXECUTION STATUS: %s\n", (isPassed? "PASSED" : "FAILED")); |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
192 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
193 |
} |
d3a33953b936
8224137: Analyze and port invocation tests to jtreg and co-locate to jdk repo
hseigel
parents:
diff
changeset
|
194 |
} |