hotspot/test/compiler/types/TypeSpeculation.java
author roland
Thu, 06 Mar 2014 11:11:04 +0100
changeset 23208 4c37d91b8b09
parent 22237 e9d7daf0d91b
child 40059 c2304140ed64
permissions -rw-r--r--
8032633: Enable type speculation by default Summary: enable type speculation Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21099
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
     1
/*
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
     4
 *
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
     8
 *
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    13
 * accompanied this code).
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    14
 *
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    18
 *
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    21
 * questions.
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    22
 */
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    23
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    24
/*
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    25
 * @test
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    26
 * @bug 8024070
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    27
 * @summary Test that type speculation doesn't cause incorrect execution
23208
4c37d91b8b09 8032633: Enable type speculation by default
roland
parents: 22237
diff changeset
    28
 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation TypeSpeculation
21099
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    29
 *
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    30
 */
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    31
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    32
public class TypeSpeculation {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    33
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    34
    interface I {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    35
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    36
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    37
    static class A {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    38
        int m() {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    39
            return 1;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    40
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    41
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    42
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    43
    static class B extends A implements I {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    44
        int m() {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    45
            return 2;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    46
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    47
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    48
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    49
    static class C extends B {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    50
        int m() {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    51
            return 3;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    52
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    53
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    54
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    55
    static int test1_invokevirtual(A a) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    56
        return a.m();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    57
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    58
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    59
    static int test1_1(A a) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    60
        return test1_invokevirtual(a);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    61
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    62
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    63
    static boolean test1() {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    64
        A a = new A();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    65
        B b = new B();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    66
        C c = new C();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    67
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    68
        // pollute profile at test1_invokevirtual to make sure the
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    69
        // compiler cannot rely on it
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    70
        for (int i = 0; i < 5000; i++) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    71
            test1_invokevirtual(a);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    72
            test1_invokevirtual(b);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    73
            test1_invokevirtual(c);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    74
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    75
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    76
        // profiling + speculation should make test1_invokevirtual
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    77
        // inline A.m() with a guard
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    78
        for (int i = 0; i < 20000; i++) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    79
            int res = test1_1(b);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    80
            if (res != b.m()) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    81
                System.out.println("test1 failed with class B");
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    82
                return false;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    83
            }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    84
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    85
        // check that the guard works as expected by passing a
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    86
        // different type
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    87
        int res = test1_1(a);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    88
        if (res != a.m()) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    89
            System.out.println("test1 failed with class A");
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    90
            return false;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    91
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    92
        return true;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    93
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    94
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    95
    static int test2_invokevirtual(A a) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    96
        return a.m();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    97
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    98
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
    99
    static int test2_1(A a, boolean t) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   100
        A aa;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   101
        if (t) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   102
            aa = (B)a;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   103
        } else {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   104
            aa = a;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   105
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   106
        // if a of type B is passed to test2_1, the static type of aa
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   107
        // here is no better than A but the profiled type is B so this
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   108
        // should inline
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   109
        return test2_invokevirtual(aa);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   110
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   111
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   112
    static boolean test2() {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   113
        A a = new A();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   114
        B b = new B();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   115
        C c = new C();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   116
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   117
        // pollute profile at test2_invokevirtual to make sure the
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   118
        // compiler cannot rely on it
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   119
        for (int i = 0; i < 5000; i++) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   120
            test2_invokevirtual(a);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   121
            test2_invokevirtual(b);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   122
            test2_invokevirtual(c);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   123
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   124
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   125
        // profiling + speculation should make test2_invokevirtual
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   126
        // inline A.m() with a guard
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   127
        for (int i = 0; i < 20000; i++) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   128
            int res = test2_1(b, (i % 2) == 0);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   129
            if (res != b.m()) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   130
                System.out.println("test2 failed with class B");
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   131
                return false;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   132
            }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   133
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   134
        // check that the guard works as expected by passing a
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   135
        // different type
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   136
        int res = test2_1(a, false);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   137
        if (res != a.m()) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   138
            System.out.println("test2 failed with class A");
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   139
            return false;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   140
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   141
        return true;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   142
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   143
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   144
    static int test3_invokevirtual(A a) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   145
        return a.m();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   146
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   147
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   148
    static void test3_2(A a) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   149
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   150
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   151
    static int test3_1(A a, int i) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   152
        if (i == 0) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   153
            return 0;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   154
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   155
        // If we come here and a is of type B but parameter profiling
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   156
        // is polluted, both branches of the if below should have
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   157
        // profiling that tell us and inlining of the virtual call
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   158
        // should happen
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   159
        if (i == 1) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   160
            test3_2(a);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   161
        } else {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   162
            test3_2(a);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   163
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   164
        return test3_invokevirtual(a);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   165
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   166
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   167
    static boolean test3() {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   168
        A a = new A();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   169
        B b = new B();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   170
        C c = new C();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   171
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   172
        // pollute profile at test3_invokevirtual and test3_1 to make
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   173
        // sure the compiler cannot rely on it
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   174
        for (int i = 0; i < 3000; i++) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   175
            test3_invokevirtual(a);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   176
            test3_invokevirtual(b);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   177
            test3_invokevirtual(c);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   178
            test3_1(a, 0);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   179
            test3_1(b, 0);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   180
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   181
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   182
        // profiling + speculation should make test3_invokevirtual
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   183
        // inline A.m() with a guard
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   184
        for (int i = 0; i < 20000; i++) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   185
            int res = test3_1(b, (i % 2) + 1);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   186
            if (res != b.m()) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   187
                System.out.println("test3 failed with class B");
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   188
                return false;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   189
            }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   190
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   191
        // check that the guard works as expected by passing a
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   192
        // different type
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   193
        int res = test3_1(a, 1);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   194
        if (res != a.m()) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   195
            System.out.println("test3 failed with class A");
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   196
            return false;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   197
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   198
        return true;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   199
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   200
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   201
    // Mix 2 incompatible profiled types
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   202
    static int test4_invokevirtual(A a) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   203
        return a.m();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   204
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   205
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   206
    static void test4_2(A a) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   207
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   208
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   209
    static int test4_1(A a, boolean b) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   210
        if (b) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   211
            test4_2(a);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   212
        } else {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   213
            test4_2(a);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   214
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   215
        // shouldn't inline
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   216
        return test4_invokevirtual(a);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   217
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   218
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   219
    static boolean test4() {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   220
        A a = new A();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   221
        B b = new B();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   222
        C c = new C();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   223
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   224
        // pollute profile at test3_invokevirtual and test3_1 to make
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   225
        // sure the compiler cannot rely on it
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   226
        for (int i = 0; i < 3000; i++) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   227
            test4_invokevirtual(a);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   228
            test4_invokevirtual(b);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   229
            test4_invokevirtual(c);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   230
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   231
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   232
        for (int i = 0; i < 20000; i++) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   233
            if ((i % 2) == 0) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   234
                int res = test4_1(a, true);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   235
                if (res != a.m()) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   236
                    System.out.println("test4 failed with class A");
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   237
                    return false;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   238
                }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   239
            } else {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   240
                int res = test4_1(b, false);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   241
                if (res != b.m()) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   242
                    System.out.println("test4 failed with class B");
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   243
                    return false;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   244
                }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   245
            }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   246
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   247
        return true;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   248
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   249
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   250
    // Mix one profiled type with an incompatible type
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   251
    static int test5_invokevirtual(A a) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   252
        return a.m();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   253
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   254
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   255
    static void test5_2(A a) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   256
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   257
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   258
    static int test5_1(A a, boolean b) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   259
        if (b) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   260
            test5_2(a);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   261
        } else {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   262
            A aa = (B)a;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   263
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   264
        // shouldn't inline
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   265
        return test5_invokevirtual(a);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   266
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   267
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   268
    static boolean test5() {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   269
        A a = new A();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   270
        B b = new B();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   271
        C c = new C();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   272
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   273
        // pollute profile at test3_invokevirtual and test3_1 to make
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   274
        // sure the compiler cannot rely on it
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   275
        for (int i = 0; i < 3000; i++) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   276
            test5_invokevirtual(a);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   277
            test5_invokevirtual(b);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   278
            test5_invokevirtual(c);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   279
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   280
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   281
        for (int i = 0; i < 20000; i++) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   282
            if ((i % 2) == 0) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   283
                int res = test5_1(a, true);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   284
                if (res != a.m()) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   285
                    System.out.println("test5 failed with class A");
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   286
                    return false;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   287
                }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   288
            } else {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   289
                int res = test5_1(b, false);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   290
                if (res != b.m()) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   291
                    System.out.println("test5 failed with class B");
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   292
                    return false;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   293
                }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   294
            }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   295
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   296
        return true;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   297
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   298
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   299
    // Mix incompatible profiled types
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   300
    static void test6_2(Object o) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   301
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   302
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   303
    static Object test6_1(Object o, boolean b) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   304
        if (b) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   305
            test6_2(o);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   306
        } else {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   307
            test6_2(o);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   308
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   309
        return o;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   310
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   311
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   312
    static boolean test6() {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   313
        A a = new A();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   314
        A[] aa = new A[10];
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   315
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   316
        for (int i = 0; i < 20000; i++) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   317
            if ((i % 2) == 0) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   318
                test6_1(a, true);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   319
            } else {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   320
                test6_1(aa, false);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   321
            }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   322
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   323
        return true;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   324
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   325
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   326
    // Mix a profiled type with an incompatible type
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   327
    static void test7_2(Object o) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   328
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   329
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   330
    static Object test7_1(Object o, boolean b) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   331
        if (b) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   332
            test7_2(o);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   333
        } else {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   334
            Object oo = (A[])o;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   335
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   336
        return o;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   337
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   338
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   339
    static boolean test7() {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   340
        A a = new A();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   341
        A[] aa = new A[10];
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   342
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   343
        for (int i = 0; i < 20000; i++) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   344
            if ((i % 2) == 0) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   345
                test7_1(a, true);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   346
            } else {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   347
                test7_1(aa, false);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   348
            }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   349
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   350
        return true;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   351
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   352
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   353
    // Mix a profiled type with an interface
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   354
    static void test8_2(Object o) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   355
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   356
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   357
    static I test8_1(Object o) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   358
        test8_2(o);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   359
        return (I)o;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   360
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   361
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   362
    static boolean test8() {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   363
        A a = new A();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   364
        B b = new B();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   365
        C c = new C();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   366
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   367
        for (int i = 0; i < 20000; i++) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   368
            test8_1(b);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   369
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   370
        return true;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   371
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   372
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   373
    // Mix a profiled type with a constant
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   374
    static void test9_2(Object o) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   375
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   376
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   377
    static Object test9_1(Object o, boolean b) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   378
        Object oo;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   379
        if (b) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   380
            test9_2(o);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   381
            oo = o;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   382
        } else {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   383
            oo = "some string";
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   384
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   385
        return oo;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   386
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   387
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   388
    static boolean test9() {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   389
        A a = new A();
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   390
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   391
        for (int i = 0; i < 20000; i++) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   392
            if ((i % 2) == 0) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   393
                test9_1(a, true);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   394
            } else {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   395
                test9_1(a, false);
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   396
            }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   397
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   398
        return true;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   399
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   400
22237
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   401
    // java/lang/Object:AnyNull:exact *,iid=top
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   402
    // meets
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   403
    // stable:bottom[int:max..0]:NotNull *
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   404
    static void test10_4(Object o) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   405
    }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   406
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   407
    static void test10_3(Object o, boolean b) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   408
        if (b) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   409
            test10_4(o);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   410
        }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   411
    }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   412
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   413
    static void test10_2(Object o, boolean b1, boolean b2) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   414
        if (b1) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   415
            test10_3(o, b2);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   416
        }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   417
    }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   418
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   419
    static void test10_1(B[] b, boolean b1, boolean b2) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   420
        test10_2(b, b1, b2);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   421
    }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   422
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   423
    static boolean test10() {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   424
        Object o = new Object();
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   425
        A[] a = new A[10];
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   426
        B[] b = new B[10];
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   427
        B[] c = new C[10];
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   428
        for (int i = 0; i < 20000; i++) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   429
            test10_1(b, false, false);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   430
            test10_1(c, false, false);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   431
            test10_2(a, true, false);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   432
            test10_3(o, true);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   433
        }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   434
        return true;
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   435
    }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   436
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   437
    // stable:TypeSpeculation$B:TopPTR *,iid=top[int:max..0]:TopPTR *,iid=top
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   438
    // meets
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   439
    // java/lang/Object:AnyNull:exact *,iid=top
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   440
    static void test11_3(Object o) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   441
    }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   442
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   443
    static void test11_2(Object o, boolean b) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   444
        if (b) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   445
            test11_3(o);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   446
        }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   447
    }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   448
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   449
    static void test11_1(B[] b, boolean bb) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   450
        test11_2(b, bb);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   451
    }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   452
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   453
    static boolean test11() {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   454
        Object o = new Object();
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   455
        B[] b = new B[10];
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   456
        B[] c = new C[10];
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   457
        for (int i = 0; i < 20000; i++) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   458
            test11_1(b, false);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   459
            test11_1(c, false);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   460
            test11_2(o, true);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   461
        }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   462
        return true;
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   463
    }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   464
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   465
    // TypeSpeculation$I *
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   466
    // meets
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   467
    // java/lang/Object:AnyNull *,iid=top
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   468
    static void test12_3(Object o) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   469
    }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   470
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   471
    static void test12_2(Object o, boolean b) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   472
        if (b) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   473
            test12_3(o);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   474
        }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   475
    }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   476
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   477
    static void test12_1(I i, boolean b) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   478
        test12_2(i, b);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   479
    }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   480
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   481
    static boolean test12() {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   482
        Object o = new Object();
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   483
        B b = new B();
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   484
        C c = new C();
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   485
        for (int i = 0; i < 20000; i++) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   486
            test12_1(b, false);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   487
            test12_1(c, false);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   488
            test12_2(o, true);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   489
        }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   490
        return true;
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   491
    }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   492
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   493
    // stable:bottom[int:max..0]:NotNull *
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   494
    // meets
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   495
    // stable:TypeSpeculation$A:TopPTR *,iid=top[int:max..0]:AnyNull:exact *,iid=top
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   496
    static Object test13_3(Object o, boolean b) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   497
        Object oo;
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   498
        if (b) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   499
            oo = o;
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   500
        } else {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   501
            oo = new A[10];
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   502
        }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   503
        return oo;
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   504
    }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   505
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   506
    static void test13_2(Object o, boolean b1, boolean b2) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   507
        if (b1) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   508
            test13_3(o, b2);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   509
        }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   510
    }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   511
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   512
    static void test13_1(B[] b, boolean b1, boolean b2) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   513
        test13_2(b, b1, b2);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   514
    }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   515
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   516
    static boolean test13() {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   517
        A[] a = new A[10];
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   518
        B[] b = new B[10];
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   519
        B[] c = new C[10];
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   520
        for (int i = 0; i < 20000; i++) {
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   521
            test13_1(b, false, false);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   522
            test13_1(c, false, false);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   523
            test13_2(a, true, (i%2) == 0);
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   524
        }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   525
        return true;
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   526
    }
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   527
21099
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   528
    static public void main(String[] args) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   529
        boolean success = true;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   530
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   531
        success = test1() && success;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   532
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   533
        success = test2() && success;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   534
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   535
        success = test3() && success;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   536
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   537
        success = test4() && success;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   538
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   539
        success = test5() && success;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   540
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   541
        success = test6() && success;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   542
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   543
        success = test7() && success;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   544
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   545
        success = test8() && success;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   546
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   547
        success = test9() && success;
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   548
22237
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   549
        success = test10() && success;
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   550
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   551
        success = test11() && success;
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   552
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   553
        success = test12() && success;
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   554
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   555
        success = test13() && success;
e9d7daf0d91b 8028536: Test cases to cover type system fixes pushed with 8024070
roland
parents: 21099
diff changeset
   556
21099
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   557
        if (success) {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   558
            System.out.println("TEST PASSED");
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   559
        } else {
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   560
            throw new RuntimeException("TEST FAILED: erroneous bound check elimination");
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   561
        }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   562
    }
46e6bbecd9e5 8024070: C2 needs some form of type speculation
roland
parents:
diff changeset
   563
}