Mercurial > hg > truffle
annotate test/compiler/6843752/Test.java @ 12986:1b422ef5288a
8025728: Missing volatile specifier for field G1AllocRegion::_alloc_region
Summary: The field G1AllocRegion::_alloc_region needs to be declared volatile as it is used with that intention. Otherwise the compiler may generate the code that reloads the value which might have changed in the meantime, leading to spurious crashes.
Reviewed-by: iveresov, simonis, tschatzl
Contributed-by: Axel Siebenborn <axel.siebenborn@sap.com>
author | tschatzl |
---|---|
date | Wed, 23 Oct 2013 10:23:06 +0200 |
parents | c18cbe5936b8 |
children |
rev | line source |
---|---|
788 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
788
diff
changeset
|
2 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. |
788 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
788
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
788
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
788
diff
changeset
|
21 * questions. |
788 | 22 */ |
23 | |
24 /* | |
25 * @test | |
26 * @bug 6843752 | |
27 * @summary missing code for an anti-dependent Phi in GCM | |
28 * @run main/othervm -Xbatch Test | |
29 */ | |
30 | |
31 public class Test { | |
32 | |
33 Item list; | |
34 | |
35 static class Item { | |
36 public Item next; | |
37 public Item prev; | |
38 public boolean remove; | |
39 | |
40 Item(boolean r) { remove = r; } | |
41 } | |
42 | |
43 private void linkIn(Item item) { | |
44 Item head = list; | |
45 if (head == null) { | |
46 item.next = item; | |
47 item.prev = item; | |
48 list = item; | |
49 } else { | |
50 item.next = head; | |
51 item.prev = head.prev; | |
52 head.prev.next = item; | |
53 head.prev = item; | |
54 } | |
55 } | |
56 | |
57 private void linkOut(Item item) { | |
58 Item head = list; | |
59 if (item.next == item) { | |
60 list = null; | |
61 } else { | |
62 item.prev.next = item.next; | |
63 item.next.prev = item.prev; | |
64 if (head == item) { | |
65 list = item.next; | |
66 } | |
67 } | |
68 item.next = null; | |
69 item.prev = null; // this is the null pointer we are seeing | |
70 } | |
71 | |
72 private void removeItems(int numItems) { | |
73 Item item = list; | |
74 if (item == null) { | |
75 return; | |
76 } | |
77 Item last = item.prev; | |
78 boolean done = false; | |
79 while (!done && numItems > 1) { | |
80 // the original code "done = (item == last);" triggered an infinite loop | |
81 // and was changed slightly in order to produce an exception instead. | |
82 done = (item.next == last.next); | |
83 item = item.next; | |
84 if (item.prev.remove) { | |
85 linkOut(item.prev); | |
86 } | |
87 } | |
88 } | |
89 | |
90 public void perform(int numItems) { | |
91 for (int i = 0; i < numItems; i++) { | |
92 linkIn(new Item(i == 0)); | |
93 } | |
94 removeItems(numItems); | |
95 list = null; | |
96 } | |
97 | |
98 static public void main(String[] args) { | |
99 int caseCnt = 0; | |
100 Test bj = new Test(); | |
101 try { | |
102 for (; caseCnt < 500000;) { | |
103 int numItems = (++caseCnt % 2); | |
104 if ((caseCnt % 64) == 0) { | |
105 numItems = 5; | |
106 } | |
107 bj.perform(numItems); | |
108 if ((caseCnt % 100000) == 0) { | |
109 System.out.println("successfully performed " + caseCnt + " cases"); | |
110 } | |
111 } | |
112 } catch (Exception e) { | |
113 System.out.println("ERROR: crashed during case " + caseCnt); | |
114 e.printStackTrace(System.out); | |
115 System.exit(97); | |
116 } | |
117 } | |
118 } | |
119 |