public final class DefaultTruffleRuntime extends java.lang.Object implements TruffleRuntime
This is an implementation-specific class. Do not use or instantiate it. Instead, use
Truffle.getRuntime()
to retrieve the current TruffleRuntime
.
Constructor and Description |
---|
DefaultTruffleRuntime() |
Modifier and Type | Method and Description |
---|---|
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) |
public java.lang.String getName()
TruffleRuntime
getName
in interface TruffleRuntime
public RootCallTarget createCallTarget(RootNode rootNode)
TruffleRuntime
createCallTarget
in interface TruffleRuntime
rootNode
- the root node whose
RootNode.execute(com.oracle.truffle.api.frame.VirtualFrame)
method
represents the entry pointpublic DirectCallNode createDirectCallNode(CallTarget target)
TruffleRuntime
DirectCallNode
.createDirectCallNode
in interface TruffleRuntime
target
- the direct CallTarget
to callpublic IndirectCallNode createIndirectCallNode()
TruffleRuntime
IndirectCallNode
.createIndirectCallNode
in interface TruffleRuntime
public VirtualFrame createVirtualFrame(java.lang.Object[] arguments, FrameDescriptor frameDescriptor)
TruffleRuntime
createVirtualFrame
in interface TruffleRuntime
public MaterializedFrame createMaterializedFrame(java.lang.Object[] arguments)
TruffleRuntime
createMaterializedFrame
in interface TruffleRuntime
public MaterializedFrame createMaterializedFrame(java.lang.Object[] arguments, FrameDescriptor frameDescriptor)
TruffleRuntime
createMaterializedFrame
in interface TruffleRuntime
frameDescriptor
- the frame descriptor describing this frame's valuespublic CompilerOptions createCompilerOptions()
TruffleRuntime
createCompilerOptions
in interface TruffleRuntime
public Assumption createAssumption()
TruffleRuntime
createAssumption
in interface TruffleRuntime
public Assumption createAssumption(java.lang.String name)
TruffleRuntime
createAssumption
in interface TruffleRuntime
name
- the name for the new assumptionpublic FrameInstance setCurrentFrame(FrameInstance newValue)
public void pushFrame(FrameInstance frame)
public void popFrame()
public <T> T iterateFrames(FrameInstanceVisitor<T> visitor)
TruffleRuntime
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.iterateFrames
in interface TruffleRuntime
visitor
- the visitor that is called for every matching frame.public FrameInstance getCallerFrame()
TruffleRuntime
TruffleRuntime.iterateFrames(com.oracle.truffle.api.frame.FrameInstanceVisitor<T>)
.getCallerFrame
in interface TruffleRuntime
public java.util.Collection<RootCallTarget> getCallTargets()
TruffleRuntime
RootCallTarget
instances that were created
using TruffleRuntime.createCallTarget(RootNode)
.getCallTargets
in interface TruffleRuntime
public FrameInstance getCurrentFrame()
TruffleRuntime
CallTarget
. It is
important to note that this FrameInstance
supports only slow path access.getCurrentFrame
in interface TruffleRuntime
public <T> T getCapability(java.lang.Class<T> capability)
TruffleRuntime
getCapability
in interface TruffleRuntime
capability
- the type of the interface representing the capabilitynull
if the runtime does not offer itpublic void notifyTransferToInterpreter()
TruffleRuntime
notifyTransferToInterpreter
in interface TruffleRuntime
public LoopNode createLoopNode(RepeatingNode repeating)
TruffleRuntime
createLoopNode
in interface TruffleRuntime