test/hotspot/jtreg/compiler/arraycopy/TestEliminatedCloneBadMemEdge.java
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 41699 hotspot/test/compiler/arraycopy/TestEliminatedCloneBadMemEdge.java@fcefeb90b468
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41699
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
     1
/*
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
     2
 * Copyright (c) 2016, Red Hat, Inc. All rights reserved.
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
     4
 *
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
     8
 *
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    13
 * accompanied this code).
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    14
 *
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    18
 *
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    21
 * questions.
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    22
 */
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    23
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    24
/**
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    25
 * @test
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    26
 * @bug 8166836
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    27
 * @summary Elimination of clone's ArrayCopyNode may make compilation fail silently
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    28
 * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestEliminatedCloneBadMemEdge::not_inlined TestEliminatedCloneBadMemEdge
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    29
 *
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    30
 */
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    31
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    32
public class TestEliminatedCloneBadMemEdge implements Cloneable {
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    33
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    34
    int f1;
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    35
    int f2;
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    36
    int f3;
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    37
    int f4;
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    38
    int f5;
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    39
    int f6;
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    40
    int f7;
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    41
    int f8;
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    42
    int f9;
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    43
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    44
    static void not_inlined() {}
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    45
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    46
    static void test(TestEliminatedCloneBadMemEdge o1) throws CloneNotSupportedException {
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    47
        TestEliminatedCloneBadMemEdge o2 = (TestEliminatedCloneBadMemEdge)o1.clone();
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    48
        not_inlined();
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    49
        o2.f1 = 0x42;
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    50
    }
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    51
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    52
    static public void main(String[] args) throws CloneNotSupportedException {
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    53
        TestEliminatedCloneBadMemEdge o1 = new TestEliminatedCloneBadMemEdge();
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    54
        for (int i = 0; i < 20000; i++) {
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    55
            test(o1);
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    56
        }
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    57
    }
fcefeb90b468 8166836: Elimination of clone's ArrayCopyNode may make compilation fail silently
roland
parents:
diff changeset
    58
}