comparison graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java @ 7006:51b6e594b0cd

refactor EscapeAnalyzeable (remove EscapeOp)
author Lukas Stadler <lukas.stadler@jku.at>
date Tue, 20 Nov 2012 13:25:28 +0100
parents 49cd16dfb10c
children 94596bbec6f0
comparison
equal deleted inserted replaced
6721:98d691bc23da 7006:51b6e594b0cd
103 public void lower(LoweringTool tool) { 103 public void lower(LoweringTool tool) {
104 tool.getRuntime().lower(this, tool); 104 tool.getRuntime().lower(this, tool);
105 } 105 }
106 106
107 @Override 107 @Override
108 public EscapeOp getEscapeOp() { 108 public ObjectDesc[] getAllocations(long nextVirtualId) {
109 if (length().asConstant() != null) { 109 if (length().asConstant() != null) {
110 final int constantLength = length().asConstant().asInt(); 110 final int constantLength = length().asConstant().asInt();
111 if (constantLength >= 0 && constantLength < MaximumEscapeAnalysisArrayLength) { 111 if (constantLength >= 0 && constantLength < MaximumEscapeAnalysisArrayLength) {
112 return new EscapeOp() { 112 ValueNode[] state = new ValueNode[constantLength];
113 113 ConstantNode defaultForKind = constantLength == 0 ? null : ConstantNode.defaultForKind(elementType().getKind(), graph());
114 @Override 114 for (int i = 0; i < constantLength; i++) {
115 public ValueNode[] fieldState() { 115 state[i] = defaultForKind;
116 ValueNode[] state = new ValueNode[constantLength]; 116 }
117 ConstantNode defaultForKind = constantLength == 0 ? null : ConstantNode.defaultForKind(elementType().getKind(), graph()); 117 VirtualObjectNode virtualObject = new VirtualArrayNode(nextVirtualId, elementType, constantLength);
118 for (int i = 0; i < constantLength; i++) { 118 return new ObjectDesc[]{new ObjectDesc(virtualObject, state, 0)};
119 state[i] = defaultForKind;
120 }
121 return state;
122 }
123
124 @Override
125 public VirtualObjectNode virtualObject(long virtualId) {
126 return new VirtualArrayNode(virtualId, elementType, constantLength);
127 }
128
129 @Override
130 public int lockCount() {
131 return 0;
132 }
133 };
134 } 119 }
135 } 120 }
136 return null; 121 return null;
137 } 122 }
138 } 123 }