Mercurial > hg > truffle
annotate test/runtime/contended/Inheritance1.java @ 20948:a0d97b639d57
Truffle-DSL: do not throw UnexpectedResultException for operations that guarantee the type.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 14 Apr 2015 19:23:33 +0200 |
parents | 205dd30230e1 |
children |
rev | line source |
---|---|
10303
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
1 /* |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
4 * |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
8 * |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
13 * accompanied this code). |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
14 * |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
18 * |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
21 * questions. |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
22 */ |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
23 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
24 import java.io.BufferedReader; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
25 import java.io.InputStreamReader; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
26 import java.lang.Class; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
27 import java.lang.String; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
28 import java.lang.System; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
29 import java.lang.management.ManagementFactory; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
30 import java.lang.management.RuntimeMXBean; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
31 import java.util.ArrayList; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
32 import java.util.List; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
33 import java.util.concurrent.CyclicBarrier; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
34 import java.util.regex.Matcher; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
35 import java.util.regex.Pattern; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
36 import java.lang.reflect.Field; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
37 import java.lang.reflect.Modifier; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
38 import sun.misc.Unsafe; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
39 import sun.misc.Contended; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
40 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
41 /* |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
42 * @test |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
43 * @bug 8012939 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
44 * @summary \@Contended doesn't work correctly with inheritance |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
45 * |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
46 * @run main/othervm -XX:-RestrictContended Inheritance1 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
47 */ |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
48 public class Inheritance1 { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
49 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
50 private static final Unsafe U; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
51 private static int ADDRESS_SIZE; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
52 private static int HEADER_SIZE; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
53 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
54 static { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
55 // steal Unsafe |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
56 try { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
57 Field unsafe = Unsafe.class.getDeclaredField("theUnsafe"); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
58 unsafe.setAccessible(true); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
59 U = (Unsafe) unsafe.get(null); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
60 } catch (NoSuchFieldException | IllegalAccessException e) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
61 throw new IllegalStateException(e); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
62 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
63 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
64 // When running with CompressedOops on 64-bit platform, the address size |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
65 // reported by Unsafe is still 8, while the real reference fields are 4 bytes long. |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
66 // Try to guess the reference field size with this naive trick. |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
67 try { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
68 long off1 = U.objectFieldOffset(CompressedOopsClass.class.getField("obj1")); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
69 long off2 = U.objectFieldOffset(CompressedOopsClass.class.getField("obj2")); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
70 ADDRESS_SIZE = (int) Math.abs(off2 - off1); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
71 HEADER_SIZE = (int) Math.min(off1, off2); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
72 } catch (NoSuchFieldException e) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
73 ADDRESS_SIZE = -1; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
74 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
75 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
76 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
77 static class CompressedOopsClass { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
78 public Object obj1; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
79 public Object obj2; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
80 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
81 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
82 public static boolean arePaddedPairwise(Class klass, String field1, String field2) throws Exception { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
83 Field f1 = klass.getField(field1); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
84 Field f2 = klass.getField(field2); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
85 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
86 int diff = offset(f1) - offset(f2); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
87 if (diff < 0) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
88 // f1 is first |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
89 return (offset(f2) - (offset(f1) + getSize(f1))) > 64; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
90 } else { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
91 // f2 is first |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
92 return (offset(f1) - (offset(f2) + getSize(f2))) > 64; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
93 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
94 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
95 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
96 public static boolean sameLayout(Class klass1, Class klass2) throws Exception { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
97 for (Field f1 : klass1.getDeclaredFields()) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
98 Field f2 = klass2.getDeclaredField(f1.getName()); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
99 if (offset(f1) != offset(f2)) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
100 return false; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
101 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
102 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
103 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
104 for (Field f2 : klass1.getDeclaredFields()) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
105 Field f1 = klass2.getDeclaredField(f2.getName()); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
106 if (offset(f1) != offset(f2)) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
107 return false; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
108 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
109 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
110 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
111 return true; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
112 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
113 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
114 public static boolean isStatic(Field field) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
115 return Modifier.isStatic(field.getModifiers()); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
116 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
117 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
118 public static int offset(Field field) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
119 if (isStatic(field)) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
120 return (int) U.staticFieldOffset(field); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
121 } else { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
122 return (int) U.objectFieldOffset(field); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
123 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
124 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
125 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
126 public static int getSize(Field field) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
127 Class type = field.getType(); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
128 if (type == byte.class) { return 1; } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
129 if (type == boolean.class) { return 1; } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
130 if (type == short.class) { return 2; } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
131 if (type == char.class) { return 2; } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
132 if (type == int.class) { return 4; } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
133 if (type == float.class) { return 4; } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
134 if (type == long.class) { return 8; } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
135 if (type == double.class) { return 8; } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
136 return ADDRESS_SIZE; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
137 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
138 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
139 public static void main(String[] args) throws Exception { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
140 boolean endResult = true; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
141 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
142 // --------------- INSTANCE FIELDS --------------------- |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
143 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
144 if (!arePaddedPairwise(A2_R1.class, "int1", "int2")) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
145 System.err.println("A2_R1 failed"); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
146 endResult &= false; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
147 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
148 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
149 if (!arePaddedPairwise(A3_R1.class, "int1", "int2")) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
150 System.err.println("A3_R1 failed"); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
151 endResult &= false; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
152 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
153 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
154 if (!arePaddedPairwise(A1_R2.class, "int1", "int2")) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
155 System.err.println("A1_R2 failed"); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
156 endResult &= false; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
157 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
158 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
159 if (!arePaddedPairwise(A2_R2.class, "int1", "int2")) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
160 System.err.println("A2_R2 failed"); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
161 endResult &= false; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
162 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
163 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
164 if (!arePaddedPairwise(A3_R2.class, "int1", "int2")) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
165 System.err.println("A3_R2 failed"); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
166 endResult &= false; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
167 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
168 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
169 if (!arePaddedPairwise(A1_R3.class, "int1", "int2")) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
170 System.err.println("A1_R3 failed"); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
171 endResult &= false; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
172 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
173 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
174 if (!arePaddedPairwise(A2_R3.class, "int1", "int2")) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
175 System.err.println("A2_R3 failed"); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
176 endResult &= false; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
177 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
178 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
179 if (!arePaddedPairwise(A3_R3.class, "int1", "int2")) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
180 System.err.println("A3_R3 failed"); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
181 endResult &= false; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
182 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
183 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
184 System.out.println(endResult ? "Test PASSES" : "Test FAILS"); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
185 if (!endResult) { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
186 throw new Error("Test failed"); |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
187 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
188 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
189 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
190 public static class R1 { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
191 public int int1; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
192 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
193 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
194 public static class R2 { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
195 @Contended |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
196 public int int1; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
197 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
198 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
199 @Contended |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
200 public static class R3 { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
201 public int int1; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
202 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
203 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
204 public static class A1_R1 extends R1 { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
205 public int int2; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
206 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
207 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
208 public static class A2_R1 extends R1 { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
209 @Contended |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
210 public int int2; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
211 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
212 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
213 @Contended |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
214 public static class A3_R1 extends R1 { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
215 public int int2; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
216 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
217 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
218 public static class A1_R2 extends R2 { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
219 public int int2; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
220 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
221 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
222 public static class A2_R2 extends R2 { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
223 @Contended |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
224 public int int2; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
225 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
226 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
227 @Contended |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
228 public static class A3_R2 extends R2 { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
229 public int int2; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
230 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
231 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
232 public static class A1_R3 extends R3 { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
233 public int int2; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
234 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
235 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
236 public static class A2_R3 extends R3 { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
237 @Contended |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
238 public int int2; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
239 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
240 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
241 @Contended |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
242 public static class A3_R3 extends R3 { |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
243 public int int2; |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
244 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
245 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
246 |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
247 } |
205dd30230e1
8012939: @Contended doesn't work correctly with inheritance
shade
parents:
diff
changeset
|
248 |