comparison graal/GraalCompiler/src/com/sun/c1x/ir/ArrayLength.java @ 2812:d27bdbec3d67

Removed ArrayLength from CFG. Fixed an issue when scheduling Merge instructions within a block. If a block only consists of a single Merge instruction, we have to schedule this instruction as the first instruction.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Mon, 30 May 2011 15:24:26 +0200
parents c3f64b66fc78
children bd17ac598c6e
comparison
equal deleted inserted replaced
2810:6fb5a1bf819f 2812:d27bdbec3d67
29 import com.sun.cri.ci.*; 29 import com.sun.cri.ci.*;
30 30
31 /** 31 /**
32 * The {@code ArrayLength} instruction gets the length of an array. 32 * The {@code ArrayLength} instruction gets the length of an array.
33 */ 33 */
34 public final class ArrayLength extends AccessArray { 34 public final class ArrayLength extends Value {
35 35
36 private static final int INPUT_COUNT = 0; 36 private static final int INPUT_COUNT = 1;
37 private static final int INPUT_ARRAY = 0;
38
37 private static final int SUCCESSOR_COUNT = 0; 39 private static final int SUCCESSOR_COUNT = 0;
40
41 @Override
42 protected int inputCount() {
43 return super.inputCount() + INPUT_COUNT;
44 }
45
46 @Override
47 protected int successorCount() {
48 return super.successorCount() + SUCCESSOR_COUNT;
49 }
50
51 /**
52 * The instruction that produces the array object.
53 */
54 public Value array() {
55 return (Value) inputs().get(super.inputCount() + INPUT_ARRAY);
56 }
57
58 public Value setArray(Value n) {
59 return (Value) inputs().set(super.inputCount() + INPUT_ARRAY, n);
60 }
38 61
39 /** 62 /**
40 * Constructs a new ArrayLength instruction. 63 * Constructs a new ArrayLength instruction.
41 * @param array the instruction producing the array 64 * @param array the instruction producing the array
42 * @param newFrameState the state after executing this instruction 65 * @param newFrameState the state after executing this instruction
43 */ 66 */
44 public ArrayLength(Value array, Graph graph) { 67 public ArrayLength(Value array, Graph graph) {
45 super(CiKind.Int, array, INPUT_COUNT, SUCCESSOR_COUNT, graph); 68 super(CiKind.Int, INPUT_COUNT, SUCCESSOR_COUNT, graph);
69 setArray(array);
46 } 70 }
47 71
48 @Override 72 @Override
49 public void accept(ValueVisitor v) { 73 public void accept(ValueVisitor v) {
50 v.visitArrayLength(this); 74 v.visitArrayLength(this);