File: code_attribute.e

package info (click to toggle)
smarteiffel 1.1-11
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 12,288 kB
  • ctags: 40,785
  • sloc: ansic: 35,791; lisp: 4,036; sh: 1,783; java: 895; ruby: 613; python: 209; makefile: 115; csh: 78; cpp: 50
file content (1975 lines) | stat: -rw-r--r-- 41,514 bytes parent folder | download | duplicates (2)
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
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
-- This file is part of SmartEiffel The GNU Eiffel Compiler Tools and Libraries
--
-- SmartEiffel is  free software;  you can redistribute it and/or  modify it
-- under  the terms of the  GNU General Public License, as published by  the
-- Free Software Foundation; either version 2, or (at your option) any later
-- version.
-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT 
-- ANY WARRANTY;  without  even the implied warranty  of MERCHANTABILITY  or
-- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-- more details.  You should have received a copy of  the GNU General Public
-- License along with SmartEiffel;  see the file COPYING.  If not,  write to
-- the Free Software Foundation,  Inc., 59 Temple Place - Suite 330,  Boston, 
-- MA 02111-1307, USA.
--
-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.
--			   - University of Nancy 1 - FRANCE
-- Copyright(C) 2003:      INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne
--			   - University of Nancy 2 - FRANCE
--
--		 Dominique COLNET, Suzanne COLLIN, Olivier ZENDRA,
--			   Philippe RIBET, Cyril ADRIAN
--
-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
--
class CODE_ATTRIBUTE
   --
   -- Unique Global Object in charge of a Code_attribute as
   -- describe in the JVM specification.
   -- Obviously, the same object is recycled for all code part.
   --
inherit
   GLOBALS
   VISITABLE

feature

   stack_level: INTEGER
         -- Used to compute `max_stack'

   item(index: INTEGER): INTEGER is
	 -- Mostly to write assertion (equivalent to `code.item(index)').
      do
	 Result := code.item(index)
      end
   
feature {METHOD_INFO}

   clear is
      do
         code.clear
         exception_table.clear
         line_number_table.clear
         max_stack := 0
         stack_level := 0
         max_locals := jvm.max_locals
      end

   store_in(storage: STRING) is
      local
         i: INTEGER
      do
         append_u2(storage,constant_pool.idx_constant_utf8)
         check
            program_counter > 0
         end
         append_u4(storage,12 + program_counter + exception_table.length + line_number_table.length )
         append_u2(storage,max_stack)
         append_u2(storage,max_locals)
         append_u4(storage,program_counter)
         from
            i := 0
         until
            i > code.upper
         loop
            append_u1(storage,code.item(i))
            i := i + 1
         end
         exception_table.store_in(storage)
         -- attribute_count :
         line_number_table.store_in( storage )
      end

feature

   program_counter: INTEGER is
      do
         Result := code.count
      end

   extra_local(local_type: E_TYPE): INTEGER is
      require
         local_type.is_run_type
      do
         Result := max_locals
         max_locals := max_locals + local_type.jvm_stack_space
      end

   extra_local_size1: INTEGER is
      do
         Result := max_locals
         max_locals := max_locals + 1
      end

