0N/A/*
0N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
0N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0N/A * or visit www.oracle.com if you need additional information or have any
0N/A * questions.
0N/A *
0N/A */
0N/A
0N/A/**
0N/A * @test
0N/A * @bug 6910605
0N/A * @summary C2: NullPointerException/ClassCaseException is thrown when C2 with DeoptimizeALot is used
0N/A *
0N/A * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot -Xbatch Test
0N/A *
0N/A * original test: nsk/coverage/runtime/runtime007
0N/A */
0N/A
0N/Aimport java.io.*;
0N/A
0N/Apublic class Test {
0N/A public static int buf=0;
0N/A
0N/A public static void main( String argv[] ) {
0N/A System.exit(run(argv, System.out)+95);
0N/A }
0N/A
0N/A public static int run(String argv[],PrintStream out) {
0N/A int ret=0, retx=0, bad=0;
0N/A
0N/A for( int i=0; (i < 100000) && (bad < 10) ; i++ ) {
0N/A retx = OptoRuntime_f2i_Type(out);
0N/A ret += retx;
0N/A if( retx !=0 ) {
0N/A out.println("i="+i);
0N/A bad++;
0N/A }
0N/A }
0N/A return ret==0 ? 0 : 2 ;
0N/A }
0N/A
0N/A public static int OptoRuntime_f2i_Type(PrintStream out) {
0N/A int c1=2, c2=3, c3=4, c4=5, c5=6;
0N/A int j=0, k=0;
0N/A try {
0N/A int[][] iii=(int[][])(new int[c1][c2]);
0N/A
0N/A for( j=0; j<c1; j++ ) {
0N/A for( k=0; k<c2; k++ ) {
0N/A iii[j][k]=(int)((float)(j+1)/(float)(k+1));
0N/A }
0N/A }
0N/A } catch (Throwable e) {
0N/A out.println("Unexpected exception " + e);
0N/A e.printStackTrace(out);
0N/A out.println("j="+j+", k="+k);
0N/A return 1;
0N/A }
0N/A return 0;
0N/A }
0N/A
0N/A}
0N/A