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