4049N/A/*
4049N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
4049N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4049N/A *
4049N/A * This code is free software; you can redistribute it and/or modify it
4049N/A * under the terms of the GNU General Public License version 2 only, as
4049N/A * published by the Free Software Foundation.
4049N/A *
4049N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4049N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4049N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4049N/A * version 2 for more details (a copy is included in the LICENSE file that
4049N/A * accompanied this code).
4049N/A *
4049N/A * You should have received a copy of the GNU General Public License version
4049N/A * 2 along with this work; if not, write to the Free Software Foundation,
4049N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4049N/A *
4049N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4049N/A * or visit www.oracle.com if you need additional information or have any
4049N/A * questions.
4049N/A *
4049N/A */
4049N/A
4049N/A/**
4049N/A * @test
4049N/A * @bug 8002069
4049N/A * @summary Assert failed in C2: assert(field->edge_count() > 0) failed: sanity
4049N/A *
4049N/A * @run main/othervm -Xmx32m -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:CompileCommand=exclude,Test8002069.dummy Test8002069
4049N/A */
4049N/A
4049N/Aabstract class O {
4049N/A int f;
4049N/A public O() { f = 5; }
4049N/A abstract void put(int i);
4049N/A public int foo(int i) {
4049N/A put(i);
4049N/A return i;
4049N/A }
4049N/A};
4049N/A
4049N/Aclass A extends O {
4049N/A int[] a;
4049N/A public A(int s) {
4049N/A a = new int[s];
4049N/A }
4049N/A public void put(int i) {
4049N/A a[i%a.length] = i;
4049N/A }
4049N/A}
4049N/A
4049N/Aclass B extends O {
4049N/A int sz;
4049N/A int[] a;
4049N/A public B(int s) {
4049N/A sz = s;
4049N/A a = new int[s];
4049N/A }
4049N/A public void put(int i) {
4049N/A a[i%sz] = i;
4049N/A }
4049N/A}
4049N/A
4049N/Apublic class Test8002069 {
4049N/A public static void main(String args[]) {
4049N/A int sum = 0;
4049N/A for (int i=0; i<8000; i++) {
4049N/A sum += test1(i);
4049N/A }
4049N/A for (int i=0; i<100000; i++) {
4049N/A sum += test2(i);
4049N/A }
4049N/A System.out.println("PASSED. sum = " + sum);
4049N/A }
4049N/A
4049N/A private O o;
4049N/A
4049N/A private int foo(int i) {
4049N/A return o.foo(i);
4049N/A }
4049N/A static int test1(int i) {
4049N/A Test8002069 t = new Test8002069();
4049N/A t.o = new A(5);
4049N/A return t.foo(i);
4049N/A }
4049N/A static int test2(int i) {
4049N/A Test8002069 t = new Test8002069();
4049N/A t.o = new B(5);
4049N/A dummy(i);
4049N/A return t.foo(i);
4049N/A }
4049N/A
4049N/A static int dummy(int i) {
4049N/A return i*2;
4049N/A }
4049N/A}
4049N/A