summaryrefslogtreecommitdiffstats
path: root/docs/dalvik-bytecode.html
blob: 4945d60f4ddaf1b7caedaa8056eafcf6b17e2a31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

<head>
<title>Bytecode for the Dalvik VM</title>
<link rel=stylesheet href="dalvik-bytecode.css">
</head>

<body>

<h1>Bytecode for the Dalvik VM</h1>
<p>Copyright &copy; 2007 The Android Open Source Project

<h2>General Design</h2>

<ul>
<li>The machine model and calling conventions are meant to approximately
  imitate common real architectures and C-style calling conventions:
  <ul>
  <li>The VM is register-based, and frames are fixed in size upon creation.
    Each frame consists of a particular number of registers (specified by
    the method) as well as any adjunct data needed to execute the method,
    such as (but not limited to) the program counter and a reference to the
    <code>.dex</code> file that contains the method.
  </li>
  <li>Registers are 32 bits wide. Adjacent register pairs are used for 64-bit
    values.
  </li>
  <li>In terms of bitwise representation, <code>(Object) null == (int)
    0</code>.
  </li>
  <li>The <i>N</i> arguments to a method land in the last <i>N</i> registers
    of the method's invocation frame, in order. Wide arguments consume
    two registers. Instance methods are passed a <code>this</code> reference
    as their first argument.
  </li>
  </ul>
<li>The storage unit in the instruction stream is a 16-bit unsigned quantity.
  Some bits in some instructions are ignored / must-be-zero.
</li>
<li>Instructions aren't gratuitously limited to a particular type. For
  example, instructions that move 32-bit register values without interpretation
  don't have to specify whether they are moving ints or floats.
</li>
<li>There are separately enumerated and indexed constant pools for
  references to strings, types, fields, and methods.
</li>
<li>Bitwise literal data is represented in-line in the instruction stream.</li>
<li>Because, in practice, it is uncommon for a method to need more than
  16 registers, and because needing more than eight registers <i>is</i>
  reasonably common, many instructions may only address the first 16
  registers. When reasonably possible, instructions allow references to
  up to the first 256 registers. In cases where an instruction variant isn't
  available to address a desired register, it is expected that the register
  contents get moved from the original register to a low register (before the
  operation) and/or moved from a low result register to a high register
  (after the operation).
</li>
<li>There are several "pseudo-instructions" that are used to hold
  variable-length data referred to by regular instructions (for example,
  <code>fill-array-data</code>). Such instructions must never be
  encountered during the normal flow of execution. In addition, the
  instructions must be located on even-numbered bytecode offsets (that is,
  4-byte aligned). In order to meet this requirement, dex generation tools
  should emit an extra <code>nop</code> instruction as a spacer if such an
  instruction would otherwise be unaligned. Finally, though not required,
  it is expected that most tools will choose to emit these instructions at
  the ends of methods, since otherwise it would likely be the case that
  additional instructions would be needed to branch around them.
</li>
<li>When installed on a running system, some instructions may be altered,
  changing their format, as an install-time static linking optimization.
  This is to allow for faster execution once linkage is known.
  See the associated
  <a href="instruction-formats.html">instruction formats document</a>
  for the suggested variants. The word "suggested" is used advisedly;
  it is not mandatory to implement these.
</li>
<li>Human-syntax and mnemonics:
  <ul>
  <li>Dest-then-source ordering for arguments.</li>
  <li>Some opcodes have a disambiguating suffix with respect to the type(s)
    they operate on: Type-general 64-bit opcodes
    are suffixed with <code>-wide</code>.
    Type-specific opcodes are suffixed with their type (or a
    straightforward abbreviation), one of: <code>-boolean</code>
    <code>-byte</code> <code>-char</code> <code>-short</code>
    <code>-int</code> <code>-long</code> <code>-float</code>
    <code>-double</code> <code>-object</code> <code>-string</code>
    <code>-class</code> <code>-void</code>. Type-general 32-bit opcodes
    are unmarked.
  </li>
  <li>Some opcodes have a disambiguating suffix to distinguish
    otherwise-identical operations that have different instruction layouts
    or options. These suffixes are separated from the main names with a slash
    ("<code>/</code>") and mainly exist at all to make there be a one-to-one
    mapping with static constants in the code that generates and interprets
    executables (that is, to reduce ambiguity for humans).
  </li>
  </ul>
</li>
<li>See the <a href="instruction-formats.html">instruction formats
  document</a> for more details about the various instruction formats
  (listed under "Op &amp; Format") as well as details about the opcode
  syntax.
</li>
</ul>

<h2>Summary of Instruction Set</h2>

<table class="instruc">
<thead>
<tr>
  <th>Op &amp; Format</th>
  <th>Mnemonic / Syntax</th>
  <th>Arguments</th>
  <th>Description</th>
</tr>
</thead>
<tbody>
<tr>
  <td>00 10x</td>
  <td>nop</td>
  <td>&nbsp;</td>
  <td>Waste cycles.</td>
</tr>
<tr>
  <td>01 12x</td>
  <td>move vA, vB</td>
  <td><code>A:</code> destination register (4 bits)<br/>
    <code>B:</code> source register (4 bits)</td>
  <td>Move the contents of one non-object register to another.</td>
</tr>
<tr>
  <td>02 22x</td>
  <td>move/from16 vAA, vBBBB</td>
  <td><code>A:</code> destination register (8 bits)<br/>
    <code>B:</code> source register (16 bits)</td>
  <td>Move the contents of one non-object register to another.</td>
</tr>
<tr>
  <td>03 32x</td>
  <td>move/16 vAAAA, vBBBB</td>
  <td><code>A:</code> destination register (16 bits)<br/>
    <code>B:</code> source register (16 bits)</td>
  <td>Move the contents of one non-object register to another.</td>
</tr>
<tr>
  <td>04 12x</td>
  <td>move-wide vA, vB</td>
  <td><code>A:</code> destination register pair (4 bits)<br/>
    <code>B:</code> source register pair (4 bits)</td>
  <td>Move the contents of one register-pair to another.
    <p><b>Note:</b>
    It is legal to move from <code>v<i>N</i></code> to either
    <code>v<i>N-1</i></code> or <code>v<i>N+1</i></code>, so implementations
    must arrange for both halves of a register pair to be read before
    anything is written.</p>
  </td>
</tr>
<tr>
  <td>05 22x</td>
  <td>move-wide/from16 vAA, vBBBB</td>
  <td><code>A:</code> destination register pair (8 bits)<br/>
    <code>B:</code> source register pair (16 bits)</td>
  <td>Move the contents of one register-pair to another.
    <p><b>Note:</b>
    Implementation considerations are the same as <code>move-wide</code>,
    above.</p>
  </td>
