Mercurial > hg > truffle
comparison graal/GraalCompiler/src/com/sun/c1x/ir/Throw.java @ 2616:3558ca7088c0
FrameState and Graphviz changes:
* removed popx, pushx methods from GraphBuilder
* FrameState subclass of Value
* added String shortName() to Node
* added GraphvizPrinter option to use short names
* small hack in GraphvizPrinter: omit FrameState->Local connections
* added GraalGraphviz to implicit classpatch (read from GRAAL env var)
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Mon, 09 May 2011 17:00:25 +0200 |
parents | 0c6564c254af |
children | 91d3952f7eb7 |
comparison
equal
deleted
inserted
replaced
2615:5768534fd4e5 | 2616:3558ca7088c0 |
---|---|
30 /** | 30 /** |
31 * The {@code Throw} instruction represents a throw of an exception. | 31 * The {@code Throw} instruction represents a throw of an exception. |
32 */ | 32 */ |
33 public final class Throw extends BlockEnd { | 33 public final class Throw extends BlockEnd { |
34 | 34 |
35 private static final int INPUT_COUNT = 1; | 35 private static final int INPUT_COUNT = 2; |
36 private static final int INPUT_EXCEPTION = 0; | 36 private static final int INPUT_EXCEPTION = 0; |
37 private static final int INPUT_STATE_BEFORE = 1; | |
37 | 38 |
38 private static final int SUCCESSOR_COUNT = 0; | 39 private static final int SUCCESSOR_COUNT = 0; |
39 | 40 |
40 @Override | 41 @Override |
41 protected int inputCount() { | 42 protected int inputCount() { |
56 | 57 |
57 public Value setException(Value n) { | 58 public Value setException(Value n) { |
58 return (Value) inputs().set(super.inputCount() + INPUT_EXCEPTION, n); | 59 return (Value) inputs().set(super.inputCount() + INPUT_EXCEPTION, n); |
59 } | 60 } |
60 | 61 |
61 FrameState stateBefore; | 62 /** |
63 * The state before this throw would occur. | |
64 */ | |
65 @Override | |
66 public FrameState stateBefore() { | |
67 return (FrameState) inputs().get(super.inputCount() + INPUT_STATE_BEFORE); | |
68 } | |
69 | |
70 private FrameState setStateBefore(FrameState n) { | |
71 return (FrameState) inputs().set(super.inputCount() + INPUT_STATE_BEFORE, n); | |
72 } | |
62 | 73 |
63 /** | 74 /** |
64 * Creates a new Throw instruction. | 75 * Creates a new Throw instruction. |
65 * @param exception the instruction that generates the exception to throw | 76 * @param exception the instruction that generates the exception to throw |
66 * @param stateAfter the state before the exception is thrown but after the exception object has been popped | 77 * @param stateAfter the state before the exception is thrown but after the exception object has been popped |
67 * @param isSafepoint {@code true} if this instruction is a safepoint instruction | 78 * @param isSafepoint {@code true} if this instruction is a safepoint instruction |
68 * @param graph | 79 * @param graph |
69 */ | 80 */ |
70 public Throw(Value exception, FrameState stateAfter, boolean isSafepoint, Graph graph) { | 81 public Throw(Value exception, FrameState stateAfter, boolean isSafepoint, Graph graph) { |
71 super(CiKind.Illegal, null, isSafepoint, 0, INPUT_COUNT, SUCCESSOR_COUNT, graph); | 82 super(CiKind.Illegal, null, isSafepoint, 0, INPUT_COUNT, SUCCESSOR_COUNT, graph); |
72 this.stateBefore = stateAfter; | 83 setStateBefore(stateAfter); |
73 setException(exception); | 84 setException(exception); |
74 } | |
75 | |
76 /** | |
77 * Returns the state before this throw would occur. | |
78 * @return the state before the throw | |
79 */ | |
80 @Override | |
81 public FrameState stateBefore() { | |
82 return stateBefore; | |
83 } | 85 } |
84 | 86 |
85 /** | 87 /** |
86 * Checks whether this instruction can trap. | 88 * Checks whether this instruction can trap. |
87 * @return {@code true} because this instruction definitely throws an exception! | 89 * @return {@code true} because this instruction definitely throws an exception! |