|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--uk.co.badgersinfoil.jactionscript.analysis.SimpleStackSimulator
Builds a picture of the actionscript stack layout as each instruction is
executed, driving an implementation of StackListener.
For example, when a NOT action is encountered, we pop an Operand off
our emulated stack, create a new Operand to hold the result, and then
pass these values to StackListener.visitNOT(Action,Operand,Operand).
The result-Operand's value isn't calculated, though the StackListener
implementation may fill this in. When visitNot() returns, the
SimpleStackSimulator pushes the result Operand onto the stack.
The only time that this class fills in the value for Operands is where constant values are pushed onto the stack. Without this, we wouldn't be able to resonably emulate things like function-calls, where the number of values to pop off the stack is determined by the (usually constant) value on the top of the stack.
Since no attempt is made to follow the branches in the flow of control
produced by BranchAction subclasses, encountering any Action that is
a branch, or that is the target of a branch invalidates all our guesses
about the stack layout. Later attempts to read from this invalid part
of the stack will always produce Operands with unknown values.
| Field Summary | |
protected LookupTable |
currentLookupTable
|
protected StackInfo |
stack
|
| Constructor Summary | |
SimpleStackSimulator(StackListener listener)
|
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected StackInfo stack
protected LookupTable currentLookupTable
| Constructor Detail |
public SimpleStackSimulator(StackListener listener)
| Method Detail |
protected void push(Operand entry)
protected Operand pop()
protected void invalidateState()
protected java.util.List popArgs()
public void visitHandle(ActionHandle handle)
throws JASVisitorException
Visitor
visitHandle in interface VisitorJASVisitorException
public void visitEnd(ActionList list)
throws JASVisitorException
Visitor
visitEnd in interface VisitorJASVisitorException
public void visitADD(Action action)
throws JASVisitorException
visitADD in interface VisitorJASVisitorException
public void visitAND(Action action)
throws JASVisitorException
visitAND in interface VisitorJASVisitorException
public void visitASCII_TO_CHAR(Action action)
throws JASVisitorException
visitASCII_TO_CHAR in interface VisitorJASVisitorException
public void visitASCII_TO_CHAR_MB(Action action)
throws JASVisitorException
visitASCII_TO_CHAR_MB in interface VisitorJASVisitorException
public void visitBIT_AND(Action action)
throws JASVisitorException
visitBIT_AND in interface VisitorJASVisitorException
public void visitBIT_OR(Action action)
throws JASVisitorException
visitBIT_OR in interface VisitorJASVisitorException
public void visitBIT_XOR(Action action)
throws JASVisitorException
visitBIT_XOR in interface VisitorJASVisitorException
public void visitCALL(Action action)
throws JASVisitorException
visitCALL in interface VisitorJASVisitorException
public void visitCALL_FUNCTION(Action action)
throws JASVisitorException
visitCALL_FUNCTION in interface VisitorJASVisitorException
public void visitCALL_METHOD(Action action)
throws JASVisitorException
visitCALL_METHOD in interface VisitorJASVisitorException
public void visitCHAR_MB_TO_ASCII(Action action)
throws JASVisitorException
visitCHAR_MB_TO_ASCII in interface VisitorJASVisitorException
public void visitCHAR_TO_ASCII(Action action)
throws JASVisitorException
visitCHAR_TO_ASCII in interface VisitorJASVisitorException
public void visitCLONE_SPRITE(Action action)
throws JASVisitorException
visitCLONE_SPRITE in interface VisitorJASVisitorException
public void visitCONCAT(Action action)
throws JASVisitorException
visitCONCAT in interface VisitorJASVisitorException
public void visitCONVERT_TO_NUMBER(Action action)
throws JASVisitorException
visitCONVERT_TO_NUMBER in interface VisitorJASVisitorException
public void visitCONVERT_TO_STRING(Action action)
throws JASVisitorException
visitCONVERT_TO_STRING in interface VisitorJASVisitorException
public void visitDECREMENT(Action action)
throws JASVisitorException
visitDECREMENT in interface VisitorJASVisitorException
public void visitDEFINE_LOCAL(Action action)
throws JASVisitorException
visitDEFINE_LOCAL in interface VisitorJASVisitorException
public void visitDEFINE_LOCAL_VALUE(Action action)
throws JASVisitorException
visitDEFINE_LOCAL_VALUE in interface VisitorJASVisitorException
public void visitDELETE_PROPERTY(Action action)
throws JASVisitorException
visitDELETE_PROPERTY in interface VisitorJASVisitorException
public void visitDELETE_THREAD_VARS(Action action)
throws JASVisitorException
visitDELETE_THREAD_VARS in interface VisitorJASVisitorException
public void visitDIVIDE(Action action)
throws JASVisitorException
visitDIVIDE in interface VisitorJASVisitorException
public void visitDUPLICATE(Action action)
throws JASVisitorException
visitDUPLICATE in interface VisitorJASVisitorException
public void visitEND_DRAG(Action action)
throws JASVisitorException
visitEND_DRAG in interface VisitorJASVisitorException
public void visitENUMERATE(Action action)
throws JASVisitorException
visitENUMERATE in interface VisitorJASVisitorException
public void visitENUMERATE_OBJECT(Action action)
throws JASVisitorException
visitENUMERATE_OBJECT in interface VisitorJASVisitorException
public void visitEQUALS(Action action)
throws JASVisitorException
visitEQUALS in interface VisitorJASVisitorException
public void visitGET_MEMBER(Action action)
throws JASVisitorException
visitGET_MEMBER in interface VisitorJASVisitorException
public void visitGET_PROPERTY(Action action)
throws JASVisitorException
visitGET_PROPERTY in interface VisitorJASVisitorException
public void visitGET_TARGET_PATH(Action action)
throws JASVisitorException
visitGET_TARGET_PATH in interface VisitorJASVisitorException
public void visitGET_TIME(Action action)
throws JASVisitorException
visitGET_TIME in interface VisitorJASVisitorException
public void visitGET_URL2(GetURL2Action action)
throws JASVisitorException
visitGET_URL2 in interface VisitorJASVisitorException
public void visitGET_URL(GetURLAction action)
throws JASVisitorException
visitGET_URL in interface VisitorJASVisitorException
public void visitGET_VARIABLE(Action action)
throws JASVisitorException
visitGET_VARIABLE in interface VisitorJASVisitorException
public void visitGOTO_FRAME2(GotoFrame2Action action)
throws JASVisitorException
visitGOTO_FRAME2 in interface VisitorJASVisitorException
public void visitGOTO_FRAME(GotoFrameAction action)
throws JASVisitorException
visitGOTO_FRAME in interface VisitorJASVisitorException
public void visitGOTO_LABEL(GotoLabelAction action)
throws JASVisitorException
visitGOTO_LABEL in interface VisitorJASVisitorException
public void visitGREATER_THAN(Action action)
throws JASVisitorException
visitGREATER_THAN in interface VisitorJASVisitorException
public void visitIF_JUMP(IfJumpAction action)
throws JASVisitorException
visitIF_JUMP in interface VisitorJASVisitorException
public void visitINCREMENT(Action action)
throws JASVisitorException
visitINCREMENT in interface VisitorJASVisitorException
public void visitINIT_ARRAY(Action action)
throws JASVisitorException
visitINIT_ARRAY in interface VisitorJASVisitorException
public void visitINIT_OBJECT(Action action)
throws JASVisitorException
visitINIT_OBJECT in interface VisitorJASVisitorException
public void visitINSTANCE_OF(Action action)
throws JASVisitorException
visitINSTANCE_OF in interface VisitorJASVisitorException
public void visitJUMP(JumpAction action)
throws JASVisitorException
visitJUMP in interface VisitorJASVisitorException
public void visitLESS_THAN(Action action)
throws JASVisitorException
visitLESS_THAN in interface VisitorJASVisitorException
public void visitLOOKUP(LookupAction action)
throws JASVisitorException
visitLOOKUP in interface VisitorJASVisitorException
public void visitLOOKUP_TABLE(LookupTableAction action)
throws JASVisitorException
visitLOOKUP_TABLE in interface VisitorJASVisitorException
public void visitMODULO(Action action)
throws JASVisitorException
visitMODULO in interface VisitorJASVisitorException
public void visitMULTIPLY(Action action)
throws JASVisitorException
visitMULTIPLY in interface VisitorJASVisitorException
public void visitNEW_METHOD(Action action)
throws JASVisitorException
visitNEW_METHOD in interface VisitorJASVisitorException
public void visitNEW_OBJECT(Action action)
throws JASVisitorException
visitNEW_OBJECT in interface VisitorJASVisitorException
public void visitNEXT_FRAME(Action action)
throws JASVisitorException
visitNEXT_FRAME in interface VisitorJASVisitorException
public void visitNOT(Action action)
throws JASVisitorException
visitNOT in interface VisitorJASVisitorException
public void visitOR(Action action)
throws JASVisitorException
visitOR in interface VisitorJASVisitorException
public void visitPLAY(Action action)
throws JASVisitorException
visitPLAY in interface VisitorJASVisitorException
public void visitPOP(Action action)
throws JASVisitorException
visitPOP in interface VisitorJASVisitorException
public void visitPREV_FRAME(Action action)
throws JASVisitorException
visitPREV_FRAME in interface VisitorJASVisitorException
public void visitPUSH(PushAction action)
throws JASVisitorException
visitPUSH in interface VisitorJASVisitorException
public void visitRANDOM_NUMBER(Action action)
throws JASVisitorException
visitRANDOM_NUMBER in interface VisitorJASVisitorException
public void visitREMOVE_SPRITE(Action action)
throws JASVisitorException
visitREMOVE_SPRITE in interface VisitorJASVisitorException
public void visitRETURN_VALUE(Action action)
throws JASVisitorException
visitRETURN_VALUE in interface VisitorJASVisitorException
public void visitSET_MEMBER(Action action)
throws JASVisitorException
visitSET_MEMBER in interface VisitorJASVisitorException
public void visitSET_PROPERTY(Action action)
throws JASVisitorException
visitSET_PROPERTY in interface VisitorJASVisitorException
public void visitSET_TARGET_2(Action action)
throws JASVisitorException
visitSET_TARGET_2 in interface VisitorJASVisitorException
public void visitSET_TARGET(SetTargetAction action)
throws JASVisitorException
visitSET_TARGET in interface VisitorJASVisitorException
public void visitSET_VARIABLE(Action action)
throws JASVisitorException
visitSET_VARIABLE in interface VisitorJASVisitorException
public void visitSHIFT_LEFT(Action action)
throws JASVisitorException
visitSHIFT_LEFT in interface VisitorJASVisitorException
public void visitSHIFT_RIGHT(Action action)
throws JASVisitorException
visitSHIFT_RIGHT in interface VisitorJASVisitorException
public void visitSHIFT_RIGHT_UNSIGNED(Action action)
throws JASVisitorException
visitSHIFT_RIGHT_UNSIGNED in interface VisitorJASVisitorException
public void visitSTART_DRAG(Action action)
throws JASVisitorException
visitSTART_DRAG in interface VisitorJASVisitorException
public void visitSTART_FUNCTION(StartFunctionAction action)
throws JASVisitorException
visitSTART_FUNCTION in interface VisitorJASVisitorException
public void visitSTART_WITH(Action action)
throws JASVisitorException
visitSTART_WITH in interface VisitorJASVisitorException
public void visitSTOP(Action action)
throws JASVisitorException
visitSTOP in interface VisitorJASVisitorException
public void visitSTOP_SOUNDS(Action action)
throws JASVisitorException
visitSTOP_SOUNDS in interface VisitorJASVisitorException
public void visitSTORE_IN_REGISTER(StoreInRegisterAction action)
throws