comparison graal/GraalCompiler/src/com/sun/c1x/ir/StateSplit.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 39aa89baa165
children 91d3952f7eb7
comparison
equal deleted inserted replaced
2615:5768534fd4e5 2616:3558ca7088c0
30 * The {@code StateSplit} class is the abstract base class of all instructions 30 * The {@code StateSplit} class is the abstract base class of all instructions
31 * that store an immutable copy of the frame state. 31 * that store an immutable copy of the frame state.
32 */ 32 */
33 public abstract class StateSplit extends Instruction { 33 public abstract class StateSplit extends Instruction {
34 34
35 private static final int INPUT_COUNT = 0; 35 private static final int INPUT_COUNT = 1;
36 private static final int INPUT_STATE_BEFORE = 0;
37
36 private static final int SUCCESSOR_COUNT = 0; 38 private static final int SUCCESSOR_COUNT = 0;
37 39
38 private FrameState stateBefore; 40 @Override
41 protected int inputCount() {
42 return super.inputCount() + INPUT_COUNT;
43 }
44
45 @Override
46 protected int successorCount() {
47 return super.successorCount() + SUCCESSOR_COUNT;
48 }
49
50 /**
51 * The state for this instruction.
52 */
53 @Override
54 public FrameState stateBefore() {
55 return (FrameState) inputs().get(super.inputCount() + INPUT_STATE_BEFORE);
56 }
57
58 public FrameState setStateBefore(FrameState n) {
59 return (FrameState) inputs().set(super.inputCount() + INPUT_STATE_BEFORE, n);
60 }
39 61
40 /** 62 /**
41 * Creates a new state split with the specified value type. 63 * Creates a new state split with the specified value type.
42 * @param kind the type of the value that this instruction produces 64 * @param kind the type of the value that this instruction produces
43 * @param inputCount 65 * @param inputCount
44 * @param successorCount 66 * @param successorCount
45 * @param graph 67 * @param graph
46 */ 68 */
47 public StateSplit(CiKind kind, FrameState stateBefore, int inputCount, int successorCount, Graph graph) { 69 public StateSplit(CiKind kind, FrameState stateBefore, int inputCount, int successorCount, Graph graph) {
48 super(kind, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph); 70 super(kind, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
49 this.stateBefore = stateBefore; 71 setStateBefore(stateBefore);
50 } 72 }
51 73
52 @Override 74 @Override
53 public boolean canTrap() { 75 public boolean canTrap() {
54 return stateBefore != null; 76 return stateBefore() != null;
55 } 77 }
56 78
57 /**
58 * Records the state of this instruction before it is executed.
59 *
60 * @param stateBefore the state
61 */
62 public final void setStateBefore(FrameState stateBefore) {
63 assert this.stateBefore == null;
64 this.stateBefore = stateBefore;
65 }
66
67 /**
68 * Gets the state for this instruction.
69 * @return the state
70 */
71 @Override
72 public final FrameState stateBefore() {
73 return stateBefore;
74 }
75 } 79 }