diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultCallTarget.java @ 15167:258e3e0b5e2e

Change RootCallTarget from an abstract class into an interface.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Wed, 16 Apr 2014 18:51:54 +0200
parents 2ed720ce9273
children a3b0ecef8a15
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultCallTarget.java	Wed Apr 16 18:33:10 2014 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultCallTarget.java	Wed Apr 16 18:51:54 2014 +0200
@@ -32,15 +32,28 @@
  * This is an implementation-specific class. Do not use or instantiate it. Instead, use
  * {@link TruffleRuntime#createCallTarget(RootNode)} to create a {@link RootCallTarget}.
  */
-public class DefaultCallTarget extends RootCallTarget {
+public class DefaultCallTarget implements RootCallTarget {
+
+    private final RootNode rootNode;
 
-    protected DefaultCallTarget(RootNode function) {
-        super(function);
+    public DefaultCallTarget(RootNode function) {
+        this.rootNode = function;
+        this.rootNode.adoptChildren();
+        this.rootNode.setCallTarget(this);
+    }
+
+    @Override
+    public String toString() {
+        return rootNode.toString();
+    }
+
+    public final RootNode getRootNode() {
+        return rootNode;
     }
 
     @Override
     public Object call(Object... args) {
         VirtualFrame frame = new DefaultVirtualFrame(getRootNode().getFrameDescriptor(), args);
-        return callProxy(frame);
+        return getRootNode().execute(frame);
     }
 }