comparison graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/CallNode.java @ 13276:06afa0db90b3

SL: removed unneccessary field in InlinableCallNode (reported by Stefan Marr)
author Christian Humer <christian.humer@gmail.com>
date Mon, 09 Dec 2013 17:30:50 +0100
parents 71991b7a0f14
children 652f24858aad
comparison
equal deleted inserted replaced
13275:bd5c996b5d25 13276:06afa0db90b3
138 return inlinedCall; 138 return inlinedCall;
139 } 139 }
140 } 140 }
141 return new InlinableCallNode((DefaultCallTarget) function, clonedArgs); 141 return new InlinableCallNode((DefaultCallTarget) function, clonedArgs);
142 } 142 }
143 } 143 // got a call target that is not inlinable (should not occur for SL)
144 144 return new DispatchedCallNode(defaultFunction, clonedArgs);
145 // got a call target that is not inlinable (should not occur for SL) 145 } else {
146 return new DispatchedCallNode(function, clonedArgs); 146 throw new AssertionError();
147 }
148
147 } 149 }
148 } 150 }
149 151
150 private static final class InlinableCallNode extends DispatchedCallNode implements InlinableCallSite { 152 private static final class InlinableCallNode extends DispatchedCallNode implements InlinableCallSite {
151
152 private final DefaultCallTarget inlinableTarget;
153 153
154 @CompilationFinal private int callCount; 154 @CompilationFinal private int callCount;
155 155
156 InlinableCallNode(DefaultCallTarget function, ArgumentsNode arguments) { 156 InlinableCallNode(DefaultCallTarget function, ArgumentsNode arguments) {
157 super(function, arguments); 157 super(function, arguments);
158 this.inlinableTarget = function;
159 } 158 }
160 159
161 @Override 160 @Override
162 public int getCallCount() { 161 public int getCallCount() {
163 return callCount; 162 return callCount;
168 callCount = 0; 167 callCount = 0;
169 } 168 }
170 169
171 @Override 170 @Override
172 public Node getInlineTree() { 171 public Node getInlineTree() {
173 RootNode root = inlinableTarget.getRootNode(); 172 RootNode root = function.getRootNode();
174 if (root instanceof FunctionRootNode) { 173 if (root instanceof FunctionRootNode) {
175 return ((FunctionRootNode) root).getUninitializedBody(); 174 return ((FunctionRootNode) root).getUninitializedBody();
176 } 175 }
177 return null; 176 return null;
178 } 177 }
180 @Override 179 @Override
181 public boolean inline(FrameFactory factory) { 180 public boolean inline(FrameFactory factory) {
182 CompilerAsserts.neverPartOfCompilation(); 181 CompilerAsserts.neverPartOfCompilation();
183 TypedNode functionCall = null; 182 TypedNode functionCall = null;
184 183
185 RootNode root = inlinableTarget.getRootNode(); 184 RootNode root = function.getRootNode();
186 if (root instanceof FunctionRootNode) { 185 if (root instanceof FunctionRootNode) {
187 functionCall = ((FunctionRootNode) root).inline(NodeUtil.cloneNode(args)); 186 functionCall = ((FunctionRootNode) root).inline(NodeUtil.cloneNode(args));
188 } 187 }
189 if (functionCall != null) { 188 if (functionCall != null) {
190 this.replace(functionCall); 189 this.replace(functionCall);
202 return super.executeGeneric(frame); 201 return super.executeGeneric(frame);
203 } 202 }
204 203
205 @Override 204 @Override
206 public CallTarget getCallTarget() { 205 public CallTarget getCallTarget() {
207 return inlinableTarget; 206 return function;
208 } 207 }
209 208
210 } 209 }
211 210
212 private static class DispatchedCallNode extends TypedNode { 211 private static class DispatchedCallNode extends TypedNode {
213 212
214 @Child protected ArgumentsNode args; 213 @Child protected ArgumentsNode args;
215 protected final CallTarget function; 214 protected final DefaultCallTarget function;
216 215
217 DispatchedCallNode(CallTarget function, ArgumentsNode arguments) { 216 DispatchedCallNode(DefaultCallTarget function, ArgumentsNode arguments) {
218 this.args = adoptChild(arguments); 217 this.args = adoptChild(arguments);
219 this.function = function; 218 this.function = function;
220 } 219 }
221 220
222 @Override 221 @Override