hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyDeopt.java
author dcubed
Mon, 18 Jul 2016 14:20:30 -0700
changeset 39978 d79e47b2d2d9
parent 39254 fb4492288b01
child 40072 08c515bbbdea
permissions -rw-r--r--
8161173: quarantine compiler/arraycopy/TestEliminatedArrayCopyDeopt.java 8161174: quarantine gc/stress/TestStressG1Humongous.java on 32-bit 8161175: quarantine serviceability/dcmd/compiler/CompilerQueueTest.java on 32-bit Reviewed-by: sspitsyn, jmasa, gtriantafill
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32370
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
     1
/*
39254
fb4492288b01 8156760: VM crashes if -XX:-ReduceInitialCardMarks is set
thartmann
parents: 32370
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
32370
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
     4
 *
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
     8
 *
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    13
 * accompanied this code).
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    14
 *
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    18
 *
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    21
 * questions.
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    22
 */
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    23
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    24
/*
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    25
 * @test
39254
fb4492288b01 8156760: VM crashes if -XX:-ReduceInitialCardMarks is set
thartmann
parents: 32370
diff changeset
    26
 * @bug 8130847 8156760
32370
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    27
 * @summary Eliminated instance/array written to by an array copy variant must be correctly initialized when reallocated at a deopt
39978
d79e47b2d2d9 8161173: quarantine compiler/arraycopy/TestEliminatedArrayCopyDeopt.java
dcubed
parents: 39254
diff changeset
    28
 * @ignore 8136818
32370
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    29
 * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestEliminatedArrayCopyDeopt
39254
fb4492288b01 8156760: VM crashes if -XX:-ReduceInitialCardMarks is set
thartmann
parents: 32370
diff changeset
    30
 * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:+IgnoreUnrecognizedVMOptions -XX:-ReduceInitialCardMarks TestEliminatedArrayCopyDeopt
32370
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    31
 */
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    32
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    33
// Test that if an ArrayCopy node is eliminated because it doesn't
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    34
// escape, then the correct field/array element values are captured so
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    35
// on a deoptimization, when the object/array is reallocated, it is
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    36
// correctly initialized
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    37
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    38
public class TestEliminatedArrayCopyDeopt {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    39
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    40
    static class A implements Cloneable {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    41
        int f0;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    42
        int f1;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    43
        int f2;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    44
        int f3;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    45
        int f4;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    46
        int f5;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    47
        int f6;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    48
        int f7;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    49
        int f8;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    50
        int f9;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    51
        int f10;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    52
        int f11;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    53
        int f12;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    54
        int f13;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    55
        int f14;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    56
        int f15;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    57
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    58
        public Object clone() throws CloneNotSupportedException {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    59
            return super.clone();
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    60
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    61
    }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    62
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    63
    // Clone
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    64
    static boolean m1(A a, boolean flag) throws CloneNotSupportedException {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    65
        A c = (A)a.clone();
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    66
        if (flag) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    67
            // never taken branch that causes the deoptimization
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    68
            if (c.f0 != 0x42) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    69
                return false;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    70
            }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    71
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    72
        return true;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    73
    }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    74
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    75
    // Array clone
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    76
    static int[] m2_src = null;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    77
    static boolean m2(boolean flag) throws CloneNotSupportedException {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    78
        int[] src  = new int[10];
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    79
        m2_src = src;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    80
        for (int i = 0; i < src.length; i++) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    81
            src[i] = 0x42+i;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    82
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    83
        int[] c = (int[])src.clone();
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    84
        if (flag) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    85
            for (int i = 0; i < c.length; i++) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    86
                if (c[i] != src[i]) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    87
                    return false;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    88
                }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    89
            }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    90
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    91
        return true;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    92
    }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    93
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    94
    // Array copy
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    95
    static boolean m3(int[] src, boolean flag) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    96
        int[] dst = new int[10];
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    97
        System.arraycopy(src, 0, dst, 0, 10);
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    98
        if (flag) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
    99
            for (int i = 0; i < dst.length; i++) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   100
                if (dst[i] != src[i]) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   101
                    return false;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   102
                }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   103
            }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   104
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   105
        return true;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   106
    }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   107
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   108
    // Array copy of subrange
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   109
    static boolean m4(int[] src, boolean flag) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   110
        int[] dst = new int[10];
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   111
        dst[0] = 0x42;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   112
        dst[1] = 0x42 - 1;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   113
        dst[2] = 0x42 - 2;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   114
        dst[8] = 0x42 - 8;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   115
        dst[9] = 0x42 - 9;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   116
        int src_off = 2;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   117
        int dst_off = 3;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   118
        int len = 5;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   119
        System.arraycopy(src, src_off, dst, dst_off, len);
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   120
        if (flag) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   121
            for (int i = 0; i < dst.length; i++) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   122
                if (i >= dst_off &&  i < dst_off + len) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   123
                    if (dst[i] != src[i - dst_off + src_off]) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   124
                        return false;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   125
                    }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   126
                } else {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   127
                    if (dst[i] != 0x42-i) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   128
                        return false;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   129
                    }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   130
                }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   131
            }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   132
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   133
        return true;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   134
    }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   135
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   136
    // Array copy with Phi
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   137
    static boolean m5(int[] src, boolean flag1, boolean flag2) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   138
        int[] dst = new int[10];
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   139
        if (flag1) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   140
            System.arraycopy(src, 0, dst, 0, 10);
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   141
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   142
        if (flag2) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   143
            for (int i = 0; i < dst.length; i++) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   144
                if (dst[i] != src[i]) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   145
                    return false;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   146
                }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   147
            }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   148
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   149
        return true;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   150
    }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   151
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   152
    static public void main(String[] args) throws Exception {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   153
        boolean success = true;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   154
        A a = new A();
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   155
        a.f0 = 0x42;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   156
        for (int i = 0; i < 20000; i++) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   157
            m1(a, false);
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   158
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   159
        if (!m1(a, true)) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   160
            System.out.println("m1 failed");
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   161
            success = false;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   162
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   163
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   164
        for (int i = 0; i < 20000; i++) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   165
            m2(false);
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   166
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   167
        if (!m2(true)) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   168
            System.out.println("m2 failed");
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   169
            success = false;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   170
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   171
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   172
        int[] src = new int[10];
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   173
        for (int i = 0; i < src.length; i++) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   174
            src[i] = 0x42+i;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   175
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   176
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   177
        for (int i = 0; i < 20000; i++) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   178
            m3(src, false);
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   179
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   180
        if (!m3(src, true)) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   181
            System.out.println("m3 failed");
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   182
            success = false;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   183
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   184
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   185
        for (int i = 0; i < 20000; i++) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   186
            m4(src, false);
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   187
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   188
        if (!m4(src, true)) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   189
            System.out.println("m4 failed");
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   190
            success = false;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   191
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   192
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   193
        for (int i = 0; i < 20000; i++) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   194
            m5(src, i%2 == 0, false);
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   195
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   196
        if (!m5(src, true, true)) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   197
            System.out.println("m4 failed");
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   198
            success = false;
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   199
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   200
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   201
        if (!success) {
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   202
            throw new RuntimeException("Test failed");
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   203
        }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   204
    }
38b7b5772b4f 8130847: Cloned object's fields observed as null after C2 escape analysis
roland
parents:
diff changeset
   205
}