public class CompileStack extends Object
This class is a helper for AsmClassGenerator. It manages different aspects of the code of a code block like handling labels, defining variables, and scopes. After a MethodNode is visited clear should be called, for initialization the method init should be used.
Some Notes:
| Modifiers | Name | Description |
|---|---|---|
static class |
CompileStack.BlockRecorder |
|
protected static class |
CompileStack.LabelRange |
| Type | Name and description |
|---|---|
def |
CompileStack(WriterController wc) |
void |
addExceptionBlock(org.objectweb.asm.Label start, org.objectweb.asm.Label end, org.objectweb.asm.Label goal, String sig)initializes this class for a MethodNode. |
void |
applyBlockRecorder() |
void |
applyFinallyBlocks(org.objectweb.asm.Label label, boolean isBreakLabel) |
void |
clear() |
boolean |
containsVariable(String name)Returns the label for the given name |
org.objectweb.asm.Label |
createLocalLabel(String name) |
int |
defineTemporaryVariable(Variable var, boolean store) |
int |
defineTemporaryVariable(String name, boolean store) |
int |
defineTemporaryVariable(String name, ClassNode node, boolean store)Clears the state of the class. |
BytecodeVariable |
defineVariable(Variable v, boolean initFromStack)@param name the name of the variable of interest |
BytecodeVariable |
defineVariable(Variable v, ClassNode variableType, boolean initFromStack) |
org.objectweb.asm.Label |
getBreakLabel() |
org.objectweb.asm.Label |
getContinueLabel() |
org.objectweb.asm.Label |
getLabel(String name) |
org.objectweb.asm.Label |
getNamedBreakLabel(String name) |
org.objectweb.asm.Label |
getNamedContinueLabel(String name) |
VariableScope |
getScope() |
BytecodeVariable |
getVariable(String variableName) |
BytecodeVariable |
getVariable(String variableName, boolean mustExist)creates a temporary variable. |
boolean |
hasBlockRecorder() |
void |
init(VariableScope el, Parameter[] parameters)Causes the state-stack to add an element and sets the given scope as new current variable scope. |
boolean |
isImplicitThis() |
boolean |
isInSpecialConstructorCall() |
boolean |
isLHS() |
void |
pop() |
void |
popBlockRecorderVisit(CompileStack.BlockRecorder finallyBlock) |
void |
popImplicitThis() |
void |
popLHS() |
void |
pushBlockRecorder(CompileStack.BlockRecorder recorder) |
void |
pushBlockRecorderVisit(CompileStack.BlockRecorder finallyBlock) |
void |
pushBooleanExpression() |
void |
pushImplicitThis(boolean implicitThis) |
void |
pushInSpecialConstructorCall() |
void |
pushLHS(boolean lhs) |
void |
pushLoop(VariableScope el, String labelName)Used for break foo inside a loop to end the
execution of the marked loop. |
void |
pushLoop(String labelName) |
void |
pushState() |
org.objectweb.asm.Label |
pushSwitch() |
void |
pushVariableScope(VariableScope el)Should be called when descending into a loop that does not define a scope. |
void |
removeVar(int tempIndex) |
void |
writeExceptionTable(CompileStack.BlockRecorder block, org.objectweb.asm.Label goal, String sig) |
initializes this class for a MethodNode. This method will automatically define variables for the method parameters and will create references if needed. The created variables can be accessed by calling getVariable().
Returns the label for the given name
Clears the state of the class. This method should be called after a MethodNode is visited. Note that a call to init will fail if clear is not called before
name - the name of the variable of interestcreates a temporary variable.
name - defines type and namestore - defines if the top-level argument of the stack should be storedCauses the state-stack to add an element and sets the given scope as new current variable scope. Creates a element for the state stack so pop has to be called later
Used for break foo inside a loop to end the
execution of the marked loop. This method will return the
break label of the loop if there is one found for the name.
If not, the current break label is returned.
Should be called when descending into a loop that does not define a scope. Creates a element for the state stack so pop has to be called later