public interface TruffleRuntime
Modifier and Type | Method and Description |
---|---|
Assumption |
createAssumption()
Creates a new assumption object that can be checked and invalidated.
|
Assumption |
createAssumption(String name)
Creates a new assumption object with a given name that can be checked and invalidated.
|
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 body)
Creates a new loop node with an implementation provided by a Truffle runtime implementation.
|
MaterializedFrame |
createMaterializedFrame(Object[] arguments)
Creates a new materialized frame object that can be used to store values.
|
MaterializedFrame |
createMaterializedFrame(Object[] arguments,
FrameDescriptor frameDescriptor)
Creates a new materialized frame object with the given frame descriptor that can be used to
store values.
|
VirtualFrame |
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.
|
<T> T |
getCapability(Class<T> capability)
Requests a capability from the runtime.
|
String |
getName()
Name describing this runtime implementation for debugging purposes.
|
boolean |
isProfilingEnabled()
Whether or not the
TruffleRuntime implementation can or wants to use gathered
profiling information Truffle compilation. |
default <T> T |
iterateFrames(FrameInstanceVisitor<T> visitor)
Accesses the current stack, i.e., the contents of the
Frame s and the associated
CallTarget s. |
default <T> T |
iterateFrames(FrameInstanceVisitor<T> visitor,
int skipFrames)
Accesses the current stack, i.e., the contents of the
Frame s and the associated
CallTarget s. |
void |
notifyTransferToInterpreter()
Internal API method.
|
String getName()
DirectCallNode createDirectCallNode(CallTarget target)
DirectCallNode
.target
- the direct CallTarget
to callLoopNode createLoopNode(RepeatingNode body)
usage example
IndirectCallNode createIndirectCallNode()
IndirectCallNode
.Assumption createAssumption()
Assumption createAssumption(String name)
name
- the name for the new assumptionVirtualFrame createVirtualFrame(Object[] arguments, FrameDescriptor frameDescriptor)
MaterializedFrame createMaterializedFrame(Object[] arguments)
MaterializedFrame createMaterializedFrame(Object[] arguments, FrameDescriptor frameDescriptor)
frameDescriptor
- the frame descriptor describing this frame's valuesdefault <T> T iterateFrames(FrameInstanceVisitor<T> visitor)
Frame
s and the associated
CallTarget
s. Iteration starts at 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.
Instances of FrameInstance
must note escape the invocation of
FrameInstanceVisitor.visitFrame(FrameInstance)
. This rule is currently not enforced,
but will be in future versions of Truffle.
Note that this method can cause deoptimization if
FrameInstance.getFrame(FrameInstance.FrameAccess)
is called with
FrameInstance.FrameAccess.READ_WRITE
or FrameInstance.FrameAccess.MATERIALIZE
on the fast path.
Instructions and flags for debugging such deoptimizations can be found in /truffle/docs/Optimizing.md#debugging-deoptimizations
To get possible asynchronous stack frames, use
TruffleStackTrace.getAsynchronousStackTrace(CallTarget, Frame)
and provide call
target and frame from the last FrameInstance
.
visitor
- the visitor that is called for every matching frame.default <T> T iterateFrames(FrameInstanceVisitor<T> visitor, int skipFrames)
Frame
s and the associated
CallTarget
s. Iteration starts at the current frame and skips a number of frames
provided as argument.
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.
Instances of FrameInstance
must note escape the invocation of
FrameInstanceVisitor.visitFrame(FrameInstance)
. This rule is currently not enforced,
but will be in future versions of Truffle.
Note that this method can cause deoptimization if
FrameInstance.getFrame(FrameInstance.FrameAccess)
is called with
FrameInstance.FrameAccess.READ_WRITE
or FrameInstance.FrameAccess.MATERIALIZE
on the fast path.
Instructions and flags for debugging such deoptimizations can be found in /truffle/docs/Optimizing.md#debugging-deoptimizations
To get possible asynchronous stack frames, use
TruffleStackTrace.getAsynchronousStackTrace(CallTarget, Frame)
and provide call
target and frame from the last FrameInstance
.
visitor
- the visitor that is called for every matching frame.skipFrames
- number of frames to skip before invoking the visitor<T> T getCapability(Class<T> capability)
capability
- the type of the interface representing the capabilitynull
if the runtime does not offer itvoid notifyTransferToInterpreter()
boolean isProfilingEnabled()
TruffleRuntime
implementation can or wants to use gathered
profiling information Truffle compilation. If this method returns false
then all
profiles in the com.oracle.truffle.api.utilities
package are returning void
implementations. If it returns true
then all implementations gather profilinig
information.