hotspot/test/compiler/loopopts/TestSplitIfUnswitchedLoopsEliminated.java
author tpivovarova
Tue, 12 Jul 2016 18:24:48 +0300
changeset 40059 c2304140ed64
parent 30309 da3efc8ed2cb
child 41705 332239c052cc
permissions -rw-r--r--
8132919: Put compiler tests in packages Reviewed-by: vlivanov, dpochepk Contributed-by: igor.ignatyev@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30309
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
     1
/*
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
     4
 *
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
     8
 *
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    13
 * accompanied this code).
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    14
 *
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    18
 *
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    21
 * questions.
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    22
 *
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    23
 */
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    24
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    25
/**
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    26
 * @test
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    27
 * @bug 8078426
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    28
 * @summary split if finds predicates on several incoming paths when unswitched's loops are optimized out
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    29
 *
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 30309
diff changeset
    30
 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseOnStackReplacement
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 30309
diff changeset
    31
 *                   -XX:-BackgroundCompilation -XX:-UseCompressedOops
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 30309
diff changeset
    32
 *                   compiler.loopopts.TestSplitIfUnswitchedLoopsEliminated
30309
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    33
 */
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    34
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 30309
diff changeset
    35
package compiler.loopopts;
30309
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    36
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    37
public class TestSplitIfUnswitchedLoopsEliminated {
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    38
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    39
    static class A {
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    40
        int f;
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    41
    }
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    42
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    43
    static A aa = new A();
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    44
    static A aaa = new A();
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    45
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    46
    static int test_helper(int stop, boolean unswitch) {
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    47
        A a = null;
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    48
        for (int i = 3; i < 10; i++) {
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    49
            if (unswitch) {
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    50
                a = null;
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    51
            } else {
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    52
                a = aa;
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    53
                int v = a.f;
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    54
            }
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    55
        }
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    56
        if (stop != 4) {
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    57
            a = aaa;
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    58
        }
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    59
        if (a != null) {
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    60
            return a.f;
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    61
        }
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    62
        return 0;
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    63
    }
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    64
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    65
    static int test(boolean unswitch) {
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    66
        int stop = 1;
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    67
        for (; stop < 3; stop *= 4) {
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    68
        }
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    69
        return test_helper(stop, unswitch);
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    70
    }
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    71
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    72
    public static void main(String[] args) {
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    73
        for (int i = 0; i < 20000; i++) {
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    74
            test_helper(10, i%2 == 0);
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    75
            test(i%2 == 0);
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    76
        }
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    77
    }
da3efc8ed2cb 8078426: mb/jvm/compiler/InterfaceCalls/testAC2 - assert(predicate_proj == 0L) failed: only one predicate entry expected
roland
parents:
diff changeset
    78
}