public abstract class DirectCallNode extends Node
CallTarget. Direct calls are calls for which the
CallTarget remains the same for each consecutive call. This part of the Truffle API
enables the runtime system to perform additional optimizations on direct calls.
Optimizations that can be applied to a DirectCallNode are inlining and call site
sensitive AST duplication. Inlining inlines this call site into the call graph of the parent
CallTarget. Call site sensitive AST duplication duplicates the CallTarget in an
uninitialized state to collect call site sensitive profiling information.
Please note: This class is not intended to be subclassed by guest language implementations.for calls with a non-constant target,
TruffleRuntime.createDirectCallNode(CallTarget),
DirectCallNode.forceInlining(),
DirectCallNode.cloneCallTarget()Node.Child, Node.Children| Modifier and Type | Field and Description |
|---|---|
protected CallTarget |
callTarget |
| Modifier | Constructor and Description |
|---|---|
protected |
DirectCallNode(CallTarget callTarget) |
| Modifier and Type | Method and Description |
|---|---|
abstract Object |
call(Object... arguments)
Calls the inner
CallTarget returned by DirectCallNode.getCurrentCallTarget(). |
abstract boolean |
cloneCallTarget()
Clones the
CallTarget instance returned by DirectCallNode.getCallTarget() in an
uninitialized state for this DirectCallNode. |
static DirectCallNode |
create(CallTarget target) |
abstract void |
forceInlining()
Enforces the runtime system to inline the
CallTarget at this call site. |
CallTarget |
getCallTarget()
Returns the originally supplied
CallTarget when this call node was created. |
abstract CallTarget |
getClonedCallTarget()
Returns the split
CallTarget if this call site's CallTarget is cloned. |
CallTarget |
getCurrentCallTarget()
Returns the used call target when
DirectCallNode.call(java.lang.Object[]) is invoked. |
RootNode |
getCurrentRootNode()
|
boolean |
isCallTargetCloned()
Returns
true if the target of the DirectCallNode was cloned by the
runtime system or by the guest language implementation. |
abstract boolean |
isCallTargetCloningAllowed()
Returns
true if the runtime system supports cloning and the RootNode
returns true in RootNode.isCloningAllowed(). |
abstract boolean |
isInlinable()
Returns
true if the underlying runtime system supports inlining for the
CallTarget in this DirectCallNode. |
abstract boolean |
isInliningForced()
Returns
true if the CallTarget is forced to be inlined. |
String |
toString()
Converts this node to a textual representation useful for debugging.
|
accept, adoptChildren, atomic, atomic, copy, deepCopy, getChildren, getCost, getDebugProperties, getDescription, getEncapsulatingSourceSection, getLock, getParent, getRootNode, getSourceSection, insert, insert, isAdoptable, isSafelyReplaceableBy, notifyInserted, onReplace, replace, replace, reportPolymorphicSpecializeprotected final CallTarget callTarget
protected DirectCallNode(CallTarget callTarget)
public abstract Object call(Object... arguments)
CallTarget returned by DirectCallNode.getCurrentCallTarget().arguments - the arguments that should be passed to the calleepublic CallTarget getCallTarget()
CallTarget when this call node was created. Please
note that the returned CallTarget is not necessarily the CallTarget that is
called. For that use DirectCallNode.getCurrentCallTarget() instead.CallTarget provided.public abstract boolean isInlinable()
true if the underlying runtime system supports inlining for the
CallTarget in this DirectCallNode.public abstract boolean isInliningForced()
true if the CallTarget is forced to be inlined. A
DirectCallNode can either be inlined manually by invoking DirectCallNode.forceInlining() or
by the runtime system which may at any point decide to inline.public abstract void forceInlining()
CallTarget at this call site. If the
runtime system does not support inlining or it is already inlined this method has no effect.
The runtime system may decide to not inline calls which were forced to inline.public abstract boolean isCallTargetCloningAllowed()
true if the runtime system supports cloning and the RootNode
returns true in RootNode.isCloningAllowed().true if the target is allowed to be cloned.public abstract boolean cloneCallTarget()
CallTarget instance returned by DirectCallNode.getCallTarget() in an
uninitialized state for this DirectCallNode. This can be sensible to gather call site
sensitive profiling information for this DirectCallNode. If
DirectCallNode.isCallTargetCloningAllowed() returns false this method has no effect
and returns false.public final boolean isCallTargetCloned()
true if the target of the DirectCallNode was cloned by the
runtime system or by the guest language implementation.public abstract CallTarget getClonedCallTarget()
CallTarget if this call site's CallTarget is cloned.CallTargetpublic CallTarget getCurrentCallTarget()
DirectCallNode.call(java.lang.Object[]) is invoked. If the
CallTarget was split this method returns the CallTarget returned by
DirectCallNode.getClonedCallTarget().CallTarget when node is calledpublic final RootNode getCurrentRootNode()
RootNode associated with CallTarget returned by
DirectCallNode.getCurrentCallTarget(). If the stored CallTarget does not contain a
RootNode this method returns null.DirectCallNode.getCurrentCallTarget()public String toString()
Nodepublic static DirectCallNode create(CallTarget target)