feature -- opcode feature list :

   opcode_nop is
      do
         opcode(0,0)
      end

   opcode_aconst_null is
      do
         opcode(1,1)
      end

   opcode_iconst_m1 is
      do
         opcode(2,1)
      end

   opcode_iconst_0 is
      do
         opcode(3,1)
      end

   opcode_iconst_1 is
      do
         opcode(4,1)
      end

   opcode_iconst_i(n: INTEGER) is
      require
         -1 <= n
         n <= 5
      do
         opcode(3 + n,1)
      end

   opcode_lconst_0 is
      do
         opcode(9,2)
      end

   opcode_lconst_1 is
      do
         opcode(10,2)
      end

   opcode_lconst_i(n: INTEGER) is
      require
         0 <= n
         n <= 1
      do
         opcode(9 + n,2)
      end

   opcode_fconst_0 is
      do
         opcode(11,1)
      end

   opcode_dconst_0 is
      do
         opcode(14,2)
      end

   opcode_bipush(byte: INTEGER) is
         -- Sign-extended value.
      require
         byte.in_range(0,255)
      do
         opcode(16,1)
         add_u1(byte)
      end

   opcode_sipush(u2: INTEGER) is
      require
         -32768 <= u2
         u2 <= 32767
         (u2 < -128 or 127 < u2)
      do
         opcode(17,1)
         add_u2(u2)
      end

   opcode_ldc(idx: INTEGER) is
         -- For both ldc and ldc_w.
      require
         constant_pool.valid_index(idx)
      do
         if idx < 255 then
            opcode(18,1)
            add_u1(idx)
         else
            opcode(19,1)
            add_u2(idx)
         end
      end

   opcode_fload(index: INTEGER) is
      require
         0 <= index
         index <= 255
      do
         if index <= 3 then
            opcode(34 + index,1)
         else
            opcode(23,1)
            add_u1(index)
         end
      end

   opcode_dload_0 is
      do
         opcode(38,2)
      end

   opcode_dload(index: INTEGER) is
      require
         0 <= index
         index <= 255
      do
         if index <= 3 then
            opcode(38 + index,2)
         else
            opcode(24,2)
            add_u1(index)
         end
      end

   opcode_aload(index: INTEGER) is
      require
         0 <= index
         index <= 255
      do
         if index <= 3 then
            opcode(42 + index,1)
         else
            opcode(25,1)
            add_u1(index)
         end
      end

   opcode_iload_0 is
      do
         opcode(26,1)
      end

   opcode_iload_1 is
      do
         opcode(27,1)
      end

   opcode_iload_2 is
      do
         opcode(28,1)
      end

   opcode_iload_3 is
      do
         opcode(29,1)
      end

   opcode_iload(index: INTEGER) is
      require
         0 <= index
         index <= 255
      do
         if index <= 3 then
            opcode(26 + index,1)
         else
            opcode(21,1)
            add_u1(index)
         end
      end

   opcode_lload_0 is
      do
         opcode(30,2)
      end

   opcode_lload_1 is
      do
         opcode(31,2)
      end

   opcode_lload_2 is
      do
         opcode(32,2)
      end

   opcode_lload_3 is
      do
         opcode(33,2)
      end

   opcode_lload(index: INTEGER) is
      require
         0 <= index
         index <= 255
      do
         if index <= 3 then
            opcode(30 + index,2)
         else
            opcode(22,2)
            add_u1(index)
         end
      end

   opcode_aload_0 is
      do
         opcode(42,1)
      end

   opcode_aload_1 is
      do
         opcode(43,1)
      end

   opcode_aload_2 is
      do
         opcode(44,1)
      end

   opcode_aload_3 is
      do
         opcode(45,1)
      end

   opcode_iaload is
      do
         opcode(46,-1)
      end

   opcode_laload is
      do
         opcode(47,0)
      end

   opcode_faload is
      do
         opcode(48,-1)
      end

   opcode_daload is
      do
         opcode(49,0)
      end

   opcode_aaload is
      do
         opcode(50,-1)
      end

   opcode_baload is
      do
         opcode(51,-1)
      end

   opcode_caload is
      do
         opcode(52,-1)
      end

   opcode_saload is
      do
         opcode(53,-1)
      end

   opcode_istore_3 is
      do
         opcode(62,-1)
      end

   opcode_istore(offset: INTEGER) is
      require
         0 <= offset
         offset <= 255
      do
         if offset <= 3 then
            opcode(59 + offset,-1)
         else
            opcode(54,-1)
            add_u1(offset)
         end
      end

   opcode_lstore(offset: INTEGER) is
      require
         0 <= offset
         offset <= 255
      do
         if offset <= 3 then
            opcode(63 + offset,-1)
         else
            opcode(55,-1)
            add_u1(offset)
         end
      end

   opcode_fstore(offset: INTEGER) is
      require
         0 <= offset
         offset <= 255
      do
         if offset <= 3 then
            opcode(67 + offset,-1)
         else
            opcode(56,-1)
            add_u1(offset)
         end
      end

   opcode_dstore(offset: INTEGER) is
      require
         0 <= offset
         offset <= 255
      do
         if offset <= 3 then
            opcode(71 + offset,-1)
         else
            opcode(57,-1)
            add_u1(offset)
         end
      end

   opcode_astore_0 is
      do
         opcode(75,-1)
      end

   opcode_astore_1 is
      do
         opcode(76,-1)
      end

   opcode_astore_2 is
      do
         opcode(77,-1)
      end

   opcode_astore_3 is
      do
         opcode(78,-1)
      end

   opcode_astore(offset: INTEGER) is
      require
         0 <= offset
         offset <= 255
      do
         if offset <= 3 then
            opcode(75 + offset,-1)
         else
            opcode(58,-1)
            add_u1(offset)
         end
      end

   opcode_iastore is
      do
         opcode(79,-3)
      end

   opcode_lastore is
      do
         opcode(80,-4)
      end

   opcode_fastore is
      do
         opcode(81,-3)
      end

   opcode_dastore is
      do
         opcode(82,-4)
      end

   opcode_aastore is
      do
         opcode(83,-3)
      end

   opcode_bastore is
      do
         opcode(84,-3)
      end

   opcode_castore is
      do
         opcode(85,-3)
      end

   opcode_sastore is
      do
         opcode(86,-3)
      end

   opcode_pop is
      do
         opcode(87,-1)
      end

   opcode_pop2 is
      do
         opcode(88,-2)
      end

   opcode_dup is
      do
         opcode(89,1)
      end

   opcode_dup_x1 is
      do
         opcode(90,1)
      end

   opcode_dup_x2 is
      do
         opcode(91,1)
      end

   opcode_dup2 is
      do
         opcode(92,2)
      end

   opcode_dup2_x1 is
      do
         opcode(93,2)
      end

   opcode_swap is
      do
         opcode(95,0)
      end

   opcode_iadd is
      do
         opcode(96,-1)
      end

   opcode_ladd is
      do
         opcode(97,-2)
      end

   opcode_fadd is
      do
         opcode(98,-1)
      end

   opcode_dadd is
      do
         opcode(99,-2)
      end

   opcode_isub is
      do
         opcode(100,-1)
      end

   opcode_lsub is
      do
         opcode(101,-2)
      end

   opcode_fsub is
      do
         opcode(102,-1)
      end

   opcode_dsub is
      do
         opcode(103,-2)
      end

   opcode_imul is
      do
         opcode(104,-1)
      end

   opcode_lmul is
      do
         opcode(105,-2)
      end

   opcode_fmul is
      do
         opcode(106,-1)
      end

   opcode_dmul is
      do
         opcode(107,-2)
      end

   opcode_idiv is
      do
         opcode(108,-1)
      end

   opcode_ldiv is
      do
         opcode(109,-2)
      end

   opcode_fdiv is
      do
         opcode(110,-1)
      end

   opcode_ddiv is
      do
         opcode(111,-2)
      end

   opcode_irem is
      do
         opcode(112,-1)
      end

   opcode_lrem is
      do
         opcode(113,-2)
      end

   opcode_ineg is
      do
         opcode(116,0)
      end

   opcode_lneg is
      do
         opcode(117,0)
      end

   opcode_fneg is
      do
         opcode(118,0)
      end

   opcode_dneg is
      do
         opcode(119,0)
      end

   opcode_ishl is
      do
         opcode(120,-1)
      end

   opcode_lshl is
      do
         opcode(121,-2)
      end

   opcode_ishr is
      do
         opcode(122,-1)
      end

   opcode_lshr is
      do
         opcode(123,-2)
      end

   opcode_iushr is
      do
         opcode(124,-1)
      end

   opcode_lushr is
      do
         opcode(125,-2)
      end

   opcode_iand is
      do
         opcode(126,-1)
      end

   opcode_land is
      do
         opcode(127,-2)
      end

   opcode_ior is
      do
         opcode(128,-1)
      end

   opcode_lor is
      do
         opcode(129,-2)
      end

   opcode_ixor is
      do
         opcode(130,-1)
      end

   opcode_lxor is
      do
         opcode(131,-2)
      end

   opcode_iinc(loc_idx, u1_increment: INTEGER) is
      do
         opcode(132,0)
         add_u1(loc_idx)
         add_u1(u1_increment)
      end

   opcode_i2l is
      do
         opcode(133,1)
      end

   opcode_i2f is
      do
         opcode(134,0)
      end

   opcode_i2d is
      do
         opcode(135,1)
      end

   opcode_l2i is
      do
         opcode(136,-1)
      end

   opcode_l2f is
      do
         opcode(137,-1)
      end

   opcode_l2d is
      do
         opcode(138,0)
      end

   opcode_f2i is
      do
         opcode(139,0)
      end

   opcode_f2l is
      do
         opcode(140,1)
      end

   opcode_f2d is
      do
         opcode(141,1)
      end

   opcode_d2i is
      do
         opcode(142,-1)
      end

   opcode_d2l is
      do
         opcode(143,0)
      end

   opcode_d2f is
      do
         opcode(144,-1)
      end

   opcode_i2b is
      do
         opcode(145,0)
      end

   opcode_i2c is
      do
         opcode(146,0)
      end

   opcode_i2s is
      do
         opcode(147,0)
      end

   opcode_lcmp is
      do
         opcode(148,-3)
      end

   opcode_fcmpg is
      do
         opcode(150,-1)
      end

   opcode_fcmpl is
      do
         opcode(149,-1)
      end

   opcode_dcmpl is
      do
         opcode(151,-3)
      end

   opcode_dcmpg is
      do
         opcode(152,-3)
      end

   opcode_ifeq: INTEGER is
      do
         opcode(153,-1)
         Result := skip_2_bytes
      end

   opcode_ifne: INTEGER is
      do
         opcode(154,-1)
         Result := skip_2_bytes
      end

   opcode_iflt: INTEGER is
      do
         opcode(155,-1)
         Result := skip_2_bytes
      end

   opcode_ifge: INTEGER is
      do
         opcode(156,-1)
         Result := skip_2_bytes
      end

   opcode_ifgt: INTEGER is
      do
         opcode(157,-1)
         Result := skip_2_bytes
      end

   opcode_ifle: INTEGER is
      do
         opcode(158,-1)
         Result := skip_2_bytes
      end

   opcode_if_icmpeq: INTEGER is
      do
         opcode(159,-2)
         Result := skip_2_bytes
      end

   opcode_if_icmpne: INTEGER is
      do
         opcode(160,-2)
         Result := skip_2_bytes
      end

   opcode_if_icmplt: INTEGER is
      do
         opcode(161,-2)
         Result := skip_2_bytes
      end

   opcode_if_icmpge: INTEGER is
      do
         opcode(162,-2)
         Result := skip_2_bytes
      end

   opcode_if_icmpgt: INTEGER is
      do
         opcode(163,-2)
         Result := skip_2_bytes
      end

   opcode_if_icmple: INTEGER is
      do
         opcode(164,-2)
         Result := skip_2_bytes
      end

   opcode_if_acmpeq: INTEGER is
      do
         opcode(165,-2)
         Result := skip_2_bytes
      end

   opcode_if_acmpne: INTEGER is
      do
         opcode(166,-2)
         Result := skip_2_bytes
      end

   opcode_goto: INTEGER is
      do
         opcode(167,0)
         Result := skip_2_bytes
      end

   opcode_goto_backward(back_point: INTEGER) is
         -- Produce a goto opcode to go back at `back_point'.
      require
         back_point < program_counter
      local
         r, q, offset: INTEGER
      do
         offset := program_counter - back_point
         opcode(167,0)
         r := offset \\ 256
         q := offset // 256
         if r = 0 then
            add_u1(256 - q)
            add_u1(0)
         else
            add_u1(255 - q)
            add_u1(256 - r)
         end
      end

   opcode_ireturn is
      do
         add_u1(172)
      end

   opcode_lreturn is
      do
         add_u1(173)
      end

   opcode_freturn is
      do
         add_u1(174)
      end

   opcode_dreturn is
      do
         add_u1(175)
      end

   opcode_areturn is
      do
         add_u1(176)
      end

   opcode_return is
      do
         add_u1(177)
      end

   opcode_getstatic(fieldref_idx, stack_inc: INTEGER) is
      require
         constant_pool.valid_index(fieldref_idx)
      do
         opcode(178,stack_inc)
         add_u2(fieldref_idx)
      end

   opcode_putstatic(fieldref_idx, stack_inc: INTEGER) is
      require
         constant_pool.valid_index(fieldref_idx)
      do
         opcode(179,stack_inc)
         add_u2(fieldref_idx)
      end

   opcode_getfield(fieldref_idx, stack_inc: INTEGER) is
      require
         constant_pool.valid_index(fieldref_idx)
      do
         opcode(180,stack_inc)
         add_u2(fieldref_idx)
      end

   opcode_putfield(fieldref_idx, stack_inc: INTEGER) is
      require
         constant_pool.valid_index(fieldref_idx)
      do
         opcode(181,stack_inc)
         add_u2(fieldref_idx)
      end

   opcode_invokevirtual(methodref_idx, stack_inc: INTEGER) is
      require
         constant_pool.is_methodref(methodref_idx)
      do
         opcode(182,stack_inc)
         add_u2(methodref_idx)
      end

   opcode_invokespecial(methodref_idx, stack_inc: INTEGER) is
      require
         constant_pool.is_methodref(methodref_idx)
      do
         opcode(183,stack_inc)
         add_u2(methodref_idx)
      end

   opcode_invokestatic(methodref_idx, stack_inc: INTEGER) is
      require
         constant_pool.is_methodref(methodref_idx)
      do
         opcode(184,stack_inc)
         add_u2(methodref_idx)
      end

   opcode_invokeinterface(methodref_idx, stack_inc, stack_words: INTEGER) is
      require
         constant_pool.is_interface_methodref(methodref_idx)
      do
         opcode(185,stack_inc)
         add_u2(methodref_idx)
         add_u1(stack_words)
         opcode_nop
      end

   opcode_new(class_idx: INTEGER) is
      require
         constant_pool.is_class(class_idx)
      do
         opcode(187,1)
         add_u2(class_idx)
      end

   opcode_newarray(u1: INTEGER) is
      require
         4 <= u1
         u1 <= 11
      do
         opcode(188,0)
         add_u1(u1)
      end

   opcode_anewarray(idx: INTEGER) is
      require
         constant_pool.valid_index(idx)
      do
         opcode(189,0)
         add_u2(idx)
      end

   opcode_arraylength is
      do
         opcode(190,0)
      end

   opcode_athrow is
      do
         opcode(191,0)
      end

feature 

   opcode_checkcast(class_idx: INTEGER) is
      require
         constant_pool.is_class(class_idx)
      do
         opcode(192,0)
         add_u2(class_idx)
      end

feature {MANIFEST_STRING_INSPECTOR}

   opcode_tableswitch(lower, upper: INTEGER; points: FIXED_ARRAY[INTEGER]): INTEGER is
      require
         points /= Void
         upper > lower
      local
         i: INTEGER
      do
         points.make(upper-lower+1)
         opcode(170,-1)
         pad_4
         Result := skip_4_bytes
         add_u4(lower)
         add_u4(upper)
         from
            i := lower
         until
            i > upper
         loop
            points.put(skip_4_bytes, i - lower)
            i := i + 1
         end
      end

   opcode_lookupswitch(values: FIXED_ARRAY[INTEGER]; points: FIXED_ARRAY[INTEGER]): INTEGER is
         -- THE `values' ARRAY WILL BE SORTED!
      require
         points /= Void
         values.count > 0
      local
         i: INTEGER
         cs: COLLECTION_SORTER[INTEGER]
      do
         points.make(values.count)
         cs.sort(values)
         opcode(171,-1)
         pad_4
         Result := skip_4_bytes
         add_u4(values.count)
         from
            i := values.lower
         until
            i > values.upper
         loop
            add_u4(values.item(i))
            points.put(skip_4_bytes, i)
            i := i + 1
         end
      ensure
         --values_sorted: (create {COLLECTION_SORTER[INTEGER]}).is_sorted(values)
      end

   resolve_tableswitch_branch(opcode_pc: INTEGER; points: FIXED_ARRAY[INTEGER]; index: INTEGER) is
      require
         points.valid_index(index)
         item(opcode_pc) = 170
         opcode_pc < program_counter
         -- `points' has been set by `opcode_tableswitch'
      do
         resolve_u4_branch(points.item(index), opcode_pc)
      end

   resolve_lookupswitch_branch(opcode_pc: INTEGER; points: FIXED_ARRAY[INTEGER]; index: INTEGER) is
      require
         points.valid_index(index)
         item(opcode_pc) = 171
         opcode_pc < program_counter
         -- `points' has been set by `opcode_lookupswitch'
      do
         resolve_u4_branch(points.item(index), opcode_pc)
      end

   resolve_tableswitch_default_branch(opcode_pc, start_point: INTEGER) is
      require
         opcode_pc < program_counter
	 item(opcode_pc) = 170
         -- `start_point' is the point returned by `opcode_tableswitch'
      do
         resolve_u4_branch(start_point, opcode_pc)
      end

   resolve_lookupswitch_default_branch(opcode_pc, start_point: INTEGER) is
      require
         item(opcode_pc) = 171
         opcode_pc < program_counter
         -- `start_point' is the point returned by `opcode_lookupswitch'
      do
         resolve_u4_branch(start_point, opcode_pc)
      end

