Top Description Fields Constructors Methods
org.droidparts.dexmaker.dx.rop.code

public final Class RegOps

extends Object
Class Inheritance
Imports
org.droidparts.dexmaker.dx.util.Hex

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 TypeField and Description
public static final int
ADD

T: any numeric type; r,x,y: T :: r = x + y

public static final int
AGET

T: any type; r: T; x: T[]; y: int :: r = x[y]

public static final int
AND

T: any integral type; r,x,y: T :: r = x & y

public static final int
APUT

T: any type; x: T; y: T[]; z: int :: x[y] = z

public static final int
ARRAY_LENGTH

T: any type; r: int; x: T[]; :: r = x.length

public static final int
CHECK_CAST

T: any object type; x: Object :: (T) x (can throw ClassCastException)

public static final int
CMPG

T: any floating point type; r: int; x,y: T :: r = (x == y) ?

public static final int
CMPL

T: any numeric type; r: int; x,y: T :: r = (x == y) ?

public static final int
CONST

T: any type; r, literal: T :: r = literal;

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)

public static final int
DIV

T: any numeric type; r,x,y: T :: r = x / y

public static final int
FILL_ARRAY_DATA

T: Any primitive type; v0..vx: T :: {v0, ..., vx}

public static final int
FILLED_NEW_ARRAY

T: any array type; r: T; x: int; v0..vx: T :: r = new T[x] {v0, ..., vx}

public static final int
GET_FIELD

T: any type; r: T; x: Object; f: instance field spec of type T :: r = x.f

public static final int
GET_STATIC

T: any type; r: T; f: static field spec of type T :: r = f

public static final int
GOTO

goto label

public static final int
IF_EQ

T: int or Object; x,y: T :: if (x == y) goto label

public static final int
IF_GE

x,y: int :: if (x >= y) goto label

public static final int
IF_GT

x,y: int :: if (x > y) goto label

public static final int
IF_LE

x,y: int :: if (x <= y) goto label

public static final int
IF_LT

x,y: int :: if (x < y) goto label

public static final int
IF_NE

T: int or Object; x,y: T :: if (x != y) goto label

public static final int
INSTANCE_OF

T: any object type; x: Object :: x instanceof T

public static final int
INVOKE_DIRECT

Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method spec; y0: T0; y1: T1 ...

public static final int
INVOKE_INTERFACE

Tr, T0, T1...: any types; r: Tr; x: Object; m: interface (instance) method spec; y0: T0; y1: T1 ...

public static final int
INVOKE_STATIC

Tr, T0, T1...: any types; r: Tr; m: static method spec; y0: T0; y1: T1 ...

public static final int
INVOKE_SUPER

Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method spec; y0: T0; y1: T1 ...

public static final int
INVOKE_VIRTUAL

Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method spec; y0: T0; y1: T1 ...

public static final int
MARK_LOCAL

T0: any type; name: local variable name :: mark(name,T0) (mark beginning or end of local variable name)

public static final int
MONITOR_ENTER

x: Object :: monitorenter(x)

public static final int
MONITOR_EXIT

x: Object :: monitorexit(x)

public static final int
MOVE

T: any type; r,x: T :: r = x;

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.

public static final int
MOVE_PARAM

T: any type; r,param(x): T :: r = param(x)

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-*.

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

public static final int
MUL

T: any numeric type; r,x,y: T :: r = x * y

public static final int
NEG

T: any numeric type; r,x: T :: r = -x

public static final int
NEW_ARRAY

T: any array type; r: T; x: int :: r = new T[x]

public static final int
NEW_INSTANCE

T: any non-array object type :: r = alloc(T) (allocate heap space for an object)

public static final int
NOP

nop()

public static final int
NOT

T: any integral type; r,x: T :: r = ~x

public static final int
OR

T: any integral type; r,x,y: T :: r = x | y

public static final int
PUT_FIELD

T: any type; x: T; y: Object; f: instance field spec of type T :: y.f = x

