test/hotspot/jtreg/compiler/c2/Test6910605_1.java
author iignatyev
Mon, 18 Feb 2019 09:31:07 -0800
changeset 53791 bec6c8739833
parent 47216 71c04702a3d5
permissions -rw-r--r--
8219157: vm/mlvm/mixed/stress/java/findDeadlock should be problem-listed only on mac Reviewed-by: thartmann
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
 * @test
fedc27b54caa 6910605: C2: NullPointerException/ClassCaseException is thrown when C2 with DeoptimizeALot is used
kvn
parents:
diff changeset
    26
 * @bug 6910605
fedc27b54caa 6910605: C2: NullPointerException/ClassCaseException is thrown when C2 with DeoptimizeALot is used
kvn
parents:
diff changeset
    27
 * @summary C2: NullPointerException/ClassCaseException is thrown when C2 with DeoptimizeALot is used
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    28
 * original test: nsk/coverage/runtime/runtime007
4893
fedc27b54caa 6910605: C2: NullPointerException/ClassCaseException is thrown when C2 with DeoptimizeALot is used
kvn
parents:
diff changeset
    29
 *
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    30
 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot -Xbatch compiler.c2.Test6910605_1
4893
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
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    33
package compiler.c2;
4893
fedc27b54caa 6910605: C2: NullPointerException/ClassCaseException is thrown when C2 with DeoptimizeALot is used
kvn
parents:
diff changeset
    34
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    35
import java.io.PrintStream;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    36
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 27699
diff changeset
    37
public class Test6910605_1 {
4893
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
}