feature {NONE}

   resolve_u4_branch(branch_point, from_pc: INTEGER) is
      local
         offset: INTEGER
      do
         offset := program_counter - from_pc
         put_code((offset |>>> 24) & 0x000000ff, branch_point)
         put_code((offset |>>> 16) & 0x000000ff, branch_point + 1)
         put_code((offset |>>>  8) & 0x000000ff, branch_point + 2)
         put_code( offset          & 0x000000ff, branch_point + 3)
      end

feature {RUN_CLASS,NATIVE}

   opcode_instanceof(class_idx: INTEGER) is
      require
         constant_pool.is_class(class_idx)
      do
         opcode(193,0)
         add_u2(class_idx)
      end

feature {NATIVE}

   opcode_monitorenter is
      do
         opcode(194,0)
      end

   opcode_monitorexit is
      do
         opcode(195,0)
      end

feature

   opcode_multianewarray(idx: INTEGER; dims: INTEGER) is
      require
         constant_pool.valid_index(idx)
         dims > 0 and dims < 256
      do
         opcode(197,0)
         add_u2(idx)
         add_u1(dims)
      end

feature

   opcode_ifnull: INTEGER is
      do
         opcode(198,-1)
         Result := skip_2_bytes
      end

   opcode_ifnonnull: INTEGER is
      do
         opcode(199,-1)
         Result := skip_2_bytes
      end