</tr>
<tr>
  <td>06 32x</td>
  <td>move-wide/16 vAAAA, vBBBB</td>
  <td><code>A:</code> destination register pair (16 bits)<br/>
    <code>B:</code> source register pair (16 bits)</td>
  <td>Move the contents of one register-pair to another.
    <p><b>Note:</b>
    Implementation considerations are the same as <code>move-wide</code>,
    above.</p>
  </td>
</tr>
<tr>
  <td>07 12x</td>
  <td>move-object vA, vB</td>
  <td><code>A:</code> destination register (4 bits)<br/>
    <code>B:</code> source register (4 bits)</td>
  <td>Move the contents of one object-bearing register to another.</td>
</tr>
<tr>
  <td>08 22x</td>
  <td>move-object/from16 vAA, vBBBB</td>
  <td><code>A:</code> destination register (8 bits)<br/>
    <code>B:</code> source register (16 bits)</td>
  <td>Move the contents of one object-bearing register to another.</td>
</tr>
<tr>
  <td>09 32x</td>
  <td>move-object/16 vAAAA, vBBBB</td>
  <td><code>A:</code> destination register (16 bits)<br/>
    <code>B:</code> source register (16 bits)</td>
  <td>Move the contents of one object-bearing register to another.</td>
</tr>
<tr>
  <td>0a 11x</td>
  <td>move-result vAA</td>
  <td><code>A:</code> destination register (8 bits)</td>
  <td>Move the single-word non-object result of the most recent
    <code>invoke-<i>kind</i></code> into the indicated register.
    This must be done as the instruction immediately after an
    <code>invoke-<i>kind</i></code> whose (single-word, non-object) result
    is not to be ignored; anywhere else is invalid.</td>
</tr>
<tr>
  <td>0b 11x</td>
  <td>move-result-wide vAA</td>
  <td><code>A:</code> destination register pair (8 bits)</td>
  <td>Move the double-word result of the most recent
    <code>invoke-<i>kind</i></code> into the indicated register pair.
    This must be done as the instruction immediately after an
    <code>invoke-<i>kind</i></code> whose (double-word) result
    is not to be ignored; anywhere else is invalid.</td>
</tr>
<tr>
  <td>0c 11x</td>
  <td>move-result-object vAA</td>
  <td><code>A:</code> destination register (8 bits)</td>
  <td>Move the object result of the most recent <code>invoke-<i>kind</i></code>
    into the indicated register. This must be done as the instruction
    immediately after an <code>invoke-<i>kind</i></code> or
    <code>filled-new-array</code>
    whose (object) result is not to be ignored; anywhere else is invalid.</td>
</tr>
<tr>
  <td>0d 11x</td>
  <td>move-exception vAA</td>
  <td><code>A:</code> destination register (8 bits)</td>
  <td>Save a just-caught exception into the given register. This should
    be the first instruction of any exception handler whose caught
    exception is not to be ignored, and this instruction may <i>only</i>
    ever occur as the first instruction of an exception handler; anywhere
    else is invalid.</td>
</tr>
<tr>
  <td>0e 10x</td>
  <td>return-void</td>
  <td>&nbsp;</td>
  <td>Return from a <code>void</code> method.</td>
</tr>
<tr>
  <td>0f 11x</td>
  <td>return vAA</td>
  <td><code>A:</code> return value register (8 bits)</td>
  <td>Return from a single-width (32-bit) non-object value-returning
    method.
  </td>
</tr>
<tr>
  <td>10 11x</td>
  <td>return-wide vAA</td>
  <td><code>A:</code> return value register-pair (8 bits)</td>
  <td>Return from a double-width (64-bit) value-returning method.</td>
</tr>
<tr>
  <td>11 11x</td>
  <td>return-object vAA</td>
  <td><code>A:</code> return value register (8 bits)</td>
  <td>Return from an object-returning method.</td>
</tr>
<tr>
  <td>12 11n</td>
  <td>const/4 vA, #+B</td>
  <td><code>A:</code> destination register (4 bits)<br/>
    <code>B:</code> signed int (4 bits)</td>
  <td>Move the given literal value (sign-extended to 32 bits) into
    the specified register.</td>
</tr>
<tr>
  <td>13 21s</td>
  <td>const/16 vAA, #+BBBB</td>
  <td><code>A:</code> destination register (8 bits)<br/>
    <code>B:</code> signed int (16 bits)</td>
  <td>Move the given literal value (sign-extended to 32 bits) into
    the specified register.</td>
</tr>
<tr>
  <td>14 31i</td>
  <td>const vAA, #+BBBBBBBB</td>
  <td><code>A:</code> destination register (8 bits)<br/>
    <code>B:</code> arbitrary 32-bit constant</td>
  <td>Move the given literal value into the specified register.</td>
</tr>
<tr>
  <td>15 21h</td>
  <td>const/high16 vAA, #+BBBB0000</td>
  <td><code>A:</code> destination register (8 bits)<br/>
    <code>B:</code> signed int (16 bits)</td>
  <td>Move the given literal value (right-zero-extended to 32 bits) into
    the specified register.</td>
</tr>
<tr>
  <td>16 21s</td>
  <td>const-wide/16 vAA, #+BBBB</td>
  <td><code>A:</code> destination register (8 bits)<br/>
    <code>B:</code> signed int (16 bits)</td>
  <td>Move the given literal value (sign-extended to 64 bits) into
    the specified register-pair.</td>
</tr>
<tr>
  <td>17 31i</td>
  <td>const-wide/32 vAA, #+BBBBBBBB</td>
  <td><code>A:</code> destination register (8 bits)<br/>
    <code>B:</code> signed int (32 bits)</td>
  <td>Move the given literal value (sign-extended to 64 bits) into
    the specified register-pair.</td>
</tr>
<tr>
  <td>18 51l</td>
  <td>const-wide vAA, #+BBBBBBBBBBBBBBBB</td>
  <td><code>A:</code> destination register (8 bits)<br/>
    <code>B:</code> arbitrary double-width (64-bit) constant</td>
  <td>Move the given literal value into
    the specified register-pair.</td>
</tr>
<tr>
  <td>19 21h</td>
  <td>const-wide/high16 vAA, #+BBBB000000000000</td>
  <td><code>A:</code> destination register (8 bits)<br/>
    <code>B:</code> signed int (16 bits)</td>
  <td>Move the given literal value (right-zero-extended to 64 bits) into
    the specified register-pair.</td>
