hotspot/test/compiler/6659207/Test.java
author never
Tue, 18 Mar 2008 23:54:17 -0700
changeset 242 f4a8c30a53b0
child 603 0e934fae2fc2
permissions -rw-r--r--
6659207: access violation in CompilerThread0 Summary: split_thru_phi produces top on a non-dead path Reviewed-by: kvn, rasbold, sgoldman
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
242
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
     1
/*
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
     2
 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
     3
 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
     4
 *
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
     5
 *
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
     6
 *
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
     7
 *
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
     8
 *
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
     9
 *
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    10
 *
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    11
 *
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    12
 *
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    13
 *
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    14
 *
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    15
 *
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    16
 *
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    17
 *
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    18
 *
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    19
 *
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    20
 *
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    21
 *
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    22
 */
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    23
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    24
/*
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    25
 * @test
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    26
 * @bug 6659207
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    27
 * @summary access violation in CompilerThread0
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    28
 */
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    29
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    30
public class Test {
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    31
    static int[] array = new int[12];
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    32
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    33
    static int index(int i) {
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    34
        if (i == 0) return 0;
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    35
        for (int n = 0; n < array.length; n++)
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    36
            if (i < array[n]) return n;
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    37
        return -1;
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    38
    }
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    39
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    40
    static int test(int i) {
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    41
        int result = 0;
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    42
        i = index(i);
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    43
        if (i >= 0)
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    44
            if (array[i] != 0)
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    45
                result++;
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    46
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    47
        if (i != -1)
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    48
            array[i]++;
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    49
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    50
        return result;
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    51
    }
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    52
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    53
    public static void main(String[] args) {
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    54
        int total = 0;
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    55
        for (int i = 0; i < 100000; i++) {
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    56
            total += test(10);
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    57
        }
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    58
        System.out.println(total);
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    59
    }
f4a8c30a53b0 6659207: access violation in CompilerThread0
never
parents:
diff changeset
    60
}