feature -- High level opcode calls :

   opcode_push_integer(i: INTEGER) is
      do
         if i < -32768 then
            push_strange_integer(i)
         elseif i < -128 then
            opcode_sipush(i)
         elseif i < -1 then
            opcode_bipush(256 + i)
         elseif i <= 5 then
            opcode_iconst_i(i)
         elseif i <= 127 then
            opcode_bipush(i)
         elseif i <= 32767 then
            opcode_sipush(i)
         else
            push_strange_integer(i)
         end
      end

   opcode_push_long(i: INTEGER) is
      do
         if i < 0 then
            push_strange_long(i)
         elseif i <= 1 then
            opcode_lconst_i(i)
         else
            push_strange_long(i)
         end
      end

   opcode_push_as_integer_64(str: STRING) is
      require
         str.count >= 1
      do
         if str.item(1) = '0' and str.count = 1 then
            opcode(9,2)
         elseif str.item(1) = '1' and str.count = 1 then
            opcode(10,2)
         else
            opcode_string2long(str)
         end
      end

   opcode_push_as_float(str: STRING) is
      require
         str.count >= 1
      do
         inspect
            str.item(1)
         when '0' then
            if str.count = 1 then
               opcode(11,1)
            else
               inspect
                  str.item(2)
               when '.' then
                  if str.count = 2 then
                     opcode(11,1)
                  elseif str.count = 3 and then str.item(3) = '0' then
                     opcode(11,1)
                  else
                     opcode_string2float(str)
                  end
               else
                  opcode_string2float(str)
               end
            end
         when '1' then
            if str.count = 1 then
               opcode(12,1)
            else
               inspect
                  str.item(2)
               when '.' then
                  if str.count = 2 then
                     opcode(12,1)
                  elseif str.count = 3 and then str.item(3) = '0' then
                     opcode(12,1)
                  else
                     opcode_string2float(str)
                  end
               else
                  opcode_string2float(str)
               end
            end
         when '2' then
            if str.count = 1 then
               opcode(13,1)
            else
               inspect
                  str.item(2)
               when '.' then
                  if str.count = 2 then
                     opcode(13,1)
                  elseif str.count = 3 and then str.item(3) = '0' then
                     opcode(13,1)
                  else
                     opcode_string2float(str)
                  end
               else
                  opcode_string2float(str)
               end
            end
         else
            opcode_string2float(str)
         end
      end

   opcode_push_as_double(str: STRING) is
      require
         str.count >= 1
      do
         inspect
            str.item(1)
         when '0' then
            if str.count = 1 then
               opcode(14,2)
            else
               inspect
                  str.item(2)
               when '.' then
                  if str.count = 2 then
                     opcode(14,2)
                  elseif str.count = 3 and then str.item(3) = '0' then
                     opcode(14,2)
                  else
                     opcode_string2double(str)
                  end
               else
                  opcode_string2double(str)
               end
            end
         when '1' then
            if str.count = 1 then
               opcode(15,2)
            else
               inspect
                  str.item(2)
               when '.' then
                  if str.count = 2 then
                     opcode(15,2)
                  elseif str.count = 3 and then str.item(3) = '0' then
                     opcode(15,2)
                  else
                     opcode_string2double(str)
                  end
               else
                  opcode_string2double(str)
               end
            end
         else
            opcode_string2double(str)
         end
      end

   opcode_push_manifest_string(ms: STRING) is
         -- Produces code to push the corresponding Eiffel STRING.
      local
         ms_idx: INTEGER
      do
         ms_idx := constant_pool.idx_string2(ms)
         opcode_ldc(ms_idx)
         opcode_java_string2eiffel_string
      end

   opcode_java_string2bytes_array is
         -- Used the pushed Java String to create the bytes array.
      local
         idx: INTEGER
      do
         idx := constant_pool.idx_methodref3(fz_java_lang_string,fz_33,fz_34)
         opcode_invokevirtual(idx,0)
      end

   opcode_java_string2eiffel_string is
         -- Used the pushed Java String to create a new Eiffel STRING.
      do
         opcode_java_string2bytes_array
         opcode_bytes_array2eiffel_string
      end

   opcode_bytes_array2eiffel_string is
         -- Used the pushed Bytes array to create a new Eiffel STRING.
      local
         cp: like constant_pool
         loc: INTEGER
         rc_string: RUN_CLASS
      do
         cp := constant_pool
         rc_string := type_string.run_class
         loc := extra_local_size1
         opcode_astore(loc)
         -- The new STRING :
         rc_string.jvm_basic_new
         -- Set count :
         opcode_dup
         opcode_aload(loc)
         opcode_arraylength
         opcode_putfield(cp.idx_eiffel_string_count_fieldref,-2)
         -- Set capacity :
         opcode_dup
         opcode_aload(loc)
         opcode_arraylength
         opcode_putfield(cp.idx_eiffel_string_capacity_fieldref,-2)
         -- Set storage :
         opcode_dup
         opcode_aload(loc)
         opcode_putfield(cp.idx_eiffel_string_storage_fieldref,-2)
      end