</tr>
<tr>
  <td>1a 21c</td>
  <td>const-string vAA, string@BBBB</td>
  <td><code>A:</code> destination register (8 bits)<br/>
    <code>B:</code> string index</td>
  <td>Move a reference to the string specified by the given index into the
    specified register.</td>
</tr>
<tr>
  <td>1b 31c</td>
  <td>const-string/jumbo vAA, string@BBBBBBBB</td>
  <td><code>A:</code> destination register (8 bits)<br/>
    <code>B:</code> string index</td>
  <td>Move a reference to the string specified by the given index into the
    specified register.</td>
</tr>
<tr>
  <td>1c 21c</td>
  <td>const-class vAA, type@BBBB</td>
  <td><code>A:</code> destination register (8 bits)<br/>
    <code>B:</code> type index</td>
  <td>Move a reference to the class specified by the given index into the
    specified register. In the case where the indicated type is primitive,
    this will store a reference to the primitive type's degenerate
    class.</td>
</tr>
<tr>
  <td>1d 11x</td>
  <td>monitor-enter vAA</td>
  <td><code>A:</code> reference-bearing register (8 bits)</td>
  <td>Acquire the monitor for the indicated object.</td>
</tr>
<tr>
  <td>1e 11x</td>
  <td>monitor-exit vAA</td>
  <td><code>A:</code> reference-bearing register (8 bits)</td>
  <td>Release the monitor for the indicated object.
    <p><b>Note:</b>
    If this instruction needs to throw an exception, it must do
    so as if the pc has already advanced past the instruction.
    It may be useful to think of this as the instruction successfully
    executing (in a sense), and the exception getting thrown <i>after</i>
    the instruction but <i>before</i> the next one gets a chance to
    run. This definition makes it possible for a method to use
    a monitor cleanup catch-all (e.g., <code>finally</code>) block as
    the monitor cleanup for that block itself, as a way to handle the
    arbitrary exceptions that might get thrown due to the historical
    implementation of <code>Thread.stop()</code>, while still managing
    to have proper monitor hygiene.</p>
  </td>
</tr>
<tr>
  <td>1f 21c</td>
  <td>check-cast vAA, type@BBBB</td>
  <td><code>A:</code> reference-bearing register (8 bits)<br/>
    <code>B:</code> type index (16 bits)</td>
  <td>Throw a <code>ClassCastException</code> if the reference in the
    given register cannot be cast to the indicated type.
    <p><b>Note:</b> Since <code>A</code> must always be a reference
    (and not a primitive value), this will necessarily fail at runtime
    (that is, it will throw an exception) if <code>B</code> refers to a
    primitive type.</p>
  </td>
</tr>
<tr>
  <td>20 22c</td>
  <td>instance-of vA, vB, type@CCCC</td>
  <td><code>A:</code> destination register (4 bits)<br/>
    <code>B:</code> reference-bearing register (4 bits)<br/>
    <code>C:</code> type index (16 bits)</td>
  <td>Store in the given destination register <code>1</code>
    if the indicated reference is an instance of the given type,
    or <code>0</code> if not.
    <p><b>Note:</b> Since <code>B</code> must always be a reference
    (and not a primitive value), this will always result
    in <code>0</code> being stored if <code>C</code> refers to a primitive
    type.</td>
</tr>
<tr>
  <td>21 12x</td>
  <td>array-length vA, vB</td>
  <td><code>A:</code> destination register (4 bits)<br/>
    <code>B:</code> array reference-bearing register (4 bits)</td>
  <td>Store in the given destination register the length of the indicated
    array, in entries</td>
</tr>
<tr>
  <td>22 21c</td>
  <td>new-instance vAA, type@BBBB</td>
  <td><code>A:</code> destination register (8 bits)<br/>
    <code>B:</code> type index</td>
  <td>Construct a new instance of the indicated type, storing a
    reference to it in the destination. The type must refer to a
    non-array class.</td>
</tr>
<tr>
  <td>23 22c</td>
  <td>new-array vA, vB, type@CCCC</td>
  <td><code>A:</code> destination register (8 bits)<br/>
    <code>B:</code> size register<br/>
    <code>C:</code> type index</td>
  <td>Construct a new array of the indicated type and size. The type
    must be an array type.</td>
</tr>
<tr>
  <td>24 35c</td>
  <td>filled-new-array {vD, vE, vF, vG, vA}, type@CCCC</td>
  <td><code>B:</code> array size and argument word count (4 bits)<br/>
    <code>C:</code> type index (16 bits)<br/>
    <code>D..G, A:</code> argument registers (4 bits each)</td>
  <td>Construct an array of the given type and size, filling it with the
    supplied contents. The type must be an array type. The array's
    contents must be single-word (that is,
    no arrays of <code>long</code> or <code>double</code>). The constructed
    instance is stored as a "result" in the same way that the method invocation
    instructions store their results, so the constructed instance must 
    be moved to a register with a subsequent
    <code>move-result-object</code> instruction (if it is to be used).</td>
</tr>
<tr>
  <td>25 3rc</td>
  <td>filled-new-array/range {vCCCC .. vNNNN}, type@BBBB</td>
  <td><code>A:</code> array size and argument word count (8 bits)<br/>
    <code>B:</code> type index (16 bits)<br/>
    <code>C:</code> first argument register (16 bits)<br/>
    <code>N = A + C - 1</code></td>
  <td>Construct an array of the given type and size, filling it with
    the supplied contents. Clarifications and restrictions are the same
    as <code>filled-new-array</code>, described above.</td>
</tr>
<tr>
  <td>26 31t</td>
  <td>fill-array-data vAA, +BBBBBBBB <i>(with supplemental data as specified
    below in "<code>fill-array-data</code> Format")</i></td>
  <td><code>A:</code> array reference (8 bits)<br/>
    <code>B:</code> signed "branch" offset to table data pseudo-instruction
    (32 bits)
  </td>
  <td>Fill the given array with the indicated data. The reference must be
    to an array of primitives, and the data table must match it in type and
    must contain no more elements than will fit in the array. That is,
    the array may be larger than the table, and if so, only the initial
    elements of the array are set, leaving the remainder alone.
  </td>
</tr>
<tr>
  <td>27 11x</td>
  <td>throw vAA</td>
  <td><code>A:</code> exception-bearing register (8 bits)<br/></td>
  <td>Throw the indicated exception.</td>
