OSDN Git Service

am 68e8f6c0: am 53015360: am 5a57e766: Merge "Change dx.bat to Windows EOL."
[android-x86/dalvik.git] / docs / dalvik-bytecode.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
3 <html>
4
5 <head>
6 <title>Bytecode for the Dalvik VM</title>
7 <link rel=stylesheet href="dalvik-bytecode.css">
8 </head>
9
10 <body>
11
12 <h1>Bytecode for the Dalvik VM</h1>
13 <p>Copyright &copy; 2007 The Android Open Source Project
14
15 <h2>General Design</h2>
16
17 <ul>
18 <li>The machine model and calling conventions are meant to approximately
19   imitate common real architectures and C-style calling conventions:
20   <ul>
21   <li>The VM is register-based, and frames are fixed in size upon creation.
22     Each frame consists of a particular number of registers (specified by
23     the method) as well as any adjunct data needed to execute the method,
24     such as (but not limited to) the program counter and a reference to the
25     <code>.dex</code> file that contains the method.
26   </li>
27   <li>When used for bit values (such as integers and floating point
28     numbers), registers are considered 32 bits wide. Adjacent register
29     pairs are used for 64-bit values. There is no alignment requirement
30     for register pairs.
31   </li>
32   <li>When used for object references, registers are considered wide enough
33     to hold exactly one such reference.
34   </li>
35   <li>In terms of bitwise representation, <code>(Object) null == (int)
36     0</code>.
37   </li>
38   <li>The <i>N</i> arguments to a method land in the last <i>N</i> registers
39     of the method's invocation frame, in order. Wide arguments consume
40     two registers. Instance methods are passed a <code>this</code> reference
41     as their first argument.
42   </li>
43   </ul>
44 <li>The storage unit in the instruction stream is a 16-bit unsigned quantity.
45   Some bits in some instructions are ignored / must-be-zero.
46 </li>
47 <li>Instructions aren't gratuitously limited to a particular type. For
48   example, instructions that move 32-bit register values without interpretation
49   don't have to specify whether they are moving ints or floats.
50 </li>
51 <li>There are separately enumerated and indexed constant pools for
52   references to strings, types, fields, and methods.
53 </li>
54 <li>Bitwise literal data is represented in-line in the instruction stream.</li>
55 <li>Because, in practice, it is uncommon for a method to need more than
56   16 registers, and because needing more than eight registers <i>is</i>
57   reasonably common, many instructions are limited to only addressing
58   the first 16
59   registers. When reasonably possible, instructions allow references to
60   up to the first 256 registers. In addition, some instructions have variants
61   that allow for much larger register counts, including a pair of catch-all
62   <code>move</code> instructions that can address registers in the range
63   <code>v0</code> &ndash; <code>v65535</code>.
64   In cases where an instruction variant isn't
65   available to address a desired register, it is expected that the register
66   contents get moved from the original register to a low register (before the
67   operation) and/or moved from a low result register to a high register
68   (after the operation).
69 </li>
70 <li>There are several "pseudo-instructions" that are used to hold
71   variable-length data payloads, which are referred to by regular
72   instructions (for example,
73   <code>fill-array-data</code>). Such instructions must never be
74   encountered during the normal flow of execution. In addition, the
75   instructions must be located on even-numbered bytecode offsets (that is,
76   4-byte aligned). In order to meet this requirement, dex generation tools
77   must emit an extra <code>nop</code> instruction as a spacer if such an
78   instruction would otherwise be unaligned. Finally, though not required,
79   it is expected that most tools will choose to emit these instructions at
80   the ends of methods, since otherwise it would likely be the case that
81   additional instructions would be needed to branch around them.
82 </li>
83 <li>When installed on a running system, some instructions may be altered,
84   changing their format, as an install-time static linking optimization.
85   This is to allow for faster execution once linkage is known.
86   See the associated
87   <a href="instruction-formats.html">instruction formats document</a>
88   for the suggested variants. The word "suggested" is used advisedly;
89   it is not mandatory to implement these.
90 </li>
91 <li>Human-syntax and mnemonics:
92   <ul>
93   <li>Dest-then-source ordering for arguments.</li>
94   <li>Some opcodes have a disambiguating name suffix to indicate the type(s)
95     they operate on:
96     <ul>
97     <li>Type-general 32-bit opcodes are unmarked.</li>
98     <li>Type-general 64-bit opcodes are suffixed with <code>-wide</code>.</li>
99     <li>Type-specific opcodes are suffixed with their type (or a
100     straightforward abbreviation), one of: <code>-boolean</code>
101     <code>-byte</code> <code>-char</code> <code>-short</code>
102     <code>-int</code> <code>-long</code> <code>-float</code>
103     <code>-double</code> <code>-object</code> <code>-string</code>
104     <code>-class</code> <code>-void</code>.</li>
105     </ul>
106   </li>
107   <li>Some opcodes have a disambiguating suffix to distinguish
108     otherwise-identical operations that have different instruction layouts
109     or options. These suffixes are separated from the main names with a slash
110     ("<code>/</code>") and mainly exist at all to make there be a one-to-one
111     mapping with static constants in the code that generates and interprets
112     executables (that is, to reduce ambiguity for humans).
113   </li>
114   <li>In the descriptions here, the width of a value (indicating, e.g., the
115     range of a constant or the number of registers possibly addressed) is
116     emphasized by the use of a character per four bits of width.
117   </li>
118   <li>For example, in the instruction
119     "<code>move-wide/from16 vAA, vBBBB</code>":
120     <ul>
121     <li>"<code>move</code>" is the base opcode, indicating the base operation
122     (move a register's value).</li>
123     <li>"<code>wide</code>" is the name suffix, indicating that it operates
124     on wide (64 bit) data.</li>
125     <li>"<code>from16</code>" is the opcode suffix, indicating a variant
126     that has a 16-bit register reference as a source.</li>
127     <li>"<code>vAA</code>" is the destination register (implied by the
128     operation; again, the rule is that destination arguments always come
129     first), which must be in the range <code>v0</code> &ndash;
130     <code>v255</code>.</li>
131     <li>"<code>vBBBB</code>" is the source register, which must be in the
132     range <code>v0</code> &ndash; <code>v65535</code>.</li>
133     </ul>
134   </li>
135   </ul>
136 </li>
137 <li>See the <a href="instruction-formats.html">instruction formats
138   document</a> for more details about the various instruction formats
139   (listed under "Op &amp; Format") as well as details about the opcode
140   syntax.
141 </li>
142 <li>See the <a href="dex-format.html"><code>.dex</code> file format
143   document</a> for more details about where the bytecode fits into
144   the bigger picture.
145 </li>
146 </ul>
147
148 <h2>Summary of Instruction Set</h2>
149
150 <table class="instruc">
151 <thead>
152 <tr>
153   <th>Op &amp; Format</th>
154   <th>Mnemonic / Syntax</th>
155   <th>Arguments</th>
156   <th>Description</th>
157 </tr>
158 </thead>
159 <tbody>
160 <tr>
161   <td>00 10x</td>
162   <td>nop</td>
163   <td>&nbsp;</td>
164   <td>Waste cycles.
165     <p><b>Note:</b>
166     Data-bearing pseudo-instructions are tagged with this opcode, in which
167     case the high-order byte of the opcode unit indicates the nature of
168     the data. See "<code>packed-switch-payload</code> Format",
169     "<code>sparse-switch-payload</code> Format", and
170     "<code>fill-array-data-payload</code> Format" below.</p>
171   </td>
172 </tr>
173 <tr>
174   <td>01 12x</td>
175   <td>move vA, vB</td>
176   <td><code>A:</code> destination register (4 bits)<br/>
177     <code>B:</code> source register (4 bits)</td>
178   <td>Move the contents of one non-object register to another.</td>
179 </tr>
180 <tr>
181   <td>02 22x</td>
182   <td>move/from16 vAA, vBBBB</td>
183   <td><code>A:</code> destination register (8 bits)<br/>
184     <code>B:</code> source register (16 bits)</td>
185   <td>Move the contents of one non-object register to another.</td>
186 </tr>
187 <tr>
188   <td>03 32x</td>
189   <td>move/16 vAAAA, vBBBB</td>
190   <td><code>A:</code> destination register (16 bits)<br/>
191     <code>B:</code> source register (16 bits)</td>
192   <td>Move the contents of one non-object register to another.</td>
193 </tr>
194 <tr>
195   <td>04 12x</td>
196   <td>move-wide vA, vB</td>
197   <td><code>A:</code> destination register pair (4 bits)<br/>
198     <code>B:</code> source register pair (4 bits)</td>
199   <td>Move the contents of one register-pair to another.
200     <p><b>Note:</b>
201     It is legal to move from <code>v<i>N</i></code> to either
202     <code>v<i>N-1</i></code> or <code>v<i>N+1</i></code>, so implementations
203     must arrange for both halves of a register pair to be read before
204     anything is written.</p>
205   </td>
206 </tr>
207 <tr>
208   <td>05 22x</td>
209   <td>move-wide/from16 vAA, vBBBB</td>
210   <td><code>A:</code> destination register pair (8 bits)<br/>
211     <code>B:</code> source register pair (16 bits)</td>
212   <td>Move the contents of one register-pair to another.
213     <p><b>Note:</b>
214     Implementation considerations are the same as <code>move-wide</code>,
215     above.</p>
216   </td>
217 </tr>
218 <tr>
219   <td>06 32x</td>
220   <td>move-wide/16 vAAAA, vBBBB</td>
221   <td><code>A:</code> destination register pair (16 bits)<br/>
222     <code>B:</code> source register pair (16 bits)</td>
223   <td>Move the contents of one register-pair to another.
224     <p><b>Note:</b>
225     Implementation considerations are the same as <code>move-wide</code>,
226     above.</p>
227   </td>
228 </tr>
229 <tr>
230   <td>07 12x</td>
231   <td>move-object vA, vB</td>
232   <td><code>A:</code> destination register (4 bits)<br/>
233     <code>B:</code> source register (4 bits)</td>
234   <td>Move the contents of one object-bearing register to another.</td>
235 </tr>
236 <tr>
237   <td>08 22x</td>
238   <td>move-object/from16 vAA, vBBBB</td>
239   <td><code>A:</code> destination register (8 bits)<br/>
240     <code>B:</code> source register (16 bits)</td>
241   <td>Move the contents of one object-bearing register to another.</td>
242 </tr>
243 <tr>
244   <td>09 32x</td>
245   <td>move-object/16 vAAAA, vBBBB</td>
246   <td><code>A:</code> destination register (16 bits)<br/>
247     <code>B:</code> source register (16 bits)</td>
248   <td>Move the contents of one object-bearing register to another.</td>
249 </tr>
250 <tr>
251   <td>0a 11x</td>
252   <td>move-result vAA</td>
253   <td><code>A:</code> destination register (8 bits)</td>
254   <td>Move the single-word non-object result of the most recent
255     <code>invoke-<i>kind</i></code> into the indicated register.
256     This must be done as the instruction immediately after an
257     <code>invoke-<i>kind</i></code> whose (single-word, non-object) result
258     is not to be ignored; anywhere else is invalid.</td>
259 </tr>
260 <tr>
261   <td>0b 11x</td>
262   <td>move-result-wide vAA</td>
263   <td><code>A:</code> destination register pair (8 bits)</td>
264   <td>Move the double-word result of the most recent
265     <code>invoke-<i>kind</i></code> into the indicated register pair.
266     This must be done as the instruction immediately after an
267     <code>invoke-<i>kind</i></code> whose (double-word) result
268     is not to be ignored; anywhere else is invalid.</td>
269 </tr>
270 <tr>
271   <td>0c 11x</td>
272   <td>move-result-object vAA</td>
273   <td><code>A:</code> destination register (8 bits)</td>
274   <td>Move the object result of the most recent <code>invoke-<i>kind</i></code>
275     into the indicated register. This must be done as the instruction
276     immediately after an <code>invoke-<i>kind</i></code> or
277     <code>filled-new-array</code>
278     whose (object) result is not to be ignored; anywhere else is invalid.</td>
279 </tr>
280 <tr>
281   <td>0d 11x</td>
282   <td>move-exception vAA</td>
283   <td><code>A:</code> destination register (8 bits)</td>
284   <td>Save a just-caught exception into the given register. This must
285     be the first instruction of any exception handler whose caught
286     exception is not to be ignored, and this instruction must <i>only</i>
287     ever occur as the first instruction of an exception handler; anywhere
288     else is invalid.</td>
289 </tr>
290 <tr>
291   <td>0e 10x</td>
292   <td>return-void</td>
293   <td>&nbsp;</td>
294   <td>Return from a <code>void</code> method.</td>
295 </tr>
296 <tr>
297   <td>0f 11x</td>
298   <td>return vAA</td>
299   <td><code>A:</code> return value register (8 bits)</td>
300   <td>Return from a single-width (32-bit) non-object value-returning
301     method.
302   </td>
303 </tr>
304 <tr>
305   <td>10 11x</td>
306   <td>return-wide vAA</td>
307   <td><code>A:</code> return value register-pair (8 bits)</td>
308   <td>Return from a double-width (64-bit) value-returning method.</td>
309 </tr>
310 <tr>
311   <td>11 11x</td>
312   <td>return-object vAA</td>
313   <td><code>A:</code> return value register (8 bits)</td>
314   <td>Return from an object-returning method.</td>
315 </tr>
316 <tr>
317   <td>12 11n</td>
318   <td>const/4 vA, #+B</td>
319   <td><code>A:</code> destination register (4 bits)<br/>
320     <code>B:</code> signed int (4 bits)</td>
321   <td>Move the given literal value (sign-extended to 32 bits) into
322     the specified register.</td>
323 </tr>
324 <tr>
325   <td>13 21s</td>
326   <td>const/16 vAA, #+BBBB</td>
327   <td><code>A:</code> destination register (8 bits)<br/>
328     <code>B:</code> signed int (16 bits)</td>
329   <td>Move the given literal value (sign-extended to 32 bits) into
330     the specified register.</td>
331 </tr>
332 <tr>
333   <td>14 31i</td>
334   <td>const vAA, #+BBBBBBBB</td>
335   <td><code>A:</code> destination register (8 bits)<br/>
336     <code>B:</code> arbitrary 32-bit constant</td>
337   <td>Move the given literal value into the specified register.</td>
338 </tr>
339 <tr>
340   <td>15 21h</td>
341   <td>const/high16 vAA, #+BBBB0000</td>
342   <td><code>A:</code> destination register (8 bits)<br/>
343     <code>B:</code> signed int (16 bits)</td>
344   <td>Move the given literal value (right-zero-extended to 32 bits) into
345     the specified register.</td>
346 </tr>
347 <tr>
348   <td>16 21s</td>
349   <td>const-wide/16 vAA, #+BBBB</td>
350   <td><code>A:</code> destination register (8 bits)<br/>
351     <code>B:</code> signed int (16 bits)</td>
352   <td>Move the given literal value (sign-extended to 64 bits) into
353     the specified register-pair.</td>
354 </tr>
355 <tr>
356   <td>17 31i</td>
357   <td>const-wide/32 vAA, #+BBBBBBBB</td>
358   <td><code>A:</code> destination register (8 bits)<br/>
359     <code>B:</code> signed int (32 bits)</td>
360   <td>Move the given literal value (sign-extended to 64 bits) into
361     the specified register-pair.</td>
362 </tr>
363 <tr>
364   <td>18 51l</td>
365   <td>const-wide vAA, #+BBBBBBBBBBBBBBBB</td>
366   <td><code>A:</code> destination register (8 bits)<br/>
367     <code>B:</code> arbitrary double-width (64-bit) constant</td>
368   <td>Move the given literal value into
369     the specified register-pair.</td>
370 </tr>
371 <tr>
372   <td>19 21h</td>
373   <td>const-wide/high16 vAA, #+BBBB000000000000</td>
374   <td><code>A:</code> destination register (8 bits)<br/>
375     <code>B:</code> signed int (16 bits)</td>
376   <td>Move the given literal value (right-zero-extended to 64 bits) into
377     the specified register-pair.</td>
378 </tr>
379 <tr>
380   <td>1a 21c</td>
381   <td>const-string vAA, string@BBBB</td>
382   <td><code>A:</code> destination register (8 bits)<br/>
383     <code>B:</code> string index</td>
384   <td>Move a reference to the string specified by the given index into the
385     specified register.</td>
386 </tr>
387 <tr>
388   <td>1b 31c</td>
389   <td>const-string/jumbo vAA, string@BBBBBBBB</td>
390   <td><code>A:</code> destination register (8 bits)<br/>
391     <code>B:</code> string index</td>
392   <td>Move a reference to the string specified by the given index into the
393     specified register.</td>
394 </tr>
395 <tr>
396   <td>1c 21c</td>
397   <td>const-class vAA, type@BBBB</td>
398   <td><code>A:</code> destination register (8 bits)<br/>
399     <code>B:</code> type index</td>
400   <td>Move a reference to the class specified by the given index into the
401     specified register. In the case where the indicated type is primitive,
402     this will store a reference to the primitive type's degenerate
403     class.</td>
404 </tr>
405 <tr>
406   <td>1d 11x</td>
407   <td>monitor-enter vAA</td>
408   <td><code>A:</code> reference-bearing register (8 bits)</td>
409   <td>Acquire the monitor for the indicated object.</td>
410 </tr>
411 <tr>
412   <td>1e 11x</td>
413   <td>monitor-exit vAA</td>
414   <td><code>A:</code> reference-bearing register (8 bits)</td>
415   <td>Release the monitor for the indicated object.
416     <p><b>Note:</b>
417     If this instruction needs to throw an exception, it must do
418     so as if the pc has already advanced past the instruction.
419     It may be useful to think of this as the instruction successfully
420     executing (in a sense), and the exception getting thrown <i>after</i>
421     the instruction but <i>before</i> the next one gets a chance to
422     run. This definition makes it possible for a method to use
423     a monitor cleanup catch-all (e.g., <code>finally</code>) block as
424     the monitor cleanup for that block itself, as a way to handle the
425     arbitrary exceptions that might get thrown due to the historical
426     implementation of <code>Thread.stop()</code>, while still managing
427     to have proper monitor hygiene.</p>
428   </td>
429 </tr>
430 <tr>
431   <td>1f 21c</td>
432   <td>check-cast vAA, type@BBBB</td>
433   <td><code>A:</code> reference-bearing register (8 bits)<br/>
434     <code>B:</code> type index (16 bits)</td>
435   <td>Throw a <code>ClassCastException</code> if the reference in the
436     given register cannot be cast to the indicated type.
437     <p><b>Note:</b> Since <code>A</code> must always be a reference
438     (and not a primitive value), this will necessarily fail at runtime
439     (that is, it will throw an exception) if <code>B</code> refers to a
440     primitive type.</p>
441   </td>
442 </tr>
443 <tr>
444   <td>20 22c</td>
445   <td>instance-of vA, vB, type@CCCC</td>
446   <td><code>A:</code> destination register (4 bits)<br/>
447     <code>B:</code> reference-bearing register (4 bits)<br/>
448     <code>C:</code> type index (16 bits)</td>
449   <td>Store in the given destination register <code>1</code>
450     if the indicated reference is an instance of the given type,
451     or <code>0</code> if not.
452     <p><b>Note:</b> Since <code>B</code> must always be a reference
453     (and not a primitive value), this will always result
454     in <code>0</code> being stored if <code>C</code> refers to a primitive
455     type.</td>
456 </tr>
457 <tr>
458   <td>21 12x</td>
459   <td>array-length vA, vB</td>
460   <td><code>A:</code> destination register (4 bits)<br/>
461     <code>B:</code> array reference-bearing register (4 bits)</td>
462   <td>Store in the given destination register the length of the indicated
463     array, in entries</td>
464 </tr>
465 <tr>
466   <td>22 21c</td>
467   <td>new-instance vAA, type@BBBB</td>
468   <td><code>A:</code> destination register (8 bits)<br/>
469     <code>B:</code> type index</td>
470   <td>Construct a new instance of the indicated type, storing a
471     reference to it in the destination. The type must refer to a
472     non-array class.</td>
473 </tr>
474 <tr>
475   <td>23 22c</td>
476   <td>new-array vA, vB, type@CCCC</td>
477   <td><code>A:</code> destination register (8 bits)<br/>
478     <code>B:</code> size register<br/>
479     <code>C:</code> type index</td>
480   <td>Construct a new array of the indicated type and size. The type
481     must be an array type.</td>
482 </tr>
483 <tr>
484   <td>24 35c</td>
485   <td>filled-new-array {vD, vE, vF, vG, vA}, type@CCCC</td>
486   <td><code>B:</code> array size and argument word count (4 bits)<br/>
487     <code>C:</code> type index (16 bits)<br/>
488     <code>D..G, A:</code> argument registers (4 bits each)</td>
489   <td>Construct an array of the given type and size, filling it with the
490     supplied contents. The type must be an array type. The array's
491     contents must be single-word (that is,
492     no arrays of <code>long</code> or <code>double</code>, but reference
493     types are acceptable). The constructed
494     instance is stored as a "result" in the same way that the method invocation
495     instructions store their results, so the constructed instance must
496     be moved to a register with an immediately subsequent
497     <code>move-result-object</code> instruction (if it is to be used).</td>
498 </tr>
499 <tr>
500   <td>25 3rc</td>
501   <td>filled-new-array/range {vCCCC .. vNNNN}, type@BBBB</td>
502   <td><code>A:</code> array size and argument word count (8 bits)<br/>
503     <code>B:</code> type index (16 bits)<br/>
504     <code>C:</code> first argument register (16 bits)<br/>
505     <code>N = A + C - 1</code></td>
506   <td>Construct an array of the given type and size, filling it with
507     the supplied contents. Clarifications and restrictions are the same
508     as <code>filled-new-array</code>, described above.</td>
509 </tr>
510 <tr>
511   <td>26 31t</td>
512   <td>fill-array-data vAA, +BBBBBBBB <i>(with supplemental data as specified
513     below in "<code>fill-array-data-payload</code> Format")</i></td>
514   <td><code>A:</code> array reference (8 bits)<br/>
515     <code>B:</code> signed "branch" offset to table data pseudo-instruction
516     (32 bits)
517   </td>
518   <td>Fill the given array with the indicated data. The reference must be
519     to an array of primitives, and the data table must match it in type and
520     must contain no more elements than will fit in the array. That is,
521     the array may be larger than the table, and if so, only the initial
522     elements of the array are set, leaving the remainder alone.
523   </td>
524 </tr>
525 <tr>
526   <td>27 11x</td>
527   <td>throw vAA</td>
528   <td><code>A:</code> exception-bearing register (8 bits)<br/></td>
529   <td>Throw the indicated exception.</td>
530 </tr>
531 <tr>
532   <td>28 10t</td>
533   <td>goto +AA</td>
534   <td><code>A:</code> signed branch offset (8 bits)</td>
535   <td>Unconditionally jump to the indicated instruction.
536     <p><b>Note:</b>
537     The branch offset must not be <code>0</code>. (A spin
538     loop may be legally constructed either with <code>goto/32</code> or
539     by including a <code>nop</code> as a target before the branch.)</p>
540   </td>
541 </tr>
542 <tr>
543   <td>29 20t</td>
544   <td>goto/16 +AAAA</td>
545   <td><code>A:</code> signed branch offset (16 bits)<br/></td>
546   <td>Unconditionally jump to the indicated instruction.
547     <p><b>Note:</b>
548     The branch offset must not be <code>0</code>. (A spin
549     loop may be legally constructed either with <code>goto/32</code> or
550     by including a <code>nop</code> as a target before the branch.)</p>
551   </td>
552 </tr>
553 <tr>
554   <td>2a 30t</td>
555   <td>goto/32 +AAAAAAAA</td>
556   <td><code>A:</code> signed branch offset (32 bits)<br/></td>
557   <td>Unconditionally jump to the indicated instruction.</td>
558 </tr>
559 <tr>
560   <td>2b 31t</td>
561   <td>packed-switch vAA, +BBBBBBBB <i>(with supplemental data as
562     specified below in "<code>packed-switch-payload</code> Format")</i></td>
563   <td><code>A:</code> register to test<br/>
564     <code>B:</code> signed "branch" offset to table data pseudo-instruction
565     (32 bits)
566   </td>
567   <td>Jump to a new instruction based on the value in the
568     given register, using a table of offsets corresponding to each value
569     in a particular integral range, or fall through to the next
570     instruction if there is no match.
571   </td>
572 </tr>
573 <tr>
574   <td>2c 31t</td>
575   <td>sparse-switch vAA, +BBBBBBBB <i>(with supplemental data as
576     specified below in "<code>sparse-switch-payload</code> Format")</i></td>
577   <td><code>A:</code> register to test<br/>
578     <code>B:</code> signed "branch" offset to table data pseudo-instruction
579     (32 bits)
580   </td>
581   <td>Jump to a new instruction based on the value in the given
582     register, using an ordered table of value-offset pairs, or fall
583     through to the next instruction if there is no match.
584   </td>
585 </tr>
586 <tr>
587   <td>2d..31 23x</td>
588   <td>cmp<i>kind</i> vAA, vBB, vCC<br/>
589     2d: cmpl-float <i>(lt bias)</i><br/>
590     2e: cmpg-float <i>(gt bias)</i><br/>
591     2f: cmpl-double <i>(lt bias)</i><br/>
592     30: cmpg-double <i>(gt bias)</i><br/>
593     31: cmp-long
594   </td>
595   <td><code>A:</code> destination register (8 bits)<br/>
596     <code>B:</code> first source register or pair<br/>
597     <code>C:</code> second source register or pair</td>
598   <td>Perform the indicated floating point or <code>long</code> comparison,
599     storing <code>0</code> if the two arguments are equal, <code>1</code>
600     if the second argument is larger, or <code>-1</code> if the first
601     argument is larger. The "bias" listed for the floating point operations
602     indicates how <code>NaN</code> comparisons are treated: "Gt bias"
603     instructions return <code>1</code> for <code>NaN</code> comparisons,
604     and "lt bias" instructions return
605     <code>-1</code>.
606     <p>For example, to check to see if floating point
607     <code>a &lt; b</code>, then it is advisable to use
608     <code>cmpg-float</code>; a result of <code>-1</code> indicates that
609     the test was true, and the other values indicate it was false either
610     due to a valid comparison or because one or the other values was
611     <code>NaN</code>.</p>
612   </td>
613 </tr>
614 <tr>
615   <td>32..37 22t</td>
616   <td>if-<i>test</i> vA, vB, +CCCC<br/>
617     32: if-eq<br/>
618     33: if-ne<br/>
619     34: if-lt<br/>
620     35: if-ge<br/>
621     36: if-gt<br/>
622     37: if-le<br/>
623   </td>
624   <td><code>A:</code> first register to test (4 bits)<br/>
625     <code>B:</code> second register to test (4 bits)<br/>
626     <code>C:</code> signed branch offset (16 bits)</td>
627   <td>Branch to the given destination if the given two registers' values
628     compare as specified.
629     <p><b>Note:</b>
630     The branch offset must not be <code>0</code>. (A spin
631     loop may be legally constructed either by branching around a
632     backward <code>goto</code> or by including a <code>nop</code> as
633     a target before the branch.)</p>
634   </td>
635 </tr>
636 <tr>
637   <td>38..3d 21t</td>
638   <td>if-<i>test</i>z vAA, +BBBB<br/>
639     38: if-eqz<br/>
640     39: if-nez<br/>
641     3a: if-ltz<br/>
642     3b: if-gez<br/>
643     3c: if-gtz<br/>
644     3d: if-lez<br/>
645   </td>
646   <td><code>A:</code> register to test (8 bits)<br/>
647     <code>B:</code> signed branch offset (16 bits)</td>
648   <td>Branch to the given destination if the given register's value compares
649     with 0 as specified.
650     <p><b>Note:</b>
651     The branch offset must not be <code>0</code>. (A spin
652     loop may be legally constructed either by branching around a
653     backward <code>goto</code> or by including a <code>nop</code> as
654     a target before the branch.)</p>
655   </td>
656 </tr>
657 <tr>
658   <td>3e..43 10x</td>
659   <td><i>(unused)</i></td>
660   <td>&nbsp;</td>
661   <td><i>(unused)</i></td>
662 </tr>
663 <tr>
664   <td>44..51 23x</td>
665   <td><i>arrayop</i> vAA, vBB, vCC<br/>
666     44: aget<br/>
667     45: aget-wide<br/>
668     46: aget-object<br/>
669     47: aget-boolean<br/>
670     48: aget-byte<br/>
671     49: aget-char<br/>
672     4a: aget-short<br/>
673     4b: aput<br/>
674     4c: aput-wide<br/>
675     4d: aput-object<br/>
676     4e: aput-boolean<br/>
677     4f: aput-byte<br/>
678     50: aput-char<br/>
679     51: aput-short
680   </td>
681   <td><code>A:</code> value register or pair; may be source or dest
682       (8 bits)<br/>
683     <code>B:</code> array register (8 bits)<br/>
684     <code>C:</code> index register (8 bits)</td>
685   <td>Perform the identified array operation at the identified index of
686     the given array, loading or storing into the value register.</td>
687 </tr>
688 <tr>
689   <td>52..5f 22c</td>
690   <td>i<i>instanceop</i> vA, vB, field@CCCC<br/>
691     52: iget<br/>
692     53: iget-wide<br/>
693     54: iget-object<br/>
694     55: iget-boolean<br/>
695     56: iget-byte<br/>
696     57: iget-char<br/>
697     58: iget-short<br/>
698     59: iput<br/>
699     5a: iput-wide<br/>
700     5b: iput-object<br/>
701     5c: iput-boolean<br/>
702     5d: iput-byte<br/>
703     5e: iput-char<br/>
704     5f: iput-short
705   </td>
706   <td><code>A:</code> value register or pair; may be source or dest
707       (4 bits)<br/>
708     <code>B:</code> object register (4 bits)<br/>
709     <code>C:</code> instance field reference index (16 bits)</td>
710   <td>Perform the identified object instance field operation with
711     the identified field, loading or storing into the value register.
712     <p><b>Note:</b> These opcodes are reasonable candidates for static linking,
713     altering the field argument to be a more direct offset.</p>
714   </td>
715 </tr>
716 <tr>
717   <td>60..6d 21c</td>
718   <td>s<i>staticop</i> vAA, field@BBBB<br/>
719     60: sget<br/>
720     61: sget-wide<br/>
721     62: sget-object<br/>
722     63: sget-boolean<br/>
723     64: sget-byte<br/>
724     65: sget-char<br/>
725     66: sget-short<br/>
726     67: sput<br/>
727     68: sput-wide<br/>
728     69: sput-object<br/>
729     6a: sput-boolean<br/>
730     6b: sput-byte<br/>
731     6c: sput-char<br/>
732     6d: sput-short
733   </td>
734   <td><code>A:</code> value register or pair; may be source or dest
735       (8 bits)<br/>
736     <code>B:</code> static field reference index (16 bits)</td>
737   <td>Perform the identified object static field operation with the identified
738     static field, loading or storing into the value register.
739     <p><b>Note:</b> These opcodes are reasonable candidates for static linking,
740     altering the field argument to be a more direct offset.</p>
741   </td>
742 </tr>
743 <tr>
744   <td>6e..72 35c</td>
745   <td>invoke-<i>kind</i> {vD, vE, vF, vG, vA}, meth@CCCC<br/>
746     6e: invoke-virtual<br/>
747     6f: invoke-super<br/>
748     70: invoke-direct<br/>
749     71: invoke-static<br/>
750     72: invoke-interface
751   </td>
752   <td><code>B:</code> argument word count (4 bits)<br/>
753     <code>C:</code> method reference index (16 bits)<br/>
754     <code>D..G, A:</code> argument registers (4 bits each)</td>
755   <td>Call the indicated method. The result (if any) may be stored
756     with an appropriate <code>move-result*</code> variant as the immediately
757     subsequent instruction.
758     <p><code>invoke-virtual</code> is used to invoke a normal virtual
759     method (a method that is not <code>private</code>, <code>static</code>,
760     or <code>final</code>, and is also not a constructor).</p>
761     <p><code>invoke-super</code> is used to invoke the closest superclass's
762     virtual method (as opposed to the one with the same <code>method_id</code>
763     in the calling class). The same method restrictions hold as for
764     <code>invoke-virtual</code>.</p>
765     <p><code>invoke-direct</code> is used to invoke a non-<code>static</code>
766     direct method (that is, an instance method that is by its nature
767     non-overridable, namely either a <code>private</code> instance method
768     or a constructor).</p>
769     <p><code>invoke-static</code> is used to invoke a <code>static</code>
770     method (which is always considered a direct method).</p>
771     <p><code>invoke-interface</code> is used to invoke an
772     <code>interface</code> method, that is, on an object whose concrete
773     class isn't known, using a <code>method_id</code> that refers to
774     an <code>interface</code>.</p>
775     <p><b>Note:</b> These opcodes are reasonable candidates for static linking,
776     altering the method argument to be a more direct offset
777     (or pair thereof).</p>
778   </td>
779 </tr>
780 <tr>
781   <td>73 10x</td>
782   <td><i>(unused)</i></td>
783   <td>&nbsp;</td>
784   <td><i>(unused)</i></td>
785 </tr>
786 <tr>
787   <td>74..78 3rc</td>
788   <td>invoke-<i>kind</i>/range {vCCCC .. vNNNN}, meth@BBBB<br/>
789     74: invoke-virtual/range<br/>
790     75: invoke-super/range<br/>
791     76: invoke-direct/range<br/>
792     77: invoke-static/range<br/>
793     78: invoke-interface/range
794   </td>
795   <td><code>A:</code> argument word count (8 bits)<br/>
796     <code>B:</code> method reference index (16 bits)<br/>
797     <code>C:</code> first argument register (16 bits)<br/>
798     <code>N = A + C - 1</code></td>
799   <td>Call the indicated method. See first <code>invoke-<i>kind</i></code>
800     description above for details, caveats, and suggestions.
801   </td>
802 </tr>
803 <tr>
804   <td>79..7a 10x</td>
805   <td><i>(unused)</i></td>
806   <td>&nbsp;</td>
807   <td><i>(unused)</i></td>
808 </tr>
809 <tr>
810   <td>7b..8f 12x</td>
811   <td><i>unop</i> vA, vB<br/>
812     7b: neg-int<br/>
813     7c: not-int<br/>
814     7d: neg-long<br/>
815     7e: not-long<br/>
816     7f: neg-float<br/>
817     80: neg-double<br/>
818     81: int-to-long<br/>
819     82: int-to-float<br/>
820     83: int-to-double<br/>
821     84: long-to-int<br/>
822     85: long-to-float<br/>
823     86: long-to-double<br/>
824     87: float-to-int<br/>
825     88: float-to-long<br/>
826     89: float-to-double<br/>
827     8a: double-to-int<br/>
828     8b: double-to-long<br/>
829     8c: double-to-float<br/>
830     8d: int-to-byte<br/>
831     8e: int-to-char<br/>
832     8f: int-to-short
833   </td>
834   <td><code>A:</code> destination register or pair (4 bits)<br/>
835     <code>B:</code> source register or pair (4 bits)</td>
836   <td>Perform the identified unary operation on the source register,
837     storing the result in the destination register.</td>
838 </tr>
839
840 <tr>
841   <td>90..af 23x</td>
842   <td><i>binop</i> vAA, vBB, vCC<br/>
843     90: add-int<br/>
844     91: sub-int<br/>
845     92: mul-int<br/>
846     93: div-int<br/>
847     94: rem-int<br/>
848     95: and-int<br/>
849     96: or-int<br/>
850     97: xor-int<br/>
851     98: shl-int<br/>
852     99: shr-int<br/>
853     9a: ushr-int<br/>
854     9b: add-long<br/>
855     9c: sub-long<br/>
856     9d: mul-long<br/>
857     9e: div-long<br/>
858     9f: rem-long<br/>
859     a0: and-long<br/>
860     a1: or-long<br/>
861     a2: xor-long<br/>
862     a3: shl-long<br/>
863     a4: shr-long<br/>
864     a5: ushr-long<br/>
865     a6: add-float<br/>
866     a7: sub-float<br/>
867     a8: mul-float<br/>
868     a9: div-float<br/>
869     aa: rem-float<br/>
870     ab: add-double<br/>
871     ac: sub-double<br/>
872     ad: mul-double<br/>
873     ae: div-double<br/>
874     af: rem-double
875   </td>
876   <td><code>A:</code> destination register or pair (8 bits)<br/>
877     <code>B:</code> first source register or pair (8 bits)<br/>
878     <code>C:</code> second source register or pair (8 bits)</td>
879   <td>Perform the identified binary operation on the two source registers,
880     storing the result in the first source register.</td>
881 </tr>
882 <tr>
883   <td>b0..cf 12x</td>
884   <td><i>binop</i>/2addr vA, vB<br/>
885     b0: add-int/2addr<br/>
886     b1: sub-int/2addr<br/>
887     b2: mul-int/2addr<br/>
888     b3: div-int/2addr<br/>
889     b4: rem-int/2addr<br/>
890     b5: and-int/2addr<br/>
891     b6: or-int/2addr<br/>
892     b7: xor-int/2addr<br/>
893     b8: shl-int/2addr<br/>
894     b9: shr-int/2addr<br/>
895     ba: ushr-int/2addr<br/>
896     bb: add-long/2addr<br/>
897     bc: sub-long/2addr<br/>
898     bd: mul-long/2addr<br/>
899     be: div-long/2addr<br/>
900     bf: rem-long/2addr<br/>
901     c0: and-long/2addr<br/>
902     c1: or-long/2addr<br/>
903     c2: xor-long/2addr<br/>
904     c3: shl-long/2addr<br/>
905     c4: shr-long/2addr<br/>
906     c5: ushr-long/2addr<br/>
907     c6: add-float/2addr<br/>
908     c7: sub-float/2addr<br/>
909     c8: mul-float/2addr<br/>
910     c9: div-float/2addr<br/>
911     ca: rem-float/2addr<br/>
912     cb: add-double/2addr<br/>
913     cc: sub-double/2addr<br/>
914     cd: mul-double/2addr<br/>
915     ce: div-double/2addr<br/>
916     cf: rem-double/2addr
917   </td>
918   <td><code>A:</code> destination and first source register or pair
919       (4 bits)<br/>
920     <code>B:</code> second source register or pair (4 bits)</td>
921   <td>Perform the identified binary operation on the two source registers,
922     storing the result in the first source register.</td>
923 </tr>
924 <tr>
925   <td>d0..d7 22s</td>
926   <td><i>binop</i>/lit16 vA, vB, #+CCCC<br/>
927     d0: add-int/lit16<br/>
928     d1: rsub-int (reverse subtract)<br/>
929     d2: mul-int/lit16<br/>
930     d3: div-int/lit16<br/>
931     d4: rem-int/lit16<br/>
932     d5: and-int/lit16<br/>
933     d6: or-int/lit16<br/>
934     d7: xor-int/lit16
935   </td>
936   <td><code>A:</code> destination register (4 bits)<br/>
937     <code>B:</code> source register (4 bits)<br/>
938     <code>C:</code> signed int constant (16 bits)</td>
939   <td>Perform the indicated binary op on the indicated register (first
940     argument) and literal value (second argument), storing the result in
941     the destination register.
942     <p><b>Note:</b>
943     <code>rsub-int</code> does not have a suffix since this version is the
944     main opcode of its family. Also, see below for details on its semantics.
945     </p>
946   </td>
947 </tr>
948 <tr>
949   <td>d8..e2 22b</td>
950   <td><i>binop</i>/lit8 vAA, vBB, #+CC<br/>
951     d8: add-int/lit8<br/>
952     d9: rsub-int/lit8<br/>
953     da: mul-int/lit8<br/>
954     db: div-int/lit8<br/>
955     dc: rem-int/lit8<br/>
956     dd: and-int/lit8<br/>
957     de: or-int/lit8<br/>
958     df: xor-int/lit8<br/>
959     e0: shl-int/lit8<br/>
960     e1: shr-int/lit8<br/>
961     e2: ushr-int/lit8
962   </td>
963   <td><code>A:</code> destination register (8 bits)<br/>
964     <code>B:</code> source register (8 bits)<br/>
965     <code>C:</code> signed int constant (8 bits)</td>
966   <td>Perform the indicated binary op on the indicated register (first
967     argument) and literal value (second argument), storing the result
968     in the destination register.
969     <p><b>Note:</b> See below for details on the semantics of
970     <code>rsub-int</code>.</p>
971   </td>
972 </tr>
973 <tr>
974   <td>e3..fe 10x</td>
975   <td><i>(unused)</i></td>
976   <td>&nbsp;</td>
977   <td><i>(unused)</i></td>
978 </tr>
979 <tr>
980   <td>ff -</td>
981   <td><i>(expanded opcode)</i></td>
982   <td>&nbsp;</td>
983   <td>An <code>ff</code> in the primary opcode position indicates that there
984     is a secondary opcode in the high-order byte of the opcode code unit,
985     as opposed to an argument value. These expanded opcodes are detailed
986     immediately below.
987   </td>
988 </tr>
989 <tr>
990   <td>00ff 41c</td>
991   <td>const-class/jumbo vBBBB, type@AAAAAAAA</td>
992   <td><code>A:</code> type index (32 bits)<br/>
993     <code>B:</code> destination register (16 bits)</td>
994   <td>Move a reference to the class specified by the given index into the
995     specified register. See <code>const-class</code> description above
996     for details, caveats, and suggestions.
997   </td>
998 </tr>
999 <tr>
1000   <td>01ff 41c</td>
1001   <td>check-cast/jumbo vBBBB, type@AAAAAAAA</td>
1002   <td><code>A:</code> type index (32 bits)<br/>
1003     <code>B:</code> reference-bearing register (16 bits)
1004   </td>
1005   <td>Throw a <code>ClassCastException</code> if the reference in the
1006     given register cannot be cast to the indicated type. See
1007     <code>check-cast</code> description above for details,
1008     caveats, and suggestions.
1009   </td>
1010 </tr>
1011 <tr>
1012   <td>02ff 52c</td>
1013   <td>instance-of/jumbo  vBBBB, vCCCC, type@AAAAAAAA</td>
1014   <td><code>A:</code> type index (32 bits)<br/>
1015     <code>B:</code> destination register (16 bits)<br/>
1016     <code>C:</code> reference-bearing register (16 bits)
1017   </td>
1018   <td>Store in the given destination register <code>1</code>
1019     if the indicated reference is an instance of the given type,
1020     or <code>0</code> if not. See
1021     <code>instance-of</code> description above for details,
1022     caveats, and suggestions.
1023   </td>
1024 </tr>
1025 <tr>
1026   <td>03ff 41c</td>
1027   <td>new-instance/jumbo vBBBB, type@AAAAAAAA</td>
1028   <td><code>A:</code> type index (32 bits)<br/>
1029     <code>B:</code> destination register (16 bits)
1030   </td>
1031   <td>Construct a new instance of the indicated type. See
1032     <code>new-instance</code> description above for details,
1033     caveats, and suggestions.
1034   </td>
1035 </tr>
1036 <tr>
1037   <td>04ff 52c</td>
1038   <td>new-array/jumbo vBBBB, vCCCC, type@AAAAAAAA</td>
1039   <td><code>A:</code> type index (32 bits)<br/>
1040     <code>B:</code> destination register (16 bits)<br/>
1041     <code>C:</code> size register (16 bits)
1042   </td>
1043   <td>Construct a new array of the indicated type and size. See
1044     <code>new-array</code> description above for details,
1045     caveats, and suggestions.
1046   </td>
1047 </tr>
1048 <tr>
1049   <td>05ff 5rc</td>
1050   <td>filled-new-array/jumbo {vCCCC .. vNNNN}, type@AAAAAAAA</td>
1051   <td><code>A:</code> type index (32 bits)<br/>
1052     <code>B:</code> array size and argument word count (16 bits)<br/>
1053     <code>C:</code> first argument register (16 bits)<br/>
1054     <code>N = B + C - 1</code>
1055   </td>
1056   <td>Construct an array of the given type and size, filling it with the
1057     supplied contents. See first
1058     <code>filled-new-array</code> description above for details,
1059     caveats, and suggestions.
1060   </td>
1061 </tr>
1062 <tr>
1063   <td>06ff..13ff 52c</td>
1064   <td>i<i>instanceop</i>/jumbo vBBBB, vCCCC, field@AAAAAAAA<br/>
1065     06ff: iget/jumbo<br/>
1066     07ff: iget-wide/jumbo<br/>
1067     08ff: iget-object/jumbo<br/>
1068     09ff: iget-boolean/jumbo<br/>
1069     0aff: iget-byte/jumbo<br/>
1070     0bff: iget-char/jumbo<br/>
1071     0cff: iget-short/jumbo<br/>
1072     0dff: iput/jumbo<br/>
1073     0eff: iput-wide/jumbo<br/>
1074     0fff: iput-object/jumbo<br/>
1075     10ff: iput-boolean/jumbo<br/>
1076     11ff: iput-byte/jumbo<br/>
1077     12ff: iput-char/jumbo<br/>
1078     13ff: iput-short/jumbo
1079   </td>
1080   <td><code>A:</code> instance field reference index (32 bits)<br/>
1081     <code>B:</code> value register or pair; may be source or dest
1082       (16 bits)<br/>
1083     <code>C:</code> object register (16 bits)
1084   </td>
1085   <td>Perform the identified object instance field operation. See
1086     <code>i<i>instanceop</i></code> description above for details,
1087     caveats, and suggestions.
1088   </td>
1089 </tr>
1090 <tr>
1091   <td>14ff..21ff 41c</td>
1092   <td>s<i>staticop</i>/jumbo vBBBB, field@AAAAAAAA<br/>
1093     14ff: sget/jumbo<br/>
1094     15ff: sget-wide/jumbo<br/>
1095     16ff: sget-object/jumbo<br/>
1096     17ff: sget-boolean/jumbo<br/>
1097     18ff: sget-byte/jumbo<br/>
1098     19ff: sget-char/jumbo<br/>
1099     1aff: sget-short/jumbo<br/>
1100     1bff: sput/jumbo<br/>
1101     1cff: sput-wide/jumbo<br/>
1102     1dff: sput-object/jumbo<br/>
1103     1eff: sput-boolean/jumbo<br/>
1104     1fff: sput-byte/jumbo<br/>
1105     20ff: sput-char/jumbo<br/>
1106     21ff: sput-short/jumbo
1107   </td>
1108   <td><code>A:</code> instance field reference index (32 bits)<br/>
1109     <code>B:</code> value register or pair; may be source or dest
1110       (16 bits)
1111   </td>
1112   <td>Perform the identified object static field operation. See
1113     <code>s<i>staticop</i></code> description above for details,
1114     caveats, and suggestions.
1115   </td>
1116 </tr>
1117 <tr>
1118   <td>22ff..26ff 5rc</td>
1119   <td>invoke-<i>kind</i>/jumbo {vCCCC .. vNNNN}, meth@AAAAAAAA<br/>
1120     22ff: invoke-virtual/jumbo<br/>
1121     23ff: invoke-super/jumbo<br/>
1122     24ff: invoke-direct/jumbo<br/>
1123     25ff: invoke-static/jumbo<br/>
1124     26ff: invoke-interface/jumbo
1125   </td>
1126   <td><code>A:</code> method reference index (32 bits)<br/>
1127     <code>B:</code> argument word count (16 bits)<br/>
1128     <code>C:</code> first argument register (16 bits)<br/>
1129     <code>N = B + C - 1</code>
1130   </td>
1131   <td>Call the indicated method. See first <code>invoke-<i>kind</i></code>
1132     description above for details, caveats, and suggestions.
1133   </td>
1134 </tr>
1135 </tbody>
1136 </table>
1137
1138 <h2><code>packed-switch-payload</code> Format</h2>
1139
1140 <table class="supplement">
1141 <thead>
1142 <tr>
1143   <th>Name</th>
1144   <th>Format</th>
1145   <th>Description</th>
1146 </tr>
1147 </thead>
1148 <tbody>
1149 <tr>
1150   <td>ident</td>
1151   <td>ushort = 0x0100</td>
1152   <td>identifying pseudo-opcode</td>
1153 </tr>
1154 <tr>
1155   <td>size</td>
1156   <td>ushort</td>
1157   <td>number of entries in the table</td>
1158 </tr>
1159 <tr>
1160   <td>first_key</td>
1161   <td>int</td>
1162   <td>first (and lowest) switch case value</td>
1163 </tr>
1164 <tr>
1165   <td>targets</td>
1166   <td>int[]</td>
1167   <td>list of <code>size</code> relative branch targets. The targets are
1168     relative to the address of the switch opcode, not of this table.
1169   </td>
1170 </tr>
1171 </tbody>
1172 </table>
1173
1174 <p><b>Note:</b> The total number of code units for an instance of this
1175 table is <code>(size * 2) + 4</code>.</p>
1176
1177 <h2><code>sparse-switch-payload</code> Format</h2>
1178
1179 <table class="supplement">
1180 <thead>
1181 <tr>
1182   <th>Name</th>
1183   <th>Format</th>
1184   <th>Description</th>
1185 </tr>
1186 </thead>
1187 <tbody>
1188 <tr>
1189   <td>ident</td>
1190   <td>ushort = 0x0200</td>
1191   <td>identifying pseudo-opcode</td>
1192 </tr>
1193 <tr>
1194   <td>size</td>
1195   <td>ushort</td>
1196   <td>number of entries in the table</td>
1197 </tr>
1198 <tr>
1199   <td>keys</td>
1200   <td>int[]</td>
1201   <td>list of <code>size</code> key values, sorted low-to-high</td>
1202 </tr>
1203 <tr>
1204   <td>targets</td>
1205   <td>int[]</td>
1206   <td>list of <code>size</code> relative branch targets, each corresponding
1207     to the key value at the same index. The targets are
1208     relative to the address of the switch opcode, not of this table.
1209   </td>
1210 </tr>
1211 </tbody>
1212 </table>
1213
1214 <p><b>Note:</b> The total number of code units for an instance of this
1215 table is <code>(size * 4) + 2</code>.</p>
1216
1217 <h2><code>fill-array-data-payload</code> Format</h2>
1218
1219 <table class="supplement">
1220 <thead>
1221 <tr>
1222   <th>Name</th>
1223   <th>Format</th>
1224   <th>Description</th>
1225 </tr>
1226 </thead>
1227 <tbody>
1228 <tr>
1229   <td>ident</td>
1230   <td>ushort = 0x0300</td>
1231   <td>identifying pseudo-opcode</td>
1232 </tr>
1233 <tr>
1234   <td>element_width</td>
1235   <td>ushort</td>
1236   <td>number of bytes in each element</td>
1237 </tr>
1238 <tr>
1239   <td>size</td>
1240   <td>uint</td>
1241   <td>number of elements in the table</td>
1242 </tr>
1243 <tr>
1244   <td>data</td>
1245   <td>ubyte[]</td>
1246   <td>data values</td>
1247 </tr>
1248 </tbody>
1249 </table>
1250
1251 <p><b>Note:</b> The total number of code units for an instance of this
1252 table is <code>(size * element_width + 1) / 2 + 4</code>.</p>
1253
1254
1255 <h2>Mathematical Operation Details</h2>
1256
1257 <p><b>Note:</b> Floating point operations must follow IEEE 754 rules, using
1258 round-to-nearest and gradual underflow, except where stated otherwise.</p>
1259
1260 <table class="math">
1261 <thead>
1262 <tr>
1263   <th>Opcode</th>
1264   <th>C Semantics</th>
1265   <th>Notes</th>
1266 </tr>
1267 </thead>
1268 <tbody>
1269 <tr>
1270   <td>neg-int</td>
1271   <td>int32 a;<br/>
1272     int32 result = -a;
1273   </td>
1274   <td>Unary twos-complement.</td>
1275 </tr>
1276 <tr>
1277   <td>not-int</td>
1278   <td>int32 a;<br/>
1279     int32 result = ~a;
1280   </td>
1281   <td>Unary ones-complement.</td>
1282 </tr>
1283 <tr>
1284   <td>neg-long</td>
1285   <td>int64 a;<br/>
1286     int64 result = -a;
1287   </td>
1288   <td>Unary twos-complement.</td>
1289 </tr>
1290 <tr>
1291   <td>not-long</td>
1292   <td>int64 a;<br/>
1293     int64 result = ~a;
1294   </td>
1295   <td>Unary ones-complement.</td>
1296 </tr>
1297 <tr>
1298   <td>neg-float</td>
1299   <td>float a;<br/>
1300     float result = -a;
1301   </td>
1302   <td>Floating point negation.</td>
1303 </tr>
1304 <tr>
1305   <td>neg-double</td>
1306   <td>double a;<br/>
1307     double result = -a;
1308   </td>
1309   <td>Floating point negation.</td>
1310 </tr>
1311 <tr>
1312   <td>int-to-long</td>
1313   <td>int32 a;<br/>
1314     int64 result = (int64) a;
1315   </td>
1316   <td>Sign extension of <code>int32</code> into <code>int64</code>.</td>
1317 </tr>
1318 <tr>
1319   <td>int-to-float</td>
1320   <td>int32 a;<br/>
1321     float result = (float) a;
1322   </td>
1323   <td>Conversion of <code>int32</code> to <code>float</code>, using
1324     round-to-nearest. This loses precision for some values.
1325   </td>
1326 </tr>
1327 <tr>
1328   <td>int-to-double</td>
1329   <td>int32 a;<br/>
1330     double result = (double) a;
1331   </td>
1332   <td>Conversion of <code>int32</code> to <code>double</code>.</td>
1333 </tr>
1334 <tr>
1335   <td>long-to-int</td>
1336   <td>int64 a;<br/>
1337     int32 result = (int32) a;
1338   </td>
1339   <td>Truncation of <code>int64</code> into <code>int32</code>.</td>
1340 </tr>
1341 <tr>
1342   <td>long-to-float</td>
1343   <td>int64 a;<br/>
1344     float result = (float) a;
1345   </td>
1346   <td>Conversion of <code>int64</code> to <code>float</code>, using
1347     round-to-nearest. This loses precision for some values.
1348   </td>
1349 </tr>
1350 <tr>
1351   <td>long-to-double</td>
1352   <td>int64 a;<br/>
1353     double result = (double) a;
1354   </td>
1355   <td>Conversion of <code>int64</code> to <code>double</code>, using
1356     round-to-nearest. This loses precision for some values.
1357   </td>
1358 </tr>
1359 <tr>
1360   <td>float-to-int</td>
1361   <td>float a;<br/>
1362     int32 result = (int32) a;
1363   </td>
1364   <td>Conversion of <code>float</code> to <code>int32</code>, using
1365     round-toward-zero. <code>NaN</code> and <code>-0.0</code> (negative zero)
1366     convert to the integer <code>0</code>. Infinities and values with
1367     too large a magnitude to be represented get converted to either
1368     <code>0x7fffffff</code> or <code>-0x80000000</code> depending on sign.
1369   </td>
1370 </tr>
1371 <tr>
1372   <td>float-to-long</td>
1373   <td>float a;<br/>
1374     int64 result = (int64) a;
1375   </td>
1376   <td>Conversion of <code>float</code> to <code>int64</code>, using
1377     round-toward-zero. The same special case rules as for
1378     <code>float-to-int</code> apply here, except that out-of-range values
1379     get converted to either <code>0x7fffffffffffffff</code> or
1380     <code>-0x8000000000000000</code> depending on sign.
1381   </td>
1382 </tr>
1383 <tr>
1384   <td>float-to-double</td>
1385   <td>float a;<br/>
1386     double result = (double) a;
1387   </td>
1388   <td>Conversion of <code>float</code> to <code>double</code>, preserving
1389     the value exactly.
1390   </td>
1391 </tr>
1392 <tr>
1393   <td>double-to-int</td>
1394   <td>double a;<br/>
1395     int32 result = (int32) a;
1396   </td>
1397   <td>Conversion of <code>double</code> to <code>int32</code>, using
1398     round-toward-zero. The same special case rules as for
1399     <code>float-to-int</code> apply here.
1400   </td>
1401 </tr>
1402 <tr>
1403   <td>double-to-long</td>
1404   <td>double a;<br/>
1405     int64 result = (int64) a;
1406   </td>
1407   <td>Conversion of <code>double</code> to <code>int64</code>, using
1408     round-toward-zero. The same special case rules as for
1409     <code>float-to-long</code> apply here.
1410   </td>
1411 </tr>
1412 <tr>
1413   <td>double-to-float</td>
1414   <td>double a;<br/>
1415     float result = (float) a;
1416   </td>
1417   <td>Conversion of <code>double</code> to <code>float</code>, using
1418     round-to-nearest. This loses precision for some values.
1419   </td>
1420 </tr>
1421 <tr>
1422   <td>int-to-byte</td>
1423   <td>int32 a;<br/>
1424     int32 result = (a &lt;&lt; 24) &gt;&gt; 24;
1425   </td>
1426   <td>Truncation of <code>int32</code> to <code>int8</code>, sign
1427     extending the result.
1428   </td>
1429 </tr>
1430 <tr>
1431   <td>int-to-char</td>
1432   <td>int32 a;<br/>
1433     int32 result = a &amp; 0xffff;
1434   </td>
1435   <td>Truncation of <code>int32</code> to <code>uint16</code>, without
1436     sign extension.
1437   </td>
1438 </tr>
1439 <tr>
1440   <td>int-to-short</td>
1441   <td>int32 a;<br/>
1442     int32 result = (a &lt;&lt; 16) &gt;&gt; 16;
1443   </td>
1444   <td>Truncation of <code>int32</code> to <code>int16</code>, sign
1445     extending the result.
1446   </td>
1447 </tr>
1448 <tr>
1449   <td>add-int</td>
1450   <td>int32 a, b;<br/>
1451     int32 result = a + b;
1452   </td>
1453   <td>Twos-complement addition.</td>
1454 </tr>
1455 <tr>
1456   <td>sub-int</td>
1457   <td>int32 a, b;<br/>
1458     int32 result = a - b;
1459   </td>
1460   <td>Twos-complement subtraction.</td>
1461 </tr>
1462 <tr>
1463   <td>rsub-int</td>
1464   <td>int32 a, b;<br/>
1465     int32 result = b - a;
1466   </td>
1467   <td>Twos-complement reverse subtraction.</td>
1468 </tr>
1469 <tr>
1470   <td>mul-int</td>
1471   <td>int32 a, b;<br/>
1472     int32 result = a * b;
1473   </td>
1474   <td>Twos-complement multiplication.</td>
1475 </tr>
1476 <tr>
1477   <td>div-int</td>
1478   <td>int32 a, b;<br/>
1479     int32 result = a / b;
1480   </td>
1481   <td>Twos-complement division, rounded towards zero (that is, truncated to
1482     integer). This throws <code>ArithmeticException</code> if
1483     <code>b == 0</code>.
1484   </td>
1485 </tr>
1486 <tr>
1487   <td>rem-int</td>
1488   <td>int32 a, b;<br/>
1489     int32 result = a % b;
1490   </td>
1491   <td>Twos-complement remainder after division. The sign of the result
1492     is the same as that of <code>a</code>, and it is more precisely
1493     defined as <code>result == a - (a / b) * b</code>. This throws
1494     <code>ArithmeticException</code> if <code>b == 0</code>.
1495   </td>
1496 </tr>
1497 <tr>
1498   <td>and-int</td>
1499   <td>int32 a, b;<br/>
1500     int32 result = a &amp; b;
1501   </td>
1502   <td>Bitwise AND.</td>
1503 </tr>
1504 <tr>
1505   <td>or-int</td>
1506   <td>int32 a, b;<br/>
1507     int32 result = a | b;
1508   </td>
1509   <td>Bitwise OR.</td>
1510 </tr>
1511 <tr>
1512   <td>xor-int</td>
1513   <td>int32 a, b;<br/>
1514     int32 result = a ^ b;
1515   </td>
1516   <td>Bitwise XOR.</td>
1517 </tr>
1518 <tr>
1519   <td>shl-int</td>
1520   <td>int32 a, b;<br/>
1521     int32 result = a &lt;&lt; (b &amp; 0x1f);
1522   </td>
1523   <td>Bitwise shift left (with masked argument).</td>
1524 </tr>
1525 <tr>
1526   <td>shr-int</td>
1527   <td>int32 a, b;<br/>
1528     int32 result = a &gt;&gt; (b &amp; 0x1f);
1529   </td>
1530   <td>Bitwise signed shift right (with masked argument).</td>
1531 </tr>
1532 <tr>
1533   <td>ushr-int</td>
1534   <td>uint32 a, b;<br/>
1535     int32 result = a &gt;&gt; (b &amp; 0x1f);
1536   </td>
1537   <td>Bitwise unsigned shift right (with masked argument).</td>
1538 </tr>
1539 <tr>
1540   <td>add-long</td>
1541   <td>int64 a, b;<br/>
1542     int64 result = a + b;
1543   </td>
1544   <td>Twos-complement addition.</td>
1545 </tr>
1546 <tr>
1547   <td>sub-long</td>
1548   <td>int64 a, b;<br/>
1549     int64 result = a - b;
1550   </td>
1551   <td>Twos-complement subtraction.</td>
1552 </tr>
1553 <tr>
1554   <td>mul-long</td>
1555   <td>int64 a, b;<br/>
1556     int64 result = a * b;
1557   </td>
1558   <td>Twos-complement multiplication.</td>
1559 </tr>
1560 <tr>
1561   <td>div-long</td>
1562   <td>int64 a, b;<br/>
1563     int64 result = a / b;
1564   </td>
1565   <td>Twos-complement division, rounded towards zero (that is, truncated to
1566     integer). This throws <code>ArithmeticException</code> if
1567     <code>b == 0</code>.
1568   </td>
1569 </tr>
1570 <tr>
1571   <td>rem-long</td>
1572   <td>int64 a, b;<br/>
1573     int64 result = a % b;
1574   </td>
1575   <td>Twos-complement remainder after division. The sign of the result
1576     is the same as that of <code>a</code>, and it is more precisely
1577     defined as <code>result == a - (a / b) * b</code>. This throws
1578     <code>ArithmeticException</code> if <code>b == 0</code>.
1579   </td>
1580 </tr>
1581 <tr>
1582   <td>and-long</td>
1583   <td>int64 a, b;<br/>
1584     int64 result = a &amp; b;
1585   </td>
1586   <td>Bitwise AND.</td>
1587 </tr>
1588 <tr>
1589   <td>or-long</td>
1590   <td>int64 a, b;<br/>
1591     int64 result = a | b;
1592   </td>
1593   <td>Bitwise OR.</td>
1594 </tr>
1595 <tr>
1596   <td>xor-long</td>
1597   <td>int64 a, b;<br/>
1598     int64 result = a ^ b;
1599   </td>
1600   <td>Bitwise XOR.</td>
1601 </tr>
1602 <tr>
1603   <td>shl-long</td>
1604   <td>int64 a, b;<br/>
1605     int64 result = a &lt;&lt; (b &amp; 0x3f);
1606   </td>
1607   <td>Bitwise shift left (with masked argument).</td>
1608 </tr>
1609 <tr>
1610   <td>shr-long</td>
1611   <td>int64 a, b;<br/>
1612     int64 result = a &gt;&gt; (b &amp; 0x3f);
1613   </td>
1614   <td>Bitwise signed shift right (with masked argument).</td>
1615 </tr>
1616 <tr>
1617   <td>ushr-long</td>
1618   <td>uint64 a, b;<br/>
1619     int64 result = a &gt;&gt; (b &amp; 0x3f);
1620   </td>
1621   <td>Bitwise unsigned shift right (with masked argument).</td>
1622 </tr>
1623 <tr>
1624   <td>add-float</td>
1625   <td>float a, b;<br/>
1626     float result = a + b;
1627   </td>
1628   <td>Floating point addition.</td>
1629 </tr>
1630 <tr>
1631   <td>sub-float</td>
1632   <td>float a, b;<br/>
1633     float result = a - b;
1634   </td>
1635   <td>Floating point subtraction.</td>
1636 </tr>
1637 <tr>
1638   <td>mul-float</td>
1639   <td>float a, b;<br/>
1640     float result = a * b;
1641   </td>
1642   <td>Floating point multiplication.</td>
1643 </tr>
1644 <tr>
1645   <td>div-float</td>
1646   <td>float a, b;<br/>
1647     float result = a / b;
1648   </td>
1649   <td>Floating point division.</td>
1650 </tr>
1651 <tr>
1652   <td>rem-float</td>
1653   <td>float a, b;<br/>
1654     float result = a % b;
1655   </td>
1656   <td>Floating point remainder after division. This function is different
1657     than IEEE 754 remainder and is defined as
1658     <code>result == a - roundTowardZero(a / b) * b</code>.
1659   </td>
1660 </tr>
1661 <tr>
1662   <td>add-double</td>
1663   <td>double a, b;<br/>
1664     double result = a + b;
1665   </td>
1666   <td>Floating point addition.</td>
1667 </tr>
1668 <tr>
1669   <td>sub-double</td>
1670   <td>double a, b;<br/>
1671     double result = a - b;
1672   </td>
1673   <td>Floating point subtraction.</td>
1674 </tr>
1675 <tr>
1676   <td>mul-double</td>
1677   <td>double a, b;<br/>
1678     double result = a * b;
1679   </td>
1680   <td>Floating point multiplication.</td>
1681 </tr>
1682 <tr>
1683   <td>div-double</td>
1684   <td>double a, b;<br/>
1685     double result = a / b;
1686   </td>
1687   <td>Floating point division.</td>
1688 </tr>
1689 <tr>
1690   <td>rem-double</td>
1691   <td>double a, b;<br/>
1692     double result = a % b;
1693   </td>
1694   <td>Floating point remainder after division. This function is different
1695     than IEEE 754 remainder and is defined as
1696     <code>result == a - roundTowardZero(a / b) * b</code>.
1697   </td>
1698 </tr>
1699 </tbody>
1700 </table>
1701
1702 </body>
1703 </html>