Mercurial > hg > graal-jvmci-8
annotate graal/GraalCompiler/src/com/sun/c1x/ir/Unwind.java @ 2851:14708c03abba
Remove isNonNull
author | Gilles Duboscq <gilles.duboscq@oracle.com> |
---|---|
date | Tue, 07 Jun 2011 11:36:32 +0200 |
parents | 75e0d39833a0 |
children |
rev | line source |
---|---|
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
1 /* |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
4 * |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
8 * |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
14 * |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
18 * |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
21 * questions. |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
22 */ |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
23 package com.sun.c1x.ir; |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
24 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
25 import com.oracle.graal.graph.*; |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
26 import com.sun.c1x.debug.*; |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
27 import com.sun.cri.ci.*; |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
28 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
29 /** |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
30 * Unwind takes an exception object, destroys the current stack frame and passes the exception object to the system's exception dispatch code. |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
31 */ |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
32 public final class Unwind extends BlockEnd { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
33 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
34 private static final int INPUT_COUNT = 1; |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
35 private static final int INPUT_EXCEPTION = 0; |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
36 |
2840
75e0d39833a0
new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents:
2834
diff
changeset
|
37 private static final int SUCCESSOR_COUNT = 0; |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
38 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
39 @Override |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
40 protected int inputCount() { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
41 return super.inputCount() + INPUT_COUNT; |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
42 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
43 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
44 @Override |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
45 protected int successorCount() { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
46 return super.successorCount() + SUCCESSOR_COUNT; |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
47 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
48 |
2751
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2712
diff
changeset
|
49 @Override |
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2712
diff
changeset
|
50 public Instruction next() { |
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2712
diff
changeset
|
51 return null; |
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2712
diff
changeset
|
52 } |
0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2712
diff
changeset
|
53 |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
54 /** |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
55 * The instruction that produces the exception object. |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
56 */ |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
57 public Value exception() { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
58 return (Value) inputs().get(super.inputCount() + INPUT_EXCEPTION); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
59 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
60 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
61 public Value setException(Value n) { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
62 assert n == null || n.kind == CiKind.Object; |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
63 return (Value) inputs().set(super.inputCount() + INPUT_EXCEPTION, n); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
64 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
65 |
2840
75e0d39833a0
new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents:
2834
diff
changeset
|
66 public Unwind(Value exception, Graph graph) { |
2774
93fd92c9f8b0
Removed usage of stateAfter on BlockEnd instructions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2751
diff
changeset
|
67 super(CiKind.Object, 0, INPUT_COUNT, SUCCESSOR_COUNT, graph); |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
68 setException(exception); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
69 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
70 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
71 @Override |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
72 public void accept(ValueVisitor v) { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
73 v.visitUnwind(this); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
74 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
75 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
76 @Override |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
77 public void print(LogStream out) { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
78 out.print(kind.typeChar).print("unwind ").print(exception()); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
79 } |
2827
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2774
diff
changeset
|
80 |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2774
diff
changeset
|
81 @Override |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2774
diff
changeset
|
82 public Node copy(Graph into) { |
2840
75e0d39833a0
new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents:
2834
diff
changeset
|
83 Unwind x = new Unwind(null, into); |
2827
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2774
diff
changeset
|
84 return x; |
bd17ac598c6e
Graph cloning, initial version (not completely working)
Lukas Stadler <lukas.stadler@jku.at>
parents:
2774
diff
changeset
|
85 } |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
86 } |