</tr>
<tr>
  <td>28 10t</td>
  <td>goto +AA</td>
  <td><code>A:</code> signed branch offset (8 bits)</td>
  <td>Unconditionally jump to the indicated instruction.
    <p><b>Note:</b>
    The branch offset may not be <code>0</code>. (A spin
    loop may be legally constructed either with <code>goto/32</code> or
    by including a <code>nop</code> as a target before the branch.)</p>
  </td>
</tr>
<tr>
  <td>29 20t</td>
  <td>goto/16 +AAAA</td>
  <td><code>A:</code> signed branch offset (16 bits)<br/></td>
  <td>Unconditionally jump to the indicated instruction.
    <p><b>Note:</b>
    The branch offset may not be <code>0</code>. (A spin
    loop may be legally constructed either with <code>goto/32</code> or
    by including a <code>nop</code> as a target before the branch.)</p>
  </td>
</tr>
<tr>
  <td>2a 30t</td>
  <td>goto/32 +AAAAAAAA</td>
  <td><code>A:</code> signed branch offset (32 bits)<br/></td>
  <td>Unconditionally jump to the indicated instruction.</td>
</tr>
<tr>
  <td>2b 31t</td>
  <td>packed-switch vAA, +BBBBBBBB <i>(with supplemental data as
    specified below in "<code>packed-switch</code> Format")</i></td>
  <td><code>A:</code> register to test<br/>
    <code>B:</code> signed "branch" offset to table data pseudo-instruction
    (32 bits)
  </td>
  <td>Jump to a new instruction based on the value in the
    given register, using a table of offsets corresponding to each value
    in a particular integral range, or fall through to the next
    instruction if there is no match.
  </td>
</tr>
<tr>
  <td>2c 31t</td>
  <td>sparse-switch vAA, +BBBBBBBB <i>(with supplemental data as
    specified below in "<code>sparse-switch</code> Format")</i></td>
  <td><code>A:</code> register to test<br/>
    <code>B:</code> signed "branch" offset to table data pseudo-instruction
    (32 bits)
  </td>
  <td>Jump to a new instruction based on the value in the given
    register, using an ordered table of value-offset pairs, or fall
    through to the next instruction if there is no match.
  </td>
</tr>
<tr>
  <td>2d..31 23x</td>
  <td>cmp<i>kind</i> vAA, vBB, vCC<br/>
    2d: cmpl-float <i>(lt bias)</i><br/>
    2e: cmpg-float <i>(gt bias)</i><br/>
    2f: cmpl-double <i>(lt bias)</i><br/>
    30: cmpg-double <i>(gt bias)</i><br/>
    31: cmp-long
  </td>
  <td><code>A:</code> destination register (8 bits)<br/>
    <code>B:</code> first source register or pair<br/>
    <code>C:</code> second source register or pair</td>
  <td>Perform the indicated floating point or <code>long</code> comparison,
    storing <code>0</code> if the two arguments are equal, <code>1</code>
    if the second argument is larger, or <code>-1</code> if the first
    argument is larger. The "bias" listed for the floating point operations
    indicates how <code>NaN</code> comparisons are treated: "Gt bias"
    instructions return <code>1</code> for <code>NaN</code> comparisons,
    and "lt bias" instructions return
    <code>-1</code>.
    <p>For example, to check to see if floating point
    <code>a &lt; b</code>, then it is advisable to use
    <code>cmpg-float</code>; a result of <code>-1</code> indicates that
    the test was true, and the other values indicate it was false either
    due to a valid comparison or because one or the other values was
    <code>NaN</code>.</p>
  </td>
</tr>
<tr>
  <td>32..37 22t</td>
  <td>if-<i>test</i> vA, vB, +CCCC<br/>
    32: if-eq<br/>
    33: if-ne<br/>
    34: if-lt<br/>
    35: if-ge<br/>
    36: if-gt<br/>
    37: if-le<br/>
  </td>
  <td><code>A:</code> first register to test (4 bits)<br/>
    <code>B:</code> second register to test (4 bits)<br/>
    <code>C:</code> signed branch offset (16 bits)</td>
  <td>Branch to the given destination if the given two registers' values
    compare as specified.
    <p><b>Note:</b>
    The branch offset may not be <code>0</code>. (A spin
    loop may be legally constructed either by branching around a
    backward <code>goto</code> or by including a <code>nop</code> as
    a target before the branch.)</p>
  </td>
</tr>
<tr>
  <td>38..3d 21t</td>
  <td>if-<i>test</i>z vAA, +BBBB<br/>
    38: if-eqz<br/>
    39: if-nez<br/>
    3a: if-ltz<br/>
    3b: if-gez<br/>
    3c: if-gtz<br/>
    3d: if-lez<br/>
  </td>
  <td><code>A:</code> register to test (8 bits)<br/>
    <code>B:</code> signed branch offset (16 bits)</td>
  <td>Branch to the given destination if the given register's value compares
    with 0 as specified.
    <p><b>Note:</b>
    The branch offset may not be <code>0</code>. (A spin
    loop may be legally constructed either by branching around a
    backward <code>goto</code> or by including a <code>nop</code> as
    a target before the branch.)</p>
  </td>
</tr>
<tr>
  <td>3e..43 10x</td>
  <td><i>(unused)</i></td>
  <td>&nbsp;</td>
  <td><i>(unused)</i></td>
</tr>
<tr>
  <td>44..51 23x</td>
  <td><i>arrayop</i> vAA, vBB, vCC<br/>
    44: aget<br/>
    45: aget-wide<br/>
    46: aget-object<br/>
    47: aget-boolean<br/>
    48: aget-byte<br/>
    49: aget-char<br/>
    4a: aget-short<br/>
    4b: aput<br/>
    4c: aput-wide<br/>
    4d: aput-object<br/>
    4e: aput-boolean<br/>
    4f: aput-byte<br/>
    50: aput-char<br/>
    51: aput-short
  </td>
  <td><code>A:</code> value register or pair; may be source or dest
      (8 bits)<br/>
    <code>B:</code> array register (8 bits)<br/>
    <code>C:</code> index register (8 bits)</td>
  <td>Perform the identified array operation at the identified index of
    the given array, loading or storing into the value register.</td>
