|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.markcrocker.purifier.OperandStack
This class implements a stack used that is used for StackMap generation. Data is stored as StackMapTypes, which is not entirely consistent with a real JVM operand stack because some StackMapType entries represent two storage words. Consequently, several methods are designed to with this in mind.
Field Summary | |
private static org.apache.log4j.Logger |
log
|
private int |
maxStack
The maximum number of stack slots this OperandStack instance may hold. |
private java.util.ArrayList |
stack
We hold the StackMapTypes here. |
Constructor Summary | |
OperandStack(int maxStack)
Creates an empty stack with a maximum of maxStack slots. |
|
OperandStack(int maxStack,
org.apache.bcel.classfile.StackMapType stackMapType)
Creates an otherwise empty stack with a maximum of maxStack slots and the StackMapType 'stackMaptype' object at the top. |
Method Summary | |
void |
clear()
Clears the stack. |
protected java.lang.Object |
clone()
Returns a deep copy of this object. |
boolean |
equals(java.lang.Object o)
Returns true if and only if this OperandStack equals another, meaning equal lengths and equal objects on the stacks. |
OperandStack |
getClone()
Returns a correctly typed clone of this object. |
int |
getMaxStack()
Returns the number of stack slots this stack can hold. |
(package private) int |
getSimulatedJVMsize()
Returns the simulated size of the JVM operand stack that this OperandStack object represents; that means, how many words would be on the operand stack of the real JVM. |
int |
getSize()
Returns the size of this OperandStack; that means, how many StackMapType objects there are. |
org.apache.bcel.classfile.StackMapType[] |
getStackItems()
Converts OperandStack StackMapTypes. |
private void |
indent(java.lang.StringBuffer sb,
java.lang.String indentString,
int indentLevel)
|
boolean |
isEmpty()
Returns true IFF this OperandStack is empty. |
void |
merge(OperandStack challenger)
Merges two OperandStacks according to JVM Specification 4.9.2 |
org.apache.bcel.classfile.StackMapType |
peek()
Returns the element on top of the stack. |
org.apache.bcel.classfile.StackMapType |
peek(int i)
Returns the element that's i elements below the top element; that means, if i==0 the top element is returned. |
org.apache.bcel.classfile.StackMapType |
pop()
Returns the element on top of the stack. |
org.apache.bcel.classfile.StackMapType |
pop(int i)
Pops i elements off the stack. |
void |
push(org.apache.bcel.classfile.StackMapType type)
Pushes a StackMapType object onto the stack. |
org.apache.bcel.classfile.StackMapType |
simulatedJVMPeek(int i)
Returns the element that's i elements below the top element of the simulated JVM operand stack; that means, iff i==0 the top element is returned. |
org.apache.bcel.classfile.StackMapType |
simulatedJVMPop(int i)
Pops i elements off the stack. |
(package private) int |
size()
Alias for getSize(). |
java.lang.String |
toString()
Returns a String representation of this OperandStack instance. |
java.lang.String |
toString(java.lang.String indentString,
int indentLevel)
Returns a String representation of this OperandStack instance prepending each line with the indent string. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static org.apache.log4j.Logger log
private java.util.ArrayList stack
private int maxStack
Constructor Detail |
public OperandStack(int maxStack)
public OperandStack(int maxStack, org.apache.bcel.classfile.StackMapType stackMapType)
Method Detail |
protected java.lang.Object clone()
clone
in class java.lang.Object
public OperandStack getClone()
clone()
public void clear()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public boolean isEmpty()
public int getMaxStack()
public org.apache.bcel.classfile.StackMapType peek()
public org.apache.bcel.classfile.StackMapType peek(int i)
simulatedJVMPeek(int index)
public org.apache.bcel.classfile.StackMapType simulatedJVMPeek(int i)
public org.apache.bcel.classfile.StackMapType pop()
public org.apache.bcel.classfile.StackMapType pop(int i)
simulatedJVMPop(int)
public org.apache.bcel.classfile.StackMapType simulatedJVMPop(int i)
simulatedJVMPop(int)
public void push(org.apache.bcel.classfile.StackMapType type)
int size()
getSize()
public int getSize()
getSimulatedJVMsize()
int getSimulatedJVMsize()
getSize()
public org.apache.bcel.classfile.StackMapType[] getStackItems()
public void merge(OperandStack challenger)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.lang.String indentString, int indentLevel)
indentString
- String to prepend to each line to allow indent
matching.indentLevel
- How many copies of indent string to append.private void indent(java.lang.StringBuffer sb, java.lang.String indentString, int indentLevel)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |