hotspot/test/compiler/8004741/Test8004741.java
author kvn
Wed, 19 Dec 2012 19:21:15 -0800
changeset 14835 70896cb93c35
child 15474 62425bb6b9e3
permissions -rw-r--r--
8004741: Missing compiled exception handle table entry for multidimensional array allocation Summary: Added missing exception path for multidimensional array allocation and use Throwable type instead of OutOfMemoryError for allocation's exception. Reviewed-by: twisti
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14835
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
     1
/*
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
     2
 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
     4
 *
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
     7
 * published by the Free Software Foundation.
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
     8
 *
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    13
 * accompanied this code).
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    14
 *
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    18
 *
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    21
 * questions.
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    22
 */
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    23
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    24
/*
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    25
 * @test Test8004741.java
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    26
 * @bug 8004741
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    27
 * @summary Missing compiled exception handle table entry for multidimensional array allocation
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    28
 * @run main/othervm -Xmx64m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers Test8004741
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    29
 *
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    30
 */
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    31
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    32
import java.util.*;
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    33
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    34
public class Test8004741 extends Thread {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    35
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    36
  static int[][] test(int a, int b) throws Exception {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    37
    int[][] ar = null;
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    38
    try {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    39
      ar = new int[a][b];
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    40
    } catch (Error e) {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    41
      System.out.println("test got Error");
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    42
      passed = true;
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    43
      throw(e);
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    44
    } catch (Exception e) {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    45
      System.out.println("test got Exception");
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    46
      throw(e);
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    47
    }
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    48
    return ar;
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    49
  }
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    50
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    51
  static boolean passed = false;
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    52
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    53
  public void run() {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    54
      System.out.println("test started");
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    55
      try {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    56
        while(true) {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    57
          test(2,20000);
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    58
        }
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    59
      } catch (ThreadDeath e) {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    60
        System.out.println("test got ThreadDeath");
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    61
        passed = true;
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    62
      } catch (Error e) {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    63
        e.printStackTrace();
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    64
        System.out.println("test got Error");
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    65
      } catch (Exception e) {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    66
        e.printStackTrace();
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    67
        System.out.println("test got Exception");
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    68
      }
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    69
  }
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    70
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    71
  public static void main(String[] args) throws Exception {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    72
    for (int n = 0; n < 11000; n++) {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    73
      test(2, 20);
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    74
    }
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    75
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    76
    // First test exception catch
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    77
    Test8004741 t = new Test8004741();
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    78
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    79
    passed = false;
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    80
    t.start();
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    81
    Thread.sleep(1000);
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    82
    t.stop();
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    83
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    84
    Thread.sleep(5000);
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    85
    t.join();
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    86
    if (passed) {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    87
      System.out.println("PASSED");
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    88
    } else {
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    89
      System.out.println("FAILED");
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    90
      System.exit(97);
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    91
    }
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    92
  }
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    93
70896cb93c35 8004741: Missing compiled exception handle table entry for multidimensional array allocation
kvn
parents:
diff changeset
    94
};