Class TracedStack

java.lang.Object
proguard.evaluation.Stack
proguard.evaluation.TracedStack

public class TracedStack extends Stack
This Stack saves additional information with stack elements, to keep track of their origins.

The stack stores a given producer Value along with each Value it stores. It then generalizes a given collected Value with the producer Value of each Value it loads. The producer Value and the initial collected Value can be set. The generalized collected Value can be retrieved, either taking into account dup/swap instructions as proper instructions or ignoring them.

  • Field Summary

    Fields inherited from class proguard.evaluation.Stack

    actualMaxSize, currentSize, values
  • Constructor Summary

    Constructors
    Constructor
    Description
    TracedStack(int maxSize)
    Creates a new TracedStack with a given maximum size.
    TracedStack(TracedStack tracedStack)
    Creates a new TracedStack that is a copy of the given TracedStack.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears the stack.
    void
     
    void
    dup()
    Duplicates the top Category 1 value.
    void
    Duplicates the top Category 1 value, one Category 1 element down the stack.
    void
    Duplicates the top Category 1 value, two Category 1 elements (or one Category 2 element) down the stack.
    void
    Duplicates the top Category 2 value (or alternatively, the equivalent Category 1 stack elements).
    void
    Duplicates the top Category 2 value, one Category 1 element down the stack (or alternatively, the equivalent Category 1 stack values).
    void
    Duplicates the top Category 2 value, one Category 2 stack element down the stack (or alternatively, the equivalent Category 1 stack values).
    boolean
    equals(Object object)
     
    boolean
     
    Gets the specified actual producer Value from the stack, ignoring dup/swap instructions, without disturbing it.
    Gets the specified producer Value from the stack, without disturbing it.
    Gets the specified actual producer Value from the stack, ignoring dup/swap instructions, without disturbing it.
    Gets the specified producer Value from the stack, without disturbing it.
    int
     
    pop()
    Pops the top Value from the stack.
    void
    Pops the top category 1 value from the stack.
    void
    Pops the top category 2 value from the stack (or alternatively, two Category 1 stack elements).
    void
    push(Value value)
    Pushes the given Value onto the stack.
    void
    removeTop(int index)
    Removes the specified Value from the stack.
    void
    reset(int size)
    Resets this Stack, so that it can be reused.
    void
    setProducerValue(Value producerValue)
    Sets the Value that will be stored along with all push and pop instructions.
    void
    Swaps the top two Category 1 values.
     

    Methods inherited from class java.lang.Object

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

    • TracedStack

      public TracedStack(int maxSize)
      Creates a new TracedStack with a given maximum size.
    • TracedStack

      public TracedStack(TracedStack tracedStack)
      Creates a new TracedStack that is a copy of the given TracedStack.
  • Method Details

    • setProducerValue

      public void setProducerValue(Value producerValue)
      Sets the Value that will be stored along with all push and pop instructions.
    • getBottomProducerValue

      public Value getBottomProducerValue(int index)
      Gets the specified producer Value from the stack, without disturbing it.
      Parameters:
      index - the index of the stack element, counting from the bottom of the stack.
      Returns:
      the producer value at the specified position.
    • getBottomActualProducerValue

      public Value getBottomActualProducerValue(int index)
      Gets the specified actual producer Value from the stack, ignoring dup/swap instructions, without disturbing it.
      Parameters:
      index - the index of the stack element, counting from the bottom of the stack.
      Returns:
      the producer value at the specified position.
    • getTopProducerValue

      public Value getTopProducerValue(int index)
      Gets the specified producer Value from the stack, without disturbing it.
      Parameters:
      index - the index of the stack element, counting from the top of the stack.
      Returns:
      the producer value at the specified position.
    • getTopActualProducerValue

      public Value getTopActualProducerValue(int index)
      Gets the specified actual producer Value from the stack, ignoring dup/swap instructions, without disturbing it.
      Parameters:
      index - the index of the stack element, counting from the top of the stack.
      Returns:
      the producer value at the specified position.
    • reset

      public void reset(int size)
      Description copied from class: Stack
      Resets this Stack, so that it can be reused.
      Overrides:
      reset in class Stack
    • copy

      public void copy(TracedStack other)
    • generalize

      public boolean generalize(TracedStack other)
    • clear

      public void clear()
      Description copied from class: Stack
      Clears the stack.
      Overrides:
      clear in class Stack
    • removeTop

      public void removeTop(int index)
      Description copied from class: Stack
      Removes the specified Value from the stack.
      Overrides:
      removeTop in class Stack
      Parameters:
      index - the index of the stack element, counting from the top of the stack.
    • push

      public void push(Value value)
      Description copied from class: Stack
      Pushes the given Value onto the stack.
      Overrides:
      push in class Stack
    • pop

      public Value pop()
      Description copied from class: Stack
      Pops the top Value from the stack.
      Overrides:
      pop in class Stack
    • pop1

      public void pop1()
      Description copied from class: Stack
      Pops the top category 1 value from the stack.
      Overrides:
      pop1 in class Stack
    • pop2

      public void pop2()
      Description copied from class: Stack
      Pops the top category 2 value from the stack (or alternatively, two Category 1 stack elements).
      Overrides:
      pop2 in class Stack
    • dup

      public void dup()
      Description copied from class: Stack
      Duplicates the top Category 1 value.
      Overrides:
      dup in class Stack
    • dup_x1

      public void dup_x1()
      Description copied from class: Stack
      Duplicates the top Category 1 value, one Category 1 element down the stack.
      Overrides:
      dup_x1 in class Stack
    • dup_x2

      public void dup_x2()
      Description copied from class: Stack
      Duplicates the top Category 1 value, two Category 1 elements (or one Category 2 element) down the stack.
      Overrides:
      dup_x2 in class Stack
    • dup2

      public void dup2()
      Description copied from class: Stack
      Duplicates the top Category 2 value (or alternatively, the equivalent Category 1 stack elements).
      Overrides:
      dup2 in class Stack
    • dup2_x1

      public void dup2_x1()
      Description copied from class: Stack
      Duplicates the top Category 2 value, one Category 1 element down the stack (or alternatively, the equivalent Category 1 stack values).
      Overrides:
      dup2_x1 in class Stack
    • dup2_x2

      public void dup2_x2()
      Description copied from class: Stack
      Duplicates the top Category 2 value, one Category 2 stack element down the stack (or alternatively, the equivalent Category 1 stack values).
      Overrides:
      dup2_x2 in class Stack
    • swap

      public void swap()
      Description copied from class: Stack
      Swaps the top two Category 1 values.
      Overrides:
      swap in class Stack
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Stack
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Stack
    • toString

      public String toString()
      Overrides:
      toString in class Stack