hotspot/test/compiler/loopopts/TestCastIINoLoopLimitCheck.java
author chegar
Tue, 22 Mar 2016 15:26:07 +0000
changeset 36694 182a5e7a519e
parent 34254 f2743650be1f
child 37287 c2660335bf81
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29344
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
     1
/*
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
     4
 *
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
     8
 *
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    13
 * accompanied this code).
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    14
 *
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    18
 *
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    21
 * questions.
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    22
 *
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    23
 */
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    24
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    25
/**
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    26
 * @test
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    27
 * @bug 8073184
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    28
 * @summary CastII that guards counted loops confuses range check elimination with LoopLimitCheck off
34254
f2743650be1f 8141706: [TESTBUG] Update tests failing due to changed behavior
gziemski
parents: 29344
diff changeset
    29
 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-LoopLimitCheck -XX:CompileOnly=TestCastIINoLoopLimitCheck.m -Xcomp  TestCastIINoLoopLimitCheck
29344
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    30
 *
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    31
 */
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    32
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    33
public class TestCastIINoLoopLimitCheck {
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    34
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    35
    static void m(int i, int index, char[] buf) {
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    36
        while (i >= 65536) {
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    37
            i = i / 100;
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    38
            buf [--index] = 0;
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    39
            buf [--index] = 1;
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    40
        }
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    41
    }
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    42
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    43
    static public void main(String[] args) {
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    44
        m(0, 0, null);
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    45
    }
49ad0989c84f 8073184: Compile of java.lang.Integer::getChars fails with LoopLimitCheck = false after 8054478
roland
parents:
diff changeset
    46
}