V
- type of the Value used for the analysis.public class Frame<V extends Value>
extends java.lang.Object
Constructor | Description |
---|---|
Frame(int nLocals,
int nStack) |
Constructs a new frame with the given size.
|
Frame(Frame<? extends V> frame) |
Constructs a copy of the given.
|
Modifier and Type | Method | Description |
---|---|---|
void |
clearStack() |
Clears the operand stack of this frame.
|
void |
execute(AbstractInsnNode insn,
Interpreter<V> interpreter) |
Simulates the execution of the given instruction on this execution stack frame.
|
V |
getLocal(int index) |
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 index) |
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> frame) |
Copies the state of the given frame into this frame.
|
boolean |
merge(Frame<? extends V> frame,
boolean[] localsUsed) |
Merges the given frame into this frame (case of a subroutine).
|
boolean |
merge(Frame<? extends V> frame,
Interpreter<V> interpreter) |
Merges the given frame into this 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 index,
V value) |
Sets the value of the given local variable.
|
void |
setReturn(V v) |
Sets the expected return type of the analyzed method.
|
void |
setStack(int i,
V value) |
Sets the value of the given stack slot.
|
java.lang.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> frame)
frame
- 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 index)
index
- a local variable index.java.lang.IndexOutOfBoundsException
- if the variable does not exist.public void setLocal(int index, V value)
index
- a local variable index.value
- the new value of this local variable.java.lang.IndexOutOfBoundsException
- if the variable does not exist.public int getStackSize()
public V getStack(int index)
index
- the index of an operand stack slot.java.lang.IndexOutOfBoundsException
- if the operand stack slot does not exist.public void setStack(int i, V value) throws java.lang.IndexOutOfBoundsException
i
- the index of an operand stack slot.value
- the new value of the stack slot.java.lang.IndexOutOfBoundsException
- if the stack slot does not exist.public void clearStack()
public V pop()
java.lang.IndexOutOfBoundsException
- if the operand stack is empty.public void push(V value)
value
- the value that must be pushed into the stack.java.lang.IndexOutOfBoundsException
- if the operand stack is full.public void execute(AbstractInsnNode insn, Interpreter<V> interpreter) throws AnalyzerException
insn
- the instruction to execute.interpreter
- the interpreter to use to compute values from other values.AnalyzerException
- if the instruction cannot be executed on this execution frame (e.g. a
POP on an empty operand stack).public boolean merge(Frame<? extends V> frame, Interpreter<V> interpreter) throws AnalyzerException
frame
- a frame. This frame is left unchanged by this method.interpreter
- the interpreter used to merge values.AnalyzerException
- if the frames have incompatible sizes.public boolean merge(Frame<? extends V> frame, boolean[] localsUsed)
frame
- a frame. This frame is left unchanged by this method.localsUsed
- the local variables that are read or written by the subroutine. The i-th
element is true if and only if the local variable at index i is read or written by the
subroutine.public java.lang.String toString()
toString
in class java.lang.Object