Class SLShortCircuitNode

All Implemented Interfaces:
com.oracle.truffle.api.instrumentation.InstrumentableNode, com.oracle.truffle.api.nodes.NodeInterface, Cloneable
Direct Known Subclasses:
SLLogicalAndNode, SLLogicalOrNode

public abstract class SLShortCircuitNode extends SLExpressionNode
Logical operations in SL use short circuit evaluation: if the evaluation of the left operand already decides the result of the operation, the right operand must not be executed. This is expressed in using this base class for SLLogicalAndNode and SLLogicalOrNode.
  • Constructor Details

  • Method Details

    • executeGeneric

      public final Object executeGeneric(com.oracle.truffle.api.frame.VirtualFrame frame)
      Description copied from class: SLExpressionNode
      The execute method when no specialization is possible. This is the most general case, therefore it must be provided by all subclasses.
      Specified by:
      executeGeneric in class SLExpressionNode
    • executeBoolean

      public final boolean executeBoolean(com.oracle.truffle.api.frame.VirtualFrame frame)
      Overrides:
      executeBoolean in class SLExpressionNode
    • isEvaluateRight

      protected abstract boolean isEvaluateRight(boolean leftValue)
      This method is called after the left child was evaluated, but before the right child is evaluated. The right child is only evaluated when the return value is {code true}.
    • execute

      protected abstract boolean execute(boolean leftValue, boolean rightValue)
      Calculates the result of the short circuit operation. If the right node is not evaluated then false is provided.