Class DirectCallNode

java.lang.Object
com.oracle.truffle.api.nodes.Node
com.oracle.truffle.api.nodes.DirectCallNode
All Implemented Interfaces:
NodeInterface, Cloneable

public abstract class DirectCallNode extends Node
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:
  • Field Details

    • callTarget

      protected final CallTarget callTarget
      Since:
      0.8 or earlier
  • Constructor Details

    • DirectCallNode

      protected DirectCallNode(CallTarget callTarget)
      Since:
      0.8 or earlier
  • Method Details

    • call

      public abstract Object call(Object... arguments)
      Calls the inner CallTarget returned by getCurrentCallTarget().
      Parameters:
      arguments - the arguments that should be passed to the callee
      Returns:
      the return result of the call
      Since:
      0.23
    • getCallTarget

      public CallTarget getCallTarget()
      Returns the originally supplied CallTarget when this call node was created. Please note that the returned CallTarget is not necessarily the CallTarget that is called. For that use getCurrentCallTarget() instead.
      Returns:
      the CallTarget provided.
      Since:
      0.8 or earlier
    • isInlinable

      public abstract boolean isInlinable()
      Returns true if the underlying runtime system supports inlining for the CallTarget in this DirectCallNode.
      Returns:
      true if inlining is supported.
      Since:
      0.8 or earlier
    • isInliningForced

      public abstract boolean isInliningForced()
      Returns true if the CallTarget is forced to be inlined. A DirectCallNode can either be inlined manually by invoking forceInlining() 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 the 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.
      Since:
      0.8 or earlier
    • isCallTargetCloningAllowed

      public abstract boolean isCallTargetCloningAllowed()
      Returns true if the runtime system supports cloning and the RootNode returns true in RootNode.isCloningAllowed().
      Returns:
      true if the target is allowed to be cloned.
      Since:
      0.8 or earlier
    • cloneCallTarget

      public abstract boolean cloneCallTarget()
      Clones the CallTarget instance returned by getCallTarget() in an uninitialized state for this DirectCallNode. This can be sensible to gather call site sensitive profiling information for this DirectCallNode. If isCallTargetCloningAllowed() returns false this method has no effect and returns false.
      Since:
      0.8 or earlier
    • isCallTargetCloned

      public final boolean isCallTargetCloned()
      Returns true if the target of the DirectCallNode was cloned by the runtime system or by the guest language implementation.
      Returns:
      if the target was split
      Since:
      0.8 or earlier
    • getClonedCallTarget

      public abstract CallTarget getClonedCallTarget()
      Returns the split CallTarget if this call site's CallTarget is cloned.
      Returns:
      the split CallTarget
      Since:
      0.8 or earlier
    • getCurrentCallTarget

      public CallTarget getCurrentCallTarget()
      Returns the used call target when call(java.lang.Object[]) is invoked. If the CallTarget was split this method returns the CallTarget returned by getClonedCallTarget().
      Returns:
      the used CallTarget when node is called
      Since:
      0.8 or earlier
    • getCurrentRootNode

      public final RootNode getCurrentRootNode()
      Returns the RootNode associated with CallTarget returned by getCurrentCallTarget(). If the stored CallTarget does not contain a RootNode this method returns null.
      Returns:
      the root node of the used call target
      Since:
      0.8 or earlier
      See Also:
    • toString

      public String toString()
      Description copied from class: Node
      Converts this node to a textual representation useful for debugging.
      Overrides:
      toString in class Node
      Since:
      0.8 or earlier
    • create

      public static DirectCallNode create(CallTarget target)
      Since:
      0.8 or earlier