comparison test/compiler/7090976/Test7090976.java @ 4871:f067b4e0e04b

7090976: Eclipse/CDT causes a JVM crash while indexing C++ code Summary: too optimistic inlining decision confuses local value numbering. Reviewed-by: never
author roland
date Wed, 01 Feb 2012 10:36:58 +0100
parents
children
comparison
equal deleted inserted replaced
4870:2f5980b127e3 4871:f067b4e0e04b
1 /*
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 /**
26 * @test
27 * @bug 7090976
28 * @summary Eclipse/CDT causes a JVM crash while indexing C++ code
29 *
30 * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement Test7090976
31 */
32
33 public class Test7090976 {
34
35 static interface I1 {
36 public void m1();
37 };
38
39 static interface I2 {
40 public void m2();
41 };
42
43 static interface I extends I1,I2 {
44 }
45
46 static class A implements I1 {
47 int v = 0;
48 int v2;
49
50 public void m1() {
51 v2 = v;
52 }
53 }
54
55 static class B implements I2 {
56 Object v = new Object();
57 Object v2;
58
59 public void m2() {
60 v2 = v;
61 }
62 }
63
64 private void test(A a)
65 {
66 if (a instanceof I) {
67 I i = (I)a;
68 i.m1();
69 i.m2();
70 }
71 }
72
73 public static void main(String[] args)
74 {
75 Test7090976 t = new Test7090976();
76 A a = new A();
77 B b = new B();
78 for (int i = 0; i < 10000; i++) {
79 t.test(a);
80 }
81 }
82 }