Mercurial > hg > graal-jvmci-8
comparison graal/GraalCompiler/src/com/sun/c1x/ir/Throw.java @ 2622:91d3952f7eb7
Framestate work : using stateAFter and reducting the number of nodes with framestates. Intermediate state (does not pass tests)
author | Gilles Duboscq <gilles.duboscq@oracle.com> |
---|---|
date | Tue, 10 May 2011 12:37:46 +0200 |
parents | 3558ca7088c0 |
children | 8e96b2b3a866 |
comparison
equal
deleted
inserted
replaced
2621:dd115f80acf8 | 2622:91d3952f7eb7 |
---|---|
22 */ | 22 */ |
23 package com.sun.c1x.ir; | 23 package com.sun.c1x.ir; |
24 | 24 |
25 import com.oracle.graal.graph.*; | 25 import com.oracle.graal.graph.*; |
26 import com.sun.c1x.debug.*; | 26 import com.sun.c1x.debug.*; |
27 import com.sun.c1x.value.*; | |
28 import com.sun.cri.ci.*; | 27 import com.sun.cri.ci.*; |
29 | 28 |
30 /** | 29 /** |
31 * The {@code Throw} instruction represents a throw of an exception. | 30 * The {@code Throw} instruction represents a throw of an exception. |
32 */ | 31 */ |
33 public final class Throw extends BlockEnd { | 32 public final class Throw extends BlockEnd { |
34 | 33 |
35 private static final int INPUT_COUNT = 2; | 34 private static final int INPUT_COUNT = 1; |
36 private static final int INPUT_EXCEPTION = 0; | 35 private static final int INPUT_EXCEPTION = 0; |
37 private static final int INPUT_STATE_BEFORE = 1; | |
38 | 36 |
39 private static final int SUCCESSOR_COUNT = 0; | 37 private static final int SUCCESSOR_COUNT = 0; |
40 | 38 |
41 @Override | 39 @Override |
42 protected int inputCount() { | 40 protected int inputCount() { |
58 public Value setException(Value n) { | 56 public Value setException(Value n) { |
59 return (Value) inputs().set(super.inputCount() + INPUT_EXCEPTION, n); | 57 return (Value) inputs().set(super.inputCount() + INPUT_EXCEPTION, n); |
60 } | 58 } |
61 | 59 |
62 /** | 60 /** |
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 } | |
73 | |
74 /** | |
75 * Creates a new Throw instruction. | 61 * Creates a new Throw instruction. |
76 * @param exception the instruction that generates the exception to throw | 62 * @param exception the instruction that generates the exception to throw |
77 * @param stateAfter the state before the exception is thrown but after the exception object has been popped | 63 * @param stateAfter the state before the exception is thrown but after the exception object has been popped |
78 * @param isSafepoint {@code true} if this instruction is a safepoint instruction | 64 * @param isSafepoint {@code true} if this instruction is a safepoint instruction |
79 * @param graph | 65 * @param graph |
80 */ | 66 */ |
81 public Throw(Value exception, FrameState stateAfter, boolean isSafepoint, Graph graph) { | 67 public Throw(Value exception, boolean isSafepoint, Graph graph) { |
82 super(CiKind.Illegal, null, isSafepoint, 0, INPUT_COUNT, SUCCESSOR_COUNT, graph); | 68 super(CiKind.Illegal, null, isSafepoint, 0, INPUT_COUNT, SUCCESSOR_COUNT, graph); |
83 setStateBefore(stateAfter); | |
84 setException(exception); | 69 setException(exception); |
85 } | 70 } |
86 | 71 |
87 /** | 72 /** |
88 * Checks whether this instruction can trap. | 73 * Checks whether this instruction can trap. |