Class SLWriteLocalVariableNode
java.lang.Object
com.oracle.truffle.api.nodes.Node
com.oracle.truffle.sl.nodes.local.SLScopedNode
com.oracle.truffle.sl.nodes.SLStatementNode
com.oracle.truffle.sl.nodes.SLExpressionNode
com.oracle.truffle.sl.nodes.local.SLWriteLocalVariableNode
- All Implemented Interfaces:
com.oracle.truffle.api.instrumentation.InstrumentableNode,com.oracle.truffle.api.nodes.NodeInterface,Cloneable
Node to write a local variable to a function's
frame. The Truffle frame API
allows to store primitive values of all Java primitive types, and Object values.-
Nested Class Summary
Nested classes/interfaces inherited from class com.oracle.truffle.api.nodes.Node
com.oracle.truffle.api.nodes.Node.Child, com.oracle.truffle.api.nodes.Node.ChildrenNested classes/interfaces inherited from interface com.oracle.truffle.api.instrumentation.InstrumentableNode
com.oracle.truffle.api.instrumentation.InstrumentableNode.WrapperNode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidexecuteWrite(com.oracle.truffle.api.frame.VirtualFrame frame, Object value) protected abstract SLExpressionNodeReturns the child nodenameNode.protected abstract intgetSlot()Returns the descriptor of the accessed local variable.final com.oracle.truffle.api.strings.TruffleStringbooleanprotected booleanisBooleanOrIllegal(com.oracle.truffle.api.frame.VirtualFrame frame) abstract booleanprotected booleanisLongOrIllegal(com.oracle.truffle.api.frame.VirtualFrame frame) Guard function that the local variable has the typelong.protected ObjectGeneric write method that works for all possible types.protected booleanwriteBoolean(com.oracle.truffle.api.frame.VirtualFrame frame, boolean value) protected longwriteLong(com.oracle.truffle.api.frame.VirtualFrame frame, long value) Specialized method to write a primitivelongvalue.Methods inherited from class com.oracle.truffle.sl.nodes.SLExpressionNode
addExpressionTag, createWrapper, executeBoolean, executeGeneric, executeLong, executeVoidMethods inherited from class com.oracle.truffle.sl.nodes.SLStatementNode
addRootTag, addStatementTag, formatSourceSection, getSourceCharIndex, getSourceEndIndex, getSourceLength, getSourceSection, hasSource, isInstrumentable, setSourceSection, setUnavailableSourceSection, toStringMethods inherited from class com.oracle.truffle.sl.nodes.local.SLScopedNode
findBlock, getVisibleVariablesIndexOnEnter, hasScope, setVisibleVariablesIndexOnEnter, setVisibleVariablesIndexOnExitMethods inherited from class com.oracle.truffle.api.nodes.Node
accept, adoptChildren, atomic, atomic, copy, deepCopy, getChildren, getCost, getDebugProperties, getDescription, getEncapsulatingSourceSection, getLock, getParent, getRootNode, insert, insert, isAdoptable, isSafelyReplaceableBy, notifyInserted, onReplace, replace, replace, reportPolymorphicSpecialize, reportReplaceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.oracle.truffle.api.instrumentation.InstrumentableNode
createProbe, findNearestNodeAt, findNearestNodeAt, findProbe, materializeInstrumentableNodes
-
Constructor Details
-
SLWriteLocalVariableNode
public SLWriteLocalVariableNode()
-
-
Method Details
-
getSlot
protected abstract int getSlot()Returns the descriptor of the accessed local variable. The implementation of this method is created by the Truffle DSL based on theNodeFieldannotation on the class. -
getNameNode
Returns the child nodenameNode. The implementation of this method is created by the Truffle DSL based on theNodeChildannotation on the class. -
isDeclaration
public abstract boolean isDeclaration() -
getSlotName
public final com.oracle.truffle.api.strings.TruffleString getSlotName() -
writeLong
protected long writeLong(com.oracle.truffle.api.frame.VirtualFrame frame, long value) Specialized method to write a primitivelongvalue. This is only possible if the local variable also has currently the typelongor was never written before, therefore a Truffle DSLcustom guardis specified. -
writeBoolean
protected boolean writeBoolean(com.oracle.truffle.api.frame.VirtualFrame frame, boolean value) -
write
Generic write method that works for all possible types.Why is this method annotated with
Specializationand notFallback? For aFallbackmethod, the Truffle DSL generated code would try all other specializations first before calling this method. We know that all these specializations would fail their guards, so there is no point in calling them. Since this method takes a value of typeObject, it is guaranteed to never fail, i.e., once we are in this specialization the node will never be re-specialized. -
executeWrite
-
isLongOrIllegal
protected boolean isLongOrIllegal(com.oracle.truffle.api.frame.VirtualFrame frame) Guard function that the local variable has the typelong.- Parameters:
frame- The parameter seems unnecessary, but it is required: Without the parameter, the Truffle DSL would not check the guard on every execution of the specialization. Guards without parameters are assumed to be pure, but our guard depends on the slot kind which can change.
-
isBooleanOrIllegal
protected boolean isBooleanOrIllegal(com.oracle.truffle.api.frame.VirtualFrame frame) -
hasTag
- Specified by:
hasTagin interfacecom.oracle.truffle.api.instrumentation.InstrumentableNode- Overrides:
hasTagin classSLExpressionNode
-
getNodeObject
-