Package proguard.evaluation
Class Stack
- java.lang.Object
-
- proguard.evaluation.Stack
-
- Direct Known Subclasses:
TracedStack
public class Stack extends java.lang.ObjectThis class represents an operand stack that containsValueinstances.
-
-
Field Summary
Fields Modifier and Type Field Description protected intactualMaxSizeprotected intcurrentSizeprotected Value[]values
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ReferenceValueapop()Pops the top ReferenceValue from the stack.voidclear()Clears the stack.voidcopy(Stack other)Copies the values of the given Stack into this Stack.DoubleValuedpop()Pops the top DoubleValue from the stack.voiddup()Duplicates the top Category 1 value.voiddup_x1()Duplicates the top Category 1 value, one Category 1 element down the stack.voiddup_x2()Duplicates the top Category 1 value, two Category 1 elements (or one Category 2 element) down the stack.voiddup2()Duplicates the top Category 2 value (or alternatively, the equivalent Category 1 stack elements).voiddup2_x1()Duplicates the top Category 2 value, one Category 1 element down the stack (or alternatively, the equivalent Category 1 stack values).voiddup2_x2()Duplicates the top Category 2 value, one Category 2 stack element down the stack (or alternatively, the equivalent Category 1 stack values).booleanequals(java.lang.Object object)FloatValuefpop()Pops the top FloatValue from the stack.booleangeneralize(Stack other)Generalizes the values of this Stack with the values of the given Stack.intgetActualMaxSize()Returns the actual maximum stack size that was required for all stack operations, accounting for the double space required by Category 2 values.ValuegetBottom(int index)Gets the specified Value from the stack, without disturbing it.ValuegetTop(int index)Gets the specified Value from the stack, without disturbing it.inthashCode()IntegerValueipop()Pops the top IntegerValue from the stack.LongValuelpop()Pops the top LongValue from the stack.InstructionOffsetValueopop()Pops the top InstructionOffsetValue from the stack.Valuepop()Pops the top Value from the stack.voidpop1()Pops the top category 1 value from the stack.voidpop2()Pops the top category 2 value from the stack (or alternatively, two Category 1 stack elements).voidpush(Value value)Pushes the given Value onto the stack.voidremoveTop(int index)Removes the specified Value from the stack.voidreplaceReferences(Value toReplace, Value replacement)Replaces all the references to {@param toReplace} with references to {@param replacement}.voidreset(int maxSize)Resets this Stack, so that it can be reused.voidsetBottom(int index, Value value)Sets the specified Value on the stack, without disturbing it.voidsetTop(int index, Value value)Sets the specified Value on the stack, without disturbing it.intsize()Returns the number of elements currently on the stack, accounting for the double space required by Category 2 values.voidswap()Swaps the top two Category 1 values.java.lang.StringtoString()
-
-
-
Field Detail
-
values
protected Value[] values
-
currentSize
protected int currentSize
-
actualMaxSize
protected int actualMaxSize
-
-
Constructor Detail
-
Stack
public Stack(int maxSize)
Creates a new Stack with a given maximum size, accounting for the double space required by Category 2 values.
-
Stack
public Stack(Stack stack)
Creates a Stack that is a copy of the given Stack.
-
-
Method Detail
-
getActualMaxSize
public int getActualMaxSize()
Returns the actual maximum stack size that was required for all stack operations, accounting for the double space required by Category 2 values.
-
reset
public void reset(int maxSize)
Resets this Stack, so that it can be reused.
-
copy
public void copy(Stack other)
Copies the values of the given Stack into this Stack.
-
generalize
public boolean generalize(Stack other)
Generalizes the values of this Stack with the values of the given Stack. The stacks must have the same current sizes.- Returns:
- whether the generalization has made any difference.
-
clear
public void clear()
Clears the stack.
-
size
public int size()
Returns the number of elements currently on the stack, accounting for the double space required by Category 2 values.
-
getBottom
public Value getBottom(int index)
Gets the specified Value from the stack, without disturbing it.- Parameters:
index- the index of the stack element, counting from the bottom of the stack.- Returns:
- the value at the specified position.
-
setBottom
public void setBottom(int index, Value value)Sets the specified Value on the stack, without disturbing it.- Parameters:
index- the index of the stack element, counting from the bottom of the stack.value- the value to set.
-
getTop
public Value getTop(int index)
Gets the specified Value from the stack, without disturbing it.- Parameters:
index- the index of the stack element, counting from the top of the stack.- Returns:
- the value at the specified position.
-
setTop
public void setTop(int index, Value value)Sets the specified Value on the stack, without disturbing it.- Parameters:
index- the index of the stack element, counting from the top of the stack.value- the value to set.
-
removeTop
public void removeTop(int index)
Removes the specified Value from the stack.- Parameters:
index- the index of the stack element, counting from the top of the stack.
-
push
public void push(Value value)
Pushes the given Value onto the stack.
-
pop
public Value pop()
Pops the top Value from the stack.
-
ipop
public IntegerValue ipop()
Pops the top IntegerValue from the stack.
-
lpop
public LongValue lpop()
Pops the top LongValue from the stack.
-
fpop
public FloatValue fpop()
Pops the top FloatValue from the stack.
-
dpop
public DoubleValue dpop()
Pops the top DoubleValue from the stack.
-
apop
public ReferenceValue apop()
Pops the top ReferenceValue from the stack.
-
opop
public InstructionOffsetValue opop()
Pops the top InstructionOffsetValue from the stack.
-
pop1
public void pop1()
Pops the top category 1 value from the stack.
-
pop2
public void pop2()
Pops the top category 2 value from the stack (or alternatively, two Category 1 stack elements).
-
dup
public void dup()
Duplicates the top Category 1 value.
-
dup_x1
public void dup_x1()
Duplicates the top Category 1 value, one Category 1 element down the stack.
-
dup_x2
public void dup_x2()
Duplicates the top Category 1 value, two Category 1 elements (or one Category 2 element) down the stack.
-
dup2
public void dup2()
Duplicates the top Category 2 value (or alternatively, the equivalent Category 1 stack elements).
-
dup2_x1
public void dup2_x1()
Duplicates the top Category 2 value, one Category 1 element down the stack (or alternatively, the equivalent Category 1 stack values).
-
dup2_x2
public void dup2_x2()
Duplicates the top Category 2 value, one Category 2 stack element down the stack (or alternatively, the equivalent Category 1 stack values).
-
swap
public void swap()
Swaps the top two Category 1 values.
-
replaceReferences
public void replaceReferences(Value toReplace, Value replacement)
Replaces all the references to {@param toReplace} with references to {@param replacement}.
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-