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
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
|
! File: sstartup.s
! Author: John van Groningen
! At: University of Nijmegen
! Machine: Sun 4
#define SHARE_CHAR_INT
#define COPIED_VECTOR
#define MY_ITOS
#define FINALIZERS
#define STACK_OVERFLOW_EXCEPTION_HANDLER
#undef ADD_SYSTEM_TIME
#undef COUNT_GARBAGE_COLLECTIONS
#define SP_G5
#define MARK_GC
#define NEW_DESCRIPTORS
#ifdef NEW_DESCRIPTORS
# define ZERO_ARITY_DESCRIPTOR_OFFSET (-4)
#else
# define ZERO_ARITY_DESCRIPTOR_OFFSET (-12)
#endif
#define ldg(g,r) sethi %hi g,%o0 ; ld [%o0+%lo g],r
#define ldgr(g,r,ir) sethi %hi g,ir ; ld [ir+%lo g],r
#define stg(r,g) sethi %hi g,%o0 ; st r,[%o0+%lo g]
#define stgr(r,g,ir) sethi %hi g,ir ; st r,[ir+%lo g]
#define ldgsb(g,r) sethi %hi g,%o0 ; ldsb [%o0+%lo g],r
#define ldgub(g,r) sethi %hi g,%o0 ; ldub [%o0+%lo g],r
#define stgb(r,g) sethi %hi g,%o0 ; stb r,[%o0+%lo g]
#define seth(g,r) sethi %hi (g),r
#define setl(g,r) add r,%lo (g),r
#define setmbit(vector,bit_n,byte_offset,bit,byte,scratch) \
mov 128,bit ;\
srl bit_n,3,byte_offset ;\
ldub [vector+byte_offset],byte ;\
and bit_n,7,scratch ;\
srl bit,scratch,bit ;\
bset bit,byte ;\
stb byte,[vector+byte_offset]
#define tstmbit(vector,bit_n,byte_offset,bit,byte,scratch) \
mov 128,bit ;\
srl bit_n,3,byte_offset ;\
ldub [vector+byte_offset],byte ;\
and bit_n,7,scratch ;\
srl bit,scratch,bit ;\
btst bit,byte
#define tst_bit(vector,bit_n,byte_offset,bit,byte) \
mov 128,bit ;\
srl bit_n,3,byte_offset ;\
ldub [vector+byte_offset],byte ;\
and bit_n,7,bit_n ;\
srl bit,bit_n,bit ;\
btst bit,byte
#define clrmbit(vector,bit_n,byte_offset,bit,byte,scratch) \
mov 128,bit ;\
srl bit_n,3,byte_offset ;\
ldub [vector+byte_offset],byte ;\
and bit_n,7,scratch ;\
srl bit,scratch,bit ;\
bclr bit,byte ;\
stb byte,[vector+byte_offset]
#ifdef SOLARIS
#define lcomm(a) .comm a,4,4
#else
#define lcomm(a) .comm a,4
#endif
#define d0 %l0
#define d1 %l1
#define d2 %l2
#define d3 %l3
#define d4 %l4
#define d5 %l5
#define d6 %l6
#define d7 %l7
#define a0 %i0
#define a1 %i1
#define a2 %i2
#define a3 %i3
#define a4 %i4
#define a5 %i5
#define a6 %g6
#ifdef SP_G5
# define sp %g5
#else
# define sp %g7
#endif
.data
lcomm (heap_mbp)
#ifdef STACK_OVERFLOW_EXCEPTION_HANDLER
lcomm (begin_b_stack_p)
#else
lcomm (stack_mbp)
#endif
lcomm (heap_p)
lcomm (heap_p1)
lcomm (heap_p2)
heap_p3: .long 0
heap_vector: .long 0
lcomm (heap_size_33)
#ifdef COPIED_VECTOR
lcomm (heap_size_129)
lcomm (heap_copied_vector)
lcomm (heap_copied_vector_size)
#endif
heap_end_after_gc: .long 0
lcomm (extra_heap)
lcomm (extra_heap_size)
lcomm (stack_p)
.global halt_sp
lcomm (halt_sp)
#ifdef MARK_GC
bit_counter: .long 0
bit_vector_p: .long 0
zero_bits_before_mark: .long 1
free_after_mark: .long 1000
last_heap_free: .long 0
lazy_array_list: .long 0
#endif
caf_list: .word 0
.global caf_listp
caf_listp: .word 0
! number of long words requested from the garbage collector
lcomm (alloc_size)
lcomm (basic_only)
#ifdef SOLARIS
lcomm (last_time)
lcomm (execute_time)
lcomm (garbage_collect_time)
lcomm (IO_time)
#else
.comm last_time,8
.comm execute_time,8
.comm garbage_collect_time,8
.comm IO_time,8
#endif
#ifdef SOLARIS
.comm jump_buffer,9*4,4
#else
.comm jump_buffer,9*4
#endif
zero_length_string:
.word __STRING__+2
.word 0
true_string:
.word __STRING__+2
.word 4
true_c_string:
.ascii "True"
.byte 0,0,0,0
false_string:
.word __STRING__+2
.word 5
false_c_string:
.ascii "False"
.byte 0,0,0
file_c_string:
.ascii "File"
.byte 0,0,0,0
garbage_collect_flag:
.byte 0
.byte 0,0,0
#ifdef COUNT_GARBAGE_COLLECTIONS
n_garbage_collections: .word 0
#endif
#ifdef SOLARIS
.comm sprintf_buffer,32,4
#else
.comm sprintf_buffer,32
#endif
out_of_memory_string_1:
.ascii "Not enough memory to allocate heap and stack"
.byte 10,0
printf_int_string:
.ascii "%d"
.byte 0
printf_real_string:
.ascii "%g"
.byte 0
printf_string_string:
.ascii "%s"
.byte 0
printf_char_string:
.ascii "%c"
.byte 0
garbage_collect_string_1:
.asciz "A stack: "
garbage_collect_string_2:
.asciz " bytes. BC stack: "
garbage_collect_string_3:
.ascii " bytes."
.byte 10,0
heap_use_after_gc_string_1:
.ascii "Heap use after garbage collection: "
.byte 0
heap_use_after_gc_string_2:
.ascii " Bytes."
.byte 10,0
stack_overflow_string:
.ascii "Stack overflow."
.byte 10,0
out_of_memory_string_4:
.ascii "Heap full."
.byte 10,0
time_string_1:
.ascii "Execution: "
.byte 0
time_string_2:
.ascii " Garbage collection: "
#ifdef COUNT_GARBAGE_COLLECTIONS
.ascii "("
#endif
.byte 0
#ifdef COUNT_GARBAGE_COLLECTIONS
time_string_3:
.ascii ") "
.byte 0
#endif
time_string_4:
.ascii " Total: "
.byte 0
high_index_string:
.ascii "Index too high in UPDATE string."
.byte 10,0
low_index_string:
.ascii "Index negative in UPDATE string."
.byte 10,0
IO_error_string:
.ascii "IO error: "
.byte 0
new_line_string:
.byte 10,0
sprintf_time_string:
.ascii "%d.%02d"
.byte 0
#ifdef MARK_GC
marked_gc_string_1:
.ascii "Marked: "
.byte 0
#endif
#ifdef SOLARIS
.comm sprintf_time_buffer,20
.align 4
#else
.comm sprintf_time_buffer,20
.align 2
#endif
first_one_bit_table:
.byte -1,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4
.byte 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
.byte 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
.byte 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
.byte 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
.byte 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
.byte 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
.byte 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
#ifdef SHARE_CHAR_INT
.global small_integers
.global static_characters
#ifdef SOLARIS
.comm small_integers,33*8,4
.comm static_characters,256*8,4
#else
.comm small_integers,33*8
.comm static_characters,256*8
#endif
#endif
#ifdef FINALIZERS
.global __Nil
.global e____system__kFinalizer
.global e____system__kFinalizerGCTemp
.global finalizer_list
finalizer_list:
.long 0
free_finalizer_list:
.long 0
#endif
.text
.global @abc_main
.global print
.global print_char
.global print_int
.global print_real
.global print__string__
.global print__chars__sc
.global print_sc
.global print_symbol
.global print_symbol_sc
.global printD
.global DtoAC
.global push_t_r_args
.global push_a_r_args
.global halt
.global dump
.global catAC
.global sliceAC
.global updateAC
.global eqAC
.global cmpAC
.global string_to_string_node
.global create_array
.global create_arrayB
.global create_arrayC
.global create_arrayI
.global create_arrayR
.global create_R_array
.global _create_arrayB
.global _create_arrayC
.global _create_arrayI
.global _create_arrayR
.global _create_r_array
.global BtoAC
.global ItoAC
.global RtoAC
.global eqD
.global collect_0
.global collect_1
.global collect_2
.global collect_3
#if 0
.global e__system__nAP
.global e__system__eaAP
#endif
.global e__system__sAP
.global yet_args_needed
.global yet_args_needed_0
.global yet_args_needed_1
.global yet_args_needed_2
.global yet_args_needed_3
.global yet_args_needed_4
.global _c3,_c4,_c5,_c6,_c7,_c8,_c9,_c10,_c11,_c12
.global _c13,_c14,_c15,_c16,_c17,_c18,_c19,_c20,_c21,_c22
.global _c23,_c24,_c25,_c26,_c27,_c28,_c29,_c30,_c31,_c32
.global e__system__nind
.global e__system__eaind
! old names of the previous two labels for compatibility, remove later
.global __indirection,__eaind
.global e__system__dind
.global eval_fill
.global eval_upd_0,eval_upd_1,eval_upd_2,eval_upd_3,eval_upd_4
.global eval_upd_5,eval_upd_6,eval_upd_7,eval_upd_8,eval_upd_9
.global eval_upd_10,eval_upd_11,eval_upd_12,eval_upd_13,eval_upd_14
.global eval_upd_15,eval_upd_16,eval_upd_17,eval_upd_18,eval_upd_19
.global eval_upd_20,eval_upd_21,eval_upd_22,eval_upd_23,eval_upd_24
.global eval_upd_25,eval_upd_26,eval_upd_27,eval_upd_28,eval_upd_29
.global eval_upd_30,eval_upd_31,eval_upd_32
.global repl_args_b
.global push_arg_b
.global del_args
#if 0
.global o__S_P2
.global ea__S_P2
#endif
.global add_IO_time
.global add_execute_time
.global @IO_error
.global stack_overflow
.global out_of_memory_4
#ifdef SOLARIS
.global __start
#else
.global _start
#endif
.global __driver
! from system.abc:
.global INT
.global CHAR
.global BOOL
.global REAL
.global FILE
.global __STRING__
.global __ARRAY__
.global __cycle__in__spine
.global __print__graph
.global __eval__to__nf
! from cgscon.c:
.global @w_print_char
.global @w_print_string
.global @w_print_text
.global @w_print_int
.global @w_print_real
.global @ew_print_char
.global @ew_print_text
.global @ew_print_string
.global @ew_print_int
.global @ab_stack_size
.global @heap_size
.global @flags
.global @execution_aborted
! from standard c library:
.global @malloc
.global @free
! .global @rand
.global @sprintf
.global @strlen
@abc_main:
save %o6,-128,%o6
save %o6,-256,%o6
ldg (@flags,d0)
and d0,1,d0
stg (d0,basic_only)
ldg (@heap_size,d0)
sub d0,3,%o0
call .udiv
mov 33,%o1
stgr (%o0,heap_size_33,%o1)
#ifdef COPIED_VECTOR
ldg (@heap_size,d0)
sub d0,3,%o0
call .udiv
mov 129,%o1
stgr (%o0,heap_size_129,%o1)
inc 3,%o0
andn %o0,3,%o0
stgr (%o0,heap_copied_vector_size,%o1)
#endif
ldgr (@heap_size,%o0,%o1)
inc 7,%o0
andn %o0,7,%o0
stgr (%o0,@heap_size,%o1)
call @malloc
inc 3+4,%o0
tst %o0
beq no_memory_2
nop
stgr (%o0,heap_mbp,%o1)
inc 3,%o0
and %o0,-4,a6
stg (a6,heap_p)
stg (a6,heap_p1)
#ifdef COPIED_VECTOR
ldg (@flags,%o0)
btst 64,%o0
bne no_copied_vector1
nop
ldg (heap_size_129,d1)
sll d1,6,d1
add a6,d1,d0
stg (d0,heap_copied_vector)
stg (d0,heap_end_after_gc)
ldg (heap_copied_vector_size,%o1)
add d0,%o1,d0
stg (d0,heap_p2)
b,a copied_vector1
no_copied_vector1:
#endif
ldg (@heap_size,d1)
srl d1,1,d1
add a6,d1,d0
stg (d0,heap_end_after_gc)
stg (d0,heap_p2)
copied_vector1:
ldg (@ab_stack_size,d0)
#ifdef STACK_OVERFLOW_EXCEPTION_HANDLER
call @allocate_stack
add d0,0,%o0
#else
call @malloc
add d0,3,%o0
#endif
tst %o0
beq no_memory_3
nop
#ifdef STACK_OVERFLOW_EXCEPTION_HANDLER
ldgr (@ab_stack_size,d0,%o1)
inc 3,d0
and d0,-4,d0
sub %o0,d0,%i4
stgr (%i4,stack_p,%o1)
add %o0,d0,sp
set 8192,%o1
add sp,%o1,sp
stg (sp,begin_b_stack_p)
#else
stgr (%o0,stack_mbp,%o1)
inc 3,%o0
and %o0,-4,d0
mov d0,%i4
ldg (@ab_stack_size,sp)
add sp,d0,sp
stg (d0,stack_p)
#endif
#ifdef SHARE_CHAR_INT
set small_integers,a0
mov 0,d0
set INT+2,d1
make_small_integers_lp:
st d1,[a0]
st d0,[a0+4]
inc 1,d0
cmp d0,33
bne make_small_integers_lp
inc 8,a0
set static_characters,a0
mov 0,d0
set CHAR+2,d1
make_static_characters_lp:
st d1,[a0]
st d0,[a0+4]
inc 1,d0
cmp d0,256
bne make_static_characters_lp
inc 8,a0
#endif
set caf_list+4,a0
stg (a0,caf_listp)
#ifdef FINALIZERS
set __Nil-8,a0
stg (a0,finalizer_list)
stg (a0,free_finalizer_list)
#endif
#ifdef COPIED_VECTOR
ldg (@flags,%o0)
btst 64,%o0
bne no_copied_vector2
nop
ldg (heap_size_129,d7)
ba copied_vector2
sll d7,6-2,d7
no_copied_vector2:
#endif
ldg (@heap_size,d7)
srl d7,3,d7
copied_vector2:
seth (garbage_collect_flag,%o0)
clrb [%o0+%lo garbage_collect_flag]
ldg (@flags,d0)
btst 32+64,d0
beq no_compact_or_mark_gc
nop
ldg (heap_size_33,d0)
sll d0,3,d7
stg (a6,heap_vector)
add a6,d0,a6
add a6,3,a6
andn a6,3,a6
stg (a6,heap_p3)
sll d0,5,d0
add d0,a6,d0
stg (d0,heap_end_after_gc)
mov -1,d0
seth (garbage_collect_flag,%o0)
stb d0,[%o0+%lo garbage_collect_flag]
no_compact_or_mark_gc:
dec 4,sp
call init_timer
st %o7,[sp]
stg (sp,halt_sp)
seth (jump_buffer,%o0)
call @setjmp
setl (jump_buffer,%o0)
tst %o0
bne exit
nop
set __cycle__in__spine,a5
dec 4,sp
#ifdef SOLARIS
call __start
#else
call _start
#endif
st %o7,[sp]
exit:
dec 4,sp
call add_execute_time
st %o7,[sp]
ldg (@flags,d0)
andcc d0,8,%g0
beq no_print_execution_time
nop
seth (time_string_1,%o0)
call @ew_print_string
setl (time_string_1,%o0)
set execute_time,a0
ld [a0],d0
#ifndef SOLARIS
ld [a0+4],d1
#endif
dec 4,sp
call print_time
st %o7,[sp]
seth (time_string_2,%o0)
call @ew_print_string
setl (time_string_2,%o0)
#ifdef COUNT_GARBAGE_COLLECTIONS
sethi %hi n_garbage_collections,%o0
call @ew_print_int
ld [%o0+%lo n_garbage_collections],%o0
seth (time_string_3,%o0)
call @ew_print_string
setl (time_string_3,%o0)
#endif
set garbage_collect_time,a0
ld [a0],d0
#ifndef SOLARIS
ld [a0+4],d1
#endif
dec 4,sp
call print_time
st %o7,[sp]
seth (time_string_4,%o0)
call @ew_print_string
setl (time_string_4,%o0)
#ifdef SOLARIS
set execute_time,a0
ld [a0],d0
set garbage_collect_time,a0
ld [a0],d2
add d0,d2,d0
set IO_time,a0
ld [a0],d2
add d0,d2,d0
#else
set execute_time,a0
ld [a0],d0
ld [a0+4],d1
set garbage_collect_time,a0
ld [a0],d2
ld [a0+4],%l3
add d0,d2,d0
add d1,d3,d1
set 1000000,d4
cmp d1,d4
bcs no_usec_overflow_1
nop
sub d1,d4,d1
inc 1,d0
no_usec_overflow_1:
set IO_time,a0
ld [a0],d2
ld [a0+4],d3
add d0,d2,d0
add d1,d3,d1
cmp d1,d4
bcs no_usec_overflow_2
nop
sub d1,d4,d1
inc 1,d0
no_usec_overflow_2:
#endif
dec 4,sp
call print_time
st %o7,[sp]
call @ew_print_char
mov 10,%o0
no_print_execution_time:
exit_3:
#ifndef STACK_OVERFLOW_EXCEPTION_HANDLER
seth (stack_mbp,%o1)
call @free
ld [%o1+%lo stack_mbp],%o0
#endif
exit_2:
seth (heap_mbp,%o1)
call @free
ld [%o1+%lo heap_mbp],%o0
exit_1:
restore
ret
restore
__driver:
ldgr (@flags,%o0,%o1)
btst 16,%o0
beq __print__graph
nop
b,a __eval__to__nf
print_time:
#ifdef SOLARIS
call _sysconf
mov 3,%o0
mov %o0,d2
mov %o0,%o1
call .udiv
mov d0,%o0
mov %o0,d3
mov d2,%o1
call .urem
mov d0,%o0
call .umul
mov 100,%o1
call .udiv
mov d2,%o1
mov %o0,%o3
set sprintf_time_string,%o1
set sprintf_time_buffer,%o0
call @sprintf
mov d3,%o2
#else
set 10000,%o1
call .udiv
mov d1,%o0
mov %o0,%o3
set sprintf_time_string,%o1
set sprintf_time_buffer,%o0
call @sprintf
mov d0,%o2
#endif
sethi %hi sprintf_time_buffer,%o0
call @ew_print_string
or %o0,%lo sprintf_time_buffer,%o0
ld [sp],%o7
retl
inc 4,sp
no_memory_2:
seth (out_of_memory_string_1,%o0)
call @ew_print_string
setl (out_of_memory_string_1,%o0)
b,a exit_1
no_memory_3:
seth (out_of_memory_string_1,%o0)
call @ew_print_string
setl (out_of_memory_string_1,%o0)
b,a exit_1
print_sc:
ldg (basic_only,%o1)
tst %o1
bne end_print
nop
print:
call @w_print_string
mov d0,%o0
end_print:
ld [sp],%o7
retl
inc 4,sp
dump:
dec 4,sp
call print
st %o7,[sp]
b,a halt
printD: btst 2,d0
bne printD_
nop
ba print_string_a2
mov d0,a2
DtoAC: btst 2,d0
bne DtoAC_
nop
add d0,4,a0
ba build_string
ld [d0],d0
DtoAC_:
ldsh [d0-2],d1
#ifdef NEW_DESCRIPTORS
cmp d1,256
bgeu,a DtoAC_string_a0
ld [d0-6],a0
lduh [d0],d1
add d0,10,a0
add a0,d1,a0
DtoAC_string_a0:
ld [a0],d0
ba build_string
inc 4,a0
#else
add d0,-2,a2
cmp d1,256
bgeu DtoAC_record
sll d1,3,d1
sub a2,d1,a2
DtoAC_record:
ba DtoAC_string_a2
ld [a2-4],a2
DtoAC_string_a2:
ld [a2],d0
ba build_string
add a2,4,a0
#endif
print_symbol:
ba print_symbol_2
clr d1
print_symbol_sc:
ldg (basic_only,d1)
print_symbol_2:
ld [a0],d0
set INT+2,%o0
cmp %o0,d0
beq print_int_node
nop
set CHAR+2,%o0
cmp %o0,d0
beq print_char_node
nop
set BOOL+2,%o0
cmp %o0,d0
beq print_bool
nop
set REAL+2,%o0
cmp %o0,d0
beq print_real_node
nop
tst d1
bne end_print_symbol
nop
printD_:
ldsh [d0-2],d1
#ifdef NEW_DESCRIPTORS
cmp d1,256
bgeu,a print_string_a2
ld [d0-6],a2
lduh [d0],d1
add d0,10,a2
ba print_string_a2
add a2,d1,a2
#else
add d0,-2,a2
cmp d1,256
bgeu print_record
sll d1,3,d1
sub a2,d1,a2
print_record:
ba print_string_a2
ld [a2-4],a2
#endif
end_print_symbol:
ld [sp],%o7
retl
inc 4,sp
print_int_node:
call @w_print_int
ld [a0+4],%o0
ld [sp],%o7
retl
inc 4,sp
print_int:
call @w_print_int
mov d0,%o0
ld [sp],%o7
retl
inc 4,sp
print_char:
ldg (basic_only,d1)
tst d1
bne print_char_node_bo
nop
b,a print_char_node_sc
print_char_node:
tst d1
bne print_char
ld [a0+4],d0
print_char_node_sc:
call @w_print_char
mov 0x27,%o0
call @w_print_char
mov d0,%o0
call @w_print_char
mov 0x27,%o0
ld [sp],%o7
retl
inc 4,sp
print_char_node_bo:
call @w_print_char
mov d0,%o0
ld [sp],%o7
retl
inc 4,sp
print_bool:
ldsb [a0+7],%o0
tst %o0
beq print_false
nop
print_true:
sethi %hi true_c_string,%o0
call @w_print_string
or %o0,%lo true_c_string,%o0
ld [sp],%o7
retl
inc 4,sp
print_false:
sethi %hi false_c_string,%o0
call @w_print_string
or %o0,%lo false_c_string,%o0
ld [sp],%o7
retl
inc 4,sp
print_real:
st %f0,[sp-8]
st %f1,[sp-4]
ld [sp-8],%o0
call @w_print_real
ld [sp-4],%o1
ld [sp],%o7
retl
inc 4,sp
print_real_node:
ld [a0+4],%o0
call @w_print_real
ld [a0+8],%o1
ld [sp],%o7
retl
inc 4,sp
print_string_a2:
ld [a2],%o1
call @w_print_text
add a2,4,%o0
ld [sp],%o7
retl
inc 4,sp
print__chars__sc:
ldg (basic_only,%o1)
tst %o1
bne no_print_chars
nop
print__string__:
ld [a0+4],%o1
call @w_print_text
add a0,8,%o0
no_print_chars:
ld [sp],%o7
retl
inc 4,sp
push_a_r_args:
ld [a0+8],a1
dec 2,a1
lduh [a1],d3
dec 256,d3
lduh [a1+2],d1
inc 4,a1
sub d3,d1,d2
sll d0,2,d0
mov 0,d4
dec d3
mul_array_size_lp:
deccc d3
bcc mul_array_size_lp
add d4,d0,d4
inc 12,a0
add a0,d4,a0
ld [sp],%o7
inc 4,sp
sll d1,2,%o0
add a0,%o0,a0
ba push_a_elements
mov a0,a3
push_a_elements_lp:
dec 4,a3
st %o0,[a4]
inc 4,a4
push_a_elements:
deccc d1
bcc,a push_a_elements_lp
ld [a3-4],%o0
sll d2,2,%o0
ba push_b_elements
add a0,%o0,a0
push_b_elements_lp:
dec 4,a0
st %o0,[sp-4]
dec 4,sp
push_b_elements:
deccc d2
bcc,a push_b_elements_lp
ld [a0-4],%o0
retl
mov a1,d0
push_t_r_args:
ld [a0],a1
inc 4,a0
dec 2,a1
lduh [a1],d3
lduh [a1+2],d1
dec 256,d3
add a1,4,d0
sub d3,d1,d2
sll d3,2,d4
cmp d3,2
bleu small_record
add a0,d4,a1
ld [a0+4],a1
dec 4,a1
add a1,d4,a1
small_record:
ld [sp],%o7
ba push_r_b_elements
inc 4,sp
push_r_b_elements_lp:
bne not_first_arg_b
dec 4,sp
ld [a0],%o0
b push_r_b_elements
st %o0,[sp]
not_first_arg_b:
ld [a1-4],%o0
dec 4,a1
st %o0,[sp]
push_r_b_elements:
deccc d2
bcc,a push_r_b_elements_lp
deccc d3
b,a push_r_a_elements
push_r_a_elements_lp:
bne not_first_arg_a
inc 4,a4
ld [a0],%o0
b push_r_a_elements
st %o0,[a4-4]
not_first_arg_a:
ld [a1-4],%o0
dec 4,a1
st %o0,[a4-4]
push_r_a_elements:
deccc d1
bcc,a push_r_a_elements_lp
deccc d3
retl
nop
BtoAC:
tst d0
be BtoAC_false
ld [sp],%o7
BtoAC_true:
sethi %hi true_string,a0
or a0,%lo true_string,a0
retl
inc 4,sp
BtoAC_false:
sethi %hi false_string,a0
or a0,%lo false_string,a0
retl
inc 4,sp
RtoAC:
st %f0,[sp-8]
st %f1,[sp-4]
set printf_real_string,%o1
ld [sp-8],%o2
set sprintf_buffer,%o0
call @sprintf
ld [sp-4],%o3
b,a D_to_S_x
ItoAC:
#ifdef MY_ITOS
sethi %hi sprintf_buffer,a0
tst d0
bpos no_minus
or a0,%lo sprintf_buffer,a0
mov 45,%o0
stb %o0,[a0]
inc a0
subcc %g0,d0,d0
no_minus:
be zero_digit
add a0,12,a2
calculate_digits:
cmp d0,10
blu last_digit
mov d0,%o0
call .urem
mov 10,%o1
add %o0,48,a1
stb a1,[a2]
mov d0,%o0
call .udiv
mov 10,%o1
mov %o0,d0
b calculate_digits
inc a2
last_digit:
tst d0
be no_zero
nop
zero_digit:
add d0,48,d0
stb d0,[a2]
inc a2
no_zero:
add a0,12,a1
reverse_digits:
ldub [a2-1],d1
dec a2
stb d1,[a0]
cmp a2,a1
bne reverse_digits
inc a0
clrb [a0]
set sprintf_buffer,d0
ba sprintf_buffer_to_string
sub a0,d0,d0
#else
mov d0,%o2
set printf_int_string,%o1
set sprintf_buffer,%o0
call @sprintf
nop
#endif
D_to_S_x:
sethi %hi sprintf_buffer,%o0
call @strlen
or %o0,%lo sprintf_buffer,%o0
mov %o0,d0
#ifdef MY_ITOS
sprintf_buffer_to_string:
set sprintf_buffer,a0
#endif
! d0 : length, a0 : string
build_string:
add d0,3,d1
srl d1,2,d1
dec 2,d7
subcc d7,d1,d7
bpos D_to_S_no_gc
nop
mov a0,d2
dec 4,sp
call collect_0
st %o7,[sp]
mov d2,a0
D_to_S_no_gc:
mov a6,d2
set __STRING__+2,%o0
st %o0,[a6]
st d0,[a6+4]
ba D_to_S_cp_str_2
inc 8,a6
D_to_S_cp_str_1:
ld [a0],%o0
inc 4,a0
st %o0,[a6]
inc 4,a6
D_to_S_cp_str_2:
deccc d1
bpos D_to_S_cp_str_1
nop
ld [sp],%o7
mov d2,a0
retl
inc 4,sp
eqD: ld [a0],d0
ld [a1],%o0
cmp d0,%o0
bne eqD_false
nop
set INT+2,%o0
cmp d0,%o0
be eqD_INT
nop
set CHAR+2,%o0
cmp d0,%o0
be eqD_CHAR
nop
set BOOL+2,%o0
cmp d0,%o0
be eqD_BOOL
nop
set REAL+2,%o0
cmp d0,%o0
be eqD_REAL
nop
ld [sp],%o7
mov -1,d0
retl
inc 4,sp
eqD_CHAR:
eqD_INT: ld [a0+4],d1
ld [a1+4],%o0
clr d0
cmp d1,%o0
beq,a eqD_CHAR_true
mov -1,d0
eqD_CHAR_true:
ld [sp],%o7
retl
inc 4,sp
eqD_BOOL: ldsb [a0+7],d1
ldsb [a1+7],%o0
clr d0
cmp d1,%o0
beq,a eqD_BOOL_true
mov -1,d0
eqD_BOOL_true:
ld [sp],%o7
retl
inc 4,sp
eqD_REAL: ld [a0+4],%f0
ld [a0+8],%f1
ld [a1+4],%f2
ld [a1+8],%f3
clr d0
fcmpd %f0,%f2
nop
fbe,a eqD_REAL_true
mov -1,d0
eqD_REAL_true:
ld [sp],%o7
retl
inc 4,sp
eqD_false:
ld [sp],%o7
clr d0
retl
inc 4,sp
!
! the timer
!
init_timer:
#ifdef SOLARIS
call @times
sub sp,16,%o0
ld [sp-16],d0
stg (d0,last_time)
stg (%g0,execute_time)
stg (%g0,garbage_collect_time)
stg (%g0,IO_time)
#else
sub sp,88,%o1
call @getrusage
clr %o0
set last_time,a0
ld [sp-88],d0
ld [sp-84],d1
# ifdef ADD_SYSTEM_TIME
ld [sp-80],%o0
add d0,%o0,d0
ld [sp-76],%o0
add d1,%o0,d1
set 1000000,%o0
cmp d1,%o0
bl no_micro_seconds_overflow1
nop
sub d1,%o0,d1
inc 1,d0
no_micro_seconds_overflow1:
# endif
st d0,[a0]
st d1,[a0+4]
set execute_time,a0
# ifdef ADD_SYSTEM_TIME
st d0,[a0]
st d1,[a0+4]
# else
clr [a0]
clr [a0+4]
# endif
set garbage_collect_time,a0
clr [a0]
clr [a0+4]
set IO_time,a0
clr [a0]
clr [a0+4]
#endif
ld [sp],%o7
retl
inc 4,sp
get_time_diff:
#ifdef SOLARIS
call @times
sub sp,16,%o0
ld [sp-16],d0
sethi %hi last_time,a0
ld [a0+%lo last_time],d2
st d0,[a0+%lo last_time]
sub d0,d2,d0
#else
sub sp,88,%o1
call @getrusage
clr %o0
ld [sp-88],d0
ld [sp-84],d1
# ifdef ADD_SYSTEM_TIME
ld [sp-80],%o0
add d0,%o0,d0
ld [sp-76],%o0
add d1,%o0,d1
set 1000000,%o0
cmp d1,%o0
bl no_micro_seconds_overflow2
nop
sub d1,%o0,d1
inc 1,d0
no_micro_seconds_overflow2:
# endif
set last_time,a0
ld [a0],d2
st d0,[a0]
sub d0,d2,d0
ld [a0+4],d2
st d1,[a0+4]
subcc d1,d2,d1
bpos get_time_diff_1
nop
set 1000000,d2
add d1,d2,d1
dec 1,d0
get_time_diff_1:
#endif
ld [sp],%o7
retl
inc 4,sp
add_execute_time:
dec 4,sp
call get_time_diff
st %o7,[sp]
set execute_time,a0
add_time:
#ifdef SOLARIS
ld [a0],d2
add d0,d2,d0
st d0,[a0]
#else
ld [a0],d2
add d0,d2,d0
st d0,[a0]
ld [a0+4],d2
add d1,d2,d1
set 1000000,d2
cmp d1,d2
bcs add_execute_time_1
nop
sub d1,d2,d1
inc 1,d0
st d0,[a0]
add_execute_time_1:
st d1,[a0+4]
#endif
ld [sp],%o7
retl
inc 4,sp
add_garbage_collect_time:
dec 4,sp
call get_time_diff
st %o7,[sp]
sethi %hi garbage_collect_time,a0
ba add_time
or a0,%lo garbage_collect_time,a0
add_IO_time:
dec 4,sp
call get_time_diff
st %o7,[sp]
sethi %hi IO_time,a0
ba add_time
or a0,%lo IO_time,a0
!
! the garbage collector
!
collect_3:
st a0,[%i4]
st a1,[%i4+4]
st a2,[%i4+8]
inc 12,%i4
dec 4,sp
call collect_0
st %o7,[sp]
ld [%i4-12],a0
ld [%i4-8],a1
ld [%i4-4],a2
dec 12,%i4
ld [sp],%o7
retl
inc 4,sp
collect_2:
st a0,[%i4]
st a1,[%i4+4]
inc 8,%i4
dec 4,sp
call collect_0
st %o7,[sp]
ld [%i4-8],a0
ld [%i4-4],a1
dec 8,%i4
ld [sp],%o7
retl
inc 4,sp
collect_1:
st a0,[%i4]
inc 4,%i4
dec 4,sp
call collect_0
st %o7,[sp]
ld [%i4-4],a0
dec 4,%i4
ld [sp],%o7
retl
inc 4,sp
collect_0:
#ifdef MARK_GC
ldg (@flags,%o0)
btst 64,%o0
beq no_mark_gc1
seth (bit_counter,%g1)
ld [%g1+%lo bit_counter],%o2
tst %o2
beq no_scan
or %g1,%lo bit_counter,%g1
ld [%g1+heap_end_after_gc-bit_counter],%o4
ld [%g1+bit_vector_p-bit_counter],a0
sub %o4,a6,%o4
srl %o4,2,%o4
sub %o4,d7,%o4
scan_bits:
ld [a0],%o0 !
inc 4,a0
tst %o0
beq zero_bits
deccc %o2
clr [a0-4]
bne,a scan_bits+4
ld [a0],%o0
b,a end_scan
zero_bits:
beq end_bits
mov a0,a1
skip_zero_bits_lp:
ld [a0],%o3 !
inc 4,a0
tst %o3
bne end_zero_bits
deccc %o2
bne,a skip_zero_bits_lp+4
ld [a0],%o3
ba end_bits+4
sub a0,a1,%o3
end_zero_bits:
clr [a0-4] !
sub a0,a1,%o3
sll %o3,3,%o3
ld [%g1+free_after_mark-bit_counter],%o1
cmp %o3,%o4
add %o1,%o3,%o1
blu scan_next
st %o1,[%g1+free_after_mark-bit_counter]
found_free_memory:
st %o2,[%g1+bit_counter-bit_counter]
st a0,[%g1+bit_vector_p-bit_counter]
sub %o3,%o4,d7
ld [%g1+heap_vector-bit_counter],%o1
sub a1,4,%o2
sub %o2,%o1,%o2
ld [%g1+heap_p3-bit_counter],%o1
sll %o2,5,%o2
add %o2,%o1,a6
sll %o3,2,%o3
add a6,%o3,%o2
ld [sp],%o7
st %o2,[%g1+heap_end_after_gc-bit_counter]
retl
inc 4,sp
scan_next:
tst %o2
bne,a scan_bits+4
ld [a0],%o0
b,a end_scan
end_bits:
sub a0,a1,%o3 !
inc 4,%o3
sll %o3,3,%o3
ld [%g1+free_after_mark-bit_counter],%o1
cmp %o3,%o4
add %o1,%o3,%o1
bgeu found_free_memory
st %o1,[%g1+free_after_mark-bit_counter]
end_scan:
st %o2,[%g1+bit_counter-bit_counter]
no_scan:
no_mark_gc1:
#endif
dec 28,sp
st d0,[sp]
st d1,[sp+4]
st d2,[sp+8]
st d3,[sp+12]
st d4,[sp+16]
st d5,[sp+20]
st d6,[sp+24]
seth (garbage_collect_flag,%g1)
ldsb [%g1+%lo garbage_collect_flag],%o0
tst %o0
ble collect
nop
dec 2,%o0
stb %o0,[%g1+%lo garbage_collect_flag]
ldg (heap_end_after_gc,d0)
sub d0,a6,d0
srl d0,2,d0
sub d0,%l7,d0
ldg (extra_heap_size,d1)
cmp d0,d1
bgu collect
nop
ldg (extra_heap_size,d1)
sub d1,d0,%l7
ldg (extra_heap,a6)
sll d1,2,d1
add d1,a6,d1
stg (d1,heap_end_after_gc)
ld [sp],d0
ld [sp+4],d1
ld [sp+8],d2
ld [sp+12],d3
ld [sp+16],d4
ld [sp+20],d5
ld [sp+24],d6
ld [sp+28],%o7
retl
inc 32,sp
collect:
dec 4,sp
call add_execute_time
st %o7,[sp]
ldgr (@flags,%o0,%o1)
btst 4,%o0
beq no_print_stack_sizes
nop
seth (garbage_collect_string_1,%o0)
call @ew_print_string
setl (garbage_collect_string_1,%o0)
ldg (stack_p,a0)
sub %i4,a0,%o0
#ifdef STACK_OVERFLOW_EXCEPTION_HANDLER
ldgr (@begin_b_stack_p,d0,%o1)
#else
ldgr (@ab_stack_size,%o2,%o1)
add a0,%o2,d0
#endif
call @ew_print_int
sub d0,sp,d0
seth (garbage_collect_string_2,%o0)
call @ew_print_string
setl (garbage_collect_string_2,%o0)
call @ew_print_int
mov d0,%o0
seth (garbage_collect_string_3,%o0)
call @ew_print_string
setl (garbage_collect_string_3,%o0)
no_print_stack_sizes:
cmp %i4,sp
bgu stack_overflow
nop
#ifdef MARK_GC
ldg (@flags,%o0)
btst 64,%o0
bne collect2_0
nop
#endif
ldgsb (garbage_collect_flag,%o1)
tst %o1
bne collect2_0
nop
#ifdef COPIED_VECTOR
ldg (@flags,%o0)
btst 64,%o0
bne no_copied_vector3
nop
ldg (heap_copied_vector,a2)
ldg (heap_copied_vector_size,d0)
srl d0,2,d0
btst 1,d0
be zero_bits1_1
srl d0,1,d0
clr [%i2]
inc 4,%i2
zero_bits1_1:
btst 1,d0
be zero_bits1_5
srl d0,1,d0
ba zero_bits1_2
dec 8,%i2
clr [%i2]
zero_bits1_4:
clr [%i2+4]
zero_bits1_2:
clr [%i2+8]
clr [%i2+12]
inc 16,%i2
zero_bits1_5:
deccc d0
bpos,a zero_bits1_4
clr [%i2]
no_copied_vector3:
#endif
! calculate alloc_size
ldg (heap_end_after_gc,d0)
sub d0,a6,d0
srl d0,2,d0
sub d0,d7,d0
stg (d0,alloc_size)
#include "scopy.a"
stg (%o4,heap_end_after_gc)
sub %o4,%g6,%l7
srl %l7,2,%l7
dec 4,sp
call add_garbage_collect_time
st %o7,[sp]
ldg (alloc_size,%o1)
subcc %l7,%o1,%l7
bneg switch_to_mark_scan
! bneg out_of_memory_4
nop
sll %l7,2,d0
add d0,%l7,d0
sll d0,5,d0
ldg (@heap_size,d2)
sll d2,2,d1
add d1,d2,d1
sll d1,1,d1
add d1,d2,d1
cmp d0,d1
bcc no_mark_scan
! ba no_mark_scan
nop
switch_to_mark_scan:
ldg (heap_size_33,d0)
sll d0,5,d0
ldg (heap_p,d1)
ldg (heap_p1,d2)
ldg (heap_p2,%o1)
cmp d2,%o1
bcs vector_at_begin
nop
vector_at_end:
stg (d1,heap_p3)
add d1,d0,d1
stg (d1,heap_vector)
ldg (heap_p1,d0)
stg (d0,extra_heap)
sub d1,d0,d1
srl d1,2,d1
stg (d1,extra_heap_size)
ba switch_to_mark_scan_2
nop
vector_at_begin:
stg (d1,heap_vector)
ldgr (@heap_size,%o0,%o1)
add d1,%o0,d1
sub d1,d0,d1
stg (d1,heap_p3)
stg (d1,extra_heap)
ldg (heap_p2,d2)
sub d2,d1,d2
srl d2,2,d2
stg (d2,extra_heap_size)
switch_to_mark_scan_2:
ldg (@heap_size,d0)
srl d0,3,d0
sub d0,%l7,d0
sll d0,2,d0
mov 1,%o1
stgb (%o1,garbage_collect_flag)
tst d7
bpos end_garbage_collect
nop
mov -1,%o1
stgb (%o1,garbage_collect_flag)
ldg (extra_heap_size,d1)
ldg (alloc_size,%l7)
subcc d1,%l7,%l7
bneg out_of_memory_4
nop
ldg (extra_heap,%g6)
sll d1,2,d1
add d1,%g6,d1
stg (d1,heap_end_after_gc)
ba end_garbage_collect
nop
no_mark_scan:
! exchange the semi_spaces
ldg (heap_p1,d0)
ldg (heap_p2,%o1)
stg (d0,heap_p2)
stg (%o1,heap_p1)
#ifdef COPIED_VECTOR
ldg (@flags,%o0)
btst 64,%o0
bne no_copied_vector5
nop
ldg (heap_size_129,d0)
ba copied_vector5
sll d0,6-2,d0
no_copied_vector5:
#endif
ldg (@heap_size,d0)
srl d0,3,d0
copied_vector5:
sub d0,d7,d0
sll d0,2,d0
end_garbage_collect:
#ifdef COUNT_GARBAGE_COLLECTIONS
sethi %hi n_garbage_collections,%o1
ld [%o1+%lo n_garbage_collections],%o2
inc 1,%o2
#endif
ldg (@flags,%o0)
btst 2,%o0
beq no_heap_use_message
#ifdef COUNT_GARBAGE_COLLECTIONS
st %o2,[%o1+%lo n_garbage_collections]
#else
nop
#endif
seth (heap_use_after_gc_string_1,%o0)
call @ew_print_string
setl (heap_use_after_gc_string_1,%o0)
call @ew_print_int
mov d0,%o0
seth (heap_use_after_gc_string_2,%o0)
call @ew_print_string
setl (heap_use_after_gc_string_2,%o0)
no_heap_use_message:
#ifdef FINALIZERS
call call_finalizers
nop
#endif
ld [sp],d0
ld [sp+4],d1
ld [sp+8],d2
ld [sp+12],d3
ld [sp+16],d4
ld [sp+20],%l5
ld [sp+24],%l6
ld [sp+28],%o7
retl
inc 32,sp
#ifdef FINALIZERS
call_finalizers:
ldg (free_finalizer_list,d0)
call_finalizers_lp:
set __Nil-8,%o1
cmp d0,%o1
beq end_call_finalizers
nop
ld [d0+8],d1
ld [d0+4],d0
ld [d1],%o1
ld [d1+4],%o0
save %o6,-128,%o6
call %i1
nop
b call_finalizers_lp
restore
end_call_finalizers:
stg (%o1,free_finalizer_list)
retl
nop
#endif
out_of_memory_4:
dec 4,sp
call add_garbage_collect_time
st %o7,[sp]
seth (out_of_memory_string_4,%o0)
b print_error
setl (out_of_memory_string_4,%o0)
reorder:
mov d0,d2
mov d1,d3
sll d0,2,d4
sll d1,2,d5
add a0,d5,a0
ba st_reorder_lp
sub a1,d4,a1
reorder_lp:
ld [a1-4],%o0
st d6,[a1-4]
st %o0,[a0]
deccc 1,d2
bne next_b_in_element
inc 4,a0
mov d0,d2
add a0,d5,a0
next_b_in_element:
deccc 1,d3
bne next_a_in_element
dec 4,a1
mov d1,d3
sub a1,d4,a1
next_a_in_element:
st_reorder_lp:
cmp a1,a0
bgu,a reorder_lp
ld [a0],d6
retl
nop
!
! the sliding compacting garbage collector
!
collect2_0:
! zero all mark bits
ldg (heap_p3,d6)
ldg (heap_vector,%o4)
ldg (heap_end_after_gc,d5)
sub d5,a6,d5
srl d5,2,d5
sub d5,d7,d5
stg (d5,alloc_size)
#ifdef MARK_GC
ldg (@flags,%o0)
btst 64,%o0
be no_mark_gc3
sethi %hi zero_bits_before_mark,%o0
ld [%o0+%lo zero_bits_before_mark],%o1
tst %o1
beq no_zero_bits
nop
clr [%o0+%lo zero_bits_before_mark]
no_mark_gc3:
#endif
mov %o4,%i2
ldg (heap_size_33,d0)
inc 3,d0
srl d0,2,d0
btst 1,d0
be zero_bits_1
srl d0,1,d0
clr [%i2]
inc 4,%i2
zero_bits_1:
btst 1,d0
be zero_bits_5
srl d0,1,d0
ba zero_bits_2
dec 8,%i2
clr [%i2]
zero_bits_4:
clr [%i2+4]
zero_bits_2:
clr [%i2+8]
clr [%i2+12]
inc 16,%i2
zero_bits_5:
deccc d0
bpos,a zero_bits_4
clr [%i2]
#ifdef MARK_GC
no_zero_bits:
ldg (@flags,%o0)
btst 64,%o0
be no_mark_gc4
nop
ldg (last_heap_free,d0)
ldg (free_after_mark,d1)
sll d1,2,d1
sll d1,3,d2
add d2,d1,d1
srl d1,2,d1
cmp d0,d1
bgu compact_gc
nop
#include "smark.a"
compact_gc:
mov 1,d0
stg (d0,zero_bits_before_mark)
sethi %hi last_heap_free,%o0
st %g0,[%o0+%lo last_heap_free]
mov 1000,%o1
stg (%o1,free_after_mark)
no_mark_gc4:
#endif
#include "scompact.a"
ldg (heap_size_33,d7)
sll d7,5,d7
ldg (heap_p3,%o1)
add d7,%o1,d7
stg (d7,heap_end_after_gc)
sub d7,%g6,d7
srl d7,2,d7
ldg (alloc_size,%o1)
subcc d7,%o1,d7
bneg out_of_memory_4
nop
mov %l7,d0
sll d0,2,d0
add d0,%l7,d0
sll d0,3,d0
ldg (@heap_size,%o1)
cmp d0,%o1
bcs out_of_memory_4
nop
sll d0,2,d0
ldg (@heap_size,d1)
sll d1,5,d1
ldg (@heap_size,%o1)
sub d1,%o1,d1
ldg (@flags,%o1)
btst 32,%o1
bne no_copy_garbage_collection
#ifdef MARK_GC
ldg (@flags,%o0)
btst 64,%o0
bne no_copy_garbage_collection
nop
#endif
cmp d0,d1
ble no_copy_garbage_collection
! ba no_copy_garbage_collection
nop
ldg (heap_p,d0)
stg (d0,heap_p1)
#ifdef COPIED_VECTOR
ldg (@flags,%o0)
btst 64,%o0
bne no_copied_vector6
nop
ldg (heap_size_129,d1)
sll d1,6,d1
add d0,d1,d0
stg (d0,heap_copied_vector)
stg (d0,heap_end_after_gc)
ldg (heap_copied_vector_size,d1)
add d1,d0,d1
stg (d1,heap_p2)
b,a copied_vector6
no_copied_vector6:
#endif
ldg (@heap_size,d1)
srl d1,1,d1
add d0,d1,d0
stg (d0,heap_p2)
stg (d0,heap_end_after_gc)
copied_vector6:
sub d0,%g6,d0
srl d0,2,d0
mov d0,%l7
ldg (alloc_size,%o1)
sub %l7,%o1,%l7
ldg (heap_p3,d0)
ldg (heap_vector,%o1)
cmp d0,%o1
ble vector_at_end_2
nop
ldg (heap_vector,d1)
stg (d1,extra_heap)
sub d0,d1,d0
srl d0,2,d0
stg (d0,extra_heap_size)
mov 2,%o1
stgb (%o1,garbage_collect_flag)
ba no_copy_garbage_collection
nop
vector_at_end_2:
stgb (%g0,garbage_collect_flag)
no_copy_garbage_collection:
dec 4,sp
call add_garbage_collect_time
st %o7,[sp]
mov %g6,d0
sub d0,%l6,d0
ldg (alloc_size,d1)
sll d1,2,d1
ba end_garbage_collect
add d0,d1,d0
stack_overflow:
dec 4,sp
call add_execute_time
st %o7,[sp]
set stack_overflow_string,%o0
ba print_error
nop
@IO_error:
save %o6,-128,%o6
set IO_error_string,%o0
call @ew_print_string
nop
call @ew_print_string
mov a0,%o0
set new_line_string,%o0
call @ew_print_string
nop
ba halt
restore
print_error:
call @ew_print_string
nop
halt:
mov 1,d0
stg (d0,@execution_aborted)
ldg (halt_sp,sp)
set jump_buffer,%o0
call @longjmp
mov 1,%o1
e__system__eaind:
__eaind:
eval_fill:
st a0,[%i4]
inc 4,%i4
mov a1,a0
ld [a1],a1
dec 4,sp
call a1
st %o7,[sp]
mov a0,a1
ld [%i4-4],a0
dec 4,%i4
ld [a1],%g1
st %g1,[a0]
ld [a1+4],%g1
st %g1,[a0+4]
ld [a1+8],%g1
st %g1,[a0+8]
ld [sp],%o7
retl
inc 4,sp
b,a e__system__eaind
nop
nop
.word e__system__dind
.word -2
e__system__nind:
__indirection:
ld [a0+4],a1
ld [a1],d0
btst 2,d0
#ifdef MARK_GC
be,a eval_fill2
st a5,[a0]
#else
be __cycle__in__spine
nop
#endif
st d0,[a0]
ld [a1+4],%g1
st %g1,[a0+4]
ld [a1+8],%g1
st %g1,[a0+8]
ld [sp],%o7
retl
inc 4,sp
#ifdef MARK_GC
eval_fill2:
ldg (@flags,%o0)
btst 64,%o0
be __cycle__in__spine
st a0,[a4]
inc 4,a4
mov a1,a0
dec 4,sp
call d0
st %o7,[sp]
ld [a4-4],a1
ld [a0],%o0
dec 4,a4
st %o0,[a1]
ld [a0+4],%o0
st %o0,[a1+4]
ld [a0+8],%o0
ld [sp],%o7
st %o0,[a1+8]
mov a1,a0
retl
inc 4,sp
#endif
eval_upd_0:
set __indirection,%i3
st %i3,[a1]
jmp %i2
st a0,[a1+4]
eval_upd_1:
set __indirection,%i3
st %i3,[a1]
ld [a1+4],d0
st a0,[a1+4]
jmp %i2
mov d0,a1
eval_upd_2:
mov %i2,%i3
set __indirection,%i2
st %i2,[a1]
ld [a1+4],%i2
st a0,[a1+4]
jmp %i3
ld [a1+8],a1
eval_upd_3:
mov %i2,%i3
set __indirection,%i2
st %i2,[a1]
ld [a1+4],%i2
st a0,[%i4]
st a0,[a1+4]
inc 4,%i4
ld [a1+12],a0
jmp %i3
ld [a1+8],a1
eval_upd_4:
mov %i2,%i3
set __indirection,%i2
st %i2,[a1]
ld [a1+4],%i2
st a0,[%i4]
st a0,[a1+4]
ld [a1+16],%g1
st %g1,[%i4+4]
inc 8,%i4
ld [a1+12],a0
jmp %i3
ld [a1+8],a1
eval_upd_5:
mov %i2,%i3
set __indirection,%i2
st %i2,[a1]
ld [a1+4],%i2
st a0,[%i4]
st a0,[a1+4]
ld [a1+20],%g1
st %g1,[%i4+4]
ld [a1+16],%g1
st %g1,[%i4+8]
inc 12,%i4
ld [a1+12],a0
jmp %i3
ld [a1+8],a1
eval_upd_6:
mov %i2,%i3
set __indirection,%i2
st %i2,[a1]
ld [a1+4],%i2
st a0,[%i4]
st a0,[a1+4]
ld [a1+24],%g1
st %g1,[%i4+4]
ld [a1+20],%g1
st %g1,[%i4+8]
ld [a1+16],%g1
st %g1,[%i4+12]
inc 16,%i4
ld [a1+12],a0
jmp %i3
ld [a1+8],a1
eval_upd_7:
mov 0,d0
mov 20,d1
eval_upd_n:
mov a2,a3
set __indirection,a2
st a2,[a1]
ld [a1+4],a2
st a0,[a4]
st a0,[a1+4]
add a1,d1,a1
ld [a1+8],%g1
st %g1,[a4+4]
ld [a1+4],%g1
st %g1,[a4+8]
ld [a1],%g1
st %g1,[a4+12]
inc 16,a4
eval_upd_n_lp:
ld [a1-4],%g1
dec 4,a1
st %g1,[a4]
deccc d0
bcc eval_upd_n_lp
inc 4,a4
ld [a1-4],a0
jmp a3
ld [a1-8],a1
eval_upd_8:
mov 1,d0
ba eval_upd_n
mov 24,d1
eval_upd_9:
mov 2,d0
ba eval_upd_n
mov 28,d1
eval_upd_10:
mov 3,d0
ba eval_upd_n
mov 32,d1
eval_upd_11:
mov 4,d0
ba eval_upd_n
mov 36,d1
eval_upd_12:
mov 5,d0
ba eval_upd_n
mov 40,d1
eval_upd_13:
mov 6,d0
ba eval_upd_n
mov 44,d1
eval_upd_14:
mov 7,d0
ba eval_upd_n
mov 48,d1
eval_upd_15:
mov 8,d0
ba eval_upd_n
mov 52,d1
eval_upd_16:
mov 9,d0
ba eval_upd_n
mov 56,d1
eval_upd_17:
mov 10,d0
ba eval_upd_n
mov 60,d1
eval_upd_18:
mov 11,d0
ba eval_upd_n
mov 64,d1
eval_upd_19:
mov 12,d0
ba eval_upd_n
mov 68,d1
eval_upd_20:
mov 13,d0
ba eval_upd_n
mov 72,d1
eval_upd_21:
mov 14,d0
ba eval_upd_n
mov 76,d1
eval_upd_22:
mov 15,d0
ba eval_upd_n
mov 80,d1
eval_upd_23:
mov 16,d0
ba eval_upd_n
mov 84,d1
eval_upd_24:
mov 17,d0
ba eval_upd_n
mov 88,d1
eval_upd_25:
mov 18,d0
ba eval_upd_n
mov 92,d1
eval_upd_26:
mov 19,d0
ba eval_upd_n
mov 96,d1
eval_upd_27:
mov 20,d0
ba eval_upd_n
mov 100,d1
eval_upd_28:
mov 21,d0
ba eval_upd_n
mov 104,d1
eval_upd_29:
mov 22,d0
ba eval_upd_n
mov 108,d1
eval_upd_30:
mov 23,d0
ba eval_upd_n
mov 112,d1
eval_upd_31:
mov 24,d0
ba eval_upd_n
mov 116,d1
eval_upd_32:
mov 25,d0
ba eval_upd_n
mov 120,d1
!
! STRINGS
!
catAC:
ld [a0+4],d0
inc 8,a0
ld [a1+4],d1
inc 8,a1
add d0,d1,d2
add d2,3+8,d5
srl d5,2,d5
subcc d7,d5,d7
! reserve one word extra, because
! word after the string may changed
ble gc_3
add d2,3,d6
gc_r_3:
set __STRING__+2,%o0
st %o0,[a6]
mov a6,d5
inc 8,a6
st d2,[a6-4]
! copy string 1
add d1,3,d2
srl d2,2,d2
ba cat_string_4
mov a6,a2
cat_string_3:
inc 4,a1
st %o0,[a2]
inc 4,a2
cat_string_4:
deccc d2
bge,a cat_string_3
ld [a1],%o0
! copy string 2
andn d1,3,%o0
add a6,%o0,a2
inc 3,d0
srl d0,2,d0
andcc d1,3,%o0
be cat_string_al0_1
mov -1,%o1
cat_string_al123:
ld [a2],d3
sll %o0,3,%o2
mov 32,%o3
sub %o3,%o2,%o3
sll %o1,%o3,%o1
ba cat_string_al123_1
and d3,%o1,d3
cat_string_al123_0:
inc 4,a0
srl %o0,%o2,d4
or d3,d4,d3
st d3,[a2]
inc 4,a2
sll %o0,%o3,d3
cat_string_al123_1:
deccc d0
bge,a cat_string_al123_0
ld [a0],%o0
st d3,[a2]
bclr 3,d6
ld [sp],%o7
mov d5,a0
add a6,d6,a6
retl
inc 4,sp
cat_string_al0_0:
inc 4,a0
st %o0,[a2]
inc 4,a2
cat_string_al0_1:
deccc d0
bge,a cat_string_al0_0
ld [a0],%o0
bclr 3,d6
ld [sp],%o7
mov d5,a0
add a6,d6,a6
retl
inc 4,sp
gc_3:
dec 8,a0
dec 8,a1
dec 4,sp
call collect_2
st %o7,[sp]
inc 8,a0
ba gc_r_3
inc 8,a1
empty_string:
ld [sp],%o7
set zero_length_string,a0
retl
inc 4,sp
sliceAC:
ld [a0+4],d2
add a0,8,a2
tst d1
bl,a slice_string_1
clr d1
slice_string_1:
cmp d1,d2
bge empty_string
cmp d0,d1
bl empty_string
inc d0
cmp d0,d2
bg,a slice_string_2
mov d2,d0
slice_string_2:
sub d0,d1,d0
add d0,3,d2
srl d2,2,d2
dec 2,d7
subcc d7,d2,d7
bneg gc_4
nop
r_gc_4:
set __STRING__+2,%o0
st %o0,[a6]
mov a6,d5
inc 8,a6
st d0,[a6-4]
andcc d1,3,%o0
be slice_string_al0_1
add a2,d1,a2
slice_string_al123:
sub a2,%o0,a2
sll %o0,3,%o2
mov 32,%o3
sub %o3,%o2,%o3
ld [a2],d3
ba slice_string_al123_1
sll d3,%o2,d4
slice_string_al123_0:
inc 4,a2
srl %o0,%o3,%o1
or d4,%o1,d4
st d4,[a6]
inc 4,a6
sll %o0,%o2,d4
slice_string_al123_1:
deccc d2
bge,a slice_string_al123_0
ld [a2+4],%o0
ld [sp],%o7
mov d5,a0
retl
inc 4,sp
slice_string_al0_0:
inc 4,a2
st %o0,[a6]
inc 4,a6
slice_string_al0_1:
deccc d2
bge,a slice_string_al0_0
ld [a2],%o0
ld [sp],%o7
mov d5,a0
retl
inc 4,sp
gc_4: dec 4,sp
call collect_1
st %o7,[sp]
ba r_gc_4
add a0,8,a2
updateAC:
ld [a0+4],d2
cmp d1,d2
bcc update_string_error
add a0,8,a2
add d2,3,d3
srl d3,2,d3
dec 2,d7
subcc d7,d3,d7
bneg gc_5
inc 8,d1
r_gc_5:
set __STRING__+2,%o0
st %o0,[%g6]
mov a6,a0
inc 8,%g6
ba update_string_5
st d2,[a6-4]
update_string_4:
inc 4,a2
st %o0,[a6]
inc 4,a6
update_string_5:
deccc d3
bge,a update_string_4
ld [a2],%o0
ld [sp],%o7
stb d0,[a0+d1]
retl
inc 4,sp
gc_5: dec 4,sp
call collect_1
st %o7,[sp]
ba r_gc_5
add a0,8,a2
update_string_error:
set high_index_string,%o0
tst d0
bpos print_error
nop
set low_index_string,%o0
update_string_error_2:
ba print_error
nop
eqAC:
ld [a0+4],d0
ld [a1+4],%o0
inc 8,a0
cmp d0,%o0
bne equal_string_ne
inc 8,a1
and d0,3,d1
srl d0,2,d0
deccc d0
bcs equal_string_b
nop
ld [a1],%o0
equal_string_1:
inc 4,a1
ld [a0],%o1
inc 4,a0
cmp %o1,%o0
bne equal_string_ne
deccc d0
bge,a equal_string_1
ld [a1],%o0
equal_string_b:
deccc d1
bcs equal_string_eq
nop
ldub [a1],%o0
equal_string_2:
inc a1
ldub [a0],%o1
inc a0
cmp %o1,%o0
bne equal_string_ne
deccc d1
bge,a equal_string_2
ldub [a1],%o0
equal_string_eq:
ld [sp],%o7
mov -1,d0
retl
inc 4,sp
equal_string_ne:
ld [sp],%o7
clr d0
retl
inc 4,sp
cmpAC:
ld [a0+4],d1
inc 8,a0
ld [a1+4],d2
inc 8,a1
cmp d2,d1
bcs,a cmp_string_less
mov -1,d0
bgu,a cmp_string_chars
mov 1,d0
ba cmp_string_chars
clr d0
cmp_string_less:
mov d2,d1
cmp_string_chars:
and d1,3,d2
srl d1,2,d1
deccc d1
bcs cmp_string_b
nop
ld [a0],%o0
cmp_string_1:
inc 4,a0
ld [a1],%o1
inc 4,a1
cmp %o1,%o0
bne cmp_string_ne
nop
deccc d1
bge,a cmp_string_1
ld [a0],%o0
cmp_string_b:
deccc d2
bcs cmp_string_eq
nop
ldub [a0],%o0
cmp_string_2:
inc a0
ldub [a1],%o1
inc a1
cmp %o1,%o0
bne cmp_string_ne
nop
deccc d2
bge,a cmp_string_2
ldub [a0],%o0
cmp_string_eq:
ld [sp],%o7
retl
inc 4,sp
cmp_string_ne:
bgu cmp_string_r1
nop
ld [sp],%o7
mov -1,d0
retl
inc 4,sp
cmp_string_r1:
ld [sp],%o7
mov 1,d0
retl
inc 4,sp
string_to_string_node:
ld [a0],d0
inc 4,a0
add d0,3,d1
srl d1,2,d1
dec 2,d7
subcc d7,d1,d7
bneg string_to_string_node_gc
nop
string_to_string_node_r:
set __STRING__+2,%o0
st %o0,[%g6]
mov %g6,d2
st d0,[%g6+4]
b string_to_string_node_4
inc 8,%g6
string_to_string_node_2:
st %o0,[%g6]
inc 4,a0
inc 4,%g6
string_to_string_node_4:
deccc d1
bge,a string_to_string_node_2
ld [a0],%o0
mov d2,a0
ld [sp],%o7
retl
inc 4,sp
string_to_string_node_gc:
st a0,[sp-4]
dec 8,sp
call collect_0
st %o7,[sp]
ld [sp],a0
b string_to_string_node_r
inc 4,sp
.word 3
_c3: b,a __cycle__in__spine
.word 4
_c4: b,a __cycle__in__spine
.word 5
_c5: b,a __cycle__in__spine
.word 6
_c6: b,a __cycle__in__spine
.word 7
_c7: b,a __cycle__in__spine
.word 8
_c8: b,a __cycle__in__spine
.word 9
_c9: b,a __cycle__in__spine
.word 10
_c10: b,a __cycle__in__spine
.word 11
_c11: b,a __cycle__in__spine
.word 12
_c12: b,a __cycle__in__spine
.word 13
_c13: b,a __cycle__in__spine
.word 14
_c14: b,a __cycle__in__spine
.word 15
_c15: b,a __cycle__in__spine
.word 16
_c16: b,a __cycle__in__spine
.word 17
_c17: b,a __cycle__in__spine
.word 18
_c18: b,a __cycle__in__spine
.word 19
_c19: b,a __cycle__in__spine
.word 20
_c20: b,a __cycle__in__spine
.word 21
_c21: b,a __cycle__in__spine
.word 22
_c22: b,a __cycle__in__spine
.word 23
_c23: b,a __cycle__in__spine
.word 24
_c24: b,a __cycle__in__spine
.word 25
_c25: b,a __cycle__in__spine
.word 26
_c26: b,a __cycle__in__spine
.word 27
_c27: b,a __cycle__in__spine
.word 28
_c28: b,a __cycle__in__spine
.word 29
_c29: b,a __cycle__in__spine
.word 30
_c30: b,a __cycle__in__spine
.word 31
_c31: b,a __cycle__in__spine
.word 32
_c32: b,a __cycle__in__spine
!
! ARRAYS
!
create_arrayB:
mov d1,d2
inc 3,d1
srl d1,2,d1
dec 3,d7
subcc d7,d1,d7
bpos no_collect_4575
nop
dec 4,sp
call collect_0
st %o7,[sp]
no_collect_4575:
sll d0,8,d3
or d0,d3,d0
sll d0,16,d3
or d0,d3,d0
set __ARRAY__+2,%o0
mov a6,a0
st %o0,[a6]
st d2,[a6+4]
set BOOL+2,%o0
st %o0,[a6+8]
ba create_arrayBCI
inc 12,a6
create_arrayC:
mov d1,d2
inc 3,d1
srl d1,2,d1
dec 2,d7
subcc d7,d1,d7
bpos no_collect_4578
nop
dec 4,sp
call collect_0
st %o7,[sp]
no_collect_4578:
sll d0,8,d3
or d0,d3,d0
sll d0,16,d3
or d0,d3,d0
mov a6,a0
set __STRING__+2,%o0
st %o0,[a6]
st d2,[a6+4]
ba create_arrayBCI
inc 8,a6
create_arrayI:
dec 3,d7
subcc d7,d1,d7
bpos no_collect_4577
nop
dec 4,sp
call collect_0
st %o7,[sp]
no_collect_4577:
set __ARRAY__+2,%o0
mov a6,a0
st %o0,[a6]
st d1,[a6+4]
set INT+2,%o0
st %o0,[a6+8]
inc 12,a6
create_arrayBCI:
btst 1,d1
be st_filli_array
srl d1,1,d1
st d0,[a6]
ba st_filli_array
inc 4,a6
filli_array:
st d0,[a6+4]
inc 8,a6
st_filli_array:
deccc 1,d1
bcc,a filli_array
st d0,[a6]
ld [sp],%o7
retl
inc 4,sp
create_arrayR:
st %f0,[sp-8]
st %f1,[sp-4]
ld [sp-8],d1
ld [sp-4],d2
dec 3,d7
sub d7,d0,d7
subcc d7,d0,d7
bpos no_collect_4579
nop
dec 4,sp
call collect_0
st %o7,[sp]
no_collect_4579:
mov a6,a0
set __ARRAY__+2,%o0
st %o0,[a6]
st d0,[a6+4]
set REAL+2,%o0
st %o0,[a6+8]
ba st_fillr_array
inc 12,a6
fillr_array:
st d2,[a6+4]
inc 8,a6
st_fillr_array:
deccc 1,d0
bcc,a fillr_array
st d1,[a6]
ld [sp],%o7
retl
inc 4,sp
create_array:
dec 3,d7
subcc d7,d0,d7
bpos no_collect_4576
nop
dec 4,sp
call collect_1
st %o7,[sp]
no_collect_4576:
mov a0,d1
set __ARRAY__+2,%o0
mov a6,a0
st %o0,[a6]
st d0,[a6+4]
st %g0,[a6+8]
inc 12,a6
ld [sp],a1
ba fillr1_array
inc 4,sp
create_R_array:
deccc 2,d2
bcs create_R_array_1
nop
be create_R_array_2
nop
deccc 2,d2
bcs create_R_array_3
nop
be create_R_array_4
nop
b,a create_R_array_5
create_R_array_1:
dec 3,d7
subcc d7,d0,d7
bpos no_collect_4581
nop
dec 4,sp
call collect_0
st %o7,[sp]
no_collect_4581:
set __ARRAY__+2,%o0
mov a6,a0
st %o0,[a6]
st d0,[a6+4]
st d1,[a6+8]
inc 12,a6
ld [sp],a1
tst d3
be r_array_1_b
inc 4,sp
ba fillr1_array
ld [a4-4],d1
r_array_1_b:
ld [sp],d1
fillr1_array:
btst 1,d0
be st_fillr1_array_1
srl d0,1,d0
st d1,[a6]
ba st_fillr1_array_1
inc 4,a6
fillr1_array_lp:
st d1,[a6+4]
inc 8,a6
st_fillr1_array_1:
deccc 1,d0
bcc,a fillr1_array_lp
st d1,[a6]
jmp a1+8
nop
create_R_array_2:
dec 3,d7
sub d7,d0,d7
subcc d7,d0,d7
bpos no_collect_4582
nop
dec 4,sp
call collect_0
st %o7,[sp]
no_collect_4582:
set __ARRAY__+2,%o0
mov a6,a0
st %o0,[a6]
st d0,[a6+4]
st d1,[a6+8]
inc 12,a6
ld [sp],a1
deccc 1,d3
bcs r_array_2_bb
inc 4,sp
be r_array_2_ab
nop
r_array_2_aa:
ld [a4-4],d1
ba st_fillr2_array
ld [a4-8],d2
r_array_2_ab:
ld [a4-4],d1
ba st_fillr2_array
ld [sp],d2
r_array_2_bb:
ld [sp],d1
ba st_fillr2_array
ld [sp+4],d2
fillr2_array_1:
st d2,[a6+4]
inc 8,a6
st_fillr2_array:
deccc 1,d0
bcc,a fillr2_array_1
st d1,[a6]
jmp a1+8
nop
create_R_array_3:
dec 3,d7
sub d7,d0,d7
sub d7,d0,d7
subcc d7,d0,d7
bpos no_collect_4583
nop
dec 4,sp
call collect_0
st %o7,[sp]
no_collect_4583:
set __ARRAY__+2,%o0
mov a6,a0
st %o0,[a6]
st d0,[a6+4]
st d1,[a6+8]
inc 12,a6
ld [sp],a1
add sp,4,a2
tst d3
be r_array_3
inc 4,sp
sll d3,2,d4
sub a4,d4,a3
dec 1,d3
copy_a_to_b_lp3:
ld [a3],%o0
inc 4,a3
st %o0,[sp-4]
deccc 1,d3
bcc copy_a_to_b_lp3
dec 4,sp
r_array_3:
ld [sp],d1
ld [sp+4],d2
ld [sp+8],d3
ba st_fillr3_array
mov a2,sp
fillr3_array_1:
st d2,[a6+4]
st d3,[a6+8]
inc 12,a6
st_fillr3_array:
deccc 1,d0
bcc,a fillr3_array_1
st d1,[a6]
jmp a1+8
nop
create_R_array_4:
dec 3,d7
sll d0,2,d2
subcc d7,d2,d7
bpos no_collect_4584
nop
dec 4,sp
call collect_0
st %o7,[sp]
no_collect_4584:
set __ARRAY__+2,%o1
mov a6,a0
st %o1,[a6]
st d0,[a6+4]
st d1,[a6+8]
inc 12,a6
ld [sp],a1
add sp,4,a2
tst d3
be r_array_4
inc 4,sp
sll d3,2,d4
sub a4,d4,a3
dec 1,d3
copy_a_to_b_lp4:
ld [a3],%o1
inc 4,a3
st %o1,[sp-4]
deccc 1,d3
bcc copy_a_to_b_lp4
dec 4,sp
r_array_4:
ld [sp],d1
ld [sp+4],d2
ld [sp+8],d3
ld [sp+12],d4
ba st_fillr4_array
mov a2,sp
fillr4_array:
st d2,[a6+4]
st d3,[a6+8]
st d4,[a6+12]
inc 16,a6
st_fillr4_array:
deccc 1,d0
bcc,a fillr4_array
st d1,[a6]
jmp a1+8
nop
create_R_array_5:
dec 3,d7
sll d0,2,d4
sub d7,d4,d7
dec 1,d2
mov d2,d5
sub_size_lp:
deccc 1,d5
bcc sub_size_lp
subcc d7,d0,d7
bpos no_collect_4585
nop
dec 4,sp
call collect_0
st %o7,[sp]
no_collect_4585:
set __ARRAY__+2,%o0
mov a6,a0
st %o0,[a6]
st d0,[a6+4]
st d1,[a6+8]
inc 12,a6
ld [sp],a1
add sp,4,a2
mov d2,d5
tst d3
be r_array_5
inc 4,sp
sll d3,2,d4
sub a4,d4,a3
dec 1,d3
copy_a_to_b_lp5:
ld [a3],%o0
inc 4,a3
st %o0,[sp-4]
deccc 1,d3
bcc copy_a_to_b_lp5
dec 4,sp
r_array_5:
ld [sp],d1
ld [sp+4],d2
ld [sp+8],d3
ba st_fillr5_array
ld [sp+12],d4
fillr5_array_1:
st d2,[a6+4]
mov d5,d6
st d3,[a6+8]
add sp,16,a3
st d4,[a6+12]
inc 16,a6
ld [a3],%o0
copy_elem_lp5:
inc 4,a3
st %o0,[a6]
inc 4,a6
deccc 1,d6
bcc,a copy_elem_lp5
ld [a3],%o0
st_fillr5_array:
deccc 1,d0
bcc,a fillr5_array_1
st d1,[a6]
jmp a1+8
mov a2,sp
!
! AP code
!
#if 0
e__system__eaAP:
st a0,[%i4]
inc 4,%i4
mov a1,a0
ba ea_ap
mov %i2,a1
sethi %hi e__system__eaAP,%i2
ba eval_upd_2
inc %lo e__system__eaAP,%i2
.word e__system__AP
.word 2
e__system__nAP:
st a0,[%i4]
st a5,[a0]
ld [a0+4],a1
ld [a0+8],a0
inc 4,%i4
ea_ap:
ld [a1],d0
btst 2,d0
bne ap_1
nop
st a0,[%i4]
mov a1,a0
inc 4,%i4
dec 4,sp
call d0
st %o7,[sp]
mov a0,a1
ld [%i4-4],a0
dec 4,%i4
ap_1:
ld [a1],a2
ld [a2+4-2],a2
dec 4,sp
call a2
st %o7,[sp]
ld [%i4-4],%i2
dec 4,%i4
ld [a0],d0
ld [a0+4],d1
st d0,[%i2]
ld [a0+8],d2
st d1,[%i2+4]
st d2,[%i2+8]
mov %i2,a0
ld [sp],%o7
retl
inc 4,sp
#endif
e__system__sAP:
ld [a1],a2
ld [a2+4-2],a2
jmp a2
nop
_create_arrayB:
mov d0,d1
inc 3,d0
srl d0,2,d0
dec 3,d7
subcc d7,d0,d7
bpos no_collect_3575
nop
dec 4,sp
call collect_0
st %o7,[sp]
no_collect_3575:
set __ARRAY__+2,%o0
mov a6,a0
st %o0,[a6]
st d1,[a6+4]
set BOOL+2,%o0
st %o0,[a6+8]
inc 12,a6
sll d0,2,d0
add a6,d0,a6
ld [sp],%o7
retl
inc 4,sp
_create_arrayC:
mov d0,d1
inc 3,d0
srl d0,2,d0
dec 2,d7
subcc d7,d0,d7
bpos no_collect_3578
nop
dec 4,sp
call collect_0
st %o7,[sp]
no_collect_3578:
set __STRING__+2,%o0
mov a6,a0
st %o0,[a6]
st d1,[a6+4]
inc 8,a6
sll d0,2,d0
add a6,d0,a6
ld [sp],%o7
retl
inc 4,sp
_create_arrayI:
dec 3,d7
subcc d7,d0,d7
bpos no_collect_3577
nop
dec 4,sp
call collect_0
st %o7,[sp]
no_collect_3577:
set __ARRAY__+2,%o0
mov a6,a0
st %o0,[a6]
st d0,[a6+4]
set INT+2,%o0
st %o0,[a6+8]
inc 12,a6
sll d0,2,d0
add a6,d0,a6
ld [sp],%o7
retl
inc 4,sp
_create_arrayR:
dec 3,d7
sub d7,d0,d7
subcc d7,d0,d7
bpos no_collect_3579
nop
dec 4,sp
call collect_0
st %o7,[sp]
no_collect_3579:
mov a6,a0
set __ARRAY__+2,%o0
st %o0,[a6]
st d0,[a6+4]
set REAL+2,%o0
st %o0,[a6+8]
inc 12,a6
sll d0,3,d0
add a6,d0,a6
ld [sp],%o7
retl
inc 4,sp
_create_r_array:
dec 3,d7
mov d2,d5
sub_size_lp2:
deccc 1,d5
bg sub_size_lp2
sub d7,d0,d7
tst d7
bpos no_collect_3585
nop
dec 4,sp
call collect_1
st %o7,[sp]
no_collect_3585:
mov a0,d4
set __ARRAY__+2,%o0
mov a6,a0
st %o0,[a6]
st d0,[a6+4]
st d1,[a6+8]
inc 12,a6
ld [sp],a1
tst d3
be _create_r_array_0
inc 4,sp
deccc 2,d3
bcs _create_r_array_1
nop
be _create_r_array_2
nop
deccc 2,d3
bcs _create_r_array_3
nop
be _create_r_array_4
nop
b,a _create_r_array_5
_create_r_array_0:
tst d2
beq _skip_fillr0_array_lp
sll d0,2,d0
_fillr0_array_1:
deccc d2
bne _fillr0_array_1
add a6,d0,a6
_skip_fillr0_array_lp:
jmp a1+8
nop
_create_r_array_1:
tst d0
beq _skip_fillr1_array_lp
sll d2,2,d2
_fillr1_array_lp:
st d4,[a6]
deccc d0
bne _fillr1_array_lp
add a6,d2,a6
_skip_fillr1_array_lp:
jmp a1+8
nop
_create_r_array_2:
tst d0
beq _skip_fillr2_array_1
sll d2,2,d2
_fillr2_array_1:
st d4,[a6]
st d4,[a6+4]
deccc d0
bne _fillr2_array_1
add a6,d2,a6
_skip_fillr2_array_1:
jmp a1+8
nop
_create_r_array_3:
tst d0
beq _skip_fillr3_array
sll d2,2,d2
_fillr3_array_1:
st d4,[a6]
st d4,[a6+4]
st d4,[a6+8]
deccc d0
bne _fillr3_array_1
add a6,d2,a6
_skip_fillr3_array:
jmp a1+8
nop
_create_r_array_4:
tst d0
beq _skip_fillr4_array
sll d2,2,d2
_fillr4_array:
st d4,[a6]
st d4,[a6+4]
st d4,[a6+8]
st d4,[a6+12]
deccc d0
bne _fillr4_array
add a6,d2,a6
_skip_fillr4_array:
jmp a1+8
nop
_create_r_array_5:
mov d3,d1
dec 4,d2
sub d2,d3,d2
ba _st_fillr5_array
sll d2,2,d2
_fillr5_array_1:
st d4,[a6+4]
mov d1,d5
st d4,[a6+8]
st d4,[a6+12]
inc 16,a6
_copy_elem_lp5:
st d4,[a6]
deccc d5
bne _copy_elem_lp5
inc 4,a6
add a6,d2,a6
_st_fillr5_array:
deccc d0
bge,a _fillr5_array_1
st d4,[a6]
jmp a1+8
nop
#ifndef NEW_DESCRIPTORS
yet_args_needed:
! for more than 4 arguments
ld [a1],d1
lduh [d1-2],d0
dec 3,%l7
subcc %l7,d0,%l7
bneg gc_1
nop
gc_r_1: ld [a1+4],%l3
dec 1+4,d0
ld [a1+8],a1
mov %g6,d2
ld [a1],%o0
ld [a1+4],%o1
st %o0,[%g6]
ld [a1+8],%o2
st %o1,[%g6+4]
inc 12,a1
st %o2,[%g6+8]
inc 12,%g6
ld [a1],%o0
cp_a: inc 4,a1
st %o0,[%g6]
inc 4,%g6
deccc d0
bge,a cp_a
ld [a1],%o0
st a0,[%g6]
inc 8,d1
st d1,[%g6+4]
add %g6,4,a0
st %l3,[%g6+8]
ld [sp],%o7
st d2,[%g6+12]
inc 4,sp
retl
inc 16,%g6
gc_1: dec 4,sp
call collect_2
st %o7,[sp]
b,a gc_r_1
yet_args_needed_0:
deccc 2,%l7
bneg gc_20
nop
gc_r_20: st a0,[%g6+4]
ld [a1],d0
mov %g6,a0
inc 8,d0
st d0,[%g6]
ld [sp],%o7
inc 8,%g6
retl
inc 4,sp
gc_20: dec 4,sp
call collect_2
st %o7,[sp]
ba gc_r_20
nop
yet_args_needed_1:
deccc 3,%l7
bneg gc_21
nop
gc_r_21: st a0,[%g6+8]
ld [a1],d0
mov %g6,a0
inc 8,d0
st d0,[%g6]
ld [a1+4],d1
st d1,[%g6+4]
ld [sp],%o7
inc 12,%g6
retl
inc 4,sp
gc_21: dec 4,sp
call collect_2
st %o7,[sp]
b,a gc_r_21
yet_args_needed_2:
deccc 5,%l7
bneg gc_22
nop
gc_r_22:
ld [a1],d0
st a0,[%g6+4]
inc 8,d0
ld [a1+4],d2
st d0,[%g6+8]
add %g6,8,a0
ld [a1+8],%o0
st d2,[%g6+12]
ld [sp],%o7
st %o0,[%g6]
inc 4,sp
st %g6,[%g6+16]
retl
inc 20,%g6
gc_22: dec 4,sp
call collect_2
st %o7,[sp]
ba gc_r_22
nop
yet_args_needed_3:
deccc 6,%l7
bneg gc_23
nop
gc_r_23:
ld [a1],d0
st a0,[%g6+8]
inc 8,d0
ld [a1+4],d2
st d0,[%g6+12]
ld [a1+8],a1
st d2,[%g6+16]
ld [a1],%o0
st %g6,[%g6+20]
ld [a1+4],%o1
add %g6,12,a0
st %o0,[%g6]
ld [sp],%o7
inc 4,sp
st %o1,[%g6+4]
retl
inc 24,%g6
gc_23: dec 4,sp
call collect_2
st %o7,[sp]
b,a gc_r_23
yet_args_needed_4:
deccc 7,%l7
bneg gc_24
nop
gc_r_24:
ld [a1],d0
st a0,[%g6+12]
inc 8,d0
ld [a1+4],d2
st d0,[%g6+16]
ld [a1+8],a1
st d2,[%g6+20]
ld [a1],%o0
st %g6,[%g6+24]
ld [a1+4],%o1
st %o0,[%g6]
add %g6,16,a0
ld [a1+8],%o2
st %o1,[%g6+4]
ld [sp],%o7
inc 4,sp
st %o2,[%g6+8]
retl
inc 28,%g6
gc_24: dec 4,sp
call collect_2
st %o7,[sp]
ba gc_r_24
nop
#endif
repl_args_b:
tst d0
ble repl_args_b_1
nop
deccc 1,d0
beq repl_args_b_4
nop
ld [a0+8],a1
deccc 2,d1
bne repl_args_b_2
nop
st a1,[%i4]
ba repl_args_b_4
inc 4,%i4
repl_args_b_2:
sll d0,2,d1
add a1,d1,a1
dec 1,d0
repl_args_b_3:
ld [a1-4],%o0
st %o0,[%i4]
dec 4,a1
inc 4,%i4
tst d0
bne repl_args_b_3
dec d0
repl_args_b_4:
ld [a0+4],%o0
st %o0,[%i4]
inc 4,%i4
repl_args_b_1:
ld [sp],%o7
retl
inc 4,sp
push_arg_b:
cmp d1,2
bcs push_arg_b_1
nop
bne push_arg_b_2
nop
cmp d1,d0
beq push_arg_b_1
nop
push_arg_b_2:
ld [a0+8],a0
dec 2,d1
push_arg_b_1:
ld [sp],%o7
sll d1,2,d1
ld [a0+d1],a0
retl
inc 4,sp
del_args:
ld [a0],d1
sub d1,d0,d1
lduh [d1-2],d0
deccc 2,d0
bge del_args_2
nop
ld [a0+4],%o0
st d1,[a1]
ld [a0+8],%o1
st %o0,[a1+4]
ld [sp],%o7
st %o1,[a1+8]
retl
inc 4,sp
del_args_2:
bne del_args_3
nop
ld [a0+4],%o0
st d1,[a1]
ld [a0+8],%o1
st %o0,[a1+4]
ld [%o1],%o1
ld [sp],%o7
st %o1,[a1+8]
retl
inc 4,sp
del_args_3:
subcc %l7,d0,%l7
bneg del_args_gc
nop
del_args_r_gc:
st d1,[a1]
ld [a0+4],%o0
st %g6,[a1+8]
ld [a0+8],a0
st %o0,[a1+4]
ld [a0],%o0
del_args_copy_args:
inc 4,a0
st %o0,[%g6]
inc 4,%g6
deccc d0
bg,a del_args_copy_args
ld [a0],%o0
ld [sp],%o7
retl
inc 4,sp
del_args_gc:
dec 4,sp
call collect_2
st %o7,[sp]
b,a del_args_r_gc
#if 0
o__S_P2:
ld [a0],d0
ldsh [d0-2],d0
cmp d0,2
be o__S_P2_2
ld [a0+8],a0
ld [a0],a0
o__S_P2_2:
ld [sp],%o7
retl
inc 4,sp
ea__S_P2:
ld [a1+4],d0
set __indirection,%i2
st %i2,[a1]
st a0,[a1+4]
mov d0,a1
ld [a1],d0
btst 2,d0
bne ea__S_P2_1
nop
st a0,[%i4]
inc 4,%i4
mov a1,a0
dec 4,sp
call d0
st %o7,[sp]
mov a0,a1
ld [%i4-4],a0
dec 4,%i4
ea__S_P2_1:
ld [a1],d0
ldsh [d0-2],d0
cmp d0,2
be ea__S_P2_2
ld [a1+8],a1
ld [a1],a1
ea__S_P2_2:
ld [a1],d0
btst 2,d0
bne ea__S_P2_3
nop
jmp d0-20
nop
ea__S_P2_3:
st d0,[a0]
ld [a1+4],%g1
st %g1,[a0+4]
ld [a1+8],%g1
st %g1,[a0+8]
ld [sp],%o7
retl
inc 4,sp
#endif
#ifdef NEW_DESCRIPTORS
# include "sap.s"
#endif
|