public final class Frame
extends java.lang.Object
| Constructor and Description |
|---|
Frame(int maxLocals,
int maxStack)
Constructs an instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
annotate(ExceptionWithContext ex)
Annotates (adds context to) the given exception with information
about this frame.
|
Frame |
copy()
Makes and returns a mutable copy of this instance.
|
LocalsArray |
getLocals()
Gets the locals array for this instance.
|
ExecutionStack |
getStack()
Gets the execution stack for this instance.
|
IntList |
getSubroutines()
Returns the largest subroutine nesting this block may be in.
|
void |
initializeWithParameters(StdTypeList params)
Initialize this frame with the method's parameters.
|
Frame |
makeExceptionHandlerStartFrame(CstType exceptionClass)
Makes a new frame for an exception handler block invoked from this
frame.
|
void |
makeInitialized(Type type)
Replaces all the occurrences of the given uninitialized type in
this frame with its initialized equivalent.
|
Frame |
makeNewSubroutineStartFrame(int subLabel,
int callerLabel)
Makes a frame for a subroutine start block, given that this is the
ending frame of one of the subroutine's calling blocks.
|
Frame |
mergeWith(Frame other)
Merges two frames.
|
Frame |
mergeWithSubroutineCaller(Frame other,
int subLabel,
int predLabel)
Merges this frame with the frame of a subroutine caller at
predLabel. |
void |
setImmutable()
Makes this instance immutable.
|
Frame |
subFrameForLabel(int startLabel,
int subLabel)
Returns a Frame instance representing the frame state that should
be used when returning from a subroutine.
|
public Frame(int maxLocals,
int maxStack)
nulls) and
the stack starts out empty.maxLocals - >= 0; the maximum number of locals this instance
can refer tomaxStack - >= 0; the maximum size of the stack for this
instancepublic Frame copy()
non-null; the copypublic void setImmutable()
public void makeInitialized(Type type)
type - non-null; type to replacepublic LocalsArray getLocals()
non-null; the locals arraypublic ExecutionStack getStack()
non-null; the execution stackpublic IntList getSubroutines()
non-null; list as noted abovepublic void initializeWithParameters(StdTypeList params)
params - Type list of method parameters.public Frame subFrameForLabel(int startLabel, int subLabel)
startLabel - >=0; The label of the returning subroutine's
start blocksubLabel - >=0; A calling label of a subroutinenull-ok; an appropriatly-constructed instance, or null
if label is not in the setpublic Frame mergeWith(Frame other)
other - non-null; another framenon-null; the result of merging the two framespublic Frame mergeWithSubroutineCaller(Frame other, int subLabel, int predLabel)
predLabel. Only called on the frame at the first
block of a subroutine.other - non-null; another framesubLabel - label of subroutine start blockpredLabel - label of calling blocknon-null; the result of merging the two framespublic Frame makeNewSubroutineStartFrame(int subLabel, int callerLabel)
subLabel - label of subroutine start blockcallerLabel - >=0; label of the caller block where this frame
came from.public Frame makeExceptionHandlerStartFrame(CstType exceptionClass)
exceptionClass - exception that the handler block will handlepublic void annotate(ExceptionWithContext ex)
ex - non-null; the exception to annotateCopyright © 2020. All Rights Reserved.