Package com.android.dx.rop.code
Class RegOps
java.lang.Object
com.android.dx.rop.code.RegOps
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
Modifier and TypeFieldDescriptionstatic 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 throwClassCastException
)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
Modifier and TypeMethodDescriptionstatic 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.
-
Field Details
-
NOP
public static final int NOPnop()
- See Also:
-
MOVE
public static final int MOVET: any type; r,x: T :: r = x;
- See Also:
-
MOVE_PARAM
public static final int MOVE_PARAMT: any type; r,param(x): T :: r = param(x)
- See Also:
-
MOVE_EXCEPTION
public static final int MOVE_EXCEPTIONT: 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
public static final int CONSTT: any type; r, literal: T :: r = literal;
- See Also:
-
GOTO
public static final int GOTOgoto label
- See Also:
-
IF_EQ
public static final int IF_EQT: int or Object; x,y: T :: if (x == y) goto label
- See Also:
-
IF_NE
public static final int IF_NET: int or Object; x,y: T :: if (x != y) goto label
- See Also:
-
IF_LT
public static final int IF_LTx,y: int :: if (x < y) goto label
- See Also:
-
IF_GE
public static final int IF_GEx,y: int :: if (x >= y) goto label
- See Also:
-
IF_LE
public static final int IF_LEx,y: int :: if (x <= y) goto label
- See Also:
-
IF_GT
public static final int IF_GTx,y: int :: if (x > y) goto label
- See Also:
-
SWITCH
public static final int SWITCHx: int :: goto table[x]
- See Also:
-
ADD
public static final int ADDT: any numeric type; r,x,y: T :: r = x + y
- See Also:
-
SUB
public static final int SUBT: any numeric type; r,x,y: T :: r = x - y
- See Also:
-
MUL
public static final int MULT: any numeric type; r,x,y: T :: r = x * y
- See Also:
-
DIV
public static final int DIVT: any numeric type; r,x,y: T :: r = x / y
- See Also:
-
REM
public static final int REMT: any numeric type; r,x,y: T :: r = x % y
(Java-style remainder)- See Also:
-
NEG
public static final int NEGT: any numeric type; r,x: T :: r = -x
- See Also:
-
AND
public static final int ANDT: any integral type; r,x,y: T :: r = x & y
- See Also:
-
OR
public static final int ORT: any integral type; r,x,y: T :: r = x | y
- See Also:
-
XOR
public static final int XORT: any integral type; r,x,y: T :: r = x ^ y
- See Also:
-
SHL
public static final int SHLT: any integral type; r,x: T; y: int :: r = x << y
- See Also:
-
SHR
public static final int SHRT: any integral type; r,x: T; y: int :: r = x >> y
(signed right-shift)- See Also:
-
USHR
public static final int USHRT: any integral type; r,x: T; y: int :: r = x >>> y
(unsigned right-shift)- See Also:
-
NOT
public static final int NOTT: any integral type; r,x: T :: r = ~x
- See Also:
-
CMPL
public static final int CMPLT: 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
public static final int CMPGT: 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
public static final int CONVT: 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
public static final int TO_BYTEr,x: int :: r = (x << 24) >> 24
(Java-style convert int to byte)- See Also:
-
TO_CHAR
public static final int TO_CHARr,x: int :: r = x & 0xffff
(Java-style convert int to char)- See Also:
-
TO_SHORT
public static final int TO_SHORTr,x: int :: r = (x << 16) >> 16
(Java-style convert int to short)- See Also:
-
RETURN
public static final int RETURNT: return type for the method; x: T; return x
- See Also:
-
ARRAY_LENGTH
public static final int ARRAY_LENGTHT: any type; r: int; x: T[]; :: r = x.length
- See Also:
-
THROW
public static final int THROWx: Throwable :: throw(x)
- See Also:
-
MONITOR_ENTER
public static final int MONITOR_ENTERx: Object :: monitorenter(x)
- See Also:
-
MONITOR_EXIT
public static final int MONITOR_EXITx: Object :: monitorexit(x)
- See Also:
-
AGET
public static final int AGETT: any type; r: T; x: T[]; y: int :: r = x[y]
- See Also:
-
APUT
public static final int APUTT: any type; x: T; y: T[]; z: int :: x[y] = z
- See Also:
-
NEW_INSTANCE
public static final int NEW_INSTANCET: any non-array object type :: r = alloc(T)
(allocate heap space for an object)- See Also:
-
NEW_ARRAY
public static final int NEW_ARRAYT: any array type; r: T; x: int :: r = new T[x]
- See Also:
-
FILLED_NEW_ARRAY
public static final int FILLED_NEW_ARRAYT: any array type; r: T; x: int; v0..vx: T :: r = new T[x] {v0, ..., vx}
- See Also:
-
CHECK_CAST
public static final int CHECK_CASTT: any object type; x: Object :: (T) x
(can throwClassCastException
)- See Also:
-
INSTANCE_OF
public static final int INSTANCE_OFT: any object type; x: Object :: x instanceof T
- See Also:
-
GET_FIELD
public static final int GET_FIELDT: any type; r: T; x: Object; f: instance field spec of type T :: r = x.f
- See Also:
-
GET_STATIC
public static final int GET_STATICT: any type; r: T; f: static field spec of type T :: r = f
- See Also:
-
PUT_FIELD
public static final int PUT_FIELDT: any type; x: T; y: Object; f: instance field spec of type T :: y.f = x
- See Also:
-
PUT_STATIC
public static final int PUT_STATICT: any type; f: static field spec of type T; x: T :: f = x
- See Also:
-
INVOKE_STATIC
public static final int INVOKE_STATICTr, 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
public static final int INVOKE_VIRTUALTr, 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
public static final int INVOKE_SUPERTr, 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
public static final int INVOKE_DIRECTTr, 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
public static final int INVOKE_INTERFACETr, 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
public static final int MARK_LOCALT0: any type; name: local variable name :: mark(name,T0)
(mark beginning or end of local variable name)- See Also:
-
MOVE_RESULT
public static final int MOVE_RESULTT: 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
public static final int MOVE_RESULT_PSEUDOT: 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
public static final int FILL_ARRAY_DATAT: Any primitive type; v0..vx: T :: {v0, ..., vx}
- See Also:
-
INVOKE_POLYMORPHIC
public static final int INVOKE_POLYMORPHICTr, 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
public static final int INVOKE_CUSTOMinvalid 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
-
opName
Gets the name of the given opcode.- Parameters:
opcode
- the opcode- Returns:
non-null;
its name
-
flippedIfOpcode
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
-