Mercurial > hg > graal-compiler
annotate test/compiler/exceptions/CatchInlineExceptions.java @ 21657:137068704691
Remove obsoleted TODOs.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Fri, 29 May 2015 15:44:36 +0200 |
parents | 331df100ad40 |
children |
rev | line source |
---|---|
20552
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
1 /* |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
4 * |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
8 * |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
13 * accompanied this code). |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
14 * |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
18 * |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
21 * questions. |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
22 */ |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
23 |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
24 /** |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
25 * @test |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
26 * @bug 8059299 |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
27 * @summary assert(adr_type != NULL) failed: expecting TypeKlassPtr |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
28 * @run main/othervm -Xbatch CatchInlineExceptions |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
29 */ |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
30 |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
31 class Exception1 extends Exception {}; |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
32 class Exception2 extends Exception {}; |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
33 |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
34 public class CatchInlineExceptions { |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
35 private static int counter0; |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
36 private static int counter1; |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
37 private static int counter2; |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
38 private static int counter; |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
39 |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
40 static void foo(int i) throws Exception { |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
41 if ((i & 1023) == 2) { |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
42 counter0++; |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
43 throw new Exception2(); |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
44 } |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
45 } |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
46 |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
47 static void test(int i) throws Exception { |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
48 try { |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
49 foo(i); |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
50 } |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
51 catch (Exception e) { |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
52 if (e instanceof Exception1) { |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
53 counter1++; |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
54 } else if (e instanceof Exception2) { |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
55 counter2++; |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
56 } |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
57 counter++; |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
58 throw e; |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
59 } |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
60 } |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
61 |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
62 public static void main(String[] args) throws Throwable { |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
63 for (int i = 0; i < 15000; i++) { |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
64 try { |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
65 test(i); |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
66 } catch (Exception e) { |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
67 // expected |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
68 } |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
69 } |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
70 if (counter1 != 0) { |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
71 throw new RuntimeException("Failed: counter1(" + counter1 + ") != 0"); |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
72 } |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
73 if (counter2 != counter0) { |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
74 throw new RuntimeException("Failed: counter2(" + counter2 + ") != counter0(" + counter0 + ")"); |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
75 } |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
76 if (counter2 != counter) { |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
77 throw new RuntimeException("Failed: counter2(" + counter2 + ") != counter(" + counter + ")"); |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
78 } |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
79 System.out.println("TEST PASSED"); |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
80 } |
331df100ad40
8059299: assert(adr_type != NULL) failed: expecting TypeKlassPtr
kvn
parents:
diff
changeset
|
81 } |