public static final int
PUT_STATIC

T: any type; f: static field spec of type T; x: T :: f = x

public static final int
REM

T: any numeric type; r,x,y: T :: r = x % y (Java-style remainder)

public static final int
RETURN

T: return type for the method; x: T; return x

public static final int
SHL

T: any integral type; r,x: T; y: int :: r = x << y

public static final int
SHR

T: any integral type; r,x: T; y: int :: r = x >> y (signed right-shift)

public static final int
SUB

T: any numeric type; r,x,y: T :: r = x - y

public static final int
SWITCH

x: int :: goto table[x]

public static final int
THROW

x: Throwable :: throw(x)

public static final int
TO_BYTE

r,x: int :: r = (x << 24) >> 24 (Java-style convert int to byte)

public static final int
TO_CHAR

r,x: int :: r = x & 0xffff (Java-style convert int to char)

public static final int
TO_SHORT

r,x: int :: r = (x << 16) >> 16 (Java-style convert int to short)

public static final int
USHR

T: any integral type; r,x: T; y: int :: r = x >>> y (unsigned right-shift)

public static final int
XOR

T: any integral type; r,x,y: T :: r = x ^ y

Constructor Summary

AccessConstructor and Description
private
RegOps()

This class is uninstantiable.

Method Summary

Modifier and TypeMethod and Description
public static int

Returns:

flipped IF Regop
flippedIfOpcode
(final int
An IF_* RegOp
opcode
)

Given an IF_* RegOp, returns the right-to-left flipped version.

public static String

Returns:

non-null; its name
opName
(int
the opcode
opcode
)

Gets the name of the given opcode.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ADDback to summary
public static final int ADD

T: any numeric type; r,x,y: T :: r = x + y

AGETback to summary
public static final int AGET

T: any type; r: T; x: T[]; y: int :: r = x[y]

ANDback to summary
public static final int AND

T: any integral type; r,x,y: T :: r = x & y

APUTback to summary
public static final int APUT

T: any type; x: T; y: T[]; z: int :: x[y] = z

ARRAY_LENGTHback to summary
public static final int ARRAY_LENGTH

T: any type; r: int; x: T[]; :: r = x.length

CHECK_CASTback to summary
public static final int CHECK_CAST

T: any object type; x: Object :: (T) x (can throw ClassCastException)

CMPGback to summary
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)

CMPLback to summary
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)

CONSTback to summary
public static final int CONST

T: any type; r, literal: T :: r = literal;

CONVback to summary
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)

DIVback to summary
public static final int DIV

T: any numeric type; r,x,y: T :: r = x / y

FILL_ARRAY_DATAback to summary
public static final int FILL_ARRAY_DATA

T: Any primitive type; v0..vx: T :: {v0, ..., vx}

FILLED_NEW_ARRAYback to summary
public static final int FILLED_NEW_ARRAY

T: any array type; r: T; x: int; v0..vx: T :: r = new T[x] {v0, ..., vx}

GET_FIELDback to summary
public static final int GET_FIELD

T: any type; r: T; x: Object; f: instance field spec of type T :: r = x.f

GET_STATICback to summary
public static final int GET_STATIC

T: any type; r: T; f: static field spec of type T :: r = f

GOTOback to summary
public static final int GOTO

goto label

IF_EQback to summary
public static final int IF_EQ

T: int or Object; x,y: T :: if (x == y) goto label

IF_GEback to summary
public static final int IF_GE

x,y: int :: if (x >= y) goto label

IF_GTback to summary
public static final int IF_GT

x,y: int :: if (x > y) goto label

IF_LEback to summary
public static final int IF_LE

x,y: int :: if (x <= y) goto label

IF_LTback to summary
public static final int IF_LT

x,y: int :: if (x < y) goto label

IF_NEback to summary
public static final int IF_NE

T: int or Object; x,y: T :: if (x != y) goto label

