hotspot/test/compiler/7024475/Test7024475.java
author prr
Thu, 25 Apr 2013 16:49:54 -0700
changeset 18254 e4083179f1c9
parent 8870 119881dc9d0b
permissions -rw-r--r--
8012421: Better positioning of PairPositioning Reviewed-by: srl, mschoene, vadim
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8870
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
     1
/*
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
     2
 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
     4
 *
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
     7
 * published by the Free Software Foundation.
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
     8
 *
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    13
 * accompanied this code).
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    14
 *
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    18
 *
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    21
 * questions.
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    22
 *
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    23
 */
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    24
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    25
/**
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    26
 * @test
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    27
 * @bug 7024475
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    28
 * @summary loop doesn't terminate when compiled
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    29
 *
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    30
 * @run main Test7024475
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    31
 */
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    32
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    33
public class Test7024475 {
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    34
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    35
    static int i;
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    36
    static int x1;
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    37
    static int[] bucket_B;
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    38
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    39
    static void test(Test7024475 test, int i, int c0, int j, int c1) {
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    40
        for (;;) {
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    41
            if (c1 > c0) {
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    42
                if (c0 > 253) {
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    43
                    throw new InternalError("c0 = " + c0);
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    44
                }
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    45
                int index = c0 * 256 + c1;
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    46
                if (index == -1) return;
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    47
                i = bucket_B[index];
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    48
                if (1 < j - i && test != null)
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    49
                    x1 = 0;
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    50
                j = i;
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    51
                c1--;
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    52
            } else {
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    53
                c0--;
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    54
                if (j <= 0)
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    55
                    break;
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    56
                c1 = 255;
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    57
            }
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    58
        }
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    59
    }
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    60
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    61
    public static void main(String args[]) {
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    62
        Test7024475 t = new Test7024475();
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    63
        bucket_B = new int[256*256];
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    64
        for (int i = 1; i < 256*256; i++) {
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    65
            bucket_B[i] = 1;
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    66
        }
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    67
        for (int n = 0; n < 100000; n++) {
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    68
            test(t, 2, 85, 1, 134);
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    69
        }
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    70
    }
119881dc9d0b 7024475: loop doesn't terminate when compiled
never
parents:
diff changeset
    71
}