comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java @ 13811:641f22b1c6b8

Truffle: further fixes to the new CallNode.
author Christian Humer <christian.humer@gmail.com>
date Wed, 29 Jan 2014 20:49:09 +0100
parents 3840d61e0e68
children 67e4e7f56911
comparison
equal deleted inserted replaced
13810:44bcfc983adb 13811:641f22b1c6b8
23 * questions. 23 * questions.
24 */ 24 */
25 package com.oracle.truffle.api.nodes; 25 package com.oracle.truffle.api.nodes;
26 26
27 import com.oracle.truffle.api.*; 27 import com.oracle.truffle.api.*;
28 import com.oracle.truffle.api.CompilerDirectives.*;
28 import com.oracle.truffle.api.frame.*; 29 import com.oracle.truffle.api.frame.*;
29 30
30 /** 31 /**
31 * A root node is a node with a method to execute it given only a frame as a parameter. Therefore, a 32 * 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 33 * root node can be used to create a call target using
34 */ 35 */
35 public abstract class RootNode extends Node { 36 public abstract class RootNode extends Node {
36 37
37 private CallTarget callTarget; 38 private CallTarget callTarget;
38 private final FrameDescriptor frameDescriptor; 39 private final FrameDescriptor frameDescriptor;
40
41 /*
42 * Internal field to keep reference to the inlined call node. The inlined parent should not be
43 * the same as the Node parent to keep the same tree hierarchy if inlined vs not inlined.
44 */
45 @CompilationFinal private CallNode parentInlinedCall;
39 46
40 protected RootNode() { 47 protected RootNode() {
41 this(null, null); 48 this(null, null);
42 } 49 }
43 50
123 } 130 }
124 131
125 public void setCallTarget(CallTarget callTarget) { 132 public void setCallTarget(CallTarget callTarget) {
126 this.callTarget = callTarget; 133 this.callTarget = callTarget;
127 } 134 }
135
136 /* Internal API. Do not use. */
137 void setParentInlinedCall(CallNode inlinedParent) {
138 this.parentInlinedCall = inlinedParent;
139 }
140
141 /**
142 * Returns the {@link CallNode} that uses this {@link RootNode} for an inlined call. Returns
143 * <code>null</code> if this {@link RootNode} is not inlined into a caller. This method can be
144 * used to also traverse parent {@link CallTarget} that have been inlined into this call.
145 *
146 * @return the responsible {@link CallNode} for inlining.
147 */
148 public final CallNode getParentInlinedCall() {
149 return parentInlinedCall;
150 }
128 } 151 }