comparison 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
comparison
equal deleted inserted replaced
13704:10a2d66262ae 13705:ac5b0f31f7a2
28 import com.oracle.truffle.api.frame.*; 28 import com.oracle.truffle.api.frame.*;
29 29
30 /** 30 /**
31 * A root node is a node with a method to execute it given only a frame as a parameter. Therefore, a 31 * A root node is a node with a method to execute it given only a frame as a parameter. Therefore, a
32 * root node can be used to create a call target using 32 * root node can be used to create a call target using
33 * {@link TruffleRuntime#createCallTarget(RootNode, FrameDescriptor)}. 33 * {@link TruffleRuntime#createCallTarget(RootNode)}.
34 */ 34 */
35 public abstract class RootNode extends Node { 35 public abstract class RootNode extends Node {
36 36
37 private CallTarget callTarget;
38 private final FrameDescriptor frameDescriptor;
39
37 protected RootNode() { 40 protected RootNode() {
41 this(null, null);
38 } 42 }
39 43
40 protected RootNode(SourceSection sourceSection) { 44 protected RootNode(SourceSection sourceSection) {
45 this(sourceSection, null);
46 }
47
48 protected RootNode(SourceSection sourceSection, FrameDescriptor frameDescriptor) {
41 super(sourceSection); 49 super(sourceSection);
50 if (frameDescriptor == null) {
51 this.frameDescriptor = new FrameDescriptor();
52 } else {
53 this.frameDescriptor = frameDescriptor;
54 }
42 } 55 }
43 56
44 /** 57 /**
45 * Executes this function using the specified frame and returns the result value. 58 * Executes this function using the specified frame and returns the result value.
46 * 59 *
47 * @param frame the frame of the currently executing guest language method 60 * @param frame the frame of the currently executing guest language method
48 * @return the value of the execution 61 * @return the value of the execution
49 */ 62 */
50 public abstract Object execute(VirtualFrame frame); 63 public abstract Object execute(VirtualFrame frame);
51 64
52 private CallTarget callTarget;
53
54 public CallTarget getCallTarget() { 65 public CallTarget getCallTarget() {
55 return callTarget; 66 return callTarget;
67 }
68
69 public FrameDescriptor getFrameDescriptor() {
70 return frameDescriptor;
56 } 71 }
57 72
58 public void setCallTarget(CallTarget callTarget) { 73 public void setCallTarget(CallTarget callTarget) {
59 this.callTarget = callTarget; 74 this.callTarget = callTarget;
60 } 75 }