com.android.dx.dex.code
Class CstInsn

java.lang.Object
  extended by com.android.dx.dex.code.DalvInsn
      extended by com.android.dx.dex.code.FixedSizeInsn
          extended by com.android.dx.dex.code.CstInsn

public final class CstInsn
extends FixedSizeInsn

Instruction which has a single constant argument in addition to all the normal instruction information.


Constructor Summary
CstInsn(Dop opcode, SourcePosition position, RegisterSpecList registers, Constant constant)
          Constructs an instance.
 
Method Summary
protected  String argString()
          Gets the string form for any arguments to this instance.
 int getClassIndex()
          Gets the constant's class index.
 Constant getConstant()
          Gets the constant argument.
 int getIndex()
          Gets the constant's index.
 boolean hasClassIndex()
          Returns whether the constant's class index has been set for this instance.
 boolean hasIndex()
          Returns whether the constant's index has been set for this instance.
 void setClassIndex(int index)
          Sets the constant's class index.
 void setIndex(int index)
          Sets the constant's index.
 DalvInsn 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.
 DalvInsn 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CstInsn

public CstInsn(Dop opcode,
               SourcePosition position,
               RegisterSpecList registers,
               Constant constant)
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 from Dops
position - non-null; source position
registers - non-null; register list, including a result register if appropriate (that is, registers may be either ins or outs)
constant - non-null; constant argument
Method Detail

withOpcode

public DalvInsn 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.

Specified by:
withOpcode in class DalvInsn
Parameters:
opcode - non-null; the new opcode
Returns:
non-null; an appropriately-constructed instance

withRegisters

public DalvInsn 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.

Specified by:
withRegisters in class DalvInsn
Parameters:
registers - non-null; new register list
Returns:
non-null; an appropriately-constructed instance

getConstant

public Constant getConstant()
Gets the constant argument.

Returns:
non-null; the constant argument

getIndex

public int getIndex()
Gets the constant's index. It is only valid to call this after setIndex(int) has been called.

Returns:
>= 0; the constant pool index

hasIndex

public boolean hasIndex()
Returns whether the constant's index has been set for this instance.

Returns:
true iff the index has been set
See Also:
setIndex(int)

setIndex

public void setIndex(int index)
Sets the constant's index. It is only valid to call this method once per instance.

Parameters:
index - >= 0; the constant pool index

getClassIndex

public int getClassIndex()
Gets the constant's class index. It is only valid to call this after setClassIndex(int) has been called.

Returns:
>= 0; the constant's class's constant pool index

hasClassIndex

public boolean hasClassIndex()
Returns whether the constant's class index has been set for this instance.

Returns:
true iff the index has been set
See Also:
setClassIndex(int)

setClassIndex

public void setClassIndex(int index)
Sets the constant's class index. This is the constant pool index for the class referred to by this instance's constant. 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 - >= 0; the constant's class's constant pool index

argString

protected String argString()
Gets the string form for any arguments to this instance. Subclasses must override this.

Specified by:
argString in class DalvInsn
Returns:
null-ok; the string version of any arguments or null if there are none


Copyright © 2013. All Rights Reserved.