Mercurial > hg > graal-compiler
annotate test/runtime/contended/OopMaps.java @ 10348:3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
Summary: field count handling fixed, has_nonstatic_fields invariant fixed, oop map overrun fixed; new asserts
Reviewed-by: kvn, dcubed, coleenp
author | shade |
---|---|
date | Mon, 27 May 2013 12:49:08 -0700 |
parents | |
children | 01c2bdd24bb5 |
rev | line source |
---|---|
10348
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
1 /* |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
4 * |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
8 * |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
13 * accompanied this code). |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
14 * |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
18 * |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
21 * questions. |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
22 */ |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
23 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
24 import java.io.BufferedReader; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
25 import java.io.InputStreamReader; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
26 import java.lang.Class; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
27 import java.lang.String; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
28 import java.lang.System; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
29 import java.lang.management.ManagementFactory; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
30 import java.lang.management.RuntimeMXBean; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
31 import java.util.ArrayList; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
32 import java.util.List; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
33 import java.util.concurrent.CyclicBarrier; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
34 import java.util.regex.Matcher; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
35 import java.util.regex.Pattern; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
36 import java.lang.reflect.Field; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
37 import java.lang.reflect.Modifier; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
38 import sun.misc.Unsafe; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
39 import sun.misc.Contended; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
40 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
41 /* |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
42 * @test |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
43 * @bug 8015270 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
44 * @summary \@Contended: fix multiple issues in the layout code |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
45 * |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
46 * @run main/othervm -XX:-RestrictContended OopMaps |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
47 */ |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
48 public class OopMaps { |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
49 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
50 public static void main(String[] args) throws Exception { |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
51 Object o01 = new Object(); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
52 Object o02 = new Object(); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
53 Object o03 = new Object(); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
54 Object o04 = new Object(); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
55 Object o05 = new Object(); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
56 Object o06 = new Object(); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
57 Object o07 = new Object(); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
58 Object o08 = new Object(); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
59 Object o09 = new Object(); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
60 Object o10 = new Object(); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
61 Object o11 = new Object(); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
62 Object o12 = new Object(); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
63 Object o13 = new Object(); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
64 Object o14 = new Object(); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
65 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
66 final int COUNT = 100000; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
67 R1[] rs = new R1[COUNT]; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
68 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
69 for (int i = 0; i < COUNT; i++) { |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
70 R1 r1 = new R1(); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
71 r1.o01 = o01; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
72 r1.o02 = o02; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
73 r1.o03 = o03; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
74 r1.o04 = o04; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
75 r1.o05 = o05; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
76 r1.o06 = o06; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
77 r1.o07 = o07; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
78 r1.o08 = o08; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
79 r1.o09 = o09; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
80 r1.o10 = o10; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
81 r1.o11 = o11; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
82 r1.o12 = o12; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
83 r1.o13 = o13; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
84 r1.o14 = o14; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
85 r1.i1 = 1; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
86 r1.i2 = 2; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
87 r1.i3 = 3; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
88 r1.i4 = 4; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
89 rs[i] = r1; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
90 } |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
91 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
92 System.gc(); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
93 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
94 for (int i = 0; i < COUNT; i++) { |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
95 R1 r1 = rs[i]; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
96 if (r1.o01 != o01) throw new Error("Test Error: o01"); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
97 if (r1.o02 != o02) throw new Error("Test Error: o02"); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
98 if (r1.o03 != o03) throw new Error("Test Error: o03"); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
99 if (r1.o04 != o04) throw new Error("Test Error: o04"); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
100 if (r1.o05 != o05) throw new Error("Test Error: o05"); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
101 if (r1.o06 != o06) throw new Error("Test Error: o06"); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
102 if (r1.o07 != o07) throw new Error("Test Error: o07"); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
103 if (r1.o08 != o08) throw new Error("Test Error: o08"); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
104 if (r1.o09 != o09) throw new Error("Test Error: o09"); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
105 if (r1.o10 != o10) throw new Error("Test Error: o10"); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
106 if (r1.o11 != o11) throw new Error("Test Error: o11"); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
107 if (r1.o12 != o12) throw new Error("Test Error: o12"); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
108 if (r1.o13 != o13) throw new Error("Test Error: o13"); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
109 if (r1.o14 != o14) throw new Error("Test Error: o14"); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
110 if (r1.i1 != 1) throw new Error("Test Error: i1"); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
111 if (r1.i2 != 2) throw new Error("Test Error: i2"); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
112 if (r1.i3 != 3) throw new Error("Test Error: i3"); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
113 if (r1.i4 != 4) throw new Error("Test Error: i4"); |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
114 } |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
115 } |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
116 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
117 public static class R0 { |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
118 int i1; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
119 int i2; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
120 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
121 Object o01; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
122 Object o02; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
123 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
124 @Contended |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
125 Object o03; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
126 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
127 @Contended |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
128 Object o04; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
129 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
130 @Contended |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
131 Object o05; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
132 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
133 @Contended |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
134 Object o06; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
135 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
136 @Contended |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
137 Object o07; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
138 } |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
139 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
140 public static class R1 extends R0 { |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
141 int i3; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
142 int i4; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
143 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
144 Object o08; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
145 Object o09; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
146 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
147 @Contended |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
148 Object o10; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
149 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
150 @Contended |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
151 Object o11; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
152 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
153 @Contended |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
154 Object o12; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
155 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
156 @Contended |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
157 Object o13; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
158 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
159 @Contended |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
160 Object o14; |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
161 } |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
162 |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
163 } |
3970971c91e0
8015270: @Contended: fix multiple issues in the layout code
shade
parents:
diff
changeset
|
164 |