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