Class RegOps

java.lang.Object
com.android.dx.rop.code.RegOps

public final class RegOps extends Object
All the register-based opcodes, and related utilities.

Note: Opcode descriptions use a rough pseudocode. r is the result register, x is the first argument, y is the second argument, and z is the third argument. The expression which describes the operation uses Java-ish syntax but is preceded by type indicators for each of the values.

  • Field Summary Link icon

    Fields
    Modifier and Type
    Field
    Description
    static final int
    T: any numeric type; r,x,y: T :: r = x + y
    static final int
    T: any type; r: T; x: T[]; y: int :: r = x[y]
    static final int
    T: any integral type; r,x,y: T :: r = x & y
    static final int
    T: any type; x: T; y: T[]; z: int :: x[y] = z
    static final int
    T: any type; r: int; x: T[]; :: r = x.length
    static final int
    T: any object type; x: Object :: (T) x (can throw ClassCastException)
    static final int
    T: any floating point type; r: int; x,y: T :: r = (x == y) ? 0 : (x < y) ? -1 : 1 (Java-style "cmpg" where a NaN is considered "greater than" all other values)
    static final int
    T: any numeric type; r: int; x,y: T :: r = (x == y) ? 0 : (x > y) ? 1 : -1 (Java-style "cmpl" where a NaN is considered "less than" all other values; also used for integral comparisons)
    static final int
    T: any type; r, literal: T :: r = literal;
    static final int
    T: any numeric type; U: any numeric type; r: T; x: U :: r = (T) x (numeric type conversion between the four "real" numeric types)
    static final int
    T: any numeric type; r,x,y: T :: r = x / y
    static final int
    T: Any primitive type; v0..vx: T :: {v0, ..., vx}
    static final int
    T: any array type; r: T; x: int; v0..vx: T :: r = new T[x] {v0, ..., vx}
    static final int
    T: any type; r: T; x: Object; f: instance field spec of type T :: r = x.f
    static final int
    T: any type; r: T; f: static field spec of type T :: r = f
    static final int
    goto label
    static final int
    T: int or Object; x,y: T :: if (x == y) goto label
    static final int
    x,y: int :: if (x >= y) goto label
    static final int
    x,y: int :: if (x > y) goto label
    static final int
    x,y: int :: if (x <= y) goto label
    static final int
    x,y: int :: if (x < y) goto label
    static final int
    T: int or Object; x,y: T :: if (x != y) goto label
    static final int
    T: any object type; x: Object :: x instanceof T
    static final int
    invalid input: '{@Code Tr, T0, T1...: any types; r: Tr; m: method spec; y0: T0; y1: T1 ... :: r = m(y0, y1, ...) <b>Note:</b> The signature of the invoked target is determined by the dynamic invocation call site information.'
    static final int
    Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...) (call direct/special method)
    static final int
    Tr, T0, T1...: any types; r: Tr; x: Object; m: interface (instance) method spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...) (call interface method)
    static final int
    Tr, T0, T1...: any types; r: Tr; x: java.lang.invoke.MethodHandle; m: signature polymorphic method spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...) (call signature polymorphic method)
    static final int
    Tr, T0, T1...: any types; r: Tr; m: static method spec; y0: T0; y1: T1 ... :: r = m(y0, y1, ...) (call static method)
    static final int
    Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...) (call superclass virtual method)
    static final int
    Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...) (call normal virtual method)
    static final int
    T0: any type; name: local variable name :: mark(name,T0) (mark beginning or end of local variable name)
    static final int
    x: Object :: monitorenter(x)
    static final int
    x: Object :: monitorexit(x)
    static final int
    T: any type; r,x: T :: r = x;
    static final int
    T: Throwable; r: T :: r = caught_exception.
    static final int
    T: any type; r,param(x): T :: r = param(x)
    static final int
    T: Any type; r: T :: r = return_type.
    static final int
    T: Any type; r: T :: r = return_type.
    static final int
    T: any numeric type; r,x,y: T :: r = x * y
    static final int
    T: any numeric type; r,x: T :: r = -x
    static final int
    T: any array type; r: T; x: int :: r = new T[x]
    static final int
    T: any non-array object type :: r = alloc(T) (allocate heap space for an object)
    static final int
    nop()
    static final int
    T: any integral type; r,x: T :: r = ~x
    static final int
    T: any integral type; r,x,y: T :: r = x | y
    static final int
    T: any type; x: T; y: Object; f: instance field spec of type T :: y.f = x
    static final int
    T: any type; f: static field spec of type T; x: T :: f = x
    static final int
    T: any numeric type; r,x,y: T :: r = x % y (Java-style remainder)
    static final int
    T: return type for the method; x: T; return x
    static final int
    T: any integral type; r,x: T; y: int :: r = x << y
    static final int
    T: any integral type; r,x: T; y: int :: r = x >> y (signed right-shift)
    static final int
    T: any numeric type; r,x,y: T :: r = x - y
    static final int
    x: int :: goto table[x]
    static final int
    x: Throwable :: throw(x)
    static final int
    r,x: int :: r = (x << 24) >> 24 (Java-style convert int to byte)
    static final int
    r,x: int :: r = x & 0xffff (Java-style convert int to char)
    static final int
    r,x: int :: r = (x << 16) >> 16 (Java-style convert int to short)
    static final int
    T: any integral type; r,x: T; y: int :: r = x >>> y (unsigned right-shift)
    static final int
    T: any integral type; r,x,y: T :: r = x ^ y
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    static int
    flippedIfOpcode(int opcode)
    Given an IF_* RegOp, returns the right-to-left flipped version.
    static String
    opName(int opcode)
    Gets the name of the given opcode.

    Methods inherited from class java.lang.Object Link icon

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details Link icon

    • NOP Link icon

      public static final int NOP
      nop()
      See Also:
    • MOVE Link icon

      public static final int MOVE
      T: any type; r,x: T :: r = x;
      See Also:
    • MOVE_PARAM Link icon

      public static final int MOVE_PARAM
      T: any type; r,param(x): T :: r = param(x)
      See Also:
    • MOVE_EXCEPTION Link icon

      public static final int MOVE_EXCEPTION
      T: Throwable; r: T :: r = caught_exception. Note: This opcode should only ever be used in the first instruction of a block, and such blocks must be the start of an exception handler.
      See Also:
    • CONST Link icon

      public static final int CONST
      T: any type; r, literal: T :: r = literal;
      See Also:
    • GOTO Link icon

      public static final int GOTO
      goto label
      See Also:
    • IF_EQ Link icon

      public static final int IF_EQ
      T: int or Object; x,y: T :: if (x == y) goto label
      See Also:
    • IF_NE Link icon

      public static final int IF_NE
      T: int or Object; x,y: T :: if (x != y) goto label
      See Also:
    • IF_LT Link icon

      public static final int IF_LT
      x,y: int :: if (x < y) goto label
      See Also:
    • IF_GE Link icon

      public static final int IF_GE
      x,y: int :: if (x >= y) goto label
      See Also:
    • IF_LE Link icon

      public static final int IF_LE
      x,y: int :: if (x <= y) goto label
      See Also:
    • IF_GT Link icon

      public static final int IF_GT
      x,y: int :: if (x > y) goto label
      See Also:
    • SWITCH Link icon

      public static final int SWITCH
      x: int :: goto table[x]
      See Also:
    • ADD Link icon

      public static final int ADD
      T: any numeric type; r,x,y: T :: r = x + y
      See Also:
    • SUB Link icon

      public static final int SUB
      T: any numeric type; r,x,y: T :: r = x - y
      See Also:
    • MUL Link icon

      public static final int MUL
      T: any numeric type; r,x,y: T :: r = x * y
      See Also:
    • DIV Link icon

      public static final int DIV
      T: any numeric type; r,x,y: T :: r = x / y
      See Also:
    • REM Link icon

      public static final int REM
      T: any numeric type; r,x,y: T :: r = x % y (Java-style remainder)
      See Also:
    • NEG Link icon

      public static final int NEG
      T: any numeric type; r,x: T :: r = -x
      See Also:
    • AND Link icon

      public static final int AND
      T: any integral type; r,x,y: T :: r = x & y
      See Also:
    • OR Link icon

      public static final int OR
      T: any integral type; r,x,y: T :: r = x | y
      See Also:
    • XOR Link icon

      public static final int XOR
      T: any integral type; r,x,y: T :: r = x ^ y
      See Also:
    • SHL Link icon

      public static final int SHL
      T: any integral type; r,x: T; y: int :: r = x << y
      See Also:
    • SHR Link icon

      public static final int SHR
      T: any integral type; r,x: T; y: int :: r = x >> y (signed right-shift)
      See Also:
    • USHR Link icon

      public static final int USHR
      T: any integral type; r,x: T; y: int :: r = x >>> y (unsigned right-shift)
      See Also:
    • NOT Link icon

      public static final int NOT
      T: any integral type; r,x: T :: r = ~x
      See Also:
    • CMPL Link icon

      public static final int CMPL
      T: any numeric type; r: int; x,y: T :: r = (x == y) ? 0 : (x > y) ? 1 : -1 (Java-style "cmpl" where a NaN is considered "less than" all other values; also used for integral comparisons)
      See Also:
    • CMPG Link icon

      public static final int CMPG
      T: any floating point type; r: int; x,y: T :: r = (x == y) ? 0 : (x < y) ? -1 : 1 (Java-style "cmpg" where a NaN is considered "greater than" all other values)
      See Also:
    • CONV Link icon

      public static final int CONV
      T: any numeric type; U: any numeric type; r: T; x: U :: r = (T) x (numeric type conversion between the four "real" numeric types)
      See Also:
    • TO_BYTE Link icon

      public static final int TO_BYTE
      r,x: int :: r = (x << 24) >> 24 (Java-style convert int to byte)
      See Also:
    • TO_CHAR Link icon

      public static final int TO_CHAR
      r,x: int :: r = x & 0xffff (Java-style convert int to char)
      See Also:
    • TO_SHORT Link icon

      public static final int TO_SHORT
      r,x: int :: r = (x << 16) >> 16 (Java-style convert int to short)
      See Also:
    • RETURN Link icon

      public static final int RETURN
      T: return type for the method; x: T; return x
      See Also:
    • ARRAY_LENGTH Link icon

      public static final int ARRAY_LENGTH
      T: any type; r: int; x: T[]; :: r = x.length
      See Also:
    • THROW Link icon

      public static final int THROW
      x: Throwable :: throw(x)
      See Also:
    • MONITOR_ENTER Link icon

      public static final int MONITOR_ENTER
      x: Object :: monitorenter(x)
      See Also:
    • MONITOR_EXIT Link icon

      public static final int MONITOR_EXIT
      x: Object :: monitorexit(x)
      See Also:
    • AGET Link icon

      public static final int AGET
      T: any type; r: T; x: T[]; y: int :: r = x[y]
      See Also:
    • APUT Link icon

      public static final int APUT
      T: any type; x: T; y: T[]; z: int :: x[y] = z
      See Also:
    • NEW_INSTANCE Link icon

      public static final int NEW_INSTANCE
      T: any non-array object type :: r = alloc(T) (allocate heap space for an object)
      See Also:
    • NEW_ARRAY Link icon

      public static final int NEW_ARRAY
      T: any array type; r: T; x: int :: r = new T[x]
      See Also:
    • FILLED_NEW_ARRAY Link icon

      public static final int FILLED_NEW_ARRAY
      T: any array type; r: T; x: int; v0..vx: T :: r = new T[x] {v0, ..., vx}
      See Also:
    • CHECK_CAST Link icon

      public static final int CHECK_CAST
      T: any object type; x: Object :: (T) x (can throw ClassCastException)
      See Also:
    • INSTANCE_OF Link icon

      public static final int INSTANCE_OF
      T: any object type; x: Object :: x instanceof T
      See Also:
    • GET_FIELD Link icon

      public static final int GET_FIELD
      T: any type; r: T; x: Object; f: instance field spec of type T :: r = x.f
      See Also:
    • GET_STATIC Link icon

      public static final int GET_STATIC
      T: any type; r: T; f: static field spec of type T :: r = f
      See Also:
    • PUT_FIELD Link icon

      public static final int PUT_FIELD
      T: any type; x: T; y: Object; f: instance field spec of type T :: y.f = x
      See Also:
    • PUT_STATIC Link icon

      public static final int PUT_STATIC
      T: any type; f: static field spec of type T; x: T :: f = x
      See Also:
    • INVOKE_STATIC Link icon

      public static final int INVOKE_STATIC
      Tr, T0, T1...: any types; r: Tr; m: static method spec; y0: T0; y1: T1 ... :: r = m(y0, y1, ...) (call static method)
      See Also:
    • INVOKE_VIRTUAL Link icon

      public static final int INVOKE_VIRTUAL
      Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...) (call normal virtual method)
      See Also:
    • INVOKE_SUPER Link icon

      public static final int INVOKE_SUPER
      Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...) (call superclass virtual method)
      See Also:
    • INVOKE_DIRECT Link icon

      public static final int INVOKE_DIRECT
      Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...) (call direct/special method)
      See Also:
    • INVOKE_INTERFACE Link icon

      public static final int INVOKE_INTERFACE
      Tr, T0, T1...: any types; r: Tr; x: Object; m: interface (instance) method spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...) (call interface method)
      See Also:
    • MARK_LOCAL Link icon

      public static final int MARK_LOCAL
      T0: any type; name: local variable name :: mark(name,T0) (mark beginning or end of local variable name)
      See Also:
    • MOVE_RESULT Link icon

      public static final int MOVE_RESULT
      T: Any type; r: T :: r = return_type. Note: This opcode should only ever be used in the first instruction of a block following an invoke-*.
      See Also:
    • MOVE_RESULT_PSEUDO Link icon

      public static final int MOVE_RESULT_PSEUDO
      T: Any type; r: T :: r = return_type. Note: This opcode should only ever be used in the first instruction of a block following a non-invoke throwing insn
      See Also:
    • FILL_ARRAY_DATA Link icon

      public static final int FILL_ARRAY_DATA
      T: Any primitive type; v0..vx: T :: {v0, ..., vx}
      See Also:
    • INVOKE_POLYMORPHIC Link icon

      public static final int INVOKE_POLYMORPHIC
      Tr, T0, T1...: any types; r: Tr; x: java.lang.invoke.MethodHandle; m: signature polymorphic method spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...) (call signature polymorphic method)
      See Also:
    • INVOKE_CUSTOM Link icon

      public static final int INVOKE_CUSTOM
      invalid input: '{@Code Tr, T0, T1...: any types; r: Tr; m: method spec; y0: T0; y1: T1 ... :: r = m(y0, y1, ...) <b>Note:</b> The signature of the invoked target is determined by the dynamic invocation call site information.'
      See Also:
  • Method Details Link icon

    • opName Link icon

      public static String opName(int opcode)
      Gets the name of the given opcode.
      Parameters:
      opcode - the opcode
      Returns:
      non-null; its name
    • flippedIfOpcode Link icon

      public static int flippedIfOpcode(int opcode)
      Given an IF_* RegOp, returns the right-to-left flipped version. For example, IF_GT becomes IF_LT.
      Parameters:
      opcode - An IF_* RegOp
      Returns:
      flipped IF Regop