Dalvik Opcodes Java
Dalvik Opcodes Java
Copyright: this document is in the public domain. If you reuse it, please consider quoting this page.
Vx values in the table denote a Dalvik register. Depending on the instruction, 16, 256 or 64k registers can be
accessed. Operations on long and double values use two registers, e.g. a double value addressed in the V0
register occupies the V0 and V1 registers.
Boolean values are stored as 1 for true and 0 for false. Operations on booleans are translated into integer
operations.
All the examples are in hig-endian format, e.g. 0F00 0A00 is coded as 0F, 00, 0A, 00 sequence.
Note there are no explanation/example at some instructions. This means that I have not seen that
instruction "in the wild" and its presence/name is only known from Android opcode constant list.
Consider using the dedexer tool to observe the Dalvik opcodes in real-life dex files!
1. Note that double and long values occupy two registers (e.g. the value addressed by vy is located in vy
and vy+1 registers)
2. The offset can be positive or negative and it is calculated from the offset of the starting byte of the
instruction. The offset is always interpreted in words (2 bytes per 1 offset value increment/decrement).
Negative offset is stored in two's complement format. The current position is the offset of the starting
byte of the instruction.
3. Compare operations returrn positive value if the first operand is greater than the second operand, 0 if
they are equal and negative value if the first operand is smaller than the second operand.
4. Not seen in the wild, interpolated from Dalvik bytecode list.
5. The invocation parameter list encoding is somewhat weird. Starting if parameter number > 4 and
parameter number % 4 == 1, the 5th (9th, etc.) parameter is encoded on the 4 lowest bit of the byte
immediately following the instruction. Curiously, this encoding is not used in case of 1 parameter, in
this case an entire 16 bit word is added after the method index of which only 4 bit is used to encode
the single parameter while the lowest 4 bit of the byte following the instruction byte is left unused.
6. This is an unsafe instruction and occurs only in ODEX files.