Interface CallTarget

All Known Subinterfaces:
RootCallTarget

public interface CallTarget
Represents the target of a call. Call targets are created automatically from a RootNode by calling RootNode.getCallTarget().

A call target allows the runtime to employ a compilation heuristic to trigger partial evaluation of the underlying RootNode, typically in the background. Additionally, calling a call target builds a guest language level stack trace which can be inspected using TruffleRuntime.iterateFrames(com.oracle.truffle.api.frame.FrameInstanceVisitor) or TruffleStackTrace.getStackTrace(Throwable).

Do not subclass CallTarget directly, as this interface is likely to become sealed in the future.

Since:
0.8 or earlier
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default Object
    call(Node location, Object... arguments)
    Calls the encapsulated root node with an explicit call location and arguments, and returns the result.
    call(Object... arguments)
    Calls the encapsulated root node with the given arguments and returns the result.
  • Method Details

    • call

      Object call(Object... arguments)
      Calls the encapsulated root node with the given arguments and returns the result.

      By calling this method, the call location is looked up using EncapsulatingNodeReference. Use call(Node, Object...) if the call location is already known.

      Calling this method in partially evaluated code will allow it to get inlined if the receiver (this) is a pe-constant. Call site cloning is only supported if a DirectCallNode is used instead.

      Parameters:
      arguments - The arguments passed to the call, as an object array.
      Returns:
      The result of the call.
      Since:
      0.8 or earlier
      See Also:
    • call

      default Object call(Node location, Object... arguments)
      Calls the encapsulated root node with an explicit call location and arguments, and returns the result.

      This method should be preferred over call(Object...) if the current location is known, as it avoids looking up the current location from a thread-local.

      Parameters:
      location - A Node that identifies the location of this call. The location may be null if no location is available.
      arguments - The arguments passed to the call, as an object array.
      Returns:
      The result of the call.
      Since:
      24.1
      See Also: