|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.android.dx.cf.code.BaseMachine
public abstract class BaseMachine
Base implementation of Machine.
Note: For the most part, the documentation for this class
ignores the distinction between Type and TypeBearer.
| Constructor Summary | |
|---|---|
BaseMachine(Prototype prototype)
Constructs an instance. |
|
| Method Summary | |
|---|---|
protected void |
addResult(TypeBearer result)
Adds an additional element to the list of results. |
protected TypeBearer |
arg(int n)
Gets the nth primary argument. |
protected int |
argCount()
Gets the number of primary arguments. |
protected int |
argWidth()
Gets the width of the arguments (where a category-2 value counts as two). |
void |
auxCstArg(Constant cst)
Indicates that there is an auxiliary (inline, not stack) object argument, with the value based on the given constant. |
void |
auxInitValues(ArrayList<Constant> initValues)
Indicates that there is an auxiliary (inline, not stack) argument consisting of a list of initial values for a newly created array. |
void |
auxIntArg(int value)
Indicates that there is an auxiliary (inline, not stack) argument of type int, with the given value. |
void |
auxSwitchArg(SwitchList cases)
Indicates that there is an auxiliary (inline, not stack) argument consisting of a switch* table. |
void |
auxTargetArg(int target)
Indicates that there is an auxiliary (inline, not stack) argument indicating a branch target. |
void |
auxType(Type type)
Indicates that the salient type of this operation is as given. |
void |
clearArgs()
Clears the regular and auxiliary arguments area. |
protected void |
clearResult()
Clears the results. |
protected SwitchList |
getAuxCases()
Gets the switch cases auxiliary argument. |
protected Constant |
getAuxCst()
Gets the constant auxiliary argument. |
protected int |
getAuxInt()
Gets the int auxiliary argument. |
protected int |
getAuxTarget()
Gets the branch target auxiliary argument. |
protected Type |
getAuxType()
Gets the type auxiliary argument. |
protected ArrayList<Constant> |
getInitValues()
Gets the init values auxiliary argument. |
protected int |
getLocalIndex()
Gets the last local index accessed. |
protected boolean |
getLocalInfo()
Gets whether the loaded local has info in the local variable table. |
protected RegisterSpec |
getLocalTarget(boolean isMove)
Gets the target local register spec of the current operation, if any. |
Prototype |
getPrototype()
Gets the effective prototype of the method that this instance is being used for. |
void |
localArg(Frame frame,
int idx)
Loads the local variable with the given index as the sole argument in the arguments area. |
void |
localInfo(boolean local)
Used to specify if a loaded local variable has info in the local variable table. |
void |
localTarget(int idx,
Type type,
LocalItem local)
Indicates that the target of this operation is the given local. |
void |
popArgs(Frame frame,
int count)
Pops the given number of values from the stack (of either category), and store them in the arguments area, indicating that there are now that many arguments. |
void |
popArgs(Frame frame,
Prototype prototype)
Pops values from the stack of the types indicated by the given Prototype (popped in reverse of the argument
order, so the first prototype argument type is for the deepest
element of the stack), and store them in the arguments area,
indicating that there are now that many arguments. |
void |
popArgs(Frame frame,
Type type)
Pops a value from the stack of the indicated type, and store it in the arguments area, indicating that there are now that many arguments. |
void |
popArgs(Frame frame,
Type type1,
Type type2)
Pops values from the stack of the indicated types (popped in reverse argument order, so the first indicated type is for the deepest element of the stack), and store them in the arguments area, indicating that there are now that many arguments. |
void |
popArgs(Frame frame,
Type type1,
Type type2,
Type type3)
Pops values from the stack of the indicated types (popped in reverse argument order, so the first indicated type is for the deepest element of the stack), and store them in the arguments area, indicating that there are now that many arguments. |
protected TypeBearer |
result(int n)
Gets the nth result value. |
protected int |
resultCount()
Gets the count of results. |
protected int |
resultWidth()
Gets the width of the results (where a category-2 value counts as two). |
protected void |
setResult(TypeBearer result)
Sets the results list to be the given single value. |
protected void |
storeResults(Frame frame)
Stores the results of the latest operation into the given frame. |
static void |
throwLocalMismatch(TypeBearer found,
TypeBearer local)
Throws an exception that indicates a mismatch in local variable types. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.android.dx.cf.code.Machine |
|---|
run |
| Constructor Detail |
|---|
public BaseMachine(Prototype prototype)
prototype - non-null; the prototype for the
associated method| Method Detail |
|---|
public Prototype getPrototype()
this argument for instance methods.
getPrototype in interface Machinenon-null; the method prototypepublic final void clearArgs()
clearArgs in interface Machine
public final void popArgs(Frame frame,
int count)
popArgs in interface Machineframe - non-null; frame to operate oncount - >= 0; number of values to pop
public void popArgs(Frame frame,
Prototype prototype)
Prototype (popped in reverse of the argument
order, so the first prototype argument type is for the deepest
element of the stack), and store them in the arguments area,
indicating that there are now that many arguments. Also, clear
the auxiliary arguments.
popArgs in interface Machineframe - non-null; frame to operate onprototype - non-null; prototype indicating arguments to pop
public final void popArgs(Frame frame,
Type type)
Machine
popArgs in interface Machineframe - non-null; frame to operate ontype - non-null; type of the argument
public final void popArgs(Frame frame,
Type type1,
Type type2)
popArgs in interface Machineframe - non-null; frame to operate ontype1 - non-null; type of the first argumenttype2 - non-null; type of the second argument
public final void popArgs(Frame frame,
Type type1,
Type type2,
Type type3)
popArgs in interface Machineframe - non-null; frame to operate ontype1 - non-null; type of the first argumenttype2 - non-null; type of the second argumenttype3 - non-null; type of the third argument
public final void localArg(Frame frame,
int idx)
localArg in interface Machineframe - non-null; frame to operate onidx - >= 0; the local variable indexpublic final void localInfo(boolean local)
localInfo in interface Machinelocal - true if local arg has info in local variable tablepublic final void auxType(Type type)
Machine are collapsed to the int
variant. (See BytecodeArray.parseInstruction(int, com.android.dx.cf.code.BytecodeArray.Visitor) for
details.)
auxType in interface Machinetype - non-null; the salient type of the upcoming operationpublic final void auxIntArg(int value)
int, with the given value.
Note: Perhaps unintuitively, the stack manipulation
ops (e.g., dup and swap) use this to
indicate the result stack pattern with a straightforward hex
encoding of the push order starting with least-significant
nibbles getting pushed first). For example, an all-category-1
dup2_x1 sets this to 0x12312, and the
other form of that op sets this to
0x121.
Also Note: For switch* instructions, this is
used to indicate the padding value (which is only useful for
verification).
auxIntArg in interface Machinevalue - the argument valuepublic final void auxCstArg(Constant cst)
Note: Some opcodes use both int and
constant auxiliary arguments.
auxCstArg in interface Machinecst - non-null; the constant containing / referencing
the valuepublic final void auxTargetArg(int target)
auxTargetArg in interface Machinetarget - the argument valuepublic final void auxSwitchArg(SwitchList cases)
switch* table.
Note: This is generally used in conjunction with
Machine.auxIntArg(int) (which holds the padding).
auxSwitchArg in interface Machinecases - non-null; the list of key-target pairs, plus the default
targetpublic final void auxInitValues(ArrayList<Constant> initValues)
auxInitValues in interface MachineinitValues - non-null; the list of constant values to initialize
the array
public final void localTarget(int idx,
Type type,
LocalItem local)
localTarget in interface Machineidx - >= 0; the local variable indextype - non-null; the type of the locallocal - null-ok; the name and signature of the local, if knownprotected final int argCount()
>= 0; the number of primary argumentsprotected final int argWidth()
>= 0; the argument widthprotected final TypeBearer arg(int n)
nth primary argument.
n - >= 0, < argCount(); which argument
non-null; the indicated argumentprotected final Type getAuxType()
null-ok; the salient typeprotected final int getAuxInt()
int auxiliary argument.
protected final Constant getAuxCst()
null-ok; the argument valueprotected final int getAuxTarget()
protected final SwitchList getAuxCases()
null-ok; the argument valueprotected final ArrayList<Constant> getInitValues()
null-ok; the argument valueprotected final int getLocalIndex()
>= -1; the salient local index or -1 if none
was set since the last time clearArgs() was calledprotected final boolean getLocalInfo()
true if local arg has info in the local variable tableprotected final RegisterSpec getLocalTarget(boolean isMove)
localTarget with the type of what
should be the sole result set by a call to setResult(com.android.dx.rop.type.TypeBearer) (or
the combination clearResult() then addResult(com.android.dx.rop.type.TypeBearer).
isMove - true if the operation being performed on the
local is a move. This will cause constant values to be propagated
to the returned local
null-ok; the salient register spec or null if no
local target was set since the last time clearArgs() was
calledprotected final void clearResult()
protected final void setResult(TypeBearer result)
Note: If there is more than one result value, the
others may be added by using addResult(com.android.dx.rop.type.TypeBearer).
result - non-null; result valueprotected final void addResult(TypeBearer result)
result - non-null; result valuesetResult(com.android.dx.rop.type.TypeBearer)protected final int resultCount()
>= 0; the countprotected final int resultWidth()
>= 0; the result widthprotected final TypeBearer result(int n)
nth result value.
n - >= 0, < resultCount(); which result
non-null; the indicated result valueprotected final void storeResults(Frame frame)
localTarget), then the sole
result is stored to that target; otherwise any results are pushed
onto the stack.
frame - non-null; frame to operate on
public static void throwLocalMismatch(TypeBearer found,
TypeBearer local)
found - non-null; the encountered typelocal - non-null; the local variable's claimed type
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||