hotspot/test/compiler/intrinsics/object/TestClone.java
author vdeshpande
Fri, 26 Aug 2016 12:20:09 -0700
changeset 41362 e09e871860a7
parent 40059 c2304140ed64
child 40631 ed82623d7831
permissions -rw-r--r--
8154122: Intrinsify fused mac operations Summary: added FMA intrinsics on x86 Reviewed-by: kvn, aph, darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24945
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
     1
/*
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 24945
diff changeset
     2
 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
24945
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
     4
 *
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
     8
 *
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    13
 * accompanied this code).
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    14
 *
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    18
 *
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    21
 * questions.
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    22
 *
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    23
 */
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    24
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    25
/*
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    26
 * @test
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    27
 * @bug 8033626
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    28
 * @summary assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
38152
80e5da81fb2c 8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents: 30604
diff changeset
    29
 * @modules java.base/jdk.internal.misc
24945
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    30
 * @library /testlibrary
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    31
 *
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    32
 * @run main/othervm -XX:-TieredCompilation -Xbatch
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    33
 *      -XX:CompileCommand=compileonly,compiler.intrinsics.object.TestClone::f
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    34
 *      compiler.intrinsics.object.TestClone
24945
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    35
 */
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    36
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    37
package compiler.intrinsics.object;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    38
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 24945
diff changeset
    39
import jdk.test.lib.Asserts;
24945
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    40
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    41
public class TestClone implements Cloneable {
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    42
    static class A extends TestClone {}
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    43
    static class B extends TestClone {
24945
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    44
        public B clone() {
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    45
            return (B)TestClone.b;
24945
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    46
        }
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    47
    }
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    48
    static class C extends TestClone {
24945
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    49
        public C clone() {
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    50
            return (C)TestClone.c;
24945
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    51
        }
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    52
    }
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    53
    static class D extends TestClone {
24945
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    54
        public D clone() {
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    55
            return (D)TestClone.d;
24945
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    56
        }
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    57
    }
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    58
    static TestClone a = new A(), b = new B(), c = new C(), d = new D();
24945
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    59
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    60
    public static Object f(TestClone o) throws CloneNotSupportedException {
24945
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    61
        // Polymorphic call site: >90% Object::clone / <10% other methods
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    62
        return o.clone();
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    63
    }
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    64
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    65
    public static void main(String[] args) throws Exception {
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    66
        TestClone[] params1 = {a, a, a, a, a, a, a, a, a, a, a,
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    67
                               a, a, a, a, a, a, a, a, a, a, a,
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    68
                               a, a, a, a, a, a, a, a, a, a, a,
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    69
                               b, c, d};
24945
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    70
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    71
        for (int i = 0; i < 15000; i++) {
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    72
            f(params1[i % params1.length]);
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    73
        }
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    74
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    75
        Asserts.assertTrue(f(a) != a);
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    76
        Asserts.assertTrue(f(b) == b);
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    77
        Asserts.assertTrue(f(c) == c);
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    78
        Asserts.assertTrue(f(d) == d);
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    79
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    80
        try {
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    81
            f(null);
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    82
            throw new AssertionError("");
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    83
        } catch (NullPointerException e) { /* expected */ }
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    84
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    85
        System.out.println("TEST PASSED");
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    86
    }
6df48e563632 8033626: assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place
vlivanov
parents:
diff changeset
    87
}