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 currentTruffleRuntime.
-
-
Constructor Summary
Constructors Constructor Description DefaultTruffleRuntime()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AssumptioncreateAssumption()Creates a new assumption object that can be checked and invalidated.AssumptioncreateAssumption(java.lang.String name)Creates a new assumption object with a given name that can be checked and invalidated.RootCallTargetcreateCallTarget(RootNode rootNode)Creates a new call target for a given root node.CompilerOptionscreateCompilerOptions()Creates an object which allows you to test for support of and set options specific for this runtime.DirectCallNodecreateDirectCallNode(CallTarget target)Creates a new runtime specific version ofDirectCallNode.IndirectCallNodecreateIndirectCallNode()Creates a new runtime specific version ofIndirectCallNode.LoopNodecreateLoopNode(RepeatingNode repeating)Experimental API.MaterializedFramecreateMaterializedFrame(java.lang.Object[] arguments)Creates a new materialized frame object that can be used to store values.MaterializedFramecreateMaterializedFrame(java.lang.Object[] arguments, FrameDescriptor frameDescriptor)Creates a new materialized frame object with the given frame descriptor that can be used to store values.VirtualFramecreateVirtualFrame(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.FrameInstancegetCallerFrame()Accesses the caller frame.java.util.Collection<RootCallTarget>getCallTargets()Returns a list of all still referencedRootCallTargetinstances that were created usingTruffleRuntime.createCallTarget(RootNode).<T> TgetCapability(java.lang.Class<T> capability)Requests a capability from the runtime.FrameInstancegetCurrentFrame()Accesses the current frame, i.e., the frame of the closestCallTarget.java.lang.StringgetName()Name describing this runtime implementation for debugging purposes.<T> TiterateFrames(FrameInstanceVisitor<T> visitor)Accesses the current stack, i.e., the contents of theFrames and the associatedCallTargets.voidnotifyTransferToInterpreter()Internal API method.voidpopFrame()voidpushFrame(FrameInstance frame)FrameInstancesetCurrentFrame(FrameInstance newValue)
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:TruffleRuntimeName describing this runtime implementation for debugging purposes.- Specified by:
getNamein interfaceTruffleRuntime- Returns:
- the name as a String
-
createCallTarget
public RootCallTarget createCallTarget(RootNode rootNode)
Description copied from interface:TruffleRuntimeCreates a new call target for a given root node.- Specified by:
createCallTargetin 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
public DirectCallNode createDirectCallNode(CallTarget target)
Description copied from interface:TruffleRuntimeCreates a new runtime specific version ofDirectCallNode.- Specified by:
createDirectCallNodein interfaceTruffleRuntime- Parameters:
target- the directCallTargetto call- Returns:
- the new call node
-
createIndirectCallNode
public IndirectCallNode createIndirectCallNode()
Description copied from interface:TruffleRuntimeCreates a new runtime specific version ofIndirectCallNode.- Specified by:
createIndirectCallNodein interfaceTruffleRuntime- Returns:
- the new call node
-
createVirtualFrame
public VirtualFrame createVirtualFrame(java.lang.Object[] arguments, FrameDescriptor frameDescriptor)
Description copied from interface:TruffleRuntimeCreates a new virtual frame object that can be used to store values and is potentially optimizable by the runtime.- Specified by:
createVirtualFramein interfaceTruffleRuntime- Returns:
- the newly created virtual frame object
-
createMaterializedFrame
public MaterializedFrame createMaterializedFrame(java.lang.Object[] arguments)
Description copied from interface:TruffleRuntimeCreates a new materialized frame object that can be used to store values.- Specified by:
createMaterializedFramein interfaceTruffleRuntime- Returns:
- the newly created materialized frame object
-
createMaterializedFrame
public MaterializedFrame createMaterializedFrame(java.lang.Object[] arguments, FrameDescriptor frameDescriptor)
Description copied from interface:TruffleRuntimeCreates a new materialized frame object with the given frame descriptor that can be used to store values.- Specified by:
createMaterializedFramein interfaceTruffleRuntimeframeDescriptor- the frame descriptor describing this frame's values- Returns:
- the newly created materialized frame object
-
createCompilerOptions
public CompilerOptions createCompilerOptions()
Description copied from interface:TruffleRuntimeCreates an object which allows you to test for support of and set options specific for this runtime.- Specified by:
createCompilerOptionsin interfaceTruffleRuntime- Returns:
- the newly created compiler options object
-
createAssumption
public Assumption createAssumption()
Description copied from interface:TruffleRuntimeCreates a new assumption object that can be checked and invalidated.- Specified by:
createAssumptionin interfaceTruffleRuntime- Returns:
- the newly created assumption object
-
createAssumption
public Assumption createAssumption(java.lang.String name)
Description copied from interface:TruffleRuntimeCreates a new assumption object with a given name that can be checked and invalidated.- Specified by:
createAssumptionin interfaceTruffleRuntime- 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:TruffleRuntimeAccesses the current stack, i.e., the contents of theFrames and the associatedCallTargets. 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:
iterateFramesin 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
public FrameInstance getCallerFrame()
Description copied from interface:TruffleRuntimeAccesses 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:
getCallerFramein interfaceTruffleRuntime
-
getCallTargets
public java.util.Collection<RootCallTarget> getCallTargets()
Description copied from interface:TruffleRuntimeReturns a list of all still referencedRootCallTargetinstances that were created usingTruffleRuntime.createCallTarget(RootNode).- Specified by:
getCallTargetsin interfaceTruffleRuntime
-
getCurrentFrame
public FrameInstance getCurrentFrame()
Description copied from interface:TruffleRuntimeAccesses the current frame, i.e., the frame of the closestCallTarget. It is important to note that thisFrameInstancesupports only slow path access.- Specified by:
getCurrentFramein interfaceTruffleRuntime
-
getCapability
public <T> T getCapability(java.lang.Class<T> capability)
Description copied from interface:TruffleRuntimeRequests a capability from the runtime.- Specified by:
getCapabilityin interfaceTruffleRuntime- Parameters:
capability- the type of the interface representing the capability- Returns:
- an implementation of the capability or
nullif the runtime does not offer it
-
notifyTransferToInterpreter
public void notifyTransferToInterpreter()
Description copied from interface:TruffleRuntimeInternal API method. Do not use.- Specified by:
notifyTransferToInterpreterin interfaceTruffleRuntime
-
createLoopNode
public LoopNode createLoopNode(RepeatingNode repeating)
Description copied from interface:TruffleRuntimeExperimental API. May change without notice.- Specified by:
createLoopNodein interfaceTruffleRuntime
-
-