blob: 0129ad980a8e1381b8570df39fa99da29157b923 [file] [log] [blame]
The Android Open Source Projectf6c38712009-03-03 19:28:47 -08001# 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
Dan Bornstein8d74cbd2010-11-02 13:31:15 -070015#
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080016# Bytecode definition file
17#
Dan Bornstein8d74cbd2010-11-02 13:31:15 -070018
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
Dan Bornsteina1d6b0e2010-11-12 17:47:43 -080030# Regular formats
Dan Bornstein8d74cbd2010-11-02 13:31:15 -070031format 10t 20t 30t
32format 10x
33format 11n 21s 21h 31i 51l
34format 11x
Elliott Hughesab35b502012-01-04 15:38:58 -080035format 12x 22x 23x 32x # See note, above.
36format 21c 31c
Dan Bornstein8d74cbd2010-11-02 13:31:15 -070037format 21t 31t
Elliott Hughesab35b502012-01-04 15:38:58 -080038format 22b 22s
39format 22c
Dan Bornstein8d74cbd2010-11-02 13:31:15 -070040format 22t
Elliott Hughesab35b502012-01-04 15:38:58 -080041format 35c 3rc
Orion Hodsonab9e85c2017-02-01 10:42:01 +000042format 45cc 4rcc
Dan Bornstein8d74cbd2010-11-02 13:31:15 -070043
Dan Bornsteina1d6b0e2010-11-12 17:47:43 -080044# Optimized formats
Orion Hodsonab9e85c2017-02-01 10:42:01 +000045format 00x
Dan Bornstein3c6c8c72010-11-30 16:46:20 -080046format 20bc
Dan Bornsteina1d6b0e2010-11-12 17:47:43 -080047format 22cs
48format 35mi
49format 35ms
50format 3rmi
51format 3rms
52
Dan Bornstein8d74cbd2010-11-02 13:31:15 -070053# One line per opcode. Columns are:
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080054# hex for opcode
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080055# opcode name
Dan Bornsteind8bb0d72010-11-12 12:15:46 -080056# format
57# has result register; one of:
58# y
59# n
60# index type; one of:
Dan Bornstein84244322010-11-17 12:05:04 -080061# unknown -- used for undefined opcodes and breakpoint
Dan Bornsteind8bb0d72010-11-12 12:15:46 -080062# none
63# varies
64# type-ref
65# string-ref
66# method-ref
67# field-ref
68# inline-method
69# vtable-offset
70# field-offset
Orion Hodsonab9e85c2017-02-01 10:42:01 +000071# method-and-proto-ref
Orion Hodsonfa5e5102017-02-14 14:52:41 +000072# call-site-ref
Orion Hodson766a6782017-09-21 15:27:51 +010073# method-handle-ref
74# proto-ref
Dan Bornsteind8bb0d72010-11-12 12:15:46 -080075# flags; pipe-combined combo of one or more of:
76# optimized -- optimized; not to be included in unoptimized dex files
77# branch -- might branch to an address
78# continue -- might continue to the next address in sequence
79# switch -- is a switch
Dan Bornsteind8bb0d72010-11-12 12:15:46 -080080# throw -- might throw an exception
81# return -- is a return from method
Dan Bornstein0759f522010-11-30 14:58:53 -080082# invoke -- is a method invoke; this is only used for true
83# method invokes and notably *not* vm-implemented
84# execute-inline nor the nop-equivalent
85# invoke-direct-empty
The Android Open Source Projectf6c38712009-03-03 19:28:47 -080086
Dan Bornstein74b28b02010-11-30 16:29:42 -080087#
Dan Bornsteina1d6b0e2010-11-12 17:47:43 -080088# Regular opcodes (with a couple holes)
Dan Bornstein74b28b02010-11-30 16:29:42 -080089#
90
Dan Bornsteind03baaf2010-11-16 15:54:10 -080091op 00 nop 10x n none continue
92op 01 move 12x y none continue
93op 02 move/from16 22x y none continue
94op 03 move/16 32x y none continue
95op 04 move-wide 12x y none continue
96op 05 move-wide/from16 22x y none continue
97op 06 move-wide/16 32x y none continue
98op 07 move-object 12x y none continue
99op 08 move-object/from16 22x y none continue
100op 09 move-object/16 32x y none continue
101op 0a move-result 11x y none continue
102op 0b move-result-wide 11x y none continue
103op 0c move-result-object 11x y none continue
104op 0d move-exception 11x y none continue
105op 0e return-void 10x n none return
106op 0f return 11x n none return
107op 10 return-wide 11x n none return
108op 11 return-object 11x n none return
109op 12 const/4 11n y none continue
110op 13 const/16 21s y none continue
111op 14 const 31i y none continue
112op 15 const/high16 21h y none continue
113op 16 const-wide/16 21s y none continue
114op 17 const-wide/32 31i y none continue
115op 18 const-wide 51l y none continue
116op 19 const-wide/high16 21h y none continue
117op 1a const-string 21c y string-ref continue|throw
118op 1b const-string/jumbo 31c y string-ref continue|throw
119op 1c const-class 21c y type-ref continue|throw
120op 1d monitor-enter 11x n none continue|throw
121op 1e monitor-exit 11x n none continue|throw
122op 1f check-cast 21c y type-ref continue|throw
123op 20 instance-of 22c y type-ref continue|throw
124op 21 array-length 12x y none continue|throw
125op 22 new-instance 21c y type-ref continue|throw
126op 23 new-array 22c y type-ref continue|throw
127op 24 filled-new-array 35c n type-ref continue|throw
128op 25 filled-new-array/range 3rc n type-ref continue|throw
129op 26 fill-array-data 31t n none continue
130op 27 throw 11x n none throw
131op 28 goto 10t n none branch
132op 29 goto/16 20t n none branch
133op 2a goto/32 30t n none branch
134op 2b packed-switch 31t n none continue|switch
135op 2c sparse-switch 31t n none continue|switch
136op 2d cmpl-float 23x y none continue
137op 2e cmpg-float 23x y none continue
138op 2f cmpl-double 23x y none continue
139op 30 cmpg-double 23x y none continue
140op 31 cmp-long 23x y none continue
141op 32 if-eq 22t n none continue|branch
142op 33 if-ne 22t n none continue|branch
143op 34 if-lt 22t n none continue|branch
144op 35 if-ge 22t n none continue|branch
145op 36 if-gt 22t n none continue|branch
146op 37 if-le 22t n none continue|branch
147op 38 if-eqz 21t n none continue|branch
148op 39 if-nez 21t n none continue|branch
149op 3a if-ltz 21t n none continue|branch
150op 3b if-gez 21t n none continue|branch
151op 3c if-gtz 21t n none continue|branch
152op 3d if-lez 21t n none continue|branch
Dan Bornsteind8bb0d72010-11-12 12:15:46 -0800153# unused: op 3e..43
Dan Bornsteind03baaf2010-11-16 15:54:10 -0800154op 44 aget 23x y none continue|throw
155op 45 aget-wide 23x y none continue|throw
156op 46 aget-object 23x y none continue|throw
157op 47 aget-boolean 23x y none continue|throw
158op 48 aget-byte 23x y none continue|throw
159op 49 aget-char 23x y none continue|throw
160op 4a aget-short 23x y none continue|throw
161op 4b aput 23x n none continue|throw
162op 4c aput-wide 23x n none continue|throw
163op 4d aput-object 23x n none continue|throw
164op 4e aput-boolean 23x n none continue|throw
165op 4f aput-byte 23x n none continue|throw
166op 50 aput-char 23x n none continue|throw
167op 51 aput-short 23x n none continue|throw
168op 52 iget 22c y field-ref continue|throw
169op 53 iget-wide 22c y field-ref continue|throw
170op 54 iget-object 22c y field-ref continue|throw
171op 55 iget-boolean 22c y field-ref continue|throw
172op 56 iget-byte 22c y field-ref continue|throw
173op 57 iget-char 22c y field-ref continue|throw
174op 58 iget-short 22c y field-ref continue|throw
175op 59 iput 22c n field-ref continue|throw
176op 5a iput-wide 22c n field-ref continue|throw
177op 5b iput-object 22c n field-ref continue|throw
178op 5c iput-boolean 22c n field-ref continue|throw
179op 5d iput-byte 22c n field-ref continue|throw
180op 5e iput-char 22c n field-ref continue|throw
181op 5f iput-short 22c n field-ref continue|throw
182op 60 sget 21c y field-ref continue|throw
183op 61 sget-wide 21c y field-ref continue|throw
184op 62 sget-object 21c y field-ref continue|throw
185op 63 sget-boolean 21c y field-ref continue|throw
186op 64 sget-byte 21c y field-ref continue|throw
187op 65 sget-char 21c y field-ref continue|throw
188op 66 sget-short 21c y field-ref continue|throw
189op 67 sput 21c n field-ref continue|throw
190op 68 sput-wide 21c n field-ref continue|throw
191op 69 sput-object 21c n field-ref continue|throw
192op 6a sput-boolean 21c n field-ref continue|throw
193op 6b sput-byte 21c n field-ref continue|throw
194op 6c sput-char 21c n field-ref continue|throw
195op 6d sput-short 21c n field-ref continue|throw
196op 6e invoke-virtual 35c n method-ref continue|throw|invoke
197op 6f invoke-super 35c n method-ref continue|throw|invoke
198op 70 invoke-direct 35c n method-ref continue|throw|invoke
199op 71 invoke-static 35c n method-ref continue|throw|invoke
200op 72 invoke-interface 35c n method-ref continue|throw|invoke
Dan Bornstein737fac22010-11-08 16:28:33 -0800201# unused: op 73
Dan Bornsteind03baaf2010-11-16 15:54:10 -0800202op 74 invoke-virtual/range 3rc n method-ref continue|throw|invoke
203op 75 invoke-super/range 3rc n method-ref continue|throw|invoke
204op 76 invoke-direct/range 3rc n method-ref continue|throw|invoke
205op 77 invoke-static/range 3rc n method-ref continue|throw|invoke
206op 78 invoke-interface/range 3rc n method-ref continue|throw|invoke
Dan Bornsteind8bb0d72010-11-12 12:15:46 -0800207# unused: op 79..7a
Dan Bornsteind03baaf2010-11-16 15:54:10 -0800208op 7b neg-int 12x y none continue
209op 7c not-int 12x y none continue
210op 7d neg-long 12x y none continue
211op 7e not-long 12x y none continue
212op 7f neg-float 12x y none continue
213op 80 neg-double 12x y none continue
214op 81 int-to-long 12x y none continue
215op 82 int-to-float 12x y none continue
216op 83 int-to-double 12x y none continue
217op 84 long-to-int 12x y none continue
218op 85 long-to-float 12x y none continue
219op 86 long-to-double 12x y none continue
220op 87 float-to-int 12x y none continue
221op 88 float-to-long 12x y none continue
222op 89 float-to-double 12x y none continue
223op 8a double-to-int 12x y none continue
224op 8b double-to-long 12x y none continue
225op 8c double-to-float 12x y none continue
226op 8d int-to-byte 12x y none continue
227op 8e int-to-char 12x y none continue
228op 8f int-to-short 12x y none continue
229op 90 add-int 23x y none continue
230op 91 sub-int 23x y none continue
231op 92 mul-int 23x y none continue
232op 93 div-int 23x y none continue|throw
233op 94 rem-int 23x y none continue|throw
234op 95 and-int 23x y none continue
235op 96 or-int 23x y none continue
236op 97 xor-int 23x y none continue
237op 98 shl-int 23x y none continue
238op 99 shr-int 23x y none continue
239op 9a ushr-int 23x y none continue
240op 9b add-long 23x y none continue
241op 9c sub-long 23x y none continue
242op 9d mul-long 23x y none continue
243op 9e div-long 23x y none continue|throw
244op 9f rem-long 23x y none continue|throw
245op a0 and-long 23x y none continue
246op a1 or-long 23x y none continue
247op a2 xor-long 23x y none continue
248op a3 shl-long 23x y none continue
249op a4 shr-long 23x y none continue
250op a5 ushr-long 23x y none continue
251op a6 add-float 23x y none continue
252op a7 sub-float 23x y none continue
253op a8 mul-float 23x y none continue
254op a9 div-float 23x y none continue
255op aa rem-float 23x y none continue
256op ab add-double 23x y none continue
257op ac sub-double 23x y none continue
258op ad mul-double 23x y none continue
259op ae div-double 23x y none continue
260op af rem-double 23x y none continue
261op b0 add-int/2addr 12x y none continue
262op b1 sub-int/2addr 12x y none continue
263op b2 mul-int/2addr 12x y none continue
264op b3 div-int/2addr 12x y none continue|throw
265op b4 rem-int/2addr 12x y none continue|throw
266op b5 and-int/2addr 12x y none continue
267op b6 or-int/2addr 12x y none continue
268op b7 xor-int/2addr 12x y none continue
269op b8 shl-int/2addr 12x y none continue
270op b9 shr-int/2addr 12x y none continue
271op ba ushr-int/2addr 12x y none continue
272op bb add-long/2addr 12x y none continue
273op bc sub-long/2addr 12x y none continue
274op bd mul-long/2addr 12x y none continue
275op be div-long/2addr 12x y none continue|throw
276op bf rem-long/2addr 12x y none continue|throw
277op c0 and-long/2addr 12x y none continue
278op c1 or-long/2addr 12x y none continue
279op c2 xor-long/2addr 12x y none continue
280op c3 shl-long/2addr 12x y none continue
281op c4 shr-long/2addr 12x y none continue
282op c5 ushr-long/2addr 12x y none continue
283op c6 add-float/2addr 12x y none continue
284op c7 sub-float/2addr 12x y none continue
285op c8 mul-float/2addr 12x y none continue
286op c9 div-float/2addr 12x y none continue
287op ca rem-float/2addr 12x y none continue
288op cb add-double/2addr 12x y none continue
289op cc sub-double/2addr 12x y none continue
290op cd mul-double/2addr 12x y none continue
291op ce div-double/2addr 12x y none continue
292op cf rem-double/2addr 12x y none continue
293op d0 add-int/lit16 22s y none continue
294op d1 rsub-int 22s y none continue
295op d2 mul-int/lit16 22s y none continue
296op d3 div-int/lit16 22s y none continue|throw
297op d4 rem-int/lit16 22s y none continue|throw
298op d5 and-int/lit16 22s y none continue
299op d6 or-int/lit16 22s y none continue
300op d7 xor-int/lit16 22s y none continue
301op d8 add-int/lit8 22b y none continue
302op d9 rsub-int/lit8 22b y none continue
303op da mul-int/lit8 22b y none continue
304op db div-int/lit8 22b y none continue|throw
305op dc rem-int/lit8 22b y none continue|throw
306op dd and-int/lit8 22b y none continue
307op de or-int/lit8 22b y none continue
308op df xor-int/lit8 22b y none continue
309op e0 shl-int/lit8 22b y none continue
310op e1 shr-int/lit8 22b y none continue
311op e2 ushr-int/lit8 22b y none continue
Dan Bornsteina1d6b0e2010-11-12 17:47:43 -0800312
Dan Bornstein74b28b02010-11-30 16:29:42 -0800313#
Dan Bornsteina1d6b0e2010-11-12 17:47:43 -0800314# Optimized opcodes (not valid in an unoptimized dex file)
315#
Dan Bornstein74b28b02010-11-30 16:29:42 -0800316
Dan Bornsteind03baaf2010-11-16 15:54:10 -0800317op e3 +iget-volatile 22c y field-ref optimized|continue|throw
318op e4 +iput-volatile 22c n field-ref optimized|continue|throw
319op e5 +sget-volatile 21c y field-ref optimized|continue|throw
320op e6 +sput-volatile 21c n field-ref optimized|continue|throw
321op e7 +iget-object-volatile 22c y field-ref optimized|continue|throw
322op e8 +iget-wide-volatile 22c y field-ref optimized|continue|throw
323op e9 +iput-wide-volatile 22c n field-ref optimized|continue|throw
324op ea +sget-wide-volatile 21c y field-ref optimized|continue|throw
325op eb +sput-wide-volatile 21c n field-ref optimized|continue|throw
Dan Bornstein74b28b02010-11-30 16:29:42 -0800326
327# Technically "breakpoint" isn't really an optimized opcode, but it
328# fits the label in terms of not being valid in regular dex files.
Dan Bornstein84244322010-11-17 12:05:04 -0800329op ec ^breakpoint 00x n unknown optimized
Dan Bornstein74b28b02010-11-30 16:29:42 -0800330
Dan Bornsteind03baaf2010-11-16 15:54:10 -0800331op ed ^throw-verification-error 20bc n varies optimized|throw
332op ee +execute-inline 35mi n inline-method optimized|continue|throw
333op ef +execute-inline/range 3rmi n inline-method optimized|continue|throw
Dan Bornstein74b28b02010-11-30 16:29:42 -0800334
Carl Shapiro3475f9c2011-03-21 13:35:24 -0700335op f0 +invoke-object-init/range 35c n method-ref optimized|continue|throw|invoke
Dan Bornsteind03baaf2010-11-16 15:54:10 -0800336op f1 +return-void-barrier 10x n none optimized|return
337op f2 +iget-quick 22cs y field-offset optimized|continue|throw
Orion Hodson766a6782017-09-21 15:27:51 +0100338
339# unused: op f3..f9
340
341#
342# Bytecodes relating to method handles API.
343#
Orion Hodsonab9e85c2017-02-01 10:42:01 +0000344
345# Invoke-polymorphic
Orion Hodson766a6782017-09-21 15:27:51 +0100346op fa invoke-polymorphic 45cc n method-and-proto-ref continue|throw|invoke
347op fb invoke-polymorphic/range 4rcc n method-and-proto-ref continue|throw|invoke
348op fc invoke-custom 35c n call-site-ref continue|throw|invoke
349op fd invoke-custom/range 3rc n call-site-ref continue|throw|invoke
Orion Hodsonab9e85c2017-02-01 10:42:01 +0000350
Orion Hodson766a6782017-09-21 15:27:51 +0100351# Constant loading for method handles and method types. NB these may throw OOME
352op fe const-method-handle 21c y method-handle-ref continue|throw
353op ff const-method-type 21c y proto-ref continue|throw
Orion Hodsonab9e85c2017-02-01 10:42:01 +0000354