Package com.oracle.truffle.api.impl

## Class DefaultTruffleRuntime

- java.lang.Object
- - com.oracle.truffle.api.impl.DefaultTruffleRuntime

All Implemented Interfaces:
  `TruffleRuntime`

    public final class DefaultTruffleRuntime
    extends java.lang.Object
    implements TruffleRuntime

Default implementation of the Truffle runtime if the virtual machine does not provide a better performing alternative.

This is an implementation-specific class. Do not use or instantiate it. Instead, use `Truffle.getRuntime()` to retrieve the current `TruffleRuntime`.

### Constructor Summary

Constructors
`DefaultTruffleRuntime()`

### Method Summary

All Methods Instance Methods Concrete Methods
`Assumption` `createAssumption()` Creates a new assumption object that can be checked and invalidated.
`Assumption` `createAssumption​(java.lang.String name)` Creates a new assumption object with a given name that can be checked and invalidated.
`RootCallTarget` `createCallTarget​(RootNode rootNode)` Creates a new call target for a given root node.
`CompilerOptions` `createCompilerOptions()` Creates an object which allows you to test for support of and set options specific for this runtime.
`DirectCallNode` `createDirectCallNode​(CallTarget target)` Creates a new runtime specific version of `DirectCallNode`.
`IndirectCallNode` `createIndirectCallNode()` Creates a new runtime specific version of `IndirectCallNode`.
`LoopNode` `createLoopNode​(RepeatingNode repeating)` Experimental API.
`MaterializedFrame` `createMaterializedFrame​(java.lang.Object[] arguments)` Creates a new materialized frame object that can be used to store values.
`MaterializedFrame` `createMaterializedFrame​(java.lang.Object[] arguments, FrameDescriptor frameDescriptor)` Creates a new materialized frame object with the given frame descriptor that can be used to store values.
`VirtualFrame` `createVirtualFrame​(java.lang.Object[] arguments, FrameDescriptor frameDescriptor)` Creates a new virtual frame object that can be used to store values and is potentially optimizable by the runtime.
`FrameInstance` `getCallerFrame()` Accesses the caller frame.
`java.util.Collection<RootCallTarget>` `getCallTargets()` Returns a list of all still referenced `RootCallTarget` instances that were created using `TruffleRuntime.createCallTarget(RootNode)`.
`<T> T` `getCapability​(java.lang.Class<T> capability)` Requests a capability from the runtime.
`FrameInstance` `getCurrentFrame()` Accesses the current frame, i.e., the frame of the closest `CallTarget`.
`java.lang.String` `getName()` Name describing this runtime implementation for debugging purposes.
`<T> T` `iterateFrames​(FrameInstanceVisitor<T> visitor)` Accesses the current stack, i.e., the contents of the `Frame`s and the associated `CallTarget`s.
`void` `notifyTransferToInterpreter()` Internal API method.
`void` `popFrame()`
`void` `pushFrame​(FrameInstance frame)`
`FrameInstance` `setCurrentFrame​(FrameInstance newValue)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### DefaultTruffleRuntime

    public DefaultTruffleRuntime()

### Method Detail

#### getName

    public java.lang.String getName()

Description copied from interface: `TruffleRuntime`
Name describing this runtime implementation for debugging purposes.

Specified by:
  `getName` in interface `TruffleRuntime`
Returns:
  the name as a String

#### createCallTarget

    public RootCallTarget createCallTarget​(RootNode rootNode)

Description copied from interface: `TruffleRuntime`
Creates a new call target for a given root node.

Specified by:
  `createCallTarget` in interface `TruffleRuntime`
Parameters:
  `rootNode` - the root node whose `RootNode.execute(com.oracle.truffle.api.frame.VirtualFrame)` method represents the entry point
Returns:
  the new call target object

#### createDirectCallNode

    public DirectCallNode createDirectCallNode​(CallTarget target)

Description copied from interface: `TruffleRuntime`
Creates a new runtime specific version of `DirectCallNode`.

Specified by:
  `createDirectCallNode` in interface `TruffleRuntime`
Parameters:
  `target` - the direct `CallTarget` to call
Returns:
  the new call node

#### createIndirectCallNode

    public IndirectCallNode createIndirectCallNode()

Description copied from interface: `TruffleRuntime`
Creates a new runtime specific version of `IndirectCallNode`.

Specified by:
  `createIndirectCallNode` in interface `TruffleRuntime`
Returns:
  the new call node

#### createVirtualFrame

    public VirtualFrame createVirtualFrame​(java.lang.Object[] arguments,
                                           FrameDescriptor frameDescriptor)

Description copied from interface: `TruffleRuntime`
Creates a new virtual frame object that can be used to store values and is potentially optimizable by the runtime.

Specified by:
  `createVirtualFrame` in interface `TruffleRuntime`
Returns:
  the newly created virtual frame object

#### createMaterializedFrame

    public MaterializedFrame createMaterializedFrame​(java.lang.Object[] arguments)

Description copied from interface: `TruffleRuntime`
Creates a new materialized frame object that can be used to store values.

Specified by:
  `createMaterializedFrame` in interface `TruffleRuntime`
Returns:
  the newly created materialized frame object

#### createMaterializedFrame

    public MaterializedFrame createMaterializedFrame​(java.lang.Object[] arguments,
                                                     FrameDescriptor frameDescriptor)

Description copied from interface: `TruffleRuntime`
Creates a new materialized frame object with the given frame descriptor that can be used to store values.

Specified by:
  `createMaterializedFrame` in interface `TruffleRuntime`
  `frameDescriptor` - the frame descriptor describing this frame's values
Returns:
  the newly created materialized frame object

#### createCompilerOptions

    public CompilerOptions createCompilerOptions()

Description copied from interface: `TruffleRuntime`
Creates an object which allows you to test for support of and set options specific for this runtime.

Specified by:
  `createCompilerOptions` in interface `TruffleRuntime`
Returns:
  the newly created compiler options object

#### createAssumption

    public Assumption createAssumption()

Description copied from interface: `TruffleRuntime`
Creates a new assumption object that can be checked and invalidated.

Specified by:
  `createAssumption` in interface `TruffleRuntime`
Returns:
  the newly created assumption object

#### createAssumption

    public Assumption createAssumption​(java.lang.String name)

Description copied from interface: `TruffleRuntime`
Creates a new assumption object with a given name that can be checked and invalidated.

Specified by:
  `createAssumption` in interface `TruffleRuntime`
Parameters:
  `name` - the name for the new assumption
Returns:
  the newly created assumption object

#### setCurrentFrame

    public FrameInstance setCurrentFrame​(FrameInstance newValue)

#### pushFrame

    public void pushFrame​(FrameInstance frame)

#### popFrame

    public void popFrame()

#### iterateFrames

    public <T> T iterateFrames​(FrameInstanceVisitor<T> visitor)

Description copied from interface: `TruffleRuntime`
Accesses the current stack, i.e., the contents of the `Frame`s and the associated `CallTarget`s. Iteration starts at the caller frame, i.e., it does not include the current frame. Iteration continues as long as `FrameInstanceVisitor.visitFrame(com.oracle.truffle.api.frame.FrameInstance)`, which is invoked for every `FrameInstance`, returns null. Any non-null result of the visitor indicates that frame iteration should stop.

Specified by:
  `iterateFrames` in interface `TruffleRuntime`
Parameters:
  `visitor` - the visitor that is called for every matching frame.
Returns:
  the last result returned by the visitor (which is non-null to indicate that iteration should stop), or null if the whole stack was iterated.

#### getCallerFrame

    public FrameInstance getCallerFrame()

Description copied from interface: `TruffleRuntime`
Accesses the caller frame. This is a convenience method that returns the first frame that is passed to the visitor of `TruffleRuntime.iterateFrames(com.oracle.truffle.api.frame.FrameInstanceVisitor<T>)`.

Specified by:
  `getCallerFrame` in interface `TruffleRuntime`

#### getCallTargets

    public java.util.Collection<RootCallTarget> getCallTargets()

Description copied from interface: `TruffleRuntime`
Returns a list of all still referenced `RootCallTarget` instances that were created using `TruffleRuntime.createCallTarget(RootNode)`.

Specified by:
  `getCallTargets` in interface `TruffleRuntime`

#### getCurrentFrame

    public FrameInstance getCurrentFrame()

Description copied from interface: `TruffleRuntime`
Accesses the current frame, i.e., the frame of the closest `CallTarget`. It is important to note that this `FrameInstance` supports only slow path access.

Specified by:
  `getCurrentFrame` in interface `TruffleRuntime`

#### getCapability

    public <T> T getCapability​(java.lang.Class<T> capability)

Description copied from interface: `TruffleRuntime`
Requests a capability from the runtime.

Specified by:
  `getCapability` in interface `TruffleRuntime`
Parameters:
  `capability` - the type of the interface representing the capability
Returns:
  an implementation of the capability or `null` if the runtime does not offer it

#### notifyTransferToInterpreter

    public void notifyTransferToInterpreter()

Description copied from interface: `TruffleRuntime`
Internal API method. Do not use.

Specified by:
  `notifyTransferToInterpreter` in interface `TruffleRuntime`

#### createLoopNode

    public LoopNode createLoopNode​(RepeatingNode repeating)

Description copied from interface: `TruffleRuntime`
Experimental API. May change without notice.

Specified by:
  `createLoopNode` in interface `TruffleRuntime`