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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
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;
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
|
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 6843752
27 * @summary missing code for an anti-dependent Phi in GCM
28 *
29 * @run main/othervm -Xbatch compiler.c2.Test6843752
30 */
31
32 package compiler.c2;
33
34 public class Test6843752 {
35
36 Item list;
37
38 static class Item {
39 public Item next;
40 public Item prev;
41 public boolean remove;
42
43 Item(boolean r) { remove = r; }
44 }
45
46 private void linkIn(Item item) {
47 Item head = list;
48 if (head == null) {
49 item.next = item;
50 item.prev = item;
51 list = item;
52 } else {
53 item.next = head;
54 item.prev = head.prev;
83 // the original code "done = (item == last);" triggered an infinite loop
84 // and was changed slightly in order to produce an exception instead.
85 done = (item.next == last.next);
86 item = item.next;
87 if (item.prev.remove) {
88 linkOut(item.prev);
89 }
90 }
91 }
92
93 public void perform(int numItems) {
94 for (int i = 0; i < numItems; i++) {
95 linkIn(new Item(i == 0));
96 }
97 removeItems(numItems);
98 list = null;
99 }
100
101 static public void main(String[] args) {
102 int caseCnt = 0;
103 Test6843752 bj = new Test6843752();
104 try {
105 for (; caseCnt < 500000;) {
106 int numItems = (++caseCnt % 2);
107 if ((caseCnt % 64) == 0) {
108 numItems = 5;
109 }
110 bj.perform(numItems);
111 if ((caseCnt % 100000) == 0) {
112 System.out.println("successfully performed " + caseCnt + " cases");
113 }
114 }
115 } catch (Exception e) {
116 System.out.println("ERROR: crashed during case " + caseCnt);
117 e.printStackTrace(System.out);
118 System.exit(97);
119 }
120 }
121 }
122
|