public abstract class RootNode extends Node
TruffleRuntime.createCallTarget(RootNode)
.Node.Child, Node.Children
Modifier | Constructor and Description |
---|---|
protected |
RootNode() |
protected |
RootNode(SourceSection sourceSection) |
protected |
RootNode(SourceSection sourceSection,
FrameDescriptor frameDescriptor) |
Modifier and Type | Method and Description |
---|---|
void |
applyInstrumentation()
Apply all registered instances of
ASTProber to the AST, if any, held by this root
node. |
Node |
copy()
Creates a shallow copy of this node.
|
abstract java.lang.Object |
execute(VirtualFrame frame)
Executes this function using the specified frame and returns the result value.
|
RootCallTarget |
getCallTarget() |
CompilerOptions |
getCompilerOptions()
Get compiler options specific to this
RootNode . |
ExecutionContext |
getExecutionContext()
Returns the
ExecutionContext associated with this RootNode . |
FrameDescriptor |
getFrameDescriptor() |
boolean |
isCloningAllowed()
Returns
true if this RootNode is allowed to be cloned. |
void |
reportLoopCount(int count)
Reports the execution count of a loop that is a child of this node.
|
void |
setCallTarget(RootCallTarget callTarget) |
accept, adoptChildren, assignSourceSection, atomic, atomic, clearSourceSection, clone, getChildren, getCost, getDebugProperties, getDescription, getEncapsulatingSourceSection, getLanguage, getParent, getRootNode, getSourceSection, insert, insert, isReplaceable, onAdopt, onReplace, replace, replace, toString
protected RootNode()
protected RootNode(SourceSection sourceSection)
protected RootNode(SourceSection sourceSection, FrameDescriptor frameDescriptor)
public boolean isCloningAllowed()
true
if this RootNode
is allowed to be cloned. The runtime
system might decide to create deep copies of the RootNode
in order to gather context
sensitive profiling feedback. The default implementation returns false
. Guest
language specific implementations may want to return true
here to indicate that
gathering call site specific profiling information might make sense for this RootNode
.true
if cloning is allowed else false
.public final void reportLoopCount(int count)
public abstract java.lang.Object execute(VirtualFrame frame)
frame
- the frame of the currently executing guest language methodpublic final RootCallTarget getCallTarget()
public final FrameDescriptor getFrameDescriptor()
public final void setCallTarget(RootCallTarget callTarget)
public ExecutionContext getExecutionContext()
ExecutionContext
associated with this RootNode
. This allows
the correct ExecutionContext
to be determined for a RootNode
(and
so also for a RootCallTarget
and a FrameInstance
obtained from the call
stack) without prior knowledge of the language it has come from.
Used for instance to determine the language of a RootNode:
rootNode.getExecutionContext().getLanguageShortName();
Returns null
by default.
public CompilerOptions getCompilerOptions()
RootNode
.public void applyInstrumentation()
ASTProber
to the AST, if any, held by this root
node. This can only be done once the AST is complete, notably once all parent pointers are
correctly assigned. But it also must be done before any AST cloning or execution.
If this is not done, then the AST will not be subject to debugging or any other instrumentation-supported tooling.
Implementations should ensure that instrumentation is never applied more than once to an AST, as this is not guaranteed to be error-free.