Class ReplacingBasicValue

java.lang.Object
org.objectweb.asm.tree.analysis.BasicValue
org.apache.drill.exec.compile.bytecode.ReplacingBasicValue
All Implemented Interfaces:
org.objectweb.asm.tree.analysis.Value

public class ReplacingBasicValue extends org.objectweb.asm.tree.analysis.BasicValue
BasicValue with additional tracking information used to determine the replaceability of the value (a holder, or boxed value) for scalar replacement purposes.

Contains a set of flags that indicate how the value is used. These are updated throughout the life of the function, via the Analyzer/Interpreter, which simulate execution of the function. After the analysis is complete, the flags indicate how the value/variable was used, and that in turn indicates whether or not we can replace it.

  • Field Summary

    Fields inherited from class org.objectweb.asm.tree.analysis.BasicValue

    DOUBLE_VALUE, FLOAT_VALUE, INT_VALUE, LONG_VALUE, REFERENCE_VALUE, RETURNADDRESS_VALUE, UNINITIALIZED_VALUE
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Associate this value with another.
    create(org.objectweb.asm.Type type, org.apache.drill.exec.compile.bytecode.ValueHolderIden iden, int index, List<ReplacingBasicValue> valueList)
    Create a new value representing a holder (boxed value).
    void
    Clear the indication that this value is used as a function return value.
    void
    dump(StringBuilder sb, int indentLevel)
    Dump the value's members to a StringBuilder.
    org.apache.drill.exec.compile.bytecode.ValueHolderIden
    Return the ValueHolder identity for this value.
    int
    Get the original local variable slot assigned to this value/holder.
    boolean
    Indicates whether or not this value is assigned to a variable inside of conditional block.
    boolean
    Indicates whether or not this value is assigned to a class member variable.
    boolean
    Indicates whether or not this value is used as a function argument.
    boolean
    Indicates whether or not this value is used as a function return value.
    boolean
    Indicates whether or not this value is replaceable.
    boolean
    Indicates whether or not this value is a "this" reference.
    void
    Mark this value as being used as a function return value.
    void
    Mark this value as being assigned to a variable inside of conditional block.
    void
    Mark this value as being assigned to a class member variable.
    void
    setFrameSlot(int frameSlot)
     
    void
    Mark this value as being used as a function argument.
    void
    Mark this value as a "this" reference.

    Methods inherited from class org.objectweb.asm.tree.analysis.BasicValue

    equals, getSize, getType, hashCode, isReference, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • create

      public static ReplacingBasicValue create(org.objectweb.asm.Type type, org.apache.drill.exec.compile.bytecode.ValueHolderIden iden, int index, List<ReplacingBasicValue> valueList)
      Create a new value representing a holder (boxed value).
      Parameters:
      type - the type of the holder
      iden - the ValueHolderIden for the holder
      index - the original local variable slot assigned to the value
      valueList - TODO
      Returns:
    • dump

      public void dump(StringBuilder sb, int indentLevel)
      Dump the value's members to a StringBuilder.

      For logging and/or debugging.

      Parameters:
      sb - the StringBuilder
      indentLevel - the amount of indentation (in spaces) to prepend to each line
    • isReplaceable

      public boolean isReplaceable()
      Indicates whether or not this value is replaceable.
      Returns:
      whether or not the value is replaceable
    • setFrameSlot

      public void setFrameSlot(int frameSlot)
    • associate

      public void associate(ReplacingBasicValue other)
      Associate this value with another.

      This value and/or the other may each already have their own set of associates.

      Once associated, these values will share flag values, and a change to any one of them will be shared with all other members of the association.

      Parameters:
      other - the other value
    • markFunctionReturn

      public void markFunctionReturn()
      Mark this value as being used as a function return value.
    • disableFunctionReturn

      public void disableFunctionReturn()
      Clear the indication that this value is used as a function return value.
    • isFunctionReturn

      public boolean isFunctionReturn()
      Indicates whether or not this value is used as a function return value.
      Returns:
      whether or not this value is used as a function return value
    • setFunctionArgument

      public void setFunctionArgument()
      Mark this value as being used as a function argument.
    • isFunctionArgument

      public boolean isFunctionArgument()
      Indicates whether or not this value is used as a function argument.
      Returns:
      whether or not this value is used as a function argument
    • setAssignedToMember

      public void setAssignedToMember()
      Mark this value as being assigned to a class member variable.
    • setAssignedInConditionalBlock

      public void setAssignedInConditionalBlock()
      Mark this value as being assigned to a variable inside of conditional block.
    • isAssignedToMember

      public boolean isAssignedToMember()
      Indicates whether or not this value is assigned to a class member variable.
      Returns:
      whether or not this value is assigned to a class member variable
    • isAssignedInConditionalBlock

      public boolean isAssignedInConditionalBlock()
      Indicates whether or not this value is assigned to a variable inside of conditional block.
      Returns:
      whether or not this value is assigned to a variable inside of conditional block
    • getIden

      public org.apache.drill.exec.compile.bytecode.ValueHolderIden getIden()
      Return the ValueHolder identity for this value.
      Returns:
      the ValueHolderIden for this value
    • getIndex

      public int getIndex()
      Get the original local variable slot assigned to this value/holder.
      Returns:
      the original local variable slot assigned to this value/holder
    • setThis

      public void setThis()
      Mark this value as a "this" reference.
    • isThis

      public boolean isThis()
      Indicates whether or not this value is a "this" reference.
      Returns:
      whether or not this value is a "this" reference