Class LocalVariableInfo

java.lang.Object
com.android.dx.util.MutabilityControl
com.android.dx.rop.code.LocalVariableInfo

public final class LocalVariableInfo extends MutabilityControl
Container for local variable information for a particular RopMethod.
  • Constructor Details

    • LocalVariableInfo

      public LocalVariableInfo(RopMethod method)
      Constructs an instance.
      Parameters:
      method - non-null; the method being represented by this instance
  • Method Details

    • setStarts

      public void setStarts(int label, RegisterSpecSet specs)
      Sets the register set associated with the start of the block with the given label.
      Parameters:
      label - >= 0; the block label
      specs - non-null; the register set to associate with the block
    • mergeStarts

      public boolean mergeStarts(int label, RegisterSpecSet specs)
      Merges the given register set into the set for the block with the given label. If there was not already an associated set, then this is the same as calling setStarts(int, com.android.dx.rop.code.RegisterSpecSet). Otherwise, this will merge the two sets and call setStarts(int, com.android.dx.rop.code.RegisterSpecSet) on the result of the merge.
      Parameters:
      label - >= 0; the block label
      specs - non-null; the register set to merge into the start set for the block
      Returns:
      true if the merge resulted in an actual change to the associated set (including storing one for the first time) or false if there was no change
    • getStarts

      public RegisterSpecSet getStarts(int label)
      Gets the register set associated with the start of the block with the given label. This returns an empty set with the appropriate max size if no set was associated with the block in question.
      Parameters:
      label - >= 0; the block label
      Returns:
      non-null; the associated register set
    • getStarts

      public RegisterSpecSet getStarts(BasicBlock block)
      Gets the register set associated with the start of the given block. This is just convenient shorthand for getStarts(block.getLabel()).
      Parameters:
      block - non-null; the block in question
      Returns:
      non-null; the associated register set
    • mutableCopyOfStarts

      public RegisterSpecSet mutableCopyOfStarts(int label)
      Gets a mutable copy of the register set associated with the start of the block with the given label. This returns a newly-allocated empty RegisterSpecSet of appropriate max size if there is not yet any set associated with the block.
      Parameters:
      label - >= 0; the block label
      Returns:
      non-null; the associated register set
    • addAssignment

      public void addAssignment(Insn insn, RegisterSpec spec)
      Adds an assignment association for the given instruction and register spec. This throws an exception if the instruction doesn't actually perform a named variable assignment. Note: Although the instruction contains its own spec for the result, it still needs to be passed in explicitly to this method, since the spec that is stored here should always have a simple type and the one in the instruction can be an arbitrary TypeBearer (such as a constant value).
      Parameters:
      insn - non-null; the instruction in question
      spec - non-null; the associated register spec
    • getAssignment

      public RegisterSpec getAssignment(Insn insn)
      Gets the named register being assigned by the given instruction, if previously stored in this instance.
      Parameters:
      insn - non-null; instruction in question
      Returns:
      null-ok; the named register being assigned, if any
    • getAssignmentCount

      public int getAssignmentCount()
      Gets the number of assignments recorded by this instance.
      Returns:
      >= 0; the number of assignments
    • debugDump

      public void debugDump()