</tr>
<tr>
  <td>52..5f 22c</td>
  <td>i<i>instanceop</i> vA, vB, field@CCCC<br/>
    52: iget<br/>
    53: iget-wide<br/>
    54: iget-object<br/>
    55: iget-boolean<br/>
    56: iget-byte<br/>
    57: iget-char<br/>
    58: iget-short<br/>
    59: iput<br/>
    5a: iput-wide<br/>
    5b: iput-object<br/>
    5c: iput-boolean<br/>
    5d: iput-byte<br/>
    5e: iput-char<br/>
    5f: iput-short
  </td>
  <td><code>A:</code> value register or pair; may be source or dest
      (4 bits)<br/>
    <code>B:</code> object register (4 bits)<br/>
    <code>C:</code> instance field reference index (16 bits)</td>
  <td>Perform the identified object instance field operation with
    the identified field, loading or storing into the value register.
    <p><b>Note:</b> These opcodes are reasonable candidates for static linking,
    altering the field argument to be a more direct offset.</p>
  </td>
</tr>
<tr>
  <td>60..6d 21c</td>
  <td>s<i>staticop</i> vAA, field@BBBB<br/>
    60: sget<br/>
    61: sget-wide<br/>
    62: sget-object<br/>
    63: sget-boolean<br/>
    64: sget-byte<br/>
    65: sget-char<br/>
    66: sget-short<br/>
    67: sput<br/>
    68: sput-wide<br/>
    69: sput-object<br/>
    6a: sput-boolean<br/>
    6b: sput-byte<br/>
    6c: sput-char<br/>
    6d: sput-short
  </td>
  <td><code>A:</code> value register or pair; may be source or dest
      (8 bits)<br/>
    <code>B:</code> static field reference index (16 bits)</td>
  <td>Perform the identified object static field operation with the identified
    static field, loading or storing into the value register.
    <p><b>Note:</b> These opcodes are reasonable candidates for static linking,
    altering the field argument to be a more direct offset.</p>
  </td>
</tr>
<tr>
  <td>6e..72 35c</td>
  <td>invoke-<i>kind</i> {vD, vE, vF, vG, vA}, meth@CCCC<br/>
    6e: invoke-virtual<br/>
    6f: invoke-super<br/>
    70: invoke-direct<br/>
    71: invoke-static<br/>
    72: invoke-interface
  </td>
  <td><code>B:</code> argument word count (4 bits)<br/>
    <code>C:</code> method index (16 bits)<br/>
    <code>D..G, A:</code> argument registers (4 bits each)</td>
  <td>Call the indicated method. The result (if any) may be stored
    with an appropriate <code>move-result*</code> variant as the immediately
    subsequent instruction.
    <p><code>invoke-virtual</code> is used to invoke a normal virtual
    method (a method that is not <code>static</code> or <code>final</code>,
    and is not a constructor).</p>
    <p><code>invoke-super</code> is used to invoke the closest superclass's
    virtual method (as opposed to the one with the same <code>method_id</code>
    in the calling class).</p>
    <p><code>invoke-direct</code> is used to invoke a non-<code>static</code>
    direct method (that is, an instance method that is by its nature
    non-overridable, namely either a <code>private</code> instance method
    or a constructor).</p>
    <p><code>invoke-static</code> is used to invoke a <code>static</code>
    method (which is always considered a direct method).</p>
    <p><code>invoke-interface</code> is used to invoke an
    <code>interface</code> method, that is, on an object whose concrete
    class isn't known, using a <code>method_id</code> that refers to
    an <code>interface</code>.</p>
    <p><b>Note:</b> These opcodes are reasonable candidates for static linking,
    altering the method argument to be a more direct offset
    (or pair thereof).</p>
  </td>
</tr>
<tr>
  <td>73 10x</td>
  <td><i>(unused)</i></td>
  <td>&nbsp;</td>
  <td><i>(unused)</i></td>
</tr>
<tr>
  <td>74..78 3rc</td>
  <td>invoke-<i>kind</i>/range {vCCCC .. vNNNN}, meth@BBBB<br/>
    74: invoke-virtual/range<br/>
    75: invoke-super/range<br/>
    76: invoke-direct/range<br/>
    77: invoke-static/range<br/>
    78: invoke-interface/range
  </td>
  <td><code>A:</code> argument word count (8 bits)<br/>
    <code>B:</code> method index (16 bits)<br/>
    <code>C:</code> first argument register (16 bits)<br/>
    <code>N = A + C - 1</code></td>
  <td>Call the indicated method. See first <code>invoke-<i>kind</i></code>
    description above for details, caveats, and suggestions.
  </td>
</tr>
<tr>
  <td>79..7a 10x</td>
  <td><i>(unused)</i></td>
  <td>&nbsp;</td>
  <td><i>(unused)</i></td>
</tr>
<tr>
  <td>7b..8f 12x</td>
  <td><i>unop</i> vA, vB<br/>
    7b: neg-int<br/>
    7c: not-int<br/>
    7d: neg-long<br/>
    7e: not-long<br/>
    7f: neg-float<br/>
    80: neg-double<br/>
    81: int-to-long<br/>
    82: int-to-float<br/>
    83: int-to-double<br/>
    84: long-to-int<br/>
    85: long-to-float<br/>
    86: long-to-double<br/>
    87: float-to-int<br/>
    88: float-to-long<br/>
    89: float-to-double<br/>
    8a: double-to-int<br/>
    8b: double-to-long<br/>
    8c: double-to-float<br/>
    8d: int-to-byte<br/>
    8e: int-to-char<br/>
    8f: int-to-short
  </td>
  <td><code>A:</code> destination register or pair (4 bits)<br/>
    <code>B:</code> source register or pair (4 bits)</td>
  <td>Perform the identified unary operation on the source register,
    storing the result in the destination register.</td>
</tr>

<tr>
  <td>90..af 23x</td>
  <td><i>binop</i> vAA, vBB, vCC<br/>
    90: add-int<br/>
    91: sub-int<br/>
    92: mul-int<br/>
    93: div-int<br/>
    94: rem-int<br/>
    95: and-int<br/>
    96: or-int<br/>
    97: xor-int<br/>
    98: shl-int<br/>
    99: shr-int<br/>
    9a: ushr-int<br/>
    9b: add-long<br/>
    9c: sub-long<br/>
    9d: mul-long<br/>
    9e: div-long<br/>
    9f: rem-long<br/>
    a0: and-long<br/>
    a1: or-long<br/>
    a2: xor-long<br/>
    a3: shl-long<br/>
    a4: shr-long<br/>
    a5: ushr-long<br/>
    a6: add-float<br/>
    a7: sub-float<br/>
    a8: mul-float<br/>
    a9: div-float<br/>
    aa: rem-float<br/>
    ab: add-double<br/>
    ac: sub-double<br/>
    ad: mul-double<br/>
    ae: div-double<br/>
    af: rem-double
  </td>
  <td><code>A:</code> destination register or pair (8 bits)<br/>
    <code>B:</code> first source register or pair (8 bits)<br/>
    <code>C:</code> second source register or pair (8 bits)</td>
  <td>Perform the identified binary operation on the two source registers,
    storing the result in the first source register.</td>
