diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java @ 13705:ac5b0f31f7a2

Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
author Christian Humer <christian.humer@gmail.com>
date Fri, 17 Jan 2014 17:06:08 +0100
parents 8f0fb0ade839
children e076c87ab175
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java	Fri Jan 17 16:55:59 2014 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java	Fri Jan 17 17:06:08 2014 +0100
@@ -30,15 +30,28 @@
 /**
  * A root node is a node with a method to execute it given only a frame as a parameter. Therefore, a
  * root node can be used to create a call target using
- * {@link TruffleRuntime#createCallTarget(RootNode, FrameDescriptor)}.
+ * {@link TruffleRuntime#createCallTarget(RootNode)}.
  */
 public abstract class RootNode extends Node {
 
+    private CallTarget callTarget;
+    private final FrameDescriptor frameDescriptor;
+
     protected RootNode() {
+        this(null, null);
     }
 
     protected RootNode(SourceSection sourceSection) {
+        this(sourceSection, null);
+    }
+
+    protected RootNode(SourceSection sourceSection, FrameDescriptor frameDescriptor) {
         super(sourceSection);
+        if (frameDescriptor == null) {
+            this.frameDescriptor = new FrameDescriptor();
+        } else {
+            this.frameDescriptor = frameDescriptor;
+        }
     }
 
     /**
@@ -49,12 +62,14 @@
      */
     public abstract Object execute(VirtualFrame frame);
 
-    private CallTarget callTarget;
-
     public CallTarget getCallTarget() {
         return callTarget;
     }
 
+    public FrameDescriptor getFrameDescriptor() {
+        return frameDescriptor;
+    }
+
     public void setCallTarget(CallTarget callTarget) {
         this.callTarget = callTarget;
     }