hotspot/test/compiler/arraycopy/TestArrayCloneBadAssert.java
author thartmann
Thu, 04 Aug 2016 10:34:34 +0200
changeset 40365 3791c1b34e36
parent 40059 c2304140ed64
permissions -rw-r--r--
8136818: Test compiler/arraycopy/TestEliminatedArrayCopyDeopt.java fails with "m1 failed" Summary: Added missing Op_StoreB check to ArrayCopyNode::may_modify_helper(). Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29345
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
     1
/*
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
     4
 *
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
     8
 *
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    13
 * accompanied this code).
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    14
 *
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    18
 *
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    21
 * questions.
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    22
 */
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    23
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    24
/*
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    25
 * @test
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    26
 * @bug 8073792
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    27
 * @summary assert broken when array size becomes known during igvn
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    28
 *
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 29345
diff changeset
    29
 * @run main/othervm -Xcomp
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 29345
diff changeset
    30
 *      -XX:CompileCommand=compileonly,compiler.arraycopy.TestArrayCloneBadAssert::m
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 29345
diff changeset
    31
 *      compiler.arraycopy.TestArrayCloneBadAssert
29345
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    32
 */
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    33
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 29345
diff changeset
    34
package compiler.arraycopy;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 29345
diff changeset
    35
29345
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    36
public class TestArrayCloneBadAssert {
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    37
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    38
    static final int[] array = new int[5];
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    39
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    40
    static int[] m(int[] arr) {
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    41
        int i = 0;
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    42
        for (; i < 2; i++) {
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    43
        }
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    44
        if (i == 2) {
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    45
            arr = array;
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    46
        }
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    47
        return arr.clone();
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    48
    }
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    49
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    50
    static public void main(String[] args) {
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    51
        int[] arr = new int[5];
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    52
        m(arr);
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    53
    }
e8f6ba59748f 8073792: assert((get_length_if_constant(phase) == -1) == !ary_src->size()->is_con()) failed: inconsistent
roland
parents:
diff changeset
    54
}