Copyright © 2007 The Android Open Source Project
.dex
file that contains the method.
(Object) null == (int)
0
.
wide
.
Typespecific opcodes are suffixed with their type (or a
straightforward abbreviation), one of: boolean
byte
char
short
int
long
float
double
object
string
class
void
. Typegeneral 32bit opcodes
are unmarked.
/
") and mainly exist at all to make there be a onetoone
mapping with static constants in the code that generates and interprets
executables (that is, to reduce ambiguity for humans).
Op & Format  Mnemonic / Syntax  Arguments  Description 

00 10x  nop  Waste cycles.  
01 12x  move vA, vB  A: destination register (4 bits)B: source register (4 bits) 
Move the contents of one nonobject register to another. 
02 22x  move/from16 vAA, vBBBB  A: destination register (8 bits)B: source register (16 bits) 
Move the contents of one nonobject register to another. 
03 32x  move/16 vAAAA, vBBBB  A: destination register (16 bits)B: source register (16 bits) 
Move the contents of one nonobject register to another. 
04 12x  movewide vA, vB  A: destination register pair (4 bits)B: source register pair (4 bits) 
Move the contents of one registerpair to another.
Note:
It is legal to move from 
05 22x  movewide/from16 vAA, vBBBB  A: destination register pair (8 bits)B: source register pair (16 bits) 
Move the contents of one registerpair to another.
Note:
Implementation considerations are the same as 
06 32x  movewide/16 vAAAA, vBBBB  A: destination register pair (16 bits)B: source register pair (16 bits) 
Move the contents of one registerpair to another.
Note:
Implementation considerations are the same as 
07 12x  moveobject vA, vB  A: destination register (4 bits)B: source register (4 bits) 
Move the contents of one objectbearing register to another. 
08 22x  moveobject/from16 vAA, vBBBB  A: destination register (8 bits)B: source register (16 bits) 
Move the contents of one objectbearing register to another. 
09 32x  moveobject/16 vAAAA, vBBBB  A: destination register (16 bits)B: source register (16 bits) 
Move the contents of one objectbearing register to another. 
0a 11x  moveresult vAA  A: destination register (8 bits) 
Move the singleword nonobject result of the most recent
invokekind into the indicated register.
This must be done as the instruction immediately after an
invokekind whose (singleword, nonobject) result
is not to be ignored; anywhere else is invalid. 
0b 11x  moveresultwide vAA  A: destination register pair (8 bits) 
Move the doubleword result of the most recent
invokekind into the indicated register pair.
This must be done as the instruction immediately after an
invokekind whose (doubleword) result
is not to be ignored; anywhere else is invalid. 
0c 11x  moveresultobject vAA  A: destination register (8 bits) 
Move the object result of the most recent invokekind
into the indicated register. This must be done as the instruction
immediately after an invokekind or
fillednewarray
whose (object) result is not to be ignored; anywhere else is invalid. 
0d 11x  moveexception vAA  A: destination register (8 bits) 
Save a justcaught exception into the given register. This should be the first instruction of any exception handler whose caught exception is not to be ignored, and this instruction may only ever occur as the first instruction of an exception handler; anywhere else is invalid. 
0e 10x  returnvoid  Return from a void method. 

