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
,java.lang.Cloneable
- Direct Known Subclasses:
DefaultDirectCallNode
public abstract class DirectCallNode extends Node
Represents a direct call to aCallTarget
. Direct calls are calls for which theCallTarget
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 aDirectCallNode
are inlining and call site sensitive AST duplication. Inlining inlines this call site into the call graph of the parentCallTarget
. Call site sensitive AST duplication duplicates theCallTarget
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.oracle.truffle.api.nodes.Node
Node.Child, Node.Children
-
-
Field Summary
Fields Modifier and Type Field Description protected CallTarget
callTarget
-
Constructor Summary
Constructors Modifier Constructor Description protected
DirectCallNode(CallTarget callTarget)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract java.lang.Object
call(VirtualFrame frame, java.lang.Object[] arguments)
Calls the innerCallTarget
returned bygetCurrentCallTarget()
.abstract boolean
cloneCallTarget()
Clones theCallTarget
instance returned bygetCallTarget()
in an uninitialized state for thisDirectCallNode
.abstract void
forceInlining()
Enforces the runtime system to inline theCallTarget
at this call site.CallTarget
getCallTarget()
Returns the originally suppliedCallTarget
when this call node was created.abstract CallTarget
getClonedCallTarget()
Returns the splitCallTarget
if this call site'sCallTarget
is cloned.CallTarget
getCurrentCallTarget()
Returns the used call target whencall(VirtualFrame, Object[])
is invoked.RootNode
getCurrentRootNode()
boolean
isCallTargetCloned()
Returnstrue
if the target of theDirectCallNode
was cloned by the runtime system or by the guest language implementation.abstract boolean
isCallTargetCloningAllowed()
Returnstrue
if the runtime system supports cloning and theRootNode
returnstrue
inRootNode.isCloningAllowed()
.abstract boolean
isInlinable()
Returnstrue
if the underlying runtime system supports inlining for theCallTarget
in thisDirectCallNode
.boolean
isInlined()
Deprecated.we do not expose this information any longer.abstract boolean
isInliningForced()
Returnstrue
if theCallTarget
is forced to be inlined.java.lang.String
toString()
Converts this node to a textual representation useful for debugging.-
Methods inherited from class com.oracle.truffle.api.nodes.Node
accept, adoptChildren, assignSourceSection, atomic, atomic, clearSourceSection, clone, copy, getChildren, getCost, getDebugProperties, getDescription, getEncapsulatingSourceSection, getLanguage, getParent, getRootNode, getSourceSection, insert, insert, isReplaceable, onAdopt, onReplace, replace, replace
-
-
-
-
Field Detail
-
callTarget
protected final CallTarget callTarget
-
-
Constructor Detail
-
DirectCallNode
protected DirectCallNode(CallTarget callTarget)
-
-
Method Detail
-
call
public abstract java.lang.Object call(VirtualFrame frame, java.lang.Object[] arguments)
Calls the innerCallTarget
returned bygetCurrentCallTarget()
.- Parameters:
arguments
- the arguments that should be passed to the callee- Returns:
- the return result of the call
-
getCallTarget
public CallTarget 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.
-
isInlinable
public abstract boolean isInlinable()
Returnstrue
if the underlying runtime system supports inlining for theCallTarget
in thisDirectCallNode
.- Returns:
- true if inlining is supported.
-
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.
-
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.
-
isInlined
@Deprecated public final boolean isInlined()
Deprecated.we do not expose this information any longer. returns always false.Returns true if the runtime system has decided to inline this call-site. If theDirectCallNode
was forced to inline then this does not necessarily mean that theDirectCallNode
is really going to be inlined. This depends on whether or not the runtime system supports inlining. The runtime system may also decide to not inline calls which were forced to inline.
-
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.
-
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
.
-
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
-
getClonedCallTarget
public abstract CallTarget getClonedCallTarget()
Returns the splitCallTarget
if this call site'sCallTarget
is cloned.- Returns:
- the split
CallTarget
-
getCurrentCallTarget
public CallTarget getCurrentCallTarget()
Returns the used call target whencall(VirtualFrame, Object[])
is invoked. If theCallTarget
was split this method returns theCallTarget
returned bygetClonedCallTarget()
.- Returns:
- the used
CallTarget
when node is called
-
getCurrentRootNode
public final RootNode 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
- See Also:
getCurrentCallTarget()
-
-