Mercurial > hg > truffle
annotate test/runtime/contended/DefaultValue.java @ 15467:4e3c2247daf4
simplify ReentrantNodeIterator
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Fri, 02 May 2014 12:02:27 +0200 |
parents | 50e9396d5257 |
children |
rev | line source |
---|---|
10305
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
1 /* |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
4 * |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
8 * |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
13 * accompanied this code). |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
14 * |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
18 * |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
21 * questions. |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
22 */ |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
23 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
24 import java.io.BufferedReader; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
25 import java.io.InputStreamReader; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
26 import java.lang.Class; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
27 import java.lang.String; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
28 import java.lang.System; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
29 import java.lang.management.ManagementFactory; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
30 import java.lang.management.RuntimeMXBean; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
31 import java.util.ArrayList; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
32 import java.util.List; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
33 import java.util.concurrent.CyclicBarrier; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
34 import java.util.regex.Matcher; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
35 import java.util.regex.Pattern; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
36 import java.lang.reflect.Field; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
37 import java.lang.reflect.Modifier; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
38 import sun.misc.Unsafe; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
39 import sun.misc.Contended; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
40 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
41 /* |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
42 * @test |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
43 * @bug 8014509 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
44 * @summary \@Contended: explicit default value behaves differently from the implicit value |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
45 * |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
46 * @run main/othervm -XX:-RestrictContended DefaultValue |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
47 */ |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
48 public class DefaultValue { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
49 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
50 private static final Unsafe U; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
51 private static int ADDRESS_SIZE; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
52 private static int HEADER_SIZE; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
53 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
54 static { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
55 // steal Unsafe |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
56 try { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
57 Field unsafe = Unsafe.class.getDeclaredField("theUnsafe"); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
58 unsafe.setAccessible(true); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
59 U = (Unsafe) unsafe.get(null); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
60 } catch (NoSuchFieldException | IllegalAccessException e) { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
61 throw new IllegalStateException(e); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
62 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
63 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
64 // When running with CompressedOops on 64-bit platform, the address size |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
65 // reported by Unsafe is still 8, while the real reference fields are 4 bytes long. |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
66 // Try to guess the reference field size with this naive trick. |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
67 try { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
68 long off1 = U.objectFieldOffset(CompressedOopsClass.class.getField("obj1")); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
69 long off2 = U.objectFieldOffset(CompressedOopsClass.class.getField("obj2")); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
70 ADDRESS_SIZE = (int) Math.abs(off2 - off1); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
71 HEADER_SIZE = (int) Math.min(off1, off2); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
72 } catch (NoSuchFieldException e) { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
73 ADDRESS_SIZE = -1; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
74 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
75 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
76 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
77 static class CompressedOopsClass { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
78 public Object obj1; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
79 public Object obj2; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
80 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
81 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
82 public static boolean arePaddedPairwise(Class klass, String field1, String field2) throws Exception { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
83 Field f1 = klass.getField(field1); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
84 Field f2 = klass.getField(field2); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
85 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
86 int diff = offset(f1) - offset(f2); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
87 if (diff < 0) { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
88 // f1 is first |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
89 return (offset(f2) - (offset(f1) + getSize(f1))) > 64; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
90 } else { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
91 // f2 is first |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
92 return (offset(f1) - (offset(f2) + getSize(f2))) > 64; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
93 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
94 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
95 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
96 public static boolean sameLayout(Class klass1, Class klass2) throws Exception { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
97 for (Field f1 : klass1.getDeclaredFields()) { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
98 Field f2 = klass2.getDeclaredField(f1.getName()); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
99 if (offset(f1) != offset(f2)) { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
100 return false; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
101 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
102 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
103 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
104 for (Field f2 : klass1.getDeclaredFields()) { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
105 Field f1 = klass2.getDeclaredField(f2.getName()); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
106 if (offset(f1) != offset(f2)) { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
107 return false; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
108 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
109 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
110 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
111 return true; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
112 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
113 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
114 public static boolean isStatic(Field field) { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
115 return Modifier.isStatic(field.getModifiers()); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
116 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
117 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
118 public static int offset(Field field) { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
119 if (isStatic(field)) { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
120 return (int) U.staticFieldOffset(field); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
121 } else { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
122 return (int) U.objectFieldOffset(field); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
123 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
124 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
125 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
126 public static int getSize(Field field) { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
127 Class type = field.getType(); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
128 if (type == byte.class) { return 1; } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
129 if (type == boolean.class) { return 1; } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
130 if (type == short.class) { return 2; } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
131 if (type == char.class) { return 2; } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
132 if (type == int.class) { return 4; } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
133 if (type == float.class) { return 4; } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
134 if (type == long.class) { return 8; } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
135 if (type == double.class) { return 8; } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
136 return ADDRESS_SIZE; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
137 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
138 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
139 public static void main(String[] args) throws Exception { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
140 boolean endResult = true; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
141 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
142 if (!arePaddedPairwise(R1.class, "int1", "int2")) { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
143 System.err.println("R1 failed"); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
144 endResult &= false; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
145 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
146 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
147 if (!arePaddedPairwise(R2.class, "int1", "int2")) { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
148 System.err.println("R2 failed"); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
149 endResult &= false; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
150 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
151 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
152 if (!arePaddedPairwise(R3.class, "int1", "int2")) { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
153 System.err.println("R3 failed"); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
154 endResult &= false; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
155 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
156 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
157 System.out.println(endResult ? "Test PASSES" : "Test FAILS"); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
158 if (!endResult) { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
159 throw new Error("Test failed"); |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
160 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
161 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
162 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
163 public static class R1 { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
164 @Contended |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
165 public int int1; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
166 @Contended |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
167 public int int2; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
168 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
169 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
170 public static class R2 { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
171 @Contended("") |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
172 public int int1; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
173 @Contended("") |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
174 public int int2; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
175 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
176 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
177 public static class R3 { |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
178 @Contended() |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
179 public int int1; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
180 @Contended() |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
181 public int int2; |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
182 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
183 |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
184 } |
50e9396d5257
8014509: @Contended: explicit default value behaves differently from the implicit value
shade
parents:
diff
changeset
|
185 |