Class Form22s

java.lang.Object
com.android.dx.dex.code.InsnFormat
com.android.dx.dex.code.form.Form22s

public final class Form22s extends InsnFormat
Instruction format 22s. See the instruction format spec for details.
  • Field Details

    • THE_ONE

      public static final InsnFormat THE_ONE
      non-null; unique instance of this class
  • Method Details

    • insnArgString

      public String insnArgString(DalvInsn insn)
      Returns the string form of the arguments to the given instruction. The instruction must be of this instance's format. If the instruction has no arguments, then the result should be "", not null.

      Subclasses must override this method.

      Specified by:
      insnArgString in class InsnFormat
      Parameters:
      insn - non-null; the instruction
      Returns:
      non-null; the string form
    • insnCommentString

      public String insnCommentString(DalvInsn insn, boolean noteIndices)
      Returns the associated comment for the given instruction, if any. The instruction must be of this instance's format. If the instruction has no comment, then the result should be "", not null.

      Subclasses must override this method.

      Specified by:
      insnCommentString in class InsnFormat
      Parameters:
      insn - non-null; the instruction
      noteIndices - whether to include an explicit notation of constant pool indices
      Returns:
      non-null; the string form
    • codeSize

      public int codeSize()
      Gets the code size of instructions that use this format. The size is a number of 16-bit code units, not bytes. This should throw an exception if this format is of variable size.
      Specified by:
      codeSize in class InsnFormat
      Returns:
      >= 0; the instruction length in 16-bit code units
    • isCompatible

      public boolean isCompatible(DalvInsn insn)
      Returns whether or not the given instruction's arguments will fit in this instance's format. This includes such things as counting register arguments, checking register ranges, and making sure that additional arguments are of appropriate types and are in-range. If this format has a branch target but the instruction's branch offset is unknown, this method will simply not check the offset.

      Subclasses must override this method.

      Specified by:
      isCompatible in class InsnFormat
      Parameters:
      insn - non-null; the instruction to check
      Returns:
      true iff the instruction's arguments are appropriate for this instance, or false if not
    • compatibleRegs

      public BitSet compatibleRegs(DalvInsn insn)
      Returns which of a given instruction's registers will fit in this instance's format.

      The default implementation of this method always returns an empty BitSet. Subclasses must override this method if they have registers.

      Overrides:
      compatibleRegs in class InsnFormat
      Parameters:
      insn - non-null; the instruction to check
      Returns:
      non-null; a BitSet flagging registers in the register list that are compatible to this format
    • writeTo

      public void writeTo(AnnotatedOutput out, DalvInsn insn)
      Writes the code units for the given instruction to the given output destination. The instruction must be of this instance's format.

      Subclasses must override this method.

      Specified by:
      writeTo in class InsnFormat
      Parameters:
      out - non-null; the output destination to write to
      insn - non-null; the instruction to write