INSTANCE_OFback to summary
public static final int INSTANCE_OF

T: any object type; x: Object :: x instanceof T

INVOKE_DIRECTback to summary
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)

INVOKE_INTERFACEback to summary
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)

INVOKE_STATICback to summary
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)

INVOKE_SUPERback to summary
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)

INVOKE_VIRTUALback to summary
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)

MARK_LOCALback to summary
public static final int MARK_LOCAL

T0: any type; name: local variable name :: mark(name,T0) (mark beginning or end of local variable name)

MONITOR_ENTERback to summary
public static final int MONITOR_ENTER

x: Object :: monitorenter(x)

MONITOR_EXITback to summary
public static final int MONITOR_EXIT

x: Object :: monitorexit(x)

MOVEback to summary
public static final int MOVE

T: any type; r,x: T :: r = x;

MOVE_EXCEPTIONback to summary
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.

MOVE_PARAMback to summary
public static final int MOVE_PARAM

T: any type; r,param(x): T :: r = param(x)

MOVE_RESULTback to summary
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-*.

MOVE_RESULT_PSEUDOback to summary
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

MULback to summary
public static final int MUL

T: any numeric type; r,x,y: T :: r = x * y

NEGback to summary
public static final int NEG

T: any numeric type; r,x: T :: r = -x

NEW_ARRAYback to summary
public static final int NEW_ARRAY

T: any array type; r: T; x: int :: r = new T[x]

NEW_INSTANCEback to summary
public static final int NEW_INSTANCE

T: any non-array object type :: r = alloc(T) (allocate heap space for an object)

NOPback to summary
public static final int NOP

nop()

NOTback to summary
public static final int NOT

T: any integral type; r,x: T :: r = ~x

ORback to summary
public static final int OR

T: any integral type; r,x,y: T :: r = x | y

PUT_FIELDback to summary
public static final int PUT_FIELD

T: any type; x: T; y: Object; f: instance field spec of type T :: y.f = x

PUT_STATICback to summary
public static final int PUT_STATIC

T: any type; f: static field spec of type T; x: T :: f = x

REMback to summary
public static final int REM

T: any numeric type; r,x,y: T :: r = x % y (Java-style remainder)

RETURNback to summary
public static final int RETURN

T: return type for the method; x: T; return x

SHLback to summary
public static final int SHL

T: any integral type; r,x: T; y: int :: r = x << y

SHRback to summary
public static final int SHR

T: any integral type; r,x: T; y: int :: r = x >> y (signed right-shift)

SUBback to summary
public static final int SUB

T: any numeric type; r,x,y: T :: r = x - y

SWITCHback to summary
public static final int SWITCH

x: int :: goto table[x]

THROWback to summary
public static final int THROW

x: Throwable :: throw(x)

TO_BYTEback to summary
public static final int TO_BYTE

r,x: int :: r = (x << 24) >> 24 (Java-style convert int to byte)

TO_CHARback to summary
public static final int TO_CHAR

r,x: int :: r = x & 0xffff (Java-style convert int to char)

TO_SHORTback to summary
public static final int TO_SHORT

r,x: int :: r = (x << 16) >> 16 (Java-style convert int to short)

USHRback to summary
public static final int USHR

T: any integral type; r,x: T; y: int :: r = x >>> y (unsigned right-shift)

XORback to summary
public static final int XOR

T: any integral type; r,x,y: T :: r = x ^ y

Constructor Detail

RegOpsback to summary
private RegOps()

This class is uninstantiable.

Method Detail

flippedIfOpcodeback to summary
public static int flippedIfOpcode(final int opcode)

Given an IF_* RegOp, returns the right-to-left flipped version. For example, IF_GT becomes IF_LT.

Parameters
opcode:int

An IF_* RegOp

Returns:int

flipped IF Regop

opNameback to summary
public static String opName(int opcode)

Gets the name of the given opcode.

Parameters
opcode:int

the opcode

Returns:String

non-null; its name