public class Frame
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private boolean |
jsrMerged |
private Type[] |
locals |
private boolean |
retMerged |
private Type[] |
stack |
private int |
top |
Constructor and Description |
---|
Frame(int locals,
int stack)
Create a new frame with the specified local variable table size, and max stack size
|
Modifier and Type | Method and Description |
---|---|
void |
clearStack()
Empties the stack
|
Frame |
copy()
Makes a shallow copy of this frame, i.e.
|
Frame |
copyStack()
Makes a shallow copy of the stack portion of this frame.
|
Type |
getLocal(int index)
Returns the local varaible table entry at index.
|
Type |
getStack(int index)
Returns the type on the stack at the specified index.
|
int |
getTopIndex()
Gets the index of the type sitting at the top of the stack.
|
(package private) boolean |
isJsrMerged()
Whether or not state from the source JSR instruction has been merged
|
(package private) boolean |
isRetMerged()
Whether or not state from the RET instruction, of the subroutine that was jumped
to has been merged.
|
int |
localsLength()
Returns the number of local variable table entries, specified
at construction.
|
boolean |
merge(Frame frame)
Merges all types on the stack and local variable table of this frame with that of the specified
type.
|
boolean |
mergeStack(Frame frame)
Merges all types on the stack of this frame instance with that of the specified frame.
|
Type |
peek()
Gets the top of the stack without altering it
|
Type |
pop()
Alters the stack to contain one less element and return it.
|
void |
push(Type type)
Alters the stack by placing the passed type on the top
|
(package private) void |
setJsrMerged(boolean jsrMerged)
Sets whether of not the state from the source JSR instruction has been merged
|
void |
setLocal(int index,
Type type)
Sets the local variable table entry at index to a type.
|
(package private) void |
setRetMerged(boolean retMerged)
Sets whether or not state from the RET instruction, of the subroutine that was jumped
to has been merged.
|
void |
setStack(int index,
Type type)
Sets the type of the stack position
|
java.lang.String |
toString() |
private Type[] locals
private Type[] stack
private int top
private boolean jsrMerged
private boolean retMerged
public Frame(int locals, int stack)
locals
- the number of local variable table entriesstack
- the maximum stack sizepublic Type getLocal(int index)
index
- the position in the tablepublic void setLocal(int index, Type type)
index
- the position in the tabletype
- the type to set at the positionpublic Type getStack(int index)
index
- the position on the stackpublic void setStack(int index, Type type)
index
- the position on the stacktype
- the type to setpublic void clearStack()
public int getTopIndex()
public int localsLength()
public Type peek()
public Type pop()
public void push(Type type)
type
- the type to add to the toppublic Frame copy()
public Frame copyStack()
public boolean mergeStack(Frame frame)
frame
- the frame to merge the stack frompublic boolean merge(Frame frame)
frame
- the frame to merge withpublic java.lang.String toString()
toString
in class java.lang.Object
boolean isJsrMerged()
void setJsrMerged(boolean jsrMerged)
jsrMerged
- true if merged, otherwise falseboolean isRetMerged()
void setRetMerged(boolean retMerged)
retMerged
- true if RET state has been merged