feature {TYPE_BIT}

   opcode_bitset_clone is
      local
         cp: like constant_pool
         idx: INTEGER
      do
         cp := constant_pool
         idx := cp.idx_methodref3(fz_java_util_bitset,fz_a6,fz_a7)
         opcode_invokevirtual(idx,0)
         idx := cp.idx_class2(fz_java_util_bitset)
         opcode_checkcast(idx)
      end

feature -- Easy access to some Java basics:

   opcode_println(string_idx: INTEGER) is
      require
         constant_pool.valid_index(string_idx)
      local
         idx: INTEGER
      do
         opcode_ldc(string_idx)
         idx := constant_pool.idx_methodref3(fz_25,fz_51,fz_57)
         opcode_invokevirtual(idx,-2)
      end

feature {NONE}

   opcode(opcode_value, max_stack_increment: INTEGER) is
      require
         stack_level >= 0
         opcode_value <= 255
      local
         cs: INTEGER
      do
         add_u1(opcode_value)
         cs := stack_level + max_stack_increment
         if cs >= 0 then
            stack_level := cs
         else
            -- ????
         end
         if stack_level > max_stack then
            max_stack := stack_level
         end
      ensure
         stack_level >= 0
      end

   add_u1(u1: INTEGER) is
      do
         add_code(u1)
      ensure
         program_counter = 1 + old program_counter
      end

   add_u2(u2: INTEGER) is
      local
         hi: INTEGER
         lo: INTEGER
         u: INTEGER
      do
         u := u2.abs
         hi := (u |>> 8) & 0x000000ff
         lo :=  u        & 0x000000ff
         if u2 < 0 then
            hi := ~hi & 0x000000ff
            lo := ~lo & 0x000000ff
            if lo <= 255 then
               lo := lo + 1
            else
               lo := 0
               hi := hi + 1
            end
         end
         add_u1( hi )
         add_u1( lo )
      ensure
         program_counter = 2 + old program_counter
      end

   skip_2_bytes: INTEGER is
         -- Return the `programm_counter' before the skip.
      do
         Result := program_counter
         add_code(0)
         add_code(0)
      end

   add_u4(u4: INTEGER) is
         -- Used by tableswitch and lookupswitch
      local
         hihi, hilo, lohi, lolo: INTEGER
         u: INTEGER
      do
         u := u4.abs

         hihi := (u |>>> 24) & 0x000000ff
         hilo := (u |>>> 16) & 0x000000ff
         lohi := (u |>>>  8) & 0x000000ff
         lolo :=  u          & 0x000000ff

         if u4 < 0 then
            hihi := (~hihi) & 0x000000ff
            hilo := (~hilo) & 0x000000ff
            lohi := (~lohi) & 0x000000ff
            lolo := (~lolo) & 0x000000ff

            if lolo < 255 then
               lolo := lolo + 1
            else
               lolo := 0
               if lohi < 255 then
                  lohi := lohi + 1
               else
                  lohi := 0
                  if hilo < 255 then
                     hilo := hilo + 1
                  else
                     hilo := 0
                     hihi := hihi + 1
                  end
               end
            end
         end

         check
            hihi >= 0 and then hihi <= 255
            hilo >= 0 and then hilo <= 255
            lohi >= 0 and then lohi <= 255
            lolo >= 0 and then lolo <= 255
         end

         add_u1( hihi )
         add_u1( hilo )
         add_u1( lohi )
         add_u1( lolo )
      ensure
         program_counter = 4 + old program_counter
      end

   skip_4_bytes: INTEGER is
         -- Return the `programm_counter' before the skip.
         -- Used by tableswitch and lookupswitch
      do
         Result := program_counter
         add_code(0)
         add_code(0)
         add_code(0)
         add_code(0)
      end

   pad_4 is
      do
         from
         until
            program_counter \\ 4 = 0
         loop
            add_code(0)
         end
      ensure
         program_counter \\ 4 = 0
      end

