1 # Copyright (C) 2007 The Android Open Source Project 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 # 16 # Bytecode definition file 17 # 18 19 # One line per instruction format family. Each line consists of a 20 # series of instruction formats that all take (potentially) compatible 21 # arguments. The order is the preferred order (most to least 22 # preferable) of formats, when more than one opcode could be used for 23 # a given instruction's arguments. 24 # 25 # Note: The family that starts with 12x has a mix of both two- and 26 # three- register formats. This is because some of the two-register 27 # opcodes effectively take three, with a destination and two sources 28 # where the destination and one of the sources have to be the same. 29 30 # Regular formats 31 format 10t 20t 30t 32 format 10x 33 format 11n 21s 21h 31i 51l 34 format 11x 35 format 12x 22x 23x 32x 33x # See note, above. 36 format 21c 31c 41c 37 format 21t 31t 38 format 22b 22s 32s 39 format 22c 52c 40 format 22t 41 format 35c 3rc 5rc 42 43 # Optimized formats 44 format 00x 45 format 20bc 46 format 22cs 47 format 35mi 48 format 35ms 49 format 3rmi 50 format 3rms 51 format 40sc 52 53 # One line per opcode. Columns are: 54 # hex for opcode 55 # opcode name 56 # format 57 # has result register; one of: 58 # y 59 # n 60 # index type; one of: 61 # unknown -- used for undefined opcodes and breakpoint 62 # none 63 # varies 64 # type-ref 65 # string-ref 66 # method-ref 67 # field-ref 68 # inline-method 69 # vtable-offset 70 # field-offset 71 # flags; pipe-combined combo of one or more of: 72 # optimized -- optimized; not to be included in unoptimized dex files 73 # branch -- might branch to an address 74 # continue -- might continue to the next address in sequence 75 # switch -- is a switch 76 # throw -- might throw an exception 77 # return -- is a return from method 78 # invoke -- is a method invoke; this is only used for true 79 # method invokes and notably *not* vm-implemented 80 # execute-inline nor the nop-equivalent 81 # invoke-direct-empty 82 83 # 84 # Regular opcodes (with a couple holes) 85 # 86 87 op 00 nop 10x n none continue 88 op 01 move 12x y none continue 89 op 02 move/from16 22x y none continue 90 op 03 move/16 32x y none continue 91 op 04 move-wide 12x y none continue 92 op 05 move-wide/from16 22x y none continue 93 op 06 move-wide/16 32x y none continue 94 op 07 move-object 12x y none continue 95 op 08 move-object/from16 22x y none continue 96 op 09 move-object/16 32x y none continue 97 op 0a move-result 11x y none continue 98 op 0b move-result-wide 11x y none continue 99 op 0c move-result-object 11x y none continue 100 op 0d move-exception 11x y none continue 101 op 0e return-void 10x n none return 102 op 0f return 11x n none return 103 op 10 return-wide 11x n none return 104 op 11 return-object 11x n none return 105 op 12 const/4 11n y none continue 106 op 13 const/16 21s y none continue 107 op 14 const 31i y none continue 108 op 15 const/high16 21h y none continue 109 op 16 const-wide/16 21s y none continue 110 op 17 const-wide/32 31i y none continue 111 op 18 const-wide 51l y none continue 112 op 19 const-wide/high16 21h y none continue 113 op 1a const-string 21c y string-ref continue|throw 114 op 1b const-string/jumbo 31c y string-ref continue|throw 115 op 1c const-class 21c y type-ref continue|throw 116 op 1d monitor-enter 11x n none continue|throw 117 op 1e monitor-exit 11x n none continue|throw 118 op 1f check-cast 21c y type-ref continue|throw 119 op 20 instance-of 22c y type-ref continue|throw 120 op 21 array-length 12x y none continue|throw 121 op 22 new-instance 21c y type-ref continue|throw 122 op 23 new-array 22c y type-ref continue|throw 123 op 24 filled-new-array 35c n type-ref continue|throw 124 op 25 filled-new-array/range 3rc n type-ref continue|throw 125 op 26 fill-array-data 31t n none continue 126 op 27 throw 11x n none throw 127 op 28 goto 10t n none branch 128 op 29 goto/16 20t n none branch 129 op 2a goto/32 30t n none branch 130 op 2b packed-switch 31t n none continue|switch 131 op 2c sparse-switch 31t n none continue|switch 132 op 2d cmpl-float 23x y none continue 133 op 2e cmpg-float 23x y none continue 134 op 2f cmpl-double 23x y none continue 135 op 30 cmpg-double 23x y none continue 136 op 31 cmp-long 23x y none continue 137 op 32 if-eq 22t n none continue|branch 138 op 33 if-ne 22t n none continue|branch 139 op 34 if-lt 22t n none continue|branch 140 op 35 if-ge 22t n none continue|branch 141 op 36 if-gt 22t n none continue|branch 142 op 37 if-le 22t n none continue|branch 143 op 38 if-eqz 21t n none continue|branch 144 op 39 if-nez 21t n none continue|branch 145 op 3a if-ltz 21t n none continue|branch 146 op 3b if-gez 21t n none continue|branch 147 op 3c if-gtz 21t n none continue|branch 148 op 3d if-lez 21t n none continue|branch 149 # unused: op 3e..43 150 op 44 aget 23x y none continue|throw 151 op 45 aget-wide 23x y none continue|throw 152 op 46 aget-object 23x y none continue|throw 153 op 47 aget-boolean 23x y none continue|throw 154 op 48 aget-byte 23x y none continue|throw 155 op 49 aget-char 23x y none continue|throw 156 op 4a aget-short 23x y none continue|throw 157 op 4b aput 23x n none continue|throw 158 op 4c aput-wide 23x n none continue|throw 159 op 4d aput-object 23x n none continue|throw 160 op 4e aput-boolean 23x n none continue|throw 161 op 4f aput-byte 23x n none continue|throw 162 op 50 aput-char 23x n none continue|throw 163 op 51 aput-short 23x n none continue|throw 164 op 52 iget 22c y field-ref continue|throw 165 op 53 iget-wide 22c y field-ref continue|throw 166 op 54 iget-object 22c y field-ref continue|throw 167 op 55 iget-boolean 22c y field-ref continue|throw 168 op 56 iget-byte 22c y field-ref continue|throw 169 op 57 iget-char 22c y field-ref continue|throw 170 op 58 iget-short 22c y field-ref continue|throw 171 op 59 iput 22c n field-ref continue|throw 172 op 5a iput-wide 22c n field-ref continue|throw 173 op 5b iput-object 22c n field-ref continue|throw 174 op 5c iput-boolean 22c n field-ref continue|throw 175 op 5d iput-byte 22c n field-ref continue|throw 176 op 5e iput-char 22c n field-ref continue|throw 177 op 5f iput-short 22c n field-ref continue|throw 178 op 60 sget 21c y field-ref continue|throw 179 op 61 sget-wide 21c y field-ref continue|throw 180 op 62 sget-object 21c y field-ref continue|throw 181 op 63 sget-boolean 21c y field-ref continue|throw 182 op 64 sget-byte 21c y field-ref continue|throw 183 op 65 sget-char 21c y field-ref continue|throw 184 op 66 sget-short 21c y field-ref continue|throw 185 op 67 sput 21c n field-ref continue|throw 186 op 68 sput-wide 21c n field-ref continue|throw 187 op 69 sput-object 21c n field-ref continue|throw 188 op 6a sput-boolean 21c n field-ref continue|throw 189 op 6b sput-byte 21c n field-ref continue|throw 190 op 6c sput-char 21c n field-ref continue|throw 191 op 6d sput-short 21c n field-ref continue|throw 192 op 6e invoke-virtual 35c n method-ref continue|throw|invoke 193 op 6f invoke-super 35c n method-ref continue|throw|invoke 194 op 70 invoke-direct 35c n method-ref continue|throw|invoke 195 op 71 invoke-static 35c n method-ref continue|throw|invoke 196 op 72 invoke-interface 35c n method-ref continue|throw|invoke 197 # unused: op 73 198 op 74 invoke-virtual/range 3rc n method-ref continue|throw|invoke 199 op 75 invoke-super/range 3rc n method-ref continue|throw|invoke 200 op 76 invoke-direct/range 3rc n method-ref continue|throw|invoke 201 op 77 invoke-static/range 3rc n method-ref continue|throw|invoke 202 op 78 invoke-interface/range 3rc n method-ref continue|throw|invoke 203 # unused: op 79..7a 204 op 7b neg-int 12x y none continue 205 op 7c not-int 12x y none continue 206 op 7d neg-long 12x y none continue 207 op 7e not-long 12x y none continue 208 op 7f neg-float 12x y none continue 209 op 80 neg-double 12x y none continue 210 op 81 int-to-long 12x y none continue 211 op 82 int-to-float 12x y none continue 212 op 83 int-to-double 12x y none continue 213 op 84 long-to-int 12x y none continue 214 op 85 long-to-float 12x y none continue 215 op 86 long-to-double 12x y none continue 216 op 87 float-to-int 12x y none continue 217 op 88 float-to-long 12x y none continue 218 op 89 float-to-double 12x y none continue 219 op 8a double-to-int 12x y none continue 220 op 8b double-to-long 12x y none continue 221 op 8c double-to-float 12x y none continue 222 op 8d int-to-byte 12x y none continue 223 op 8e int-to-char 12x y none continue 224 op 8f int-to-short 12x y none continue 225 op 90 add-int 23x y none continue 226 op 91 sub-int 23x y none continue 227 op 92 mul-int 23x y none continue 228 op 93 div-int 23x y none continue|throw 229 op 94 rem-int 23x y none continue|throw 230 op 95 and-int 23x y none continue 231 op 96 or-int 23x y none continue 232 op 97 xor-int 23x y none continue 233 op 98 shl-int 23x y none continue 234 op 99 shr-int 23x y none continue 235 op 9a ushr-int 23x y none continue 236 op 9b add-long 23x y none continue 237 op 9c sub-long 23x y none continue 238 op 9d mul-long 23x y none continue 239 op 9e div-long 23x y none continue|throw 240 op 9f rem-long 23x y none continue|throw 241 op a0 and-long 23x y none continue 242 op a1 or-long 23x y none continue 243 op a2 xor-long 23x y none continue 244 op a3 shl-long 23x y none continue 245 op a4 shr-long 23x y none continue 246 op a5 ushr-long 23x y none continue 247 op a6 add-float 23x y none continue 248 op a7 sub-float 23x y none continue 249 op a8 mul-float 23x y none continue 250 op a9 div-float 23x y none continue 251 op aa rem-float 23x y none continue 252 op ab add-double 23x y none continue 253 op ac sub-double 23x y none continue 254 op ad mul-double 23x y none continue 255 op ae div-double 23x y none continue 256 op af rem-double 23x y none continue 257 op b0 add-int/2addr 12x y none continue 258 op b1 sub-int/2addr 12x y none continue 259 op b2 mul-int/2addr 12x y none continue 260 op b3 div-int/2addr 12x y none continue|throw 261 op b4 rem-int/2addr 12x y none continue|throw 262 op b5 and-int/2addr 12x y none continue 263 op b6 or-int/2addr 12x y none continue 264 op b7 xor-int/2addr 12x y none continue 265 op b8 shl-int/2addr 12x y none continue 266 op b9 shr-int/2addr 12x y none continue 267 op ba ushr-int/2addr 12x y none continue 268 op bb add-long/2addr 12x y none continue 269 op bc sub-long/2addr 12x y none continue 270 op bd mul-long/2addr 12x y none continue 271 op be div-long/2addr 12x y none continue|throw 272 op bf rem-long/2addr 12x y none continue|throw 273 op c0 and-long/2addr 12x y none continue 274 op c1 or-long/2addr 12x y none continue 275 op c2 xor-long/2addr 12x y none continue 276 op c3 shl-long/2addr 12x y none continue 277 op c4 shr-long/2addr 12x y none continue 278 op c5 ushr-long/2addr 12x y none continue 279 op c6 add-float/2addr 12x y none continue 280 op c7 sub-float/2addr 12x y none continue 281 op c8 mul-float/2addr 12x y none continue 282 op c9 div-float/2addr 12x y none continue 283 op ca rem-float/2addr 12x y none continue 284 op cb add-double/2addr 12x y none continue 285 op cc sub-double/2addr 12x y none continue 286 op cd mul-double/2addr 12x y none continue 287 op ce div-double/2addr 12x y none continue 288 op cf rem-double/2addr 12x y none continue 289 op d0 add-int/lit16 22s y none continue 290 op d1 rsub-int 22s y none continue 291 op d2 mul-int/lit16 22s y none continue 292 op d3 div-int/lit16 22s y none continue|throw 293 op d4 rem-int/lit16 22s y none continue|throw 294 op d5 and-int/lit16 22s y none continue 295 op d6 or-int/lit16 22s y none continue 296 op d7 xor-int/lit16 22s y none continue 297 op d8 add-int/lit8 22b y none continue 298 op d9 rsub-int/lit8 22b y none continue 299 op da mul-int/lit8 22b y none continue 300 op db div-int/lit8 22b y none continue|throw 301 op dc rem-int/lit8 22b y none continue|throw 302 op dd and-int/lit8 22b y none continue 303 op de or-int/lit8 22b y none continue 304 op df xor-int/lit8 22b y none continue 305 op e0 shl-int/lit8 22b y none continue 306 op e1 shr-int/lit8 22b y none continue 307 op e2 ushr-int/lit8 22b y none continue 308 309 # 310 # Optimized opcodes (not valid in an unoptimized dex file) 311 # 312 313 op e3 +iget-volatile 22c y field-ref optimized|continue|throw 314 op e4 +iput-volatile 22c n field-ref optimized|continue|throw 315 op e5 +sget-volatile 21c y field-ref optimized|continue|throw 316 op e6 +sput-volatile 21c n field-ref optimized|continue|throw 317 op e7 +iget-object-volatile 22c y field-ref optimized|continue|throw 318 op e8 +iget-wide-volatile 22c y field-ref optimized|continue|throw 319 op e9 +iput-wide-volatile 22c n field-ref optimized|continue|throw 320 op ea +sget-wide-volatile 21c y field-ref optimized|continue|throw 321 op eb +sput-wide-volatile 21c n field-ref optimized|continue|throw 322 323 # Technically "breakpoint" isn't really an optimized opcode, but it 324 # fits the label in terms of not being valid in regular dex files. 325 op ec ^breakpoint 00x n unknown optimized 326 327 op ed ^throw-verification-error 20bc n varies optimized|throw 328 op ee +execute-inline 35mi n inline-method optimized|continue|throw 329 op ef +execute-inline/range 3rmi n inline-method optimized|continue|throw 330 331 op f0 +invoke-object-init/range 35c n method-ref optimized|continue|throw|invoke 332 op f1 +return-void-barrier 10x n none optimized|return 333 op f2 +iget-quick 22cs y field-offset optimized|continue|throw 334 op f3 +iget-wide-quick 22cs y field-offset optimized|continue|throw 335 op f4 +iget-object-quick 22cs y field-offset optimized|continue|throw 336 op f5 +iput-quick 22cs n field-offset optimized|continue|throw 337 op f6 +iput-wide-quick 22cs n field-offset optimized|continue|throw 338 op f7 +iput-object-quick 22cs n field-offset optimized|continue|throw 339 op f8 +invoke-virtual-quick 35ms n vtable-offset optimized|continue|throw|invoke 340 op f9 +invoke-virtual-quick/range 3rms n vtable-offset optimized|continue|throw|invoke 341 op fa +invoke-super-quick 35ms n vtable-offset optimized|continue|throw|invoke 342 op fb +invoke-super-quick/range 3rms n vtable-offset optimized|continue|throw|invoke 343 op fc +iput-object-volatile 22c n field-ref optimized|continue|throw 344 op fd +sget-object-volatile 21c y field-ref optimized|continue|throw 345 op fe +sput-object-volatile 21c n field-ref optimized|continue|throw 346 347 # 348 # Extended-width opcodes 349 # 350 351 op 00ff const-class/jumbo 41c y type-ref continue|throw 352 op 01ff check-cast/jumbo 41c n type-ref continue|throw 353 op 02ff instance-of/jumbo 52c y type-ref continue|throw 354 op 03ff new-instance/jumbo 41c y type-ref continue|throw 355 op 04ff new-array/jumbo 52c y type-ref continue|throw 356 op 05ff filled-new-array/jumbo 5rc n type-ref continue|throw 357 op 06ff iget/jumbo 52c y field-ref continue|throw 358 op 07ff iget-wide/jumbo 52c y field-ref continue|throw 359 op 08ff iget-object/jumbo 52c y field-ref continue|throw 360 op 09ff iget-boolean/jumbo 52c y field-ref continue|throw 361 op 0aff iget-byte/jumbo 52c y field-ref continue|throw 362 op 0bff iget-char/jumbo 52c y field-ref continue|throw 363 op 0cff iget-short/jumbo 52c y field-ref continue|throw 364 op 0dff iput/jumbo 52c n field-ref continue|throw 365 op 0eff iput-wide/jumbo 52c n field-ref continue|throw 366 op 0fff iput-object/jumbo 52c n field-ref continue|throw 367 op 10ff iput-boolean/jumbo 52c n field-ref continue|throw 368 op 11ff iput-byte/jumbo 52c n field-ref continue|throw 369 op 12ff iput-char/jumbo 52c n field-ref continue|throw 370 op 13ff iput-short/jumbo 52c n field-ref continue|throw 371 op 14ff sget/jumbo 41c y field-ref continue|throw 372 op 15ff sget-wide/jumbo 41c y field-ref continue|throw 373 op 16ff sget-object/jumbo 41c y field-ref continue|throw 374 op 17ff sget-boolean/jumbo 41c y field-ref continue|throw 375 op 18ff sget-byte/jumbo 41c y field-ref continue|throw 376 op 19ff sget-char/jumbo 41c y field-ref continue|throw 377 op 1aff sget-short/jumbo 41c y field-ref continue|throw 378 op 1bff sput/jumbo 41c n field-ref continue|throw 379 op 1cff sput-wide/jumbo 41c n field-ref continue|throw 380 op 1dff sput-object/jumbo 41c n field-ref continue|throw 381 op 1eff sput-boolean/jumbo 41c n field-ref continue|throw 382 op 1fff sput-byte/jumbo 41c n field-ref continue|throw 383 op 20ff sput-char/jumbo 41c n field-ref continue|throw 384 op 21ff sput-short/jumbo 41c n field-ref continue|throw 385 op 22ff invoke-virtual/jumbo 5rc n method-ref continue|throw|invoke 386 op 23ff invoke-super/jumbo 5rc n method-ref continue|throw|invoke 387 op 24ff invoke-direct/jumbo 5rc n method-ref continue|throw|invoke 388 op 25ff invoke-static/jumbo 5rc n method-ref continue|throw|invoke 389 op 26ff invoke-interface/jumbo 5rc n method-ref continue|throw|invoke 390 391 # unused: op 27ff..f1ff 392 393 # 394 # Optimized opcodes (not valid in an unoptimized dex file) 395 # 396 397 op f2ff +invoke-object-init/jumbo 5rc n method-ref optimized|continue|throw|invoke 398 op f3ff +iget-volatile/jumbo 52c y field-ref optimized|continue|throw 399 op f4ff +iget-wide-volatile/jumbo 52c y field-ref optimized|continue|throw 400 op f5ff +iget-object-volatile/jumbo 52c y field-ref optimized|continue|throw 401 op f6ff +iput-volatile/jumbo 52c n field-ref optimized|continue|throw 402 op f7ff +iput-wide-volatile/jumbo 52c n field-ref optimized|continue|throw 403 op f8ff +iput-object-volatile/jumbo 52c n field-ref optimized|continue|throw 404 op f9ff +sget-volatile/jumbo 41c y field-ref optimized|continue|throw 405 op faff +sget-wide-volatile/jumbo 41c y field-ref optimized|continue|throw 406 op fbff +sget-object-volatile/jumbo 41c y field-ref optimized|continue|throw 407 op fcff +sput-volatile/jumbo 41c n field-ref optimized|continue|throw 408 op fdff +sput-wide-volatile/jumbo 41c n field-ref optimized|continue|throw 409 op feff +sput-object-volatile/jumbo 41c n field-ref optimized|continue|throw 410 op ffff ^throw-verification-error/jumbo 40sc n varies optimized|throw 411