</tr>
<tr>
  <td>b0..cf 12x</td>
  <td><i>binop</i>/2addr vA, vB<br/>
    b0: add-int/2addr<br/>
    b1: sub-int/2addr<br/>
    b2: mul-int/2addr<br/>
    b3: div-int/2addr<br/>
    b4: rem-int/2addr<br/>
    b5: and-int/2addr<br/>
    b6: or-int/2addr<br/>
    b7: xor-int/2addr<br/>
    b8: shl-int/2addr<br/>
    b9: shr-int/2addr<br/>
    ba: ushr-int/2addr<br/>
    bb: add-long/2addr<br/>
    bc: sub-long/2addr<br/>
    bd: mul-long/2addr<br/>
    be: div-long/2addr<br/>
    bf: rem-long/2addr<br/>
    c0: and-long/2addr<br/>
    c1: or-long/2addr<br/>
    c2: xor-long/2addr<br/>
    c3: shl-long/2addr<br/>
    c4: shr-long/2addr<br/>
    c5: ushr-long/2addr<br/>
    c6: add-float/2addr<br/>
    c7: sub-float/2addr<br/>
    c8: mul-float/2addr<br/>
    c9: div-float/2addr<br/>
    ca: rem-float/2addr<br/>
    cb: add-double/2addr<br/>
    cc: sub-double/2addr<br/>
    cd: mul-double/2addr<br/>
    ce: div-double/2addr<br/>
    cf: rem-double/2addr
  </td>
  <td><code>A:</code> destination and first source register or pair
      (4 bits)<br/>
    <code>B:</code> second source register or pair (4 bits)</td>
  <td>Perform the identified binary operation on the two source registers,
    storing the result in the first source register.</td>
</tr>
<tr>
  <td>d0..d7 22s</td>
  <td><i>binop</i>/lit16 vA, vB, #+CCCC<br/>
    d0: add-int/lit16<br/>
    d1: rsub-int (reverse subtract)<br/>
    d2: mul-int/lit16<br/>
    d3: div-int/lit16<br/>
    d4: rem-int/lit16<br/>
    d5: and-int/lit16<br/>
    d6: or-int/lit16<br/>
    d7: xor-int/lit16
  </td>
  <td><code>A:</code> destination register (4 bits)<br/>
    <code>B:</code> source register (4 bits)<br/>
    <code>C:</code> signed int constant (16 bits)</td>
  <td>Perform the indicated binary op on the indicated register (first
    argument) and literal value (second argument), storing the result in
    the destination register.
    <p><b>Note:</b>
    <code>rsub-int</code> does not have a suffix since this version is the
    main opcode of its family. Also, see below for details on its semantics.
    </p>
  </td>
</tr>
<tr>
  <td>d8..e2 22b</td>
  <td><i>binop</i>/lit8 vAA, vBB, #+CC<br/>
    d8: add-int/lit8<br/>
    d9: rsub-int/lit8<br/>
    da: mul-int/lit8<br/>
    db: div-int/lit8<br/>
    dc: rem-int/lit8<br/>
    dd: and-int/lit8<br/>
    de: or-int/lit8<br/>
    df: xor-int/lit8<br/>
    e0: shl-int/lit8<br/>
    e1: shr-int/lit8<br/>
    e2: ushr-int/lit8
  </td>
  <td><code>A:</code> destination register (8 bits)<br/>
    <code>B:</code> source register (8 bits)<br/>
    <code>C:</code> signed int constant (8 bits)</td>
  <td>Perform the indicated binary op on the indicated register (first
    argument) and literal value (second argument), storing the result
    in the destination register.
    <p><b>Note:</b> See below for details on the semantics of
    <code>rsub-int</code>.</p>
  </td>
</tr>
<tr>
  <td>e3..ff 10x</td>
  <td><i>(unused)</i></td>
  <td>&nbsp;</td>
  <td><i>(unused)</i></td>
</tr>
</tbody>
</table>

<h2><code>packed-switch</code> Format</h2>

<table class="supplement">
<thead>
<tr>
  <th>Name</th>
  <th>Format</th>
  <th>Description</th>
</tr>
</thead>
<tbody>
<tr>
  <td>ident</td>
  <td>ushort = 0x0100</td>
  <td>identifying pseudo-opcode</td>
</tr>
<tr>
  <td>size</td>
  <td>ushort</td>
  <td>number of entries in the table</td>
</tr>
<tr>
  <td>first_key</td>
  <td>int</td>
  <td>first (and lowest) switch case value</td>
</tr>
<tr>
  <td>targets</td>
  <td>int[]</td>
  <td>list of <code>size</code> relative branch targets. The targets are
    relative to the address of the switch opcode, not of this table.
  </td>
</tr>
</tbody>
</table>

<p><b>Note:</b> The total number of code units for an instance of this
table is <code>(size * 2) + 4</code>.</p>

<h2><code>sparse-switch</code> Format</h2>

<table class="supplement">
<thead>
<tr>
  <th>Name</th>
  <th>Format</th>
  <th>Description</th>
</tr>
</thead>
<tbody>
<tr>
  <td>ident</td>
  <td>ushort = 0x0200</td>
  <td>identifying pseudo-opcode</td>
</tr>
<tr>
  <td>size</td>
  <td>ushort</td>
  <td>number of entries in the table</td>
</tr>
<tr>
  <td>keys</td>
  <td>int[]</td>
  <td>list of <code>size</code> key values, sorted low-to-high</td>
</tr>
<tr>
  <td>targets</td>
  <td>int[]</td>
  <td>list of <code>size</code> relative branch targets, each corresponding
    to the key value at the same index. The targets are
    relative to the address of the switch opcode, not of this table.
  </td>
</tr>
</tbody>
</table>

<p><b>Note:</b> The total number of code units for an instance of this
table is <code>(size * 4) + 2</code>.</p>

<h2><code>fill-array-data</code> Format</h2>

<table class="supplement">
<thead>
<tr>
  <th>Name</th>
  <th>Format</th>
  <th>Description</th>
</tr>
</thead>
<tbody>
<tr>
  <td>ident</td>
  <td>ushort = 0x0300</td>
  <td>identifying pseudo-opcode</td>
</tr>
<tr>
  <td>element_width</td>
  <td>ushort</td>
  <td>number of bytes in each element</td>
