V
- type of the Value used for the analysis.public class Frame<V extends Value> extends Object
Constructor and Description |
---|
Frame(Frame<? extends V> src)
Constructs a new frame that is identical to the given frame.
|
Frame(int nLocals,
int nStack)
Constructs a new frame with the given size.
|
Modifier and Type | Method and Description |
---|---|
void |
clearStack()
Clears the operand stack of this frame.
|
void |
execute(AbstractInsnNode insn,
Interpreter<V> interpreter) |
V |
getLocal(int i)
Returns the value of the given local variable.
|
int |
getLocals()
Returns the maximum number of local variables of this frame.
|
int |
getMaxStackSize()
Returns the maximum stack size of this frame.
|
V |
getStack(int i)
Returns the value of the given operand stack slot.
|
int |
getStackSize()
Returns the number of values in the operand stack of this frame.
|
Frame<V> |
init(Frame<? extends V> src)
Copies the state of the given frame into this frame.
|
boolean |
merge(Frame<? extends V> frame,
boolean[] access)
Merges this frame with the given frame (case of a RET instruction).
|
boolean |
merge(Frame<? extends V> frame,
Interpreter<V> interpreter)
Merges this frame with the given frame.
|
V |
pop()
Pops a value from the operand stack of this frame.
|
void |
push(V value)
Pushes a value into the operand stack of this frame.
|
void |
setLocal(int i,
V value)
Sets the value of the given local variable.
|
void |
setReturn(V v)
Sets the expected return type of the analyzed method.
|
String |
toString()
Returns a string representation of this frame.
|
public Frame(int nLocals, int nStack)
nLocals
- the maximum number of local variables of the frame.nStack
- the maximum stack size of the frame.public Frame<V> init(Frame<? extends V> src)
src
- a frame.public void setReturn(V v)
v
- the expected return type of the analyzed method, or
null if the method returns void.public int getLocals()
public int getMaxStackSize()
public V getLocal(int i) throws IndexOutOfBoundsException
i
- a local variable index.IndexOutOfBoundsException
- if the variable does not exist.public void setLocal(int i, V value) throws IndexOutOfBoundsException
i
- a local variable index.value
- the new value of this local variable.IndexOutOfBoundsException
- if the variable does not exist.public int getStackSize()
public V getStack(int i) throws IndexOutOfBoundsException
i
- the index of an operand stack slot.IndexOutOfBoundsException
- if the operand stack slot does not exist.public void clearStack()
public V pop() throws IndexOutOfBoundsException
IndexOutOfBoundsException
- if the operand stack is empty.public void push(V value) throws IndexOutOfBoundsException
value
- the value that must be pushed into the stack.IndexOutOfBoundsException
- if the operand stack is full.public void execute(AbstractInsnNode insn, Interpreter<V> interpreter) throws AnalyzerException
AnalyzerException
public boolean merge(Frame<? extends V> frame, Interpreter<V> interpreter) throws AnalyzerException
frame
- a frame.interpreter
- the interpreter used to merge values.AnalyzerException
- if the frames have incompatible sizes.public boolean merge(Frame<? extends V> frame, boolean[] access)
frame
- a frameaccess
- the local variables that have been accessed by the subroutine
to which the RET instruction corresponds.