comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java @ 18162:ab62800259ff

Truffle: renamed the splitting to callTargetCloning. Made RootNode cloning an implementation detail of the Truffle runtime.
author Christian Humer <christian.humer@gmail.com>
date Thu, 23 Oct 2014 17:20:10 +0200
parents 915ebb306fcc
children be1316e633b5
comparison
equal deleted inserted replaced
18161:94f16a759646 18162:ab62800259ff
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.CompilationFinal;
28 import com.oracle.truffle.api.frame.*; 29 import com.oracle.truffle.api.frame.*;
29 import com.oracle.truffle.api.source.*; 30 import com.oracle.truffle.api.source.*;
30 31
31 /** 32 /**
32 * A root node is a node with a method to execute it given only a frame as a parameter. Therefore, a 33 * A root node is a node with a method to execute it given only a frame as a parameter. Therefore, a
34 * {@link TruffleRuntime#createCallTarget(RootNode)}. 35 * {@link TruffleRuntime#createCallTarget(RootNode)}.
35 */ 36 */
36 public abstract class RootNode extends Node { 37 public abstract class RootNode extends Node {
37 38
38 private RootCallTarget callTarget; 39 private RootCallTarget callTarget;
39 private final FrameDescriptor frameDescriptor; 40 @CompilationFinal private FrameDescriptor frameDescriptor;
40 41
41 protected RootNode() { 42 protected RootNode() {
42 this(null, null); 43 this(null, null);
43 } 44 }
44 45
53 } else { 54 } else {
54 this.frameDescriptor = frameDescriptor; 55 this.frameDescriptor = frameDescriptor;
55 } 56 }
56 } 57 }
57 58
58 /** 59 @Override
59 * Creates a split {@link RootNode} based on the current {@link RootNode}. This method should 60 public Node copy() {
60 * return an AST that was never executed and must not be shared with other {@link RootNode} or 61 RootNode root = (RootNode) super.copy();
61 * {@link CallTarget} instances. This method is intended to be overridden by a subclass. 62 root.frameDescriptor = frameDescriptor.shallowCopy();
62 * 63 return root;
63 * @return the split {@link RootNode}
64 */
65 public RootNode split() {
66 throw new UnsupportedOperationException();
67 } 64 }
68 65
69 /** 66 /**
70 * Returns <code>true</code> if this {@link RootNode} can be split. A {@link RootNode} can be 67 * Returns <code>true</code> if this {@link RootNode} is allowed to be cloned. The runtime
71 * split inside of a {@link CallTarget} that is invoked using a {@link DirectCallNode}. If this 68 * system might decide to create deep copies of the {@link RootNode} in order to gather context
72 * method returns <code>true</code> a proper implementation of {@link #split()} must also be 69 * sensitive profiling feedback. The default implementation returns <code>false</code>. Guest
73 * provided. This method is intended to be overridden by a subclass. 70 * language specific implementations may want to return <code>true</code> here to indicate that
71 * gathering call site specific profiling information might make sense for this {@link RootNode}
72 * .
74 * 73 *
75 * @return <code>true</code> if splittable else <code>false</code>. 74 * @return <code>true</code> if cloning is allowed else <code>false</code>.
76 */ 75 */
77 public boolean isSplittable() { 76 public boolean isCloningAllowed() {
78 return false; 77 return false;
79 } 78 }
80 79
81 /** 80 /**
82 * Reports the execution count of a loop that is a child of this node. The optimization 81 * Reports the execution count of a loop that is a child of this node. The optimization