Class SLWriteLocalVariableNode

All Implemented Interfaces:
com.oracle.truffle.api.instrumentation.InstrumentableNode, com.oracle.truffle.api.nodes.NodeInterface, Cloneable

public abstract class SLWriteLocalVariableNode extends SLExpressionNode
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.
  • 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 the NodeField annotation on the class.
    • getNameNode

      protected abstract SLExpressionNode getNameNode()
      Returns the child node nameNode. The implementation of this method is created by the Truffle DSL based on the NodeChild annotation 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 primitive long value. This is only possible if the local variable also has currently the type long or was never written before, therefore a Truffle DSL custom guard is specified.
    • writeBoolean

      protected boolean writeBoolean(com.oracle.truffle.api.frame.VirtualFrame frame, boolean value)
    • write

      protected Object write(com.oracle.truffle.api.frame.VirtualFrame frame, Object value)
      Generic write method that works for all possible types.

      Why is this method annotated with Specialization and not Fallback? For a Fallback method, 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 type Object, it is guaranteed to never fail, i.e., once we are in this specialization the node will never be re-specialized.

    • executeWrite

      public abstract void executeWrite(com.oracle.truffle.api.frame.VirtualFrame frame, Object value)
    • isLongOrIllegal

      protected boolean isLongOrIllegal(com.oracle.truffle.api.frame.VirtualFrame frame)
      Guard function that the local variable has the type long.
      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

      public boolean hasTag(Class<? extends com.oracle.truffle.api.instrumentation.Tag> tag)
      Specified by:
      hasTag in interface com.oracle.truffle.api.instrumentation.InstrumentableNode
      Overrides:
      hasTag in class SLExpressionNode
    • getNodeObject

      public Object getNodeObject()