changeset 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 bd5c996b5d25
children ce017d1e4234
files graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLNodeFactory.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/CallNode.java
diffstat 2 files changed, 9 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLNodeFactory.java	Thu Dec 05 13:39:08 2013 +0100
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLNodeFactory.java	Mon Dec 09 17:30:50 2013 +0100
@@ -59,10 +59,6 @@
         this.parser = parser;
     }
 
-    public CallTarget findFunction(String name) {
-        return context.getFunctionRegistry().lookup(name);
-    }
-
     public void startFunction() {
         frameDescriptor = new FrameDescriptor();
     }
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/CallNode.java	Thu Dec 05 13:39:08 2013 +0100
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/CallNode.java	Mon Dec 09 17:30:50 2013 +0100
@@ -140,22 +140,21 @@
                     }
                     return new InlinableCallNode((DefaultCallTarget) function, clonedArgs);
                 }
+                // got a call target that is not inlinable (should not occur for SL)
+                return new DispatchedCallNode(defaultFunction, clonedArgs);
+            } else {
+                throw new AssertionError();
             }
 
-            // got a call target that is not inlinable (should not occur for SL)
-            return new DispatchedCallNode(function, clonedArgs);
         }
     }
 
     private static final class InlinableCallNode extends DispatchedCallNode implements InlinableCallSite {
 
-        private final DefaultCallTarget inlinableTarget;
-
         @CompilationFinal private int callCount;
 
         InlinableCallNode(DefaultCallTarget function, ArgumentsNode arguments) {
             super(function, arguments);
-            this.inlinableTarget = function;
         }
 
         @Override
@@ -170,7 +169,7 @@
 
         @Override
         public Node getInlineTree() {
-            RootNode root = inlinableTarget.getRootNode();
+            RootNode root = function.getRootNode();
             if (root instanceof FunctionRootNode) {
                 return ((FunctionRootNode) root).getUninitializedBody();
             }
@@ -182,7 +181,7 @@
             CompilerAsserts.neverPartOfCompilation();
             TypedNode functionCall = null;
 
-            RootNode root = inlinableTarget.getRootNode();
+            RootNode root = function.getRootNode();
             if (root instanceof FunctionRootNode) {
                 functionCall = ((FunctionRootNode) root).inline(NodeUtil.cloneNode(args));
             }
@@ -204,7 +203,7 @@
 
         @Override
         public CallTarget getCallTarget() {
-            return inlinableTarget;
+            return function;
         }
 
     }
@@ -212,9 +211,9 @@
     private static class DispatchedCallNode extends TypedNode {
 
         @Child protected ArgumentsNode args;
-        protected final CallTarget function;
+        protected final DefaultCallTarget function;
 
-        DispatchedCallNode(CallTarget function, ArgumentsNode arguments) {
+        DispatchedCallNode(DefaultCallTarget function, ArgumentsNode arguments) {
             this.args = adoptChild(arguments);
             this.function = function;
         }