annotate test/compiler/6659207/Test.java @ 3237:399aa66d375e

Fixed a bug in which the valueEquals method was misused. The method does only check the equality of the node data and not full GVN equality by taking inputs and successors into account.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 27 Jul 2011 14:16:38 -0700
parents c18cbe5936b8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
69
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
1 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 196
diff changeset
2 * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
177
2a8ec427fbe1 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 69
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
69
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
4 *
177
2a8ec427fbe1 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 69
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
2a8ec427fbe1 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 69
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
2a8ec427fbe1 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 69
diff changeset
7 * published by the Free Software Foundation.
69
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
8 *
177
2a8ec427fbe1 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 69
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
2a8ec427fbe1 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 69
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2a8ec427fbe1 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 69
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2a8ec427fbe1 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 69
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
2a8ec427fbe1 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 69
diff changeset
13 * accompanied this code).
69
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
14 *
177
2a8ec427fbe1 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 69
diff changeset
15 * You should have received a copy of the GNU General Public License version
2a8ec427fbe1 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 69
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
2a8ec427fbe1 6706604: Copyright headers need to be changed to GPL.
kamg
parents: 69
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
69
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 196
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 196
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: 196
diff changeset
21 * questions.
69
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
22 *
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
23 */
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
24
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
25 /*
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
26 * @test
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
27 * @bug 6659207
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
28 * @summary access violation in CompilerThread0
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
29 */
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
30
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
31 public class Test {
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
32 static int[] array = new int[12];
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
33
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
34 static int index(int i) {
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
35 if (i == 0) return 0;
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
36 for (int n = 0; n < array.length; n++)
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
37 if (i < array[n]) return n;
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
38 return -1;
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
39 }
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
40
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
41 static int test(int i) {
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
42 int result = 0;
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
43 i = index(i);
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
44 if (i >= 0)
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
45 if (array[i] != 0)
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
46 result++;
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
47
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
48 if (i != -1)
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
49 array[i]++;
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
50
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
51 return result;
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
52 }
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
53
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
54 public static void main(String[] args) {
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
55 int total = 0;
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
56 for (int i = 0; i < 100000; i++) {
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
57 total += test(10);
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
58 }
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
59 System.out.println(total);
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
60 }
8bb88f9877e5 6659207: access violation in CompilerThread0
never
parents:
diff changeset
61 }