Package com.oracle.truffle.api.nodes
Class DirectCallNode
java.lang.Object
com.oracle.truffle.api.nodes.Node
com.oracle.truffle.api.nodes.DirectCallNode
- All Implemented Interfaces:
NodeInterface
,Cloneable
Represents a direct call to a
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.- Since:
- 0.8 or earlier
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.oracle.truffle.api.nodes.Node
Node.Child, Node.Children
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract Object
Calls the innerCallTarget
returned bygetCurrentCallTarget()
.abstract boolean
Clones theCallTarget
instance returned bygetCallTarget()
in an uninitialized state for thisDirectCallNode
.static DirectCallNode
create
(CallTarget target) Creates cached direct call node using bytecode index-1
.abstract void
Enforces the runtime system to inline theCallTarget
at this call site.Returns the originally suppliedCallTarget
when this call node was created.abstract CallTarget
Returns the splitCallTarget
if this call site'sCallTarget
is cloned.Returns the used call target whencall(java.lang.Object[])
is invoked.final RootNode
final boolean
Returnstrue
if the target of theDirectCallNode
was cloned by the runtime system or by the guest language implementation.abstract boolean
Returnstrue
if the runtime system supports cloning and theRootNode
returnstrue
inRootNode.isCloningAllowed()
.abstract boolean
Returnstrue
if the underlying runtime system supports inlining for theCallTarget
in thisDirectCallNode
.abstract boolean
Returnstrue
if theCallTarget
is forced to be inlined.toString()
Converts this node to a textual representation useful for debugging.Methods inherited from class com.oracle.truffle.api.nodes.Node
accept, adoptChildren, atomic, atomic, copy, deepCopy, getChildren, getCost, getDebugProperties, getDescription, getEncapsulatingSourceSection, getLock, getParent, getRootNode, getSourceSection, insert, insert, isAdoptable, isSafelyReplaceableBy, notifyInserted, onReplace, replace, replace, reportPolymorphicSpecialize
-
Field Details
-
callTarget
- Since:
- 0.8 or earlier
-
-
Constructor Details
-
DirectCallNode
- Since:
- 0.8 or earlier
-
-
Method Details
-
call
Calls the innerCallTarget
returned bygetCurrentCallTarget()
.- Parameters:
arguments
- the arguments that should be passed to the callee- Returns:
- the return result of the call
- Since:
- 0.23
-
getCallTarget
Returns the originally suppliedCallTarget
when this call node was created. Please note that the returnedCallTarget
is not necessarily theCallTarget
that is called. For that usegetCurrentCallTarget()
instead.- Returns:
- the
CallTarget
provided. - Since:
- 0.8 or earlier
-
isInlinable
public abstract boolean isInlinable()Returnstrue
if the underlying runtime system supports inlining for theCallTarget
in thisDirectCallNode
.- Returns:
- true if inlining is supported.
- Since:
- 0.8 or earlier
-
isInliningForced
public abstract boolean isInliningForced()Returnstrue
if theCallTarget
is forced to be inlined. ADirectCallNode
can either be inlined manually by invokingforceInlining()
or by the runtime system which may at any point decide to inline.- Returns:
- true if this method was inlined else false.
- Since:
- 0.8 or earlier
-
forceInlining
public abstract void forceInlining()Enforces the runtime system to inline theCallTarget
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.- Since:
- 0.8 or earlier
-
isCallTargetCloningAllowed
public abstract boolean isCallTargetCloningAllowed()Returnstrue
if the runtime system supports cloning and theRootNode
returnstrue
inRootNode.isCloningAllowed()
.- Returns:
true
if the target is allowed to be cloned.- Since:
- 0.8 or earlier
-
cloneCallTarget
public abstract boolean cloneCallTarget()Clones theCallTarget
instance returned bygetCallTarget()
in an uninitialized state for thisDirectCallNode
. This can be sensible to gather call site sensitive profiling information for thisDirectCallNode
. IfisCallTargetCloningAllowed()
returnsfalse
this method has no effect and returnsfalse
.- Since:
- 0.8 or earlier
-
isCallTargetCloned
public final boolean isCallTargetCloned()Returnstrue
if the target of theDirectCallNode
was cloned by the runtime system or by the guest language implementation.- Returns:
- if the target was split
- Since:
- 0.8 or earlier
-
getClonedCallTarget
Returns the splitCallTarget
if this call site'sCallTarget
is cloned.- Returns:
- the split
CallTarget
- Since:
- 0.8 or earlier
-
getCurrentCallTarget
Returns the used call target whencall(java.lang.Object[])
is invoked. If theCallTarget
was split this method returns theCallTarget
returned bygetClonedCallTarget()
.- Returns:
- the used
CallTarget
when node is called - Since:
- 0.8 or earlier
-
getCurrentRootNode
Returns theRootNode
associated withCallTarget
returned bygetCurrentCallTarget()
. If the storedCallTarget
does not contain aRootNode
this method returnsnull
.- Returns:
- the root node of the used call target
- Since:
- 0.8 or earlier
- See Also:
-
toString
Description copied from class:Node
Converts this node to a textual representation useful for debugging. -
create
Creates cached direct call node using bytecode index-1
.- Since:
- 0.8 or earlier
-