feature

   resolve_u2_branch(start_point: INTEGER) is
      require
         start_point < program_counter
         start_point > 0
      local
         offset: INTEGER
      do
         offset := program_counter - start_point + 1
         put_code(offset // 256,start_point)
         put_code(offset \\ 256,start_point + 1)
      end

feature

   next_branch_array_index: INTEGER
   
   get_branch_array_index: INTEGER is
      require
         next_branch_array_index >= 0
      local
         fai: FIXED_ARRAY[INTEGER]
      do
         branch_array.item(next_branch_array_index).clear
         Result := next_branch_array_index
         next_branch_array_index := next_branch_array_index + 1
         if not branch_array.valid_index( next_branch_array_index ) then
            create fai.with_capacity(16)
            branch_array.force( fai, next_branch_array_index )
         end
      end
      
   release_branch_array_index is
      do
         next_branch_array_index := next_branch_array_index - 1
      ensure
         next_branch_array_index >= 0
      end
      
   add_branch( point: INTEGER; index: INTEGER ) is
      require
         branch_array.valid_index(index)
      do
         branch_array.item(index).add_last(point)
      ensure
         branch_array.item(index).has(point)
      end
      
   branch_array: FIXED_ARRAY[FIXED_ARRAY[INTEGER]] is
      local
         fai: FIXED_ARRAY[INTEGER]
      once
         !!Result.with_capacity(4)
         create fai.with_capacity(16)
         branch_array.force( fai, 0 )
         create fai.with_capacity(16)
         branch_array.force( fai, 1 )
         create fai.with_capacity(16)
         branch_array.force( fai, 2 )
         create fai.with_capacity(16)
         branch_array.force( fai, 3 )
      end

   resolve_branches( index: INTEGER ) is
      do
         resolve_with(branch_array.item(index))
      end

   resolve_with(points: FIXED_ARRAY[INTEGER]) is
      local
         i: INTEGER
      do
         from
            i := points.upper
         until
            i < 0
         loop
            resolve_u2_branch(points.item(i))
            i := i - 1
         end
      end

feature {NONE}

   check_flag_idx,  skip_check: INTEGER

feature {ASSERTION_LIST}

   check_opening is
      local
         cp: like constant_pool
      do
         cp := constant_pool
         opcode_iconst_1
         check_flag_idx := cp.idx_fieldref3(jvm_root_class,fz_58,fz_41)
         opcode_getstatic(check_flag_idx,1)
         skip_check := opcode_ifne
         opcode_putstatic(check_flag_idx,-1)
      end

   check_closing is
      do
         opcode_iconst_0
         opcode_putstatic(check_flag_idx,-1)
         resolve_u2_branch(skip_check)
      end

feature {NONE}

   opcode_string2long(str: STRING) is
      local
         idx: INTEGER
      do
         idx := constant_pool.idx_string(str)
         opcode_ldc(idx)
         idx := constant_pool.idx_methodref3(fz_java_lang_long,fz_c1,fz_de)
         opcode_invokestatic(idx,1)
      end

   opcode_string2double(str: STRING) is
      local
         idx: INTEGER
      do
         idx := constant_pool.idx_string(str)
         opcode_ldc(idx)
         idx := constant_pool.idx_methodref3(fz_java_lang_double,fz_c0,fz_61)
         opcode_invokestatic(idx,1)
      end

   opcode_string2float(str: STRING) is
      do
         opcode_string2double(str)
         opcode_d2f
      end

feature {NONE}

   push_strange_integer(i: INTEGER) is
      local
         idx: INTEGER
         cp: like constant_pool
      do
         cp := constant_pool
         tmp_string.clear
         i.append_in(tmp_string)
         idx := cp.idx_string(tmp_string)
         opcode_ldc(idx)
         idx := cp.idx_methodref3(fz_java_lang_integer,fz_82,fz_83)
         opcode_invokestatic(idx,0)
      end

   push_strange_long(i: INTEGER) is
      local
         idx: INTEGER
         cp: like constant_pool
      do
         cp := constant_pool
         tmp_string.clear
         i.append_in(tmp_string)
         idx := cp.idx_string(tmp_string)
         opcode_ldc(idx)
         idx := cp.idx_methodref3(fz_java_lang_long,fz_c1,fz_de)
         opcode_invokestatic(idx,0)
       end

   tmp_string: STRING is
      once
         !!Result.make(32)
      end

feature {NONE}

   exception_table: EXCEPTION_TABLE is
      once
         !!Result.make
      end

feature

   add_exception(f, t, h, idx: INTEGER) is
      do
         exception_table.add(f,t,h,idx)
      end

feature -- Calls to SmartEiffelRuntime.java :


   runtime_die_with_code is
         -- Assume the status code is already pushed.
      local
         cp: like constant_pool
         idx: INTEGER
      do
         cp := constant_pool
         idx := cp.idx_methodref3(fz_se_runtime,as_die_with_code,fz_27)
         opcode_invokestatic(idx,-1)
      end

   runtime_internal_exception_number is
      local
         cp: like constant_pool
         idx: INTEGER
      do
         cp := constant_pool
         idx := cp.idx_fieldref3(fz_se_runtime,"internal_exception_number",fz_i)
         opcode_getstatic(idx,1)
      end

   runtime_error(p: POSITION; t: E_TYPE; message: STRING) is
      local
         cp: like constant_pool
         idx: INTEGER
      do
         cp := constant_pool
         push_position(p)
         if t = Void then
            opcode_aconst_null
         else
            opcode_ldc(cp.idx_string(t.run_time_mark))
         end
         opcode_ldc(cp.idx_string(message))
         idx := cp.idx_methodref3(fz_se_runtime,"runtime_error",
         "(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V")
         opcode_invokestatic(idx,-5)
      end

   runtime_error_bad_target(p: POSITION; t: E_TYPE; message: STRING) is
         -- Assume the bad target is pushed.
         -- The expected type, if any is `t'.
      local
         cp: like constant_pool
         idx: INTEGER
      do
         cp := constant_pool
         push_position(p)
         opcode_ldc(cp.idx_string(t.run_time_mark))
         if message = Void then
            opcode_aconst_null
         else
            opcode_ldc(cp.idx_string(message))
         end
         idx := cp.idx_methodref3(fz_se_runtime,"runtime_error_bad_target",
         "(Ljava/lang/Object;IILjava/lang/String;Ljava/lang/String;%
         %Ljava/lang/String;)V")
         opcode_invokestatic(idx,-6)
      end

feature {E_LOOP}

   runtime_check_loop_variant(expression: EXPRESSION) is
         -- Assume the loop counter and the previous variant value
         -- is already pushed.
         -- Returns the next variant value.
      require
         expression /= Void
      local
         cp: like constant_pool
         idx: INTEGER
      do
         cp := constant_pool
         expression.compile_to_jvm
         push_position(expression.start_position)
         idx := cp.idx_methodref3(fz_se_runtime,"runtime_check_loop_variant",
         "(IIIIILjava/lang/String;)I")
         opcode_invokestatic(idx,-5)
      end

feature {E_INSPECT,MANIFEST_STRING_INSPECTOR}

   runtime_error_inspect(expression: EXPRESSION) is
         -- Assume the not selected inspect value of `expression' is
         -- already pushed.
      local
         cp: like constant_pool
         rt: E_TYPE
         idx: INTEGER
      do
         cp := constant_pool
         rt := expression.result_type
         if rt.is_character then
            -- Convert byte 2 int ??
         end
         push_position(expression.start_position)
         idx := cp.idx_methodref3(fz_se_runtime,"runtime_error_inspect",
         "(IIILjava/lang/String;)I")
         opcode_invokestatic(idx,-3)
      end

feature {COMPOUND}

   se_trace(ct: E_TYPE; p: POSITION) is
         -- Assume the Current target of type `ct' is pushed.
      require
         p.sedb_trace
      local
         cp: like constant_pool
         idx: INTEGER
      do
         if p.is_unknown then
            opcode_pop
         else
            cp := constant_pool
            ct.jvm_push_local(0)
            push_position(p)
            tmp_string.clear
            tmp_string.extend('(')
            if ct.is_basic_eiffel_expanded then
               ct.jvm_descriptor_in(tmp_string)
            else
               tmp_string.append("Ljava/lang/Object;")
            end
            tmp_string.append("IILjava/lang/String;)V")
            idx := cp.idx_methodref3(fz_se_runtime,"se_trace",tmp_string)
            opcode_invokestatic(idx,- ct.jvm_stack_space - 3)
         end
      end

feature {NONE}

   put_code(c, i: INTEGER) is
         -- Puts the code `c' at index `i'
      require
         c >= 0 and then c <= 255
         code.valid_index(i)
      do
         code.put(c, i)
      ensure
         item(i) = c
      end

   add_code(c: INTEGER) is
      require
         c >= 0 and then c <= 255
      do
         code.add_last(c)
      ensure
         code.count = old code.count+1
         code.last = c
      end

   push_position(p: POSITION) is
      do
         opcode_push_integer(p.line)
         opcode_push_integer(p.column)
         if p.is_unknown then
            opcode_aconst_null
         else
            opcode_ldc(constant_pool.idx_string(p.path))
         end
      end

feature {CODE_ATTRIBUTE_VISITOR}

   accept(visitor: CODE_ATTRIBUTE_VISITOR) is
      do
         visitor.visit_code_attribute(Current)
      end

feature {NONE}

   code: FIXED_ARRAY[INTEGER] is
      once
         !!Result.with_capacity(1024)
      end

   max_stack: INTEGER
         -- To compute the maximum size of the operand stack.

   max_locals: INTEGER

invariant

   stack_level >= 0

   stack_level <= max_stack

end -- CODE_ATTRIBUTE