</tr>
<tr>
  <td>size</td>
  <td>uint</td>
  <td>number of elements in the table</td>
</tr>
<tr>
  <td>data</td>
  <td>ubyte[]</td>
  <td>data values</td>
</tr>
</tbody>
</table>

<p><b>Note:</b> The total number of code units for an instance of this
table is <code>(size * element_width + 1) / 2 + 4</code>.</p>


<h2>Mathematical Operation Details</h2>

<p><b>Note:</b> Floating point operations must follow IEEE 754 rules, using
round-to-nearest and gradual underflow, except where stated otherwise.</p>

<table class="math">
<thead>
<tr>
  <th>Opcode</th>
  <th>C Semantics</th>
  <th>Notes</th>
</tr>
</thead>
<tbody>
<tr>
  <td>neg-int</td>
  <td>int32 a;<br/>
    int32 result = -a;
  </td>
  <td>Unary twos-complement.</td>
</tr>
<tr>
  <td>not-int</td>
  <td>int32 a;<br/>
    int32 result = ~a;
  </td>
  <td>Unary ones-complement.</td>
</tr>
<tr>
  <td>neg-long</td>
  <td>int64 a;<br/>
    int64 result = -a;
  </td>
  <td>Unary twos-complement.</td>
</tr>
<tr>
  <td>not-long</td>
  <td>int64 a;<br/>
    int64 result = ~a;
  </td>
  <td>Unary ones-complement.</td>
</tr>
<tr>
  <td>neg-float</td>
  <td>float a;<br/>
    float result = -a;
  </td>
  <td>Floating point negation.</td>
</tr>
<tr>
  <td>neg-double</td>
  <td>double a;<br/>
    double result = -a;
  </td>
  <td>Floating point negation.</td>
</tr>
<tr>
  <td>int-to-long</td>
  <td>int32 a;<br/>
    int64 result = (int64) a;
  </td>
  <td>Sign extension of <code>int32</code> into <code>int64</code>.</td>
</tr>
<tr>
  <td>int-to-float</td>
  <td>int32 a;<br/>
    float result = (float) a;
  </td>
  <td>Conversion of <code>int32</code> to <code>float</code>, using
    round-to-nearest. This loses precision for some values.
  </td>
</tr>
<tr>
  <td>int-to-double</td>
  <td>int32 a;<br/>
    double result = (double) a;
  </td>
  <td>Conversion of <code>int32</code> to <code>double</code>.</td>
</tr>
<tr>
  <td>long-to-int</td>
  <td>int64 a;<br/>
    int32 result = (int32) a;
  </td>
  <td>Truncation of <code>int64</code> into <code>int32</code>.</td>
</tr>
<tr>
  <td>long-to-float</td>
  <td>int64 a;<br/>
    float result = (float) a;
  </td>
  <td>Conversion of <code>int64</code> to <code>float</code>, using
    round-to-nearest. This loses precision for some values.
  </td>
</tr>
<tr>
  <td>long-to-double</td>
  <td>int64 a;<br/>
    double result = (double) a;
  </td>
  <td>Conversion of <code>int64</code> to <code>double</code>, using
    round-to-nearest. This loses precision for some values.
  </td>
</tr>
<tr>
  <td>float-to-int</td>
  <td>float a;<br/>
    int32 result = (int32) a;
  </td>
  <td>Conversion of <code>float</code> to <code>int32</code>, using
    round-toward-zero. <code>NaN</code> and <code>-0.0</code> (negative zero)
    convert to the integer <code>0</code>. Infinities and values with
    too large a magnitude to be represented get converted to either
    <code>0x7fffffff</code> or <code>-0x80000000</code> depending on sign.
  </td>
</tr>
<tr>
  <td>float-to-long</td>
  <td>float a;<br/>
    int64 result = (int64) a;
  </td>
  <td>Conversion of <code>float</code> to <code>int64</code>, using
    round-toward-zero. The same special case rules as for
    <code>float-to-int</code> apply here, except that out-of-range values
    get converted to either <code>0x7fffffffffffffff</code> or
    <code>-0x8000000000000000</code> depending on sign.
  </td>
</tr>
<tr>
  <td>float-to-double</td>
  <td>float a;<br/>
    double result = (double) a;
  </td>
  <td>Conversion of <code>float</code> to <code>double</code>, preserving
    the value exactly.
  </td>
</tr>
<tr>
  <td>double-to-int</td>
  <td>double a;<br/>
    int32 result = (int32) a;
  </td>
  <td>Conversion of <code>double</code> to <code>int32</code>, using
    round-toward-zero. The same special case rules as for
    <code>float-to-int</code> apply here.
  </td>
</tr>
<tr>
  <td>double-to-long</td>
  <td>double a;<br/>
    int64 result = (int64) a;
  </td>
  <td>Conversion of <code>double</code> to <code>int64</code>, using
    round-toward-zero. The same special case rules as for
    <code>float-to-long</code> apply here.
  </td>
</tr>
<tr>
  <td>double-to-float</td>
  <td>double a;<br/>
    float result = (float) a;
  </td>
  <td>Conversion of <code>double</code> to <code>float</code>, using
    round-to-nearest. This loses precision for some values.
  </td>
</tr>
<tr>
  <td>int-to-byte</td>
  <td>int32 a;<br/>
    int32 result = (a &lt;&lt; 24) &gt;&gt; 24;
  </td>
  <td>Truncation of <code>int32</code> to <code>int8</code>, sign
    extending the result.
  </td>
</tr>
<tr>
  <td>int-to-char</td>
  <td>int32 a;<br/>
    int32 result = a &amp; 0xffff;
  </td>
  <td>Truncation of <code>int32</code> to <code>uint16</code>, without
    sign extension.
  </td>
</tr>
<tr>
  <td>int-to-short</td>
  <td>int32 a;<br/>
    int32 result = (a &lt;&lt; 16) &gt;&gt; 16;
  </td>
  <td>Truncation of <code>int32</code> to <code>int16</code>, sign
    extending the result.
  </td>
</tr>
<tr>
  <td>add-int</td>
  <td>int32 a, b;<br/>
    int32 result = a + b;
  </td>
  <td>Twos-complement addition.</td>
</tr>
<tr>
  <td>sub-int</td>
  <td>int32 a, b;<br/>
    int32 result = a - b;
  </td>
  <td>Twos-complement subtraction.</td>
</tr>
<tr>
  <td>rsub-int</td>
  <td>int32 a, b;<br/>
    int32 result = b - a;
  </td>
  <td>Twos-complement reverse subtraction.</td>
