Package com.android.dx.dex.code
Class MultiCstInsn
java.lang.Object
com.android.dx.dex.code.DalvInsn
com.android.dx.dex.code.FixedSizeInsn
com.android.dx.dex.code.MultiCstInsn
An instruction with multiple constant arguments in addition
to all the normal instruction information.
-
Constructor Summary
ConstructorDescriptionMultiCstInsn
(Dop opcode, SourcePosition position, RegisterSpecList registers, Constant[] constants) Constructs an instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Gets the string form for any arguments to this instance.Helper which returns the comment form of the associated constants for inclusion in a human oriented listing dump.Helper which returns the string form of the associated constants for inclusion in a human oriented listing dump.int
Gets the class index associated with this instance.getConstant
(int position) Gets a constant associated with the instruction.int
getIndex
(int position) Gets the DEX index of a constant.int
Gets the number of constants associated with instruction.boolean
Returns whether the class index associated with this instruction has been set.boolean
hasIndex
(int position) Returns whether the DEX index of a constant has been set.void
setClassIndex
(int index) Sets the class index associated with this instruction.void
setIndex
(int position, int index) Sets the DEX index of a constant.withOpcode
(Dop opcode) Returns an instance that is just like this one, except that its opcode is replaced by the one given, and its address is reset.withRegisters
(RegisterSpecList registers) Returns an instance that is just like this one, except that the register list is replaced by the given one, and its address is reset.Methods inherited from class com.android.dx.dex.code.FixedSizeInsn
codeSize, listingString0, withRegisterOffset, writeTo
Methods inherited from class com.android.dx.dex.code.DalvInsn
expandedPrefix, expandedSuffix, expandedVersion, getAddress, getLowRegVersion, getMinimumRegisterRequirement, getNextAddress, getOpcode, getPosition, getRegisters, hasAddress, hasResult, identifierString, listingString, makeMove, setAddress, toString, withMapper
-
Constructor Details
-
MultiCstInsn
public MultiCstInsn(Dop opcode, SourcePosition position, RegisterSpecList registers, Constant[] constants) Constructs an instance. The output address of this instance is initially unknown (-1
) as is the constant pool index.- Parameters:
opcode
- the opcode; one of the constants fromDops
position
-non-null;
source positionregisters
-non-null;
register list, including a result register if appropriate (that is, registers may be either ins or outs)constants
-non-null;
constants argument
-
-
Method Details
-
withOpcode
Returns an instance that is just like this one, except that its opcode is replaced by the one given, and its address is reset.- Specified by:
withOpcode
in classDalvInsn
- Parameters:
opcode
-non-null;
the new opcode- Returns:
non-null;
an appropriately-constructed instance
-
withRegisters
Returns an instance that is just like this one, except that the register list is replaced by the given one, and its address is reset.- Specified by:
withRegisters
in classDalvInsn
- Parameters:
registers
-non-null;
new register list- Returns:
non-null;
an appropriately-constructed instance
-
getNumberOfConstants
public int getNumberOfConstants()Gets the number of constants associated with instruction.- Returns:
- the number of constants.
-
getConstant
Gets a constant associated with the instruction.- Parameters:
position
- the position of the constant to get.- Returns:
non-null;
the constant argument
-
getIndex
public int getIndex(int position) Gets the DEX index of a constant. It is only valid to call this aftersetIndex(int, int)
has been called.- Parameters:
position
- the position of the constant to get the index for.- Returns:
>= 0;
the constant pool index
-
hasIndex
public boolean hasIndex(int position) Returns whether the DEX index of a constant has been set.- Parameters:
position
- the position of the constant to test.- Returns:
true
if the index has been set- See Also:
-
setIndex
public void setIndex(int position, int index) Sets the DEX index of a constant. It is only valid to call this method once per instance.- Parameters:
position
- the position of the constant to set.index
-index >= 0;
the constant pool index
-
getClassIndex
public int getClassIndex()Gets the class index associated with this instance. The class index may be set only once and for one of the constants associated with this instance (e.g. a CstMethodRef). It is only valid to call this aftersetClassIndex(int)
has been called.- Returns:
>= 0;
the constant pool index of the class.
-
hasClassIndex
public boolean hasClassIndex()Returns whether the class index associated with this instruction has been set.- Returns:
true
if the index has been set, false otherwise- See Also:
-
setClassIndex
public void setClassIndex(int index) Sets the class index associated with this instruction. This is the constant pool index for the class referred to by this instruction. Only reference constants have a class, so it is only on instances with reference constants that this method should ever be called. It is only valid to call this method once per instance.- Parameters:
index
-index >= 0;
the constant pool index of the class
-
argString
Gets the string form for any arguments to this instance. Subclasses must override this. -
cstString
Helper which returns the string form of the associated constants for inclusion in a human oriented listing dump. This method is only implemented for instructions with one or more constants. -
cstComment
Helper which returns the comment form of the associated constants for inclusion in a human oriented listing dump. This method is only implemented for instructions with one or more constants.- Overrides:
cstComment
in classDalvInsn
- Returns:
- the comment as a string.
-