hotspot/test/compiler/c1/Test7090976.java
author stsmirno
Mon, 17 Oct 2016 18:54:12 -0400
changeset 41705 332239c052cc
parent 40059 c2304140ed64
permissions -rw-r--r--
8165687: Fix license and copyright headers in jd9 under hotspot/test Summary: Legal notices and Oracle copyrights were updated (white and blank space, commas) in tests files for uniformity to meet Oracle requirements. Reviewed-by: dholmes, iris Contributed-by: Stanislav Smirnov <stanislav.smirnov@oracle.com>, Vassili Igouchkine <vassili.igouchkine@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11635
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
     1
/*
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
     2
 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
     4
 *
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
     8
 *
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    13
 * accompanied this code).
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    14
 *
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    18
 *
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    21
 * questions.
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    22
 */
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    23
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    24
/**
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    25
 * @test
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    26
 * @bug 7090976
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    27
 * @summary Eclipse/CDT causes a JVM crash while indexing C++ code
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    28
 *
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    29
 * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    30
 *      compiler.c1.Test7090976
11635
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    31
 */
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    32
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    33
package compiler.c1;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    34
11635
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    35
public class Test7090976 {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    36
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    37
    static interface I1 {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    38
        public void m1();
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    39
    };
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    40
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    41
    static interface I2 {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    42
        public void m2();
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    43
    };
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    44
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    45
    static interface I extends I1,I2 {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    46
    }
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    47
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    48
    static class A implements I1 {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    49
        int v = 0;
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    50
        int v2;
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    51
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    52
        public void m1() {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    53
            v2 = v;
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    54
        }
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    55
    }
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    56
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    57
    static class B implements I2 {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    58
        Object v = new Object();
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    59
        Object v2;
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    60
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    61
        public void m2() {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    62
            v2 = v;
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    63
        }
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    64
    }
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    65
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    66
    private void test(A a)
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    67
    {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    68
        if (a instanceof I) {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    69
            I i = (I)a;
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    70
            i.m1();
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    71
            i.m2();
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    72
        }
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    73
    }
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    74
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    75
    public static void main(String[] args)
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    76
    {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    77
        Test7090976 t = new Test7090976();
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    78
        A a = new A();
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    79
        B b = new B();
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    80
        for (int i = 0; i < 10000; i++) {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    81
            t.test(a);
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    82
        }
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    83
    }
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    84
}