comparison graal/GraalCompiler/src/com/sun/c1x/ir/NewMultiArray.java @ 2834:bfce42cd9c07

Graph duplication now passes all tests
author Lukas Stadler <lukas.stadler@jku.at>
date Tue, 31 May 2011 13:34:52 +0200
parents bd17ac598c6e
children 14708c03abba
comparison
equal deleted inserted replaced
2829:27c00b180416 2834:bfce42cd9c07
65 */ 65 */
66 public int dimensionCount() { 66 public int dimensionCount() {
67 return dimensionCount; 67 return dimensionCount;
68 } 68 }
69 69
70 public final RiType elementKind; 70 public final RiType elementType;
71 public final int cpi; 71 public final int cpi;
72 public final RiConstantPool constantPool; 72 public final RiConstantPool constantPool;
73 73
74 /** 74 /**
75 * Constructs a new NewMultiArray instruction. 75 * Constructs a new NewMultiArray instruction.
76 * @param elementKind the element type of the array 76 * @param elementType the element type of the array
77 * @param dimensions the instructions which produce the dimensions for this array 77 * @param dimensions the instructions which produce the dimensions for this array
78 * @param stateBefore the state before this instruction 78 * @param stateBefore the state before this instruction
79 * @param cpi the constant pool index for resolution 79 * @param cpi the constant pool index for resolution
80 * @param riConstantPool the constant pool for resolution 80 * @param riConstantPool the constant pool for resolution
81 * @param graph 81 * @param graph
82 */ 82 */
83 public NewMultiArray(RiType elementKind, Value[] dimensions, int cpi, RiConstantPool riConstantPool, Graph graph) { 83 public NewMultiArray(RiType elementType, Value[] dimensions, int cpi, RiConstantPool riConstantPool, Graph graph) {
84 super(null, dimensions.length, SUCCESSOR_COUNT, graph); 84 super(null, dimensions.length, SUCCESSOR_COUNT, graph);
85 this.constantPool = riConstantPool; 85 this.constantPool = riConstantPool;
86 this.elementKind = elementKind; 86 this.elementType = elementType;
87 this.cpi = cpi; 87 this.cpi = cpi;
88 88
89 this.dimensionCount = dimensions.length; 89 this.dimensionCount = dimensions.length;
90 for (int i = 0; i < dimensions.length; i++) { 90 for (int i = 0; i < dimensions.length; i++) {
91 setDimension(i, dimensions[i]); 91 setDimension(i, dimensions[i]);
100 /** 100 /**
101 * Gets the element type of the array. 101 * Gets the element type of the array.
102 * @return the element type of the array 102 * @return the element type of the array
103 */ 103 */
104 public RiType elementType() { 104 public RiType elementType() {
105 return elementKind; 105 return elementType;
106 } 106 }
107 107
108 @Override 108 @Override
109 public void print(LogStream out) { 109 public void print(LogStream out) {
110 out.print("new multi array ["); 110 out.print("new multi array [");
112 if (i > 0) { 112 if (i > 0) {
113 out.print(", "); 113 out.print(", ");
114 } 114 }
115 out.print(dimension(i)); 115 out.print(dimension(i));
116 } 116 }
117 out.print("] ").print(CiUtil.toJavaName(elementKind)); 117 out.print("] ").print(CiUtil.toJavaName(elementType));
118 } 118 }
119 119
120 @Override 120 @Override
121 public Node copy(Graph into) { 121 public Node copy(Graph into) {
122 NewMultiArray x = new NewMultiArray(elementKind, new Value[dimensionCount], cpi, constantPool, into); 122 NewMultiArray x = new NewMultiArray(elementType, new Value[dimensionCount], cpi, constantPool, into);
123 x.setNonNull(isNonNull()); 123 x.setNonNull(isNonNull());
124 return x; 124 return x;
125 } 125 }
126 } 126 }