0f 11x  return vAA  A: return value register (8 bits) 
Return from a singlewidth (32bit) nonobject valuereturning method. 
10 11x  returnwide vAA  A: return value registerpair (8 bits) 
Return from a doublewidth (64bit) valuereturning method. 
11 11x  returnobject vAA  A: return value register (8 bits) 
Return from an objectreturning method. 
12 11n  const/4 vA, #+B  A: destination register (4 bits)B: signed int (4 bits) 
Move the given literal value (signextended to 32 bits) into the specified register. 
13 21s  const/16 vAA, #+BBBB  A: destination register (8 bits)B: signed int (16 bits) 
Move the given literal value (signextended to 32 bits) into the specified register. 
14 31i  const vAA, #+BBBBBBBB  A: destination register (8 bits)B: arbitrary 32bit constant 
Move the given literal value into the specified register. 
15 21h  const/high16 vAA, #+BBBB0000  A: destination register (8 bits)B: signed int (16 bits) 
Move the given literal value (rightzeroextended to 32 bits) into the specified register. 
16 21s  constwide/16 vAA, #+BBBB  A: destination register (8 bits)B: signed int (16 bits) 
Move the given literal value (signextended to 64 bits) into the specified registerpair. 
17 31i  constwide/32 vAA, #+BBBBBBBB  A: destination register (8 bits)B: signed int (32 bits) 
Move the given literal value (signextended to 64 bits) into the specified registerpair. 
18 51l  constwide vAA, #+BBBBBBBBBBBBBBBB  A: destination register (8 bits)B: arbitrary doublewidth (64bit) constant 
Move the given literal value into the specified registerpair. 
19 21h  constwide/high16 vAA, #+BBBB000000000000  A: destination register (8 bits)B: signed int (16 bits) 
Move the given literal value (rightzeroextended to 64 bits) into the specified registerpair. 
1a 21c  conststring vAA, string@BBBB  A: destination register (8 bits)B: string index 
Move a reference to the string specified by the given index into the specified register. 
1b 31c  conststring/jumbo vAA, string@BBBBBBBB  A: destination register (8 bits)B: string index 
Move a reference to the string specified by the given index into the specified register. 
1c 21c  constclass vAA, type@BBBB  A: destination register (8 bits)B: type index 
Move a reference to the class specified by the given index into the specified register. In the case where the indicated type is primitive, this will store a reference to the primitive type's degenerate class. 
1d 11x  monitorenter vAA  A: referencebearing register (8 bits) 
Acquire the monitor for the indicated object. 
1e 11x  monitorexit vAA  A: referencebearing register (8 bits) 
Release the monitor for the indicated object.
Note:
If this instruction needs to throw an exception, it must do
so as if the pc has already advanced past the instruction.
It may be useful to think of this as the instruction successfully
executing (in a sense), and the exception getting thrown after
the instruction but before the next one gets a chance to
run. This definition makes it possible for a method to use
a monitor cleanup catchall (e.g., 
1f 21c  checkcast vAA, type@BBBB  A: referencebearing register (8 bits)B: type index (16 bits) 
Throw if the reference in the given register cannot be cast to the indicated type. The type must be a reference type (not a primitive type). 
20 22c  instanceof vA, vB, type@CCCC  A: destination register (4 bits)B: referencebearing register (4 bits)C: type index (16 bits) 
Store in the given destination register 1
if the indicated reference is an instance of the given type,
or 0 if not. The type must be a
reference type (not a primitive type). 
21 12x  arraylength vA, vB  A: destination register (4 bits)B: array referencebearing register (4 bits) 
Store in the given destination register the length of the indicated array, in entries 
22 21c  newinstance vAA, type@BBBB  A: destination register (8 bits)B: type index 
Construct a new instance of the indicated type, storing a reference to it in the destination. The type must refer to a nonarray class. 
23 22c  newarray vA, vB, type@CCCC  A: destination register (8 bits)B: size registerC: type index 
Construct a new array of the indicated type and size. The type must be an array type. 
24 35c  fillednewarray {vD, vE, vF, vG, vA}, type@CCCC  B: array size and argument word count (4 bits)C: type index (16 bits)D..G, A: argument registers (4 bits each) 
Construct an array of the given type and size, filling it with the
supplied contents. The type must be an array type. The array's
contents must be singleword (that is,
no arrays of long or double ). The constructed
instance is stored as a "result" in the same way that the method invocation
instructions store their results, so the constructed instance must
be moved to a register with a subsequent
moveresultobject instruction (if it is to be used). 
25 3rc  fillednewarray/range {vCCCC .. vNNNN}, type@BBBB  A: array size and argument word count (8 bits)B: type index (16 bits)C: first argument register (16 bits)N = A + C  1 
Construct an array of the given type and size, filling it with
the supplied contents. Clarifications and restrictions are the same
as fillednewarray , described above. 
26 31t  fillarraydata vAA, +BBBBBBBB (with supplemental data as specified
below in "fillarraydata Format") 
A: array reference (8 bits)B: signed "branch" offset to table data (32 bits) 
Fill the given array with the indicated data. The reference must be
to an array of primitives, and the data table must match it in type and
size.
Note:
The address of the table is guaranteed to be even
(that is, 4byte aligned). If the code size of the method is otherwise
odd, then an extra code unit is inserted between the main code and the
table whose value is the same as a 
27 11x  throw vAA  A: exceptionbearing register (8 bits) 
Throw the indicated exception. 
28 10t  goto +AA  A: signed branch offset (8 bits) 
Unconditionally jump to the indicated instruction.
Note:
The branch offset may not be 
29 20t  goto/16 +AAAA  A: signed branch offset (16 bits) 
Unconditionally jump to the indicated instruction.
Note:
The branch offset may not be 
2a 30t  goto/32 +AAAAAAAA  A: signed branch offset (32 bits) 
Unconditionally jump to the indicated instruction. 
2b 31t  packedswitch vAA, +BBBBBBBB (with supplemental data as
specified below in "packedswitch Format") 
A: register to testB: signed "branch" offset to table data (32 bits) 
Jump to a new instruction based on the value in the
given register, using a table of offsets corresponding to each value
in a particular integral range, or fall through to the next
instruction if there is no match.
Note:
The address of the
table is guaranteed to be even (that is, 4byte aligned). If the
code size of the method is otherwise odd, then an extra code unit
is inserted between the main code and the table whose value is
the same as a 
2c 31t  sparseswitch vAA, +BBBBBBBB (with supplemental data as
specified below in "sparseswitch Format") 
A: register to testB: signed "branch" offset to table data (32 bits) 
Jump to a new instruction based on the value in the given
register, using an ordered table of valueoffset pairs, or fall
through to the next instruction if there is no match.
Note:
Alignment and padding considerations are identical to

2d..31 23x  cmpkind vAA, vBB, vCC 2d: cmplfloat (lt bias) 2e: cmpgfloat (gt bias) 2f: cmpldouble (lt bias) 30: cmpgdouble (gt bias) 31: cmplong 
A: destination register (8 bits)B: first source register or pairC: second source register or pair 
Perform the indicated floating point or long comparison,
storing 0 if the two arguments are equal, 1
if the second argument is larger, or 1 if the first
argument is larger. The "bias" listed for the floating point operations
indicates how NaN comparisons are treated: "Gt bias"
instructions return 1 for NaN comparisons,
and "lt bias" instructions return
1 .
For example, to check to see if floating point

32..37 22t  iftest vA, vB, +CCCC 32: ifeq 33: ifne 34: iflt 35: ifge 36: ifgt 37: ifle 
A: first register to test (4 bits)B: second register to test (4 bits)C: signed branch offset (16 bits) 
Branch to the given destination if the given two registers' values
compare as specified.
Note:
The branch offset may not be 
38..3d 21t  iftestz vAA, +BBBB 38: ifeqz 39: ifnez 3a: ifltz 3b: ifgez 3c: ifgtz 3d: iflez 
A: register to test (8 bits)B: signed branch offset (16 bits) 
Branch to the given destination if the given register's value compares
with 0 as specified.
Note:
The branch offset may not be 
3e..43 10x  (unused)  (unused)  
44..51 23x  arrayop vAA, vBB, vCC 44: aget 45: agetwide 46: agetobject 47: agetboolean 48: agetbyte 49: agetchar 4a: agetshort 4b: aput 4c: aputwide 4d: aputobject 4e: aputboolean 4f: aputbyte 50: aputchar 51: aputshort 
A: value register or pair; may be source or dest
(8 bits)B: array register (8 bits)C: index register (8 bits) 
Perform the identified array operation at the identified index of the given array, loading or storing into the value register. 
52..5f 22c  iinstanceop vA, vB, field@CCCC 52: iget 53: igetwide 54: igetobject 55: igetboolean 56: igetbyte 57: igetchar 58: igetshort 59: iput 5a: iputwide 5b: iputobject 5c: iputboolean 5d: iputbyte 5e: iputchar 5f: iputshort 
A: value register or pair; may be source or dest
(4 bits)B: object register (4 bits)C: instance field reference index (16 bits) 
Perform the identified object instance field operation with
the identified field, loading or storing into the value register.
Note: These opcodes are reasonable candidates for static linking, altering the field argument to be a more direct offset. 
60..6d 21c  sstaticop vAA, field@BBBB 60: sget 61: sgetwide 62: sgetobject 63: sgetboolean 64: sgetbyte 65: sgetchar 66: sgetshort 67: sput 68: sputwide 69: sputobject 6a: sputboolean 6b: sputbyte 6c: sputchar 6d: sputshort 
A: value register or pair; may be source or dest
(8 bits)B: static field reference index (16 bits) 
Perform the identified object static field operation with the identified
static field, loading or storing into the value register.
Note: These opcodes are reasonable candidates for static linking, altering the field argument to be a more direct offset. 
6e..72 35c  invokekind {vD, vE, vF, vG, vA}, meth@CCCC 6e: invokevirtual 6f: invokesuper 70: invokedirect 71: invokestatic 72: invokeinterface 
B: argument word count (4 bits)C: method index (16 bits)D..G, A: argument registers (4 bits each) 
Call the indicated method. The result (if any) may be stored
with an appropriate moveresult* variant as the immediately
subsequent instruction.
Note: These opcodes are reasonable candidates for static linking, altering the method argument to be a more direct offset (or pair thereof). 
73 10x  (unused)  (unused)  
74..78 3rc  invokekind/range {vCCCC .. vNNNN}, meth@BBBB 74: invokevirtual/range 75: invokesuper/range 76: invokedirect/range 77: invokestatic/range 78: invokeinterface/range 
A: argument word count (8 bits)B: method index (16 bits)C: first argument register (16 bits)N = A + C  1 
Call the indicated method. See first invokekind
description above for details, caveats, and suggestions.

79..7a 10x  (unused)  (unused)  
7b..8f 12x  unop vA, vB 7b: negint 7c: notint 7d: neglong 7e: notlong 7f: negfloat 80: negdouble 81: inttolong 82: inttofloat 83: inttodouble 84: longtoint 85: longtofloat 86: longtodouble 87: floattoint 88: floattolong 89: floattodouble 8a: doubletoint 8b: doubletolong 8c: doubletofloat 8d: inttobyte 8e: inttochar 8f: inttoshort 
A: destination register or pair (4 bits)B: source register or pair (4 bits) 
Perform the identified unary operation on the source register, storing the result in the destination register. 
90..af 23x  binop vAA, vBB, vCC 90: addint 91: subint 92: mulint 93: divint 94: remint 95: andint 96: orint 97: xorint 98: shlint 99: shrint 9a: ushrint 9b: addlong 9c: sublong 9d: mullong 9e: divlong 9f: remlong a0: andlong a1: orlong a2: xorlong a3: shllong a4: shrlong a5: ushrlong a6: addfloat a7: subfloat a8: mulfloat a9: divfloat aa: remfloat ab: adddouble ac: subdouble ad: muldouble ae: divdouble af: remdouble 
A: destination register or pair (8 bits)B: first source register or pair (8 bits)C: second source register or pair (8 bits) 
Perform the identified binary operation on the two source registers, storing the result in the first source register. 
b0..cf 12x  binop/2addr vA, vB b0: addint/2addr b1: subint/2addr b2: mulint/2addr b3: divint/2addr b4: remint/2addr b5: andint/2addr b6: orint/2addr b7: xorint/2addr b8: shlint/2addr b9: shrint/2addr ba: ushrint/2addr bb: addlong/2addr bc: sublong/2addr bd: mullong/2addr be: divlong/2addr bf: remlong/2addr c0: andlong/2addr c1: orlong/2addr c2: xorlong/2addr c3: shllong/2addr c4: shrlong/2addr c5: ushrlong/2addr c6: addfloat/2addr c7: subfloat/2addr c8: mulfloat/2addr c9: divfloat/2addr ca: remfloat/2addr cb: adddouble/2addr cc: subdouble/2addr cd: muldouble/2addr ce: divdouble/2addr cf: remdouble/2addr 
A: destination and first source register or pair
(4 bits)B: second source register or pair (4 bits) 
Perform the identified binary operation on the two source registers, storing the result in the first source register. 
d0..d7 22s  binop/lit16 vA, vB, #+CCCC d0: addint/lit16 d1: rsubint (reverse subtract) d2: mulint/lit16 d3: divint/lit16 d4: remint/lit16 d5: andint/lit16 d6: orint/lit16 d7: xorint/lit16 
A: destination register (4 bits)B: source register (4 bits)C: signed int constant (16 bits) 
Perform the indicated binary op on the indicated register (first
argument) and literal value (second argument), storing the result in
the destination register.
Note:

d8..e2 22b  binop/lit8 vAA, vBB, #+CC d8: addint/lit8 d9: rsubint/lit8 da: mulint/lit8 db: divint/lit8 dc: remint/lit8 dd: andint/lit8 de: orint/lit8 df: xorint/lit8 e0: shlint/lit8 e1: shrint/lit8 e2: ushrint/lit8 
A: destination register (8 bits)B: source register (8 bits)C: signed int constant (8 bits) 
Perform the indicated binary op on the indicated register (first
argument) and literal value (second argument), storing the result
in the destination register.
Note: See below for details on the semantics of

e3..ff 10x  (unused)  (unused) 
packedswitch
FormatName  Format  Description 

ident  ushort = 0x0100  identifying pseudoopcode 
size  ushort  number of entries in the table 
first_key  int  first (and lowest) switch case value 
targets  int[]  list of size relative branch targets. The targets are
relative to the address of the switch opcode, not of this table.

Note: The total number of code units for an instance of this
table is (size * 2) + 4
.
sparseswitch
FormatName  Format  Description 

ident  ushort = 0x0200  identifying pseudoopcode 
size  ushort  number of entries in the table 
keys  int[]  list of size key values, sorted lowtohigh 
targets  int[]  list of size relative branch targets, each corresponding
to the key value at the same index. The targets are
relative to the address of the switch opcode, not of this table.

Note: The total number of code units for an instance of this
table is (size * 4) + 2
.
fillarraydata
FormatName  Format  Description 

ident  ushort = 0x0300  identifying pseudoopcode 
element_width  ushort  number of bytes in each element 
size  uint  number of elements in the table 
data  ubyte[]  data values 
Note: The total number of code units for an instance of this
table is (size * element_width + 1) / 2 + 4
.
Note: Floating point operations must follow IEEE 754 rules, using roundtonearest and gradual underflow, except where stated otherwise.
Opcode  C Semantics  Notes 

negint  int32 a; int32 result = a; 
Unary twoscomplement. 
notint  int32 a; int32 result = ~a; 
Unary onescomplement. 
neglong  int64 a; int64 result = a; 
Unary twoscomplement. 
notlong  int64 a; int64 result = ~a; 
Unary onescomplement. 
negfloat  float a; float result = a; 
Floating point negation. 
negdouble  double a; double result = a; 
Floating point negation. 
inttolong  int32 a; int64 result = (int64) a; 
Sign extension of int32 into int64 . 
inttofloat  int32 a; float result = (float) a; 
Conversion of int32 to float , using
roundtonearest. This loses precision for some values.

inttodouble  int32 a; double result = (double) a; 
Conversion of int32 to double . 
longtoint  int64 a; int32 result = (int32) a; 
Truncation of int64 into int32 . 
longtofloat  int64 a; float result = (float) a; 
Conversion of int64 to float , using
roundtonearest. This loses precision for some values.

longtodouble  int64 a; double result = (double) a; 
Conversion of int64 to double , using
roundtonearest. This loses precision for some values.

floattoint  float a; int32 result = (int32) a; 
Conversion of float to int32 , using
roundtowardzero. NaN and 0.0 (negative zero)
convert to the integer 0 . Infinities and values with
too large a magnitude to be represented get converted to either
0x7fffffff or 0x80000000 depending on sign.

floattolong  float a; int64 result = (int64) a; 
Conversion of float to int32 , using
roundtowardzero. The same special case rules as for
floattoint apply here, except that outofrange values
get converted to either 0x7fffffffffffffff or
0x8000000000000000 depending on sign.

floattodouble  float a; double result = (double) a; 
Conversion of float to double , preserving
the value exactly.

doubletoint  double a; int32 result = (int32) a; 
Conversion of double to int32 , using
roundtowardzero. The same special case rules as for
floattoint apply here.

doubletolong  double a; int64 result = (int64) a; 
Conversion of double to int64 , using
roundtowardzero. The same special case rules as for
floattolong apply here.

doubletofloat  double a; float result = (float) a; 
Conversion of double to float , using
roundtonearest. This loses precision for some values.

inttobyte  int32 a; int32 result = (a << 24) >> 24; 
Truncation of int32 to int8 , sign
extending the result.

inttochar  int32 a; int32 result = a & 0xffff; 
Truncation of int32 to uint16 , without
sign extension.

inttoshort  int32 a; int32 result = (a << 16) >> 16; 
Truncation of int32 to int16 , sign
extending the result.

addint  int32 a, b; int32 result = a + b; 
Twoscomplement addition. 
subint  int32 a, b; int32 result = a  b; 
Twoscomplement subtraction. 
rsubint  int32 a, b; int32 result = b  a; 
Twoscomplement reverse subtraction. 
mulint  int32 a, b; int32 result = a * b; 
Twoscomplement multiplication. 
divint  int32 a, b; int32 result = a / b; 
Twoscomplement division, rounded towards zero (that is, truncated to
integer). This throws ArithmeticException if
b == 0 .

remint  int32 a, b; int32 result = a % b; 
Twoscomplement remainder after division. The sign of the result
is the same as that of a , and it is more precisely
defined as result == a  (a / b) * b . This throws
ArithmeticException if b == 0 .

andint  int32 a, b; int32 result = a & b; 
Bitwise AND. 
orint  int32 a, b; int32 result = a  b; 
Bitwise OR. 
xorint  int32 a, b; int32 result = a ^ b; 
Bitwise XOR. 
shlint  int32 a, b; int32 result = a << (b & 0x1f); 
Bitwise shift left (with masked argument). 
shrint  int32 a, b; int32 result = a >> (b & 0x1f); 
Bitwise signed shift right (with masked argument). 
ushrint  uint32 a, b; int32 result = a >> (b & 0x1f); 
Bitwise unsigned shift right (with masked argument). 
addlong  int64 a, b; int64 result = a + b; 
Twoscomplement addition. 
sublong  int64 a, b; int64 result = a  b; 
Twoscomplement subtraction. 
mullong  int64 a, b; int64 result = a * b; 
Twoscomplement multiplication. 
divlong  int64 a, b; int64 result = a / b; 
Twoscomplement division, rounded towards zero (that is, truncated to
integer). This throws ArithmeticException if
b == 0 .

remlong  int64 a, b; int64 result = a % b; 
Twoscomplement remainder after division. The sign of the result
is the same as that of a , and it is more precisely
defined as result == a  (a / b) * b . This throws
ArithmeticException if b == 0 .

andlong  int64 a, b; int64 result = a & b; 
Bitwise AND. 
orlong  int64 a, b; int64 result = a  b; 
Bitwise OR. 
xorlong  int64 a, b; int64 result = a ^ b; 
Bitwise XOR. 
shllong  int64 a, b; int64 result = a << (b & 0x3f); 
Bitwise shift left (with masked argument). 
shrlong  int64 a, b; int64 result = a >> (b & 0x3f); 
Bitwise signed shift right (with masked argument). 
ushrlong  uint64 a, b; int64 result = a >> (b & 0x3f); 
Bitwise unsigned shift right (with masked argument). 
addfloat  float a, b; float result = a + b; 
Floating point addition. 
subfloat  float a, b; float result = a  b; 
Floating point subtraction. 
mulfloat  float a, b; float result = a * b; 
Floating point multiplication. 
divfloat  float a, b; float result = a / b; 
Floating point division. 
remfloat  float a, b; float result = a % b; 
Floating point remainder after division. This function is different
than IEEE 754 remainder and is defined as
result == a  roundTowardZero(a / b) * b .

adddouble  double a, b; double result = a + b; 
Floating point addition. 
subdouble  double a, b; double result = a  b; 
Floating point subtraction. 
muldouble  double a, b; double result = a * b; 
Floating point multiplication. 
divdouble  double a, b; double result = a / b; 
Floating point division. 
remdouble  double a, b; double result = a % b; 
Floating point remainder after division. This function is different
than IEEE 754 remainder and is defined as
result == a  roundTowardZero(a / b) * b .
