hotspot/test/compiler/7090976/Test7090976.java
author jlaskey
Tue, 23 Jul 2013 12:00:29 -0300
changeset 19089 51cfdcf21d35
parent 11635 5a16856f871f
permissions -rw-r--r--
8021130: Comments need to be tokens Reviewed-by: lagergren, attila Contributed-by: james.laskey@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
/**
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    26
 * @test
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    27
 * @bug 7090976
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    28
 * @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
    29
 *
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    30
 * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement Test7090976
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
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    33
public class Test7090976 {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    34
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    35
    static interface I1 {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    36
        public void m1();
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    37
    };
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    38
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    39
    static interface I2 {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    40
        public void m2();
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    41
    };
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    42
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    43
    static interface I extends I1,I2 {
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
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    46
    static class A implements I1 {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    47
        int v = 0;
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    48
        int v2;
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    49
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    50
        public void m1() {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    51
            v2 = v;
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    52
        }
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    53
    }
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
    static class B implements I2 {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    56
        Object v = new Object();
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    57
        Object v2;
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    58
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    59
        public void m2() {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    60
            v2 = v;
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    61
        }
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    62
    }
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
    private void test(A a)
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
        if (a instanceof I) {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    67
            I i = (I)a;
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    68
            i.m1();
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    69
            i.m2();
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    70
        }
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    71
    }
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
    public static void main(String[] args)
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
        Test7090976 t = new Test7090976();
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    76
        A a = new A();
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    77
        B b = new B();
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    78
        for (int i = 0; i < 10000; i++) {
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    79
            t.test(a);
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    80
        }
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    81
    }
5a16856f871f 7090976: Eclipse/CDT causes a JVM crash while indexing C++ code
roland
parents:
diff changeset
    82
}