V
- type of the Value used for the analysis.public class Frame<V extends Value> extends Object
Constructor and Description |
---|
Frame(Frame<? extends V> frame)
Constructs a copy of the given.
|
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)
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.
|
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.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.IndexOutOfBoundsException
- if the variable does not exist.public int getStackSize()
public V getStack(int index)
index
- the index of an operand stack slot.IndexOutOfBoundsException
- if the operand stack slot does not exist.public void clearStack()
public V pop()
IndexOutOfBoundsException
- if the operand stack is empty.public void push(V value)
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
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.Copyright © 2021. All rights reserved.