test/compiler/6910605/Test.java

Thu, 20 Oct 2011 10:32:37 -0700

author
katleman
date
Thu, 20 Oct 2011 10:32:37 -0700
changeset 3191
3170e4044f2d
parent 1907
c18cbe5936b8
child 6876
710a3c8b516e
permissions
-rw-r--r--

Added tag jdk8-b10 for changeset d815de2e85e5

kvn@1687 1 /*
trims@1907 2 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
kvn@1687 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
kvn@1687 4 *
kvn@1687 5 * This code is free software; you can redistribute it and/or modify it
kvn@1687 6 * under the terms of the GNU General Public License version 2 only, as
kvn@1687 7 * published by the Free Software Foundation.
kvn@1687 8 *
kvn@1687 9 * This code is distributed in the hope that it will be useful, but WITHOUT
kvn@1687 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
kvn@1687 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kvn@1687 12 * version 2 for more details (a copy is included in the LICENSE file that
kvn@1687 13 * accompanied this code).
kvn@1687 14 *
kvn@1687 15 * You should have received a copy of the GNU General Public License version
kvn@1687 16 * 2 along with this work; if not, write to the Free Software Foundation,
kvn@1687 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
kvn@1687 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
kvn@1687 22 *
kvn@1687 23 */
kvn@1687 24
kvn@1687 25 /**
kvn@1687 26 * @test
kvn@1687 27 * @bug 6910605
kvn@1687 28 * @summary C2: NullPointerException/ClassCaseException is thrown when C2 with DeoptimizeALot is used
kvn@1687 29 *
kvn@1687 30 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot -Xbatch Test
kvn@1687 31 *
kvn@1687 32 * original test: nsk/coverage/runtime/runtime007
kvn@1687 33 */
kvn@1687 34
kvn@1687 35 import java.io.*;
kvn@1687 36
kvn@1687 37 public class Test {
kvn@1687 38 public static int buf=0;
kvn@1687 39
kvn@1687 40 public static void main( String argv[] ) {
kvn@1687 41 System.exit(run(argv, System.out)+95);
kvn@1687 42 }
kvn@1687 43
kvn@1687 44 public static int run(String argv[],PrintStream out) {
kvn@1687 45 int ret=0, retx=0, bad=0;
kvn@1687 46
kvn@1687 47 for( int i=0; (i < 100000) && (bad < 10) ; i++ ) {
kvn@1687 48 retx = OptoRuntime_f2i_Type(out);
kvn@1687 49 ret += retx;
kvn@1687 50 if( retx !=0 ) {
kvn@1687 51 out.println("i="+i);
kvn@1687 52 bad++;
kvn@1687 53 }
kvn@1687 54 }
kvn@1687 55 return ret==0 ? 0 : 2 ;
kvn@1687 56 }
kvn@1687 57
kvn@1687 58 public static int OptoRuntime_f2i_Type(PrintStream out) {
kvn@1687 59 int c1=2, c2=3, c3=4, c4=5, c5=6;
kvn@1687 60 int j=0, k=0;
kvn@1687 61 try {
kvn@1687 62 int[][] iii=(int[][])(new int[c1][c2]);
kvn@1687 63
kvn@1687 64 for( j=0; j<c1; j++ ) {
kvn@1687 65 for( k=0; k<c2; k++ ) {
kvn@1687 66 iii[j][k]=(int)((float)(j+1)/(float)(k+1));
kvn@1687 67 }
kvn@1687 68 }
kvn@1687 69 } catch (Throwable e) {
kvn@1687 70 out.println("Unexpected exception " + e);
kvn@1687 71 e.printStackTrace(out);
kvn@1687 72 out.println("j="+j+", k="+k);
kvn@1687 73 return 1;
kvn@1687 74 }
kvn@1687 75 return 0;
kvn@1687 76 }
kvn@1687 77
kvn@1687 78 }

mercurial