</tr>
<tr>
  <td>mul-int</td>
  <td>int32 a, b;<br/>
    int32 result = a * b;
  </td>
  <td>Twos-complement multiplication.</td>
</tr>
<tr>
  <td>div-int</td>
  <td>int32 a, b;<br/>
    int32 result = a / b;
  </td>
  <td>Twos-complement division, rounded towards zero (that is, truncated to
    integer). This throws <code>ArithmeticException</code> if
    <code>b == 0</code>.
  </td>
</tr>
<tr>
  <td>rem-int</td>
  <td>int32 a, b;<br/>
    int32 result = a % b;
  </td>
  <td>Twos-complement remainder after division. The sign of the result
    is the same as that of <code>a</code>, and it is more precisely
    defined as <code>result == a - (a / b) * b</code>. This throws
    <code>ArithmeticException</code> if <code>b == 0</code>.
  </td>
</tr>
<tr>
  <td>and-int</td>
  <td>int32 a, b;<br/>
    int32 result = a &amp; b;
  </td>
  <td>Bitwise AND.</td>
</tr>
<tr>
  <td>or-int</td>
  <td>int32 a, b;<br/>
    int32 result = a | b;
  </td>
  <td>Bitwise OR.</td>
</tr>
<tr>
  <td>xor-int</td>
  <td>int32 a, b;<br/>
    int32 result = a ^ b;
  </td>
  <td>Bitwise XOR.</td>
</tr>
<tr>
  <td>shl-int</td>
  <td>int32 a, b;<br/>
    int32 result = a &lt;&lt; (b &amp; 0x1f);
  </td>
  <td>Bitwise shift left (with masked argument).</td>
</tr>
<tr>
  <td>shr-int</td>
  <td>int32 a, b;<br/>
    int32 result = a &gt;&gt; (b &amp; 0x1f);
  </td>
  <td>Bitwise signed shift right (with masked argument).</td>
</tr>
<tr>
  <td>ushr-int</td>
  <td>uint32 a, b;<br/>
    int32 result = a &gt;&gt; (b &amp; 0x1f);
  </td>
  <td>Bitwise unsigned shift right (with masked argument).</td>
</tr>
<tr>
  <td>add-long</td>
  <td>int64 a, b;<br/>
    int64 result = a + b;
  </td>
  <td>Twos-complement addition.</td>
</tr>
<tr>
  <td>sub-long</td>
  <td>int64 a, b;<br/>
    int64 result = a - b;
  </td>
  <td>Twos-complement subtraction.</td>
</tr>
<tr>
  <td>mul-long</td>
  <td>int64 a, b;<br/>
    int64 result = a * b;
  </td>
  <td>Twos-complement multiplication.</td>
</tr>
<tr>
  <td>div-long</td>
  <td>int64 a, b;<br/>
    int64 result = a / b;
  </td>
  <td>Twos-complement division, rounded towards zero (that is, truncated to
    integer). This throws <code>ArithmeticException</code> if
    <code>b == 0</code>.
  </td>
</tr>
<tr>
  <td>rem-long</td>
  <td>int64 a, b;<br/>
    int64 result = a % b;
  </td>
  <td>Twos-complement remainder after division. The sign of the result
    is the same as that of <code>a</code>, and it is more precisely
    defined as <code>result == a - (a / b) * b</code>. This throws
    <code>ArithmeticException</code> if <code>b == 0</code>.
  </td>
</tr>
<tr>
  <td>and-long</td>
  <td>int64 a, b;<br/>
    int64 result = a &amp; b;
  </td>
  <td>Bitwise AND.</td>
</tr>
<tr>
  <td>or-long</td>
  <td>int64 a, b;<br/>
    int64 result = a | b;
  </td>
  <td>Bitwise OR.</td>
</tr>
<tr>
  <td>xor-long</td>
  <td>int64 a, b;<br/>
    int64 result = a ^ b;
  </td>
  <td>Bitwise XOR.</td>
</tr>
<tr>
  <td>shl-long</td>
  <td>int64 a, b;<br/>
    int64 result = a &lt;&lt; (b &amp; 0x3f);
  </td>
  <td>Bitwise shift left (with masked argument).</td>
</tr>
<tr>
  <td>shr-long</td>
  <td>int64 a, b;<br/>
    int64 result = a &gt;&gt; (b &amp; 0x3f);
  </td>
  <td>Bitwise signed shift right (with masked argument).</td>
</tr>
<tr>
  <td>ushr-long</td>
  <td>uint64 a, b;<br/>
    int64 result = a &gt;&gt; (b &amp; 0x3f);
  </td>
  <td>Bitwise unsigned shift right (with masked argument).</td>
</tr>
<tr>
  <td>add-float</td>
  <td>float a, b;<br/>
    float result = a + b;
  </td>
  <td>Floating point addition.</td>
</tr>
<tr>
  <td>sub-float</td>
  <td>float a, b;<br/>
    float result = a - b;
  </td>
  <td>Floating point subtraction.</td>
</tr>
<tr>
  <td>mul-float</td>
  <td>float a, b;<br/>
    float result = a * b;
  </td>
  <td>Floating point multiplication.</td>
</tr>
<tr>
  <td>div-float</td>
  <td>float a, b;<br/>
    float result = a / b;
  </td>
  <td>Floating point division.</td>
</tr>
<tr>
  <td>rem-float</td>
  <td>float a, b;<br/>
    float result = a % b;
  </td>
  <td>Floating point remainder after division. This function is different
    than IEEE 754 remainder and is defined as 
    <code>result == a - roundTowardZero(a / b) * b</code>.
  </td>
</tr>
<tr>
  <td>add-double</td>
  <td>double a, b;<br/>
    double result = a + b;
  </td>
  <td>Floating point addition.</td>
</tr>
<tr>
  <td>sub-double</td>
  <td>double a, b;<br/>
    double result = a - b;
  </td>
  <td>Floating point subtraction.</td>
</tr>
<tr>
  <td>mul-double</td>
  <td>double a, b;<br/>
    double result = a * b;
  </td>
  <td>Floating point multiplication.</td>
</tr>
<tr>
  <td>div-double</td>
  <td>double a, b;<br/>
    double result = a / b;
  </td>
  <td>Floating point division.</td>
</tr>
<tr>
  <td>rem-double</td>
  <td>double a, b;<br/>
    double result = a % b;
  </td>
  <td>Floating point remainder after division. This function is different
    than IEEE 754 remainder and is defined as 
    <code>result == a - roundTowardZero(a / b) * b</code>.
  </td>
</tr>
</tbody>
</table>

</body>
</html>