comparison graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java @ 2634:4dd0573f510b

FrameState fixes.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 11 May 2011 10:52:37 +0200
parents 62ff4a70f07e
children 8c02ca1e9eb1
comparison
equal deleted inserted replaced
2633:721a45190d6d 2634:4dd0573f510b
37 /** 37 /**
38 * Denotes the beginning of a basic block, and holds information 38 * Denotes the beginning of a basic block, and holds information
39 * about the basic block, including the successor and 39 * about the basic block, including the successor and
40 * predecessor blocks, exception handlers, liveness information, etc. 40 * predecessor blocks, exception handlers, liveness information, etc.
41 */ 41 */
42 public final class BlockBegin extends Instruction { 42 public final class BlockBegin extends StateSplit {
43 43
44 private static final int INPUT_COUNT = 1; 44 private static final int INPUT_COUNT = 1;
45 private static final int INPUT_STATE_BEFORE = 0; 45 private static final int INPUT_STATE_BEFORE = 0;
46 46
47 private static final int SUCCESSOR_COUNT = 1; 47 private static final int SUCCESSOR_COUNT = 1;
56 protected int successorCount() { 56 protected int successorCount() {
57 return super.successorCount() + SUCCESSOR_COUNT; 57 return super.successorCount() + SUCCESSOR_COUNT;
58 } 58 }
59 59
60 /** 60 /**
61 * The frame state before execution of the first instruction in this block.
62 */
63 public FrameState stateBefore() {
64 return (FrameState) inputs().get(super.inputCount() + INPUT_STATE_BEFORE);
65 }
66
67 public FrameState setStateBefore(FrameState n) {
68 assert stateBefore() == null;
69 return (FrameState) inputs().set(super.inputCount() + INPUT_STATE_BEFORE, n);
70 }
71
72 /**
73 * The last node in the block (which contains the successors). 61 * The last node in the block (which contains the successors).
74 */ 62 */
75 public BlockEnd end() { 63 public BlockEnd end() {
76 return (BlockEnd) successors().get(super.successorCount() + SUCCESSOR_END); 64 return (BlockEnd) successors().get(super.successorCount() + SUCCESSOR_END);
65 }
66
67 @Override
68 public boolean needsStateAfter() {
69 return false;
77 } 70 }
78 71
79 public void setEnd(BlockEnd end) { 72 public void setEnd(BlockEnd end) {
80 assert end != null; 73 assert end != null;
81 BlockEnd old = this.end(); 74 BlockEnd old = this.end();
122 /** 115 /**
123 * Denotes the current set of {@link BlockBegin.BlockFlag} settings. 116 * Denotes the current set of {@link BlockBegin.BlockFlag} settings.
124 */ 117 */
125 private int blockFlags; 118 private int blockFlags;
126 119
127 private FrameState stateAfter;
128
129 /** 120 /**
130 * The {@link BlockBegin} nodes for which this node is a successor. 121 * The {@link BlockBegin} nodes for which this node is a successor.
131 */ 122 */
132 private final List<BlockBegin> predecessors; 123 private final List<BlockBegin> predecessors;
133 124
211 * Gets the loop index of this block. 202 * Gets the loop index of this block.
212 * @return the loop index 203 * @return the loop index
213 */ 204 */
214 public int loopIndex() { 205 public int loopIndex() {
215 return loopIndex; 206 return loopIndex;
216 }
217
218 public void setStateAfter(FrameState stateAfter) {
219 this.stateAfter = stateAfter;
220 }
221
222 @Override
223 public FrameState stateAfter() {
224 return stateAfter;
225 } 207 }
226 208
227 /** 209 /**
228 * Gets the exception handlers that cover one or more instructions of this basic block. 210 * Gets the exception handlers that cover one or more instructions of this basic block.
229 * 211 *