Package com.oracle.truffle.api.impl
Class DefaultTruffleRuntime
java.lang.Object
com.oracle.truffle.api.impl.DefaultTruffleRuntime
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionCreates a new assumption object that can be checked and invalidated.createAssumption
(String name) Creates a new assumption object with a given name that can be checked and invalidated.createCallTarget
(RootNode rootNode) Creates a new call target for a given root node.Creates an object which allows you to test for support of and set options specific for this runtime.createDirectCallNode
(CallTarget target) Creates a new runtime specific version ofDirectCallNode
.Creates a new runtime specific version ofIndirectCallNode
.createLoopNode
(RepeatingNode repeating) Experimental API.createMaterializedFrame
(Object[] arguments) Creates a new materialized frame object that can be used to store values.createMaterializedFrame
(Object[] arguments, FrameDescriptor frameDescriptor) Creates a new materialized frame object with the given frame descriptor that can be used to store values.createVirtualFrame
(Object[] arguments, FrameDescriptor frameDescriptor) Creates a new virtual frame object that can be used to store values and is potentially optimizable by the runtime.Accesses the caller frame.Returns a list of all still referencedRootCallTarget
instances that were created usingTruffleRuntime.createCallTarget(RootNode)
.<T> T
getCapability
(Class<T> capability) Requests a capability from the runtime.Accesses the current frame, i.e., the frame of the closestCallTarget
.getName()
Name describing this runtime implementation for debugging purposes.<T> T
iterateFrames
(FrameInstanceVisitor<T> visitor) Accesses the current stack, i.e., the contents of theFrame
s and the associatedCallTarget
s.void
Internal API method.void
popFrame()
void
pushFrame
(FrameInstance frame) setCurrentFrame
(FrameInstance newValue)
-
Constructor Details
-
DefaultTruffleRuntime
public DefaultTruffleRuntime()
-
-
Method Details
-
getName
Description copied from interface:TruffleRuntime
Name describing this runtime implementation for debugging purposes.- Specified by:
getName
in interfaceTruffleRuntime
- Returns:
- the name as a String
-
createCallTarget
Description copied from interface:TruffleRuntime
Creates a new call target for a given root node.- Specified by:
createCallTarget
in interfaceTruffleRuntime
- Parameters:
rootNode
- the root node whoseRootNode.execute(com.oracle.truffle.api.frame.VirtualFrame)
method represents the entry point- Returns:
- the new call target object
-
createDirectCallNode
Description copied from interface:TruffleRuntime
Creates a new runtime specific version ofDirectCallNode
.- Specified by:
createDirectCallNode
in interfaceTruffleRuntime
- Parameters:
target
- the directCallTarget
to call- Returns:
- the new call node
-
createIndirectCallNode
Description copied from interface:TruffleRuntime
Creates a new runtime specific version ofIndirectCallNode
.- Specified by:
createIndirectCallNode
in interfaceTruffleRuntime
- Returns:
- the new call node
-
createVirtualFrame
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 interfaceTruffleRuntime
- Returns:
- the newly created virtual frame object
-
createMaterializedFrame
Description copied from interface:TruffleRuntime
Creates a new materialized frame object that can be used to store values.- Specified by:
createMaterializedFrame
in interfaceTruffleRuntime
- Returns:
- the newly created materialized frame object
-
createMaterializedFrame
public MaterializedFrame createMaterializedFrame(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 interfaceTruffleRuntime
frameDescriptor
- the frame descriptor describing this frame's values- Returns:
- the newly created materialized frame object
-
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 interfaceTruffleRuntime
- Returns:
- the newly created compiler options object
-
createAssumption
Description copied from interface:TruffleRuntime
Creates a new assumption object that can be checked and invalidated.- Specified by:
createAssumption
in interfaceTruffleRuntime
- Returns:
- the newly created assumption object
-
createAssumption
Description copied from interface:TruffleRuntime
Creates a new assumption object with a given name that can be checked and invalidated.- Specified by:
createAssumption
in interfaceTruffleRuntime
- Parameters:
name
- the name for the new assumption- Returns:
- the newly created assumption object
-
setCurrentFrame
-
pushFrame
-
popFrame
public void popFrame() -
iterateFrames
Description copied from interface:TruffleRuntime
Accesses the current stack, i.e., the contents of theFrame
s and the associatedCallTarget
s. Iteration starts at the caller frame, i.e., it does not include the current frame. Iteration continues as long asFrameInstanceVisitor.visitFrame(com.oracle.truffle.api.frame.FrameInstance)
, which is invoked for everyFrameInstance
, returns null. Any non-null result of the visitor indicates that frame iteration should stop.- Specified by:
iterateFrames
in interfaceTruffleRuntime
- 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
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 ofTruffleRuntime.iterateFrames(com.oracle.truffle.api.frame.FrameInstanceVisitor<T>)
.- Specified by:
getCallerFrame
in interfaceTruffleRuntime
-
getCallTargets
Description copied from interface:TruffleRuntime
Returns a list of all still referencedRootCallTarget
instances that were created usingTruffleRuntime.createCallTarget(RootNode)
.- Specified by:
getCallTargets
in interfaceTruffleRuntime
-
getCurrentFrame
Description copied from interface:TruffleRuntime
Accesses the current frame, i.e., the frame of the closestCallTarget
. It is important to note that thisFrameInstance
supports only slow path access.- Specified by:
getCurrentFrame
in interfaceTruffleRuntime
-
getCapability
Description copied from interface:TruffleRuntime
Requests a capability from the runtime.- Specified by:
getCapability
in interfaceTruffleRuntime
- 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 interfaceTruffleRuntime
-
createLoopNode
Description copied from interface:TruffleRuntime
Experimental API. May change without notice.- Specified by:
createLoopNode
in interfaceTruffleRuntime
-