[a530bb]: doc / cmucl / cmu-user / cmu-user.tex Maximize Restore History

Download this file

cmu-user.tex    13322 lines (11054 with data), 528.6 kB

    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
 4218
 4219
 4220
 4221
 4222
 4223
 4224
 4225
 4226
 4227
 4228
 4229
 4230
 4231
 4232
 4233
 4234
 4235
 4236
 4237
 4238
 4239
 4240
 4241
 4242
 4243
 4244
 4245
 4246
 4247
 4248
 4249
 4250
 4251
 4252
 4253
 4254
 4255
 4256
 4257
 4258
 4259
 4260
 4261
 4262
 4263
 4264
 4265
 4266
 4267
 4268
 4269
 4270
 4271
 4272
 4273
 4274
 4275
 4276
 4277
 4278
 4279
 4280
 4281
 4282
 4283
 4284
 4285
 4286
 4287
 4288
 4289
 4290
 4291
 4292
 4293
 4294
 4295
 4296
 4297
 4298
 4299
 4300
 4301
 4302
 4303
 4304
 4305
 4306
 4307
 4308
 4309
 4310
 4311
 4312
 4313
 4314
 4315
 4316
 4317
 4318
 4319
 4320
 4321
 4322
 4323
 4324
 4325
 4326
 4327
 4328
 4329
 4330
 4331
 4332
 4333
 4334
 4335
 4336
 4337
 4338
 4339
 4340
 4341
 4342
 4343
 4344
 4345
 4346
 4347
 4348
 4349
 4350
 4351
 4352
 4353
 4354
 4355
 4356
 4357
 4358
 4359
 4360
 4361
 4362
 4363
 4364
 4365
 4366
 4367
 4368
 4369
 4370
 4371
 4372
 4373
 4374
 4375
 4376
 4377
 4378
 4379
 4380
 4381
 4382
 4383
 4384
 4385
 4386
 4387
 4388
 4389
 4390
 4391
 4392
 4393
 4394
 4395
 4396
 4397
 4398
 4399
 4400
 4401
 4402
 4403
 4404
 4405
 4406
 4407
 4408
 4409
 4410
 4411
 4412
 4413
 4414
 4415
 4416
 4417
 4418
 4419
 4420
 4421
 4422
 4423
 4424
 4425
 4426
 4427
 4428
 4429
 4430
 4431
 4432
 4433
 4434
 4435
 4436
 4437
 4438
 4439
 4440
 4441
 4442
 4443
 4444
 4445
 4446
 4447
 4448
 4449
 4450
 4451
 4452
 4453
 4454
 4455
 4456
 4457
 4458
 4459
 4460
 4461
 4462
 4463
 4464
 4465
 4466
 4467
 4468
 4469
 4470
 4471
 4472
 4473
 4474
 4475
 4476
 4477
 4478
 4479
 4480
 4481
 4482
 4483
 4484
 4485
 4486
 4487
 4488
 4489
 4490
 4491
 4492
 4493
 4494
 4495
 4496
 4497
 4498
 4499
 4500
 4501
 4502
 4503
 4504
 4505
 4506
 4507
 4508
 4509
 4510
 4511
 4512
 4513
 4514
 4515
 4516
 4517
 4518
 4519
 4520
 4521
 4522
 4523
 4524
 4525
 4526
 4527
 4528
 4529
 4530
 4531
 4532
 4533
 4534
 4535
 4536
 4537
 4538
 4539
 4540
 4541
 4542
 4543
 4544
 4545
 4546
 4547
 4548
 4549
 4550
 4551
 4552
 4553
 4554
 4555
 4556
 4557
 4558
 4559
 4560
 4561
 4562
 4563
 4564
 4565
 4566
 4567
 4568
 4569
 4570
 4571
 4572
 4573
 4574
 4575
 4576
 4577
 4578
 4579
 4580
 4581
 4582
 4583
 4584
 4585
 4586
 4587
 4588
 4589
 4590
 4591
 4592
 4593
 4594
 4595
 4596
 4597
 4598
 4599
 4600
 4601
 4602
 4603
 4604
 4605
 4606
 4607
 4608
 4609
 4610
 4611
 4612
 4613
 4614
 4615
 4616
 4617
 4618
 4619
 4620
 4621
 4622
 4623
 4624
 4625
 4626
 4627
 4628
 4629
 4630
 4631
 4632
 4633
 4634
 4635
 4636
 4637
 4638
 4639
 4640
 4641
 4642
 4643
 4644
 4645
 4646
 4647
 4648
 4649
 4650
 4651
 4652
 4653
 4654
 4655
 4656
 4657
 4658
 4659
 4660
 4661
 4662
 4663
 4664
 4665
 4666
 4667
 4668
 4669
 4670
 4671
 4672
 4673
 4674
 4675
 4676
 4677
 4678
 4679
 4680
 4681
 4682
 4683
 4684
 4685
 4686
 4687
 4688
 4689
 4690
 4691
 4692
 4693
 4694
 4695
 4696
 4697
 4698
 4699
 4700
 4701
 4702
 4703
 4704
 4705
 4706
 4707
 4708
 4709
 4710
 4711
 4712
 4713
 4714
 4715
 4716
 4717
 4718
 4719
 4720
 4721
 4722
 4723
 4724
 4725
 4726
 4727
 4728
 4729
 4730
 4731
 4732
 4733
 4734
 4735
 4736
 4737
 4738
 4739
 4740
 4741
 4742
 4743
 4744
 4745
 4746
 4747
 4748
 4749
 4750
 4751
 4752
 4753
 4754
 4755
 4756
 4757
 4758
 4759
 4760
 4761
 4762
 4763
 4764
 4765
 4766
 4767
 4768
 4769
 4770
 4771
 4772
 4773
 4774
 4775
 4776
 4777
 4778
 4779
 4780
 4781
 4782
 4783
 4784
 4785
 4786
 4787
 4788
 4789
 4790
 4791
 4792
 4793
 4794
 4795
 4796
 4797
 4798
 4799
 4800
 4801
 4802
 4803
 4804
 4805
 4806
 4807
 4808
 4809
 4810
 4811
 4812
 4813
 4814
 4815
 4816
 4817
 4818
 4819
 4820
 4821
 4822
 4823
 4824
 4825
 4826
 4827
 4828
 4829
 4830
 4831
 4832
 4833
 4834
 4835
 4836
 4837
 4838
 4839
 4840
 4841
 4842
 4843
 4844
 4845
 4846
 4847
 4848
 4849
 4850
 4851
 4852
 4853
 4854
 4855
 4856
 4857
 4858
 4859
 4860
 4861
 4862
 4863
 4864
 4865
 4866
 4867
 4868
 4869
 4870
 4871
 4872
 4873
 4874
 4875
 4876
 4877
 4878
 4879
 4880
 4881
 4882
 4883
 4884
 4885
 4886
 4887
 4888
 4889
 4890
 4891
 4892
 4893
 4894
 4895
 4896
 4897
 4898
 4899
 4900
 4901
 4902
 4903
 4904
 4905
 4906
 4907
 4908
 4909
 4910
 4911
 4912
 4913
 4914
 4915
 4916
 4917
 4918
 4919
 4920
 4921
 4922
 4923
 4924
 4925
 4926
 4927
 4928
 4929
 4930
 4931
 4932
 4933
 4934
 4935
 4936
 4937
 4938
 4939
 4940
 4941
 4942
 4943
 4944
 4945
 4946
 4947
 4948
 4949
 4950
 4951
 4952
 4953
 4954
 4955
 4956
 4957
 4958
 4959
 4960
 4961
 4962
 4963
 4964
 4965
 4966
 4967
 4968
 4969
 4970
 4971
 4972
 4973
 4974
 4975
 4976
 4977
 4978
 4979
 4980
 4981
 4982
 4983
 4984
 4985
 4986
 4987
 4988
 4989
 4990
 4991
 4992
 4993
 4994
 4995
 4996
 4997
 4998
 4999
 5000
 5001
 5002
 5003
 5004
 5005
 5006
 5007
 5008
 5009
 5010
 5011
 5012
 5013
 5014
 5015
 5016
 5017
 5018
 5019
 5020
 5021
 5022
 5023
 5024
 5025
 5026
 5027
 5028
 5029
 5030
 5031
 5032
 5033
 5034
 5035
 5036
 5037
 5038
 5039
 5040
 5041
 5042
 5043
 5044
 5045
 5046
 5047
 5048
 5049
 5050
 5051
 5052
 5053
 5054
 5055
 5056
 5057
 5058
 5059
 5060
 5061
 5062
 5063
 5064
 5065
 5066
 5067
 5068
 5069
 5070
 5071
 5072
 5073
 5074
 5075
 5076
 5077
 5078
 5079
 5080
 5081
 5082
 5083
 5084
 5085
 5086
 5087
 5088
 5089
 5090
 5091
 5092
 5093
 5094
 5095
 5096
 5097
 5098
 5099
 5100
 5101
 5102
 5103
 5104
 5105
 5106
 5107
 5108
 5109
 5110
 5111
 5112
 5113
 5114
 5115
 5116
 5117
 5118
 5119
 5120
 5121
 5122
 5123
 5124
 5125
 5126
 5127
 5128
 5129
 5130
 5131
 5132
 5133
 5134
 5135
 5136
 5137
 5138
 5139
 5140
 5141
 5142
 5143
 5144
 5145
 5146
 5147
 5148
 5149
 5150
 5151
 5152
 5153
 5154
 5155
 5156
 5157
 5158
 5159
 5160
 5161
 5162
 5163
 5164
 5165
 5166
 5167
 5168
 5169
 5170
 5171
 5172
 5173
 5174
 5175
 5176
 5177
 5178
 5179
 5180
 5181
 5182
 5183
 5184
 5185
 5186
 5187
 5188
 5189
 5190
 5191
 5192
 5193
 5194
 5195
 5196
 5197
 5198
 5199
 5200
 5201
 5202
 5203
 5204
 5205
 5206
 5207
 5208
 5209
 5210
 5211
 5212
 5213
 5214
 5215
 5216
 5217
 5218
 5219
 5220
 5221
 5222
 5223
 5224
 5225
 5226
 5227
 5228
 5229
 5230
 5231
 5232
 5233
 5234
 5235
 5236
 5237
 5238
 5239
 5240
 5241
 5242
 5243
 5244
 5245
 5246
 5247
 5248
 5249
 5250
 5251
 5252
 5253
 5254
 5255
 5256
 5257
 5258
 5259
 5260
 5261
 5262
 5263
 5264
 5265
 5266
 5267
 5268
 5269
 5270
 5271
 5272
 5273
 5274
 5275
 5276
 5277
 5278
 5279
 5280
 5281
 5282
 5283
 5284
 5285
 5286
 5287
 5288
 5289
 5290
 5291
 5292
 5293
 5294
 5295
 5296
 5297
 5298
 5299
 5300
 5301
 5302
 5303
 5304
 5305
 5306
 5307
 5308
 5309
 5310
 5311
 5312
 5313
 5314
 5315
 5316
 5317
 5318
 5319
 5320
 5321
 5322
 5323
 5324
 5325
 5326
 5327
 5328
 5329
 5330
 5331
 5332
 5333
 5334
 5335
 5336
 5337
 5338
 5339
 5340
 5341
 5342
 5343
 5344
 5345
 5346
 5347
 5348
 5349
 5350
 5351
 5352
 5353
 5354
 5355
 5356
 5357
 5358
 5359
 5360
 5361
 5362
 5363
 5364
 5365
 5366
 5367
 5368
 5369
 5370
 5371
 5372
 5373
 5374
 5375
 5376
 5377
 5378
 5379
 5380
 5381
 5382
 5383
 5384
 5385
 5386
 5387
 5388
 5389
 5390
 5391
 5392
 5393
 5394
 5395
 5396
 5397
 5398
 5399
 5400
 5401
 5402
 5403
 5404
 5405
 5406
 5407
 5408
 5409
 5410
 5411
 5412
 5413
 5414
 5415
 5416
 5417
 5418
 5419
 5420
 5421
 5422
 5423
 5424
 5425
 5426
 5427
 5428
 5429
 5430
 5431
 5432
 5433
 5434
 5435
 5436
 5437
 5438
 5439
 5440
 5441
 5442
 5443
 5444
 5445
 5446
 5447
 5448
 5449
 5450
 5451
 5452
 5453
 5454
 5455
 5456
 5457
 5458
 5459
 5460
 5461
 5462
 5463
 5464
 5465
 5466
 5467
 5468
 5469
 5470
 5471
 5472
 5473
 5474
 5475
 5476
 5477
 5478
 5479
 5480
 5481
 5482
 5483
 5484
 5485
 5486
 5487
 5488
 5489
 5490
 5491
 5492
 5493
 5494
 5495
 5496
 5497
 5498
 5499
 5500
 5501
 5502
 5503
 5504
 5505
 5506
 5507
 5508
 5509
 5510
 5511
 5512
 5513
 5514
 5515
 5516
 5517
 5518
 5519
 5520
 5521
 5522
 5523
 5524
 5525
 5526
 5527
 5528
 5529
 5530
 5531
 5532
 5533
 5534
 5535
 5536
 5537
 5538
 5539
 5540
 5541
 5542
 5543
 5544
 5545
 5546
 5547
 5548
 5549
 5550
 5551
 5552
 5553
 5554
 5555
 5556
 5557
 5558
 5559
 5560
 5561
 5562
 5563
 5564
 5565
 5566
 5567
 5568
 5569
 5570
 5571
 5572
 5573
 5574
 5575
 5576
 5577
 5578
 5579
 5580
 5581
 5582
 5583
 5584
 5585
 5586
 5587
 5588
 5589
 5590
 5591
 5592
 5593
 5594
 5595
 5596
 5597
 5598
 5599
 5600
 5601
 5602
 5603
 5604
 5605
 5606
 5607
 5608
 5609
 5610
 5611
 5612
 5613
 5614
 5615
 5616
 5617
 5618
 5619
 5620
 5621
 5622
 5623
 5624
 5625
 5626
 5627
 5628
 5629
 5630
 5631
 5632
 5633
 5634
 5635
 5636
 5637
 5638
 5639
 5640
 5641
 5642
 5643
 5644
 5645
 5646
 5647
 5648
 5649
 5650
 5651
 5652
 5653
 5654
 5655
 5656
 5657
 5658
 5659
 5660
 5661
 5662
 5663
 5664
 5665
 5666
 5667
 5668
 5669
 5670
 5671
 5672
 5673
 5674
 5675
 5676
 5677
 5678
 5679
 5680
 5681
 5682
 5683
 5684
 5685
 5686
 5687
 5688
 5689
 5690
 5691
 5692
 5693
 5694
 5695
 5696
 5697
 5698
 5699
 5700
 5701
 5702
 5703
 5704
 5705
 5706
 5707
 5708
 5709
 5710
 5711
 5712
 5713
 5714
 5715
 5716
 5717
 5718
 5719
 5720
 5721
 5722
 5723
 5724
 5725
 5726
 5727
 5728
 5729
 5730
 5731
 5732
 5733
 5734
 5735
 5736
 5737
 5738
 5739
 5740
 5741
 5742
 5743
 5744
 5745
 5746
 5747
 5748
 5749
 5750
 5751
 5752
 5753
 5754
 5755
 5756
 5757
 5758
 5759
 5760
 5761
 5762
 5763
 5764
 5765
 5766
 5767
 5768
 5769
 5770
 5771
 5772
 5773
 5774
 5775
 5776
 5777
 5778
 5779
 5780
 5781
 5782
 5783
 5784
 5785
 5786
 5787
 5788
 5789
 5790
 5791
 5792
 5793
 5794
 5795
 5796
 5797
 5798
 5799
 5800
 5801
 5802
 5803
 5804
 5805
 5806
 5807
 5808
 5809
 5810
 5811
 5812
 5813
 5814
 5815
 5816
 5817
 5818
 5819
 5820
 5821
 5822
 5823
 5824
 5825
 5826
 5827
 5828
 5829
 5830
 5831
 5832
 5833
 5834
 5835
 5836
 5837
 5838
 5839
 5840
 5841
 5842
 5843
 5844
 5845
 5846
 5847
 5848
 5849
 5850
 5851
 5852
 5853
 5854
 5855
 5856
 5857
 5858
 5859
 5860
 5861
 5862
 5863
 5864
 5865
 5866
 5867
 5868
 5869
 5870
 5871
 5872
 5873
 5874
 5875
 5876
 5877
 5878
 5879
 5880
 5881
 5882
 5883
 5884
 5885
 5886
 5887
 5888
 5889
 5890
 5891
 5892
 5893
 5894
 5895
 5896
 5897
 5898
 5899
 5900
 5901
 5902
 5903
 5904
 5905
 5906
 5907
 5908
 5909
 5910
 5911
 5912
 5913
 5914
 5915
 5916
 5917
 5918
 5919
 5920
 5921
 5922
 5923
 5924
 5925
 5926
 5927
 5928
 5929
 5930
 5931
 5932
 5933
 5934
 5935
 5936
 5937
 5938
 5939
 5940
 5941
 5942
 5943
 5944
 5945
 5946
 5947
 5948
 5949
 5950
 5951
 5952
 5953
 5954
 5955
 5956
 5957
 5958
 5959
 5960
 5961
 5962
 5963
 5964
 5965
 5966
 5967
 5968
 5969
 5970
 5971
 5972
 5973
 5974
 5975
 5976
 5977
 5978
 5979
 5980
 5981
 5982
 5983
 5984
 5985
 5986
 5987
 5988
 5989
 5990
 5991
 5992
 5993
 5994
 5995
 5996
 5997
 5998
 5999
 6000
 6001
 6002
 6003
 6004
 6005
 6006
 6007
 6008
 6009
 6010
 6011
 6012
 6013
 6014
 6015
 6016
 6017
 6018
 6019
 6020
 6021
 6022
 6023
 6024
 6025
 6026
 6027
 6028
 6029
 6030
 6031
 6032
 6033
 6034
 6035
 6036
 6037
 6038
 6039
 6040
 6041
 6042
 6043
 6044
 6045
 6046
 6047
 6048
 6049
 6050
 6051
 6052
 6053
 6054
 6055
 6056
 6057
 6058
 6059
 6060
 6061
 6062
 6063
 6064
 6065
 6066
 6067
 6068
 6069
 6070
 6071
 6072
 6073
 6074
 6075
 6076
 6077
 6078
 6079
 6080
 6081
 6082
 6083
 6084
 6085
 6086
 6087
 6088
 6089
 6090
 6091
 6092
 6093
 6094
 6095
 6096
 6097
 6098
 6099
 6100
 6101
 6102
 6103
 6104
 6105
 6106
 6107
 6108
 6109
 6110
 6111
 6112
 6113
 6114
 6115
 6116
 6117
 6118
 6119
 6120
 6121
 6122
 6123
 6124
 6125
 6126
 6127
 6128
 6129
 6130
 6131
 6132
 6133
 6134
 6135
 6136
 6137
 6138
 6139
 6140
 6141
 6142
 6143
 6144
 6145
 6146
 6147
 6148
 6149
 6150
 6151
 6152
 6153
 6154
 6155
 6156
 6157
 6158
 6159
 6160
 6161
 6162
 6163
 6164
 6165
 6166
 6167
 6168
 6169
 6170
 6171
 6172
 6173
 6174
 6175
 6176
 6177
 6178
 6179
 6180
 6181
 6182
 6183
 6184
 6185
 6186
 6187
 6188
 6189
 6190
 6191
 6192
 6193
 6194
 6195
 6196
 6197
 6198
 6199
 6200
 6201
 6202
 6203
 6204
 6205
 6206
 6207
 6208
 6209
 6210
 6211
 6212
 6213
 6214
 6215
 6216
 6217
 6218
 6219
 6220
 6221
 6222
 6223
 6224
 6225
 6226
 6227
 6228
 6229
 6230
 6231
 6232
 6233
 6234
 6235
 6236
 6237
 6238
 6239
 6240
 6241
 6242
 6243
 6244
 6245
 6246
 6247
 6248
 6249
 6250
 6251
 6252
 6253
 6254
 6255
 6256
 6257
 6258
 6259
 6260
 6261
 6262
 6263
 6264
 6265
 6266
 6267
 6268
 6269
 6270
 6271
 6272
 6273
 6274
 6275
 6276
 6277
 6278
 6279
 6280
 6281
 6282
 6283
 6284
 6285
 6286
 6287
 6288
 6289
 6290
 6291
 6292
 6293
 6294
 6295
 6296
 6297
 6298
 6299
 6300
 6301
 6302
 6303
 6304
 6305
 6306
 6307
 6308
 6309
 6310
 6311
 6312
 6313
 6314
 6315
 6316
 6317
 6318
 6319
 6320
 6321
 6322
 6323
 6324
 6325
 6326
 6327
 6328
 6329
 6330
 6331
 6332
 6333
 6334
 6335
 6336
 6337
 6338
 6339
 6340
 6341
 6342
 6343
 6344
 6345
 6346
 6347
 6348
 6349
 6350
 6351
 6352
 6353
 6354
 6355
 6356
 6357
 6358
 6359
 6360
 6361
 6362
 6363
 6364
 6365
 6366
 6367
 6368
 6369
 6370
 6371
 6372
 6373
 6374
 6375
 6376
 6377
 6378
 6379
 6380
 6381
 6382
 6383
 6384
 6385
 6386
 6387
 6388
 6389
 6390
 6391
 6392
 6393
 6394
 6395
 6396
 6397
 6398
 6399
 6400
 6401
 6402
 6403
 6404
 6405
 6406
 6407
 6408
 6409
 6410
 6411
 6412
 6413
 6414
 6415
 6416
 6417
 6418
 6419
 6420
 6421
 6422
 6423
 6424
 6425
 6426
 6427
 6428
 6429
 6430
 6431
 6432
 6433
 6434
 6435
 6436
 6437
 6438
 6439
 6440
 6441
 6442
 6443
 6444
 6445
 6446
 6447
 6448
 6449
 6450
 6451
 6452
 6453
 6454
 6455
 6456
 6457
 6458
 6459
 6460
 6461
 6462
 6463
 6464
 6465
 6466
 6467
 6468
 6469
 6470
 6471
 6472
 6473
 6474
 6475
 6476
 6477
 6478
 6479
 6480
 6481
 6482
 6483
 6484
 6485
 6486
 6487
 6488
 6489
 6490
 6491
 6492
 6493
 6494
 6495
 6496
 6497
 6498
 6499
 6500
 6501
 6502
 6503
 6504
 6505
 6506
 6507
 6508
 6509
 6510
 6511
 6512
 6513
 6514
 6515
 6516
 6517
 6518
 6519
 6520
 6521
 6522
 6523
 6524
 6525
 6526
 6527
 6528
 6529
 6530
 6531
 6532
 6533
 6534
 6535
 6536
 6537
 6538
 6539
 6540
 6541
 6542
 6543
 6544
 6545
 6546
 6547
 6548
 6549
 6550
 6551
 6552
 6553
 6554
 6555
 6556
 6557
 6558
 6559
 6560
 6561
 6562
 6563
 6564
 6565
 6566
 6567
 6568
 6569
 6570
 6571
 6572
 6573
 6574
 6575
 6576
 6577
 6578
 6579
 6580
 6581
 6582
 6583
 6584
 6585
 6586
 6587
 6588
 6589
 6590
 6591
 6592
 6593
 6594
 6595
 6596
 6597
 6598
 6599
 6600
 6601
 6602
 6603
 6604
 6605
 6606
 6607
 6608
 6609
 6610
 6611
 6612
 6613
 6614
 6615
 6616
 6617
 6618
 6619
 6620
 6621
 6622
 6623
 6624
 6625
 6626
 6627
 6628
 6629
 6630
 6631
 6632
 6633
 6634
 6635
 6636
 6637
 6638
 6639
 6640
 6641
 6642
 6643
 6644
 6645
 6646
 6647
 6648
 6649
 6650
 6651
 6652
 6653
 6654
 6655
 6656
 6657
 6658
 6659
 6660
 6661
 6662
 6663
 6664
 6665
 6666
 6667
 6668
 6669
 6670
 6671
 6672
 6673
 6674
 6675
 6676
 6677
 6678
 6679
 6680
 6681
 6682
 6683
 6684
 6685
 6686
 6687
 6688
 6689
 6690
 6691
 6692
 6693
 6694
 6695
 6696
 6697
 6698
 6699
 6700
 6701
 6702
 6703
 6704
 6705
 6706
 6707
 6708
 6709
 6710
 6711
 6712
 6713
 6714
 6715
 6716
 6717
 6718
 6719
 6720
 6721
 6722
 6723
 6724
 6725
 6726
 6727
 6728
 6729
 6730
 6731
 6732
 6733
 6734
 6735
 6736
 6737
 6738
 6739
 6740
 6741
 6742
 6743
 6744
 6745
 6746
 6747
 6748
 6749
 6750
 6751
 6752
 6753
 6754
 6755
 6756
 6757
 6758
 6759
 6760
 6761
 6762
 6763
 6764
 6765
 6766
 6767
 6768
 6769
 6770
 6771
 6772
 6773
 6774
 6775
 6776
 6777
 6778
 6779
 6780
 6781
 6782
 6783
 6784
 6785
 6786
 6787
 6788
 6789
 6790
 6791
 6792
 6793
 6794
 6795
 6796
 6797
 6798
 6799
 6800
 6801
 6802
 6803
 6804
 6805
 6806
 6807
 6808
 6809
 6810
 6811
 6812
 6813
 6814
 6815
 6816
 6817
 6818
 6819
 6820
 6821
 6822
 6823
 6824
 6825
 6826
 6827
 6828
 6829
 6830
 6831
 6832
 6833
 6834
 6835
 6836
 6837
 6838
 6839
 6840
 6841
 6842
 6843
 6844
 6845
 6846
 6847
 6848
 6849
 6850
 6851
 6852
 6853
 6854
 6855
 6856
 6857
 6858
 6859
 6860
 6861
 6862
 6863
 6864
 6865
 6866
 6867
 6868
 6869
 6870
 6871
 6872
 6873
 6874
 6875
 6876
 6877
 6878
 6879
 6880
 6881
 6882
 6883
 6884
 6885
 6886
 6887
 6888
 6889
 6890
 6891
 6892
 6893
 6894
 6895
 6896
 6897
 6898
 6899
 6900
 6901
 6902
 6903
 6904
 6905
 6906
 6907
 6908
 6909
 6910
 6911
 6912
 6913
 6914
 6915
 6916
 6917
 6918
 6919
 6920
 6921
 6922
 6923
 6924
 6925
 6926
 6927
 6928
 6929
 6930
 6931
 6932
 6933
 6934
 6935
 6936
 6937
 6938
 6939
 6940
 6941
 6942
 6943
 6944
 6945
 6946
 6947
 6948
 6949
 6950
 6951
 6952
 6953
 6954
 6955
 6956
 6957
 6958
 6959
 6960
 6961
 6962
 6963
 6964
 6965
 6966
 6967
 6968
 6969
 6970
 6971
 6972
 6973
 6974
 6975
 6976
 6977
 6978
 6979
 6980
 6981
 6982
 6983
 6984
 6985
 6986
 6987
 6988
 6989
 6990
 6991
 6992
 6993
 6994
 6995
 6996
 6997
 6998
 6999
 7000
 7001
 7002
 7003
 7004
 7005
 7006
 7007
 7008
 7009
 7010
 7011
 7012
 7013
 7014
 7015
 7016
 7017
 7018
 7019
 7020
 7021
 7022
 7023
 7024
 7025
 7026
 7027
 7028
 7029
 7030
 7031
 7032
 7033
 7034
 7035
 7036
 7037
 7038
 7039
 7040
 7041
 7042
 7043
 7044
 7045
 7046
 7047
 7048
 7049
 7050
 7051
 7052
 7053
 7054
 7055
 7056
 7057
 7058
 7059
 7060
 7061
 7062
 7063
 7064
 7065
 7066
 7067
 7068
 7069
 7070
 7071
 7072
 7073
 7074
 7075
 7076
 7077
 7078
 7079
 7080
 7081
 7082
 7083
 7084
 7085
 7086
 7087
 7088
 7089
 7090
 7091
 7092
 7093
 7094
 7095
 7096
 7097
 7098
 7099
 7100
 7101
 7102
 7103
 7104
 7105
 7106
 7107
 7108
 7109
 7110
 7111
 7112
 7113
 7114
 7115
 7116
 7117
 7118
 7119
 7120
 7121
 7122
 7123
 7124
 7125
 7126
 7127
 7128
 7129
 7130
 7131
 7132
 7133
 7134
 7135
 7136
 7137
 7138
 7139
 7140
 7141
 7142
 7143
 7144
 7145
 7146
 7147
 7148
 7149
 7150
 7151
 7152
 7153
 7154
 7155
 7156
 7157
 7158
 7159
 7160
 7161
 7162
 7163
 7164
 7165
 7166
 7167
 7168
 7169
 7170
 7171
 7172
 7173
 7174
 7175
 7176
 7177
 7178
 7179
 7180
 7181
 7182
 7183
 7184
 7185
 7186
 7187
 7188
 7189
 7190
 7191
 7192
 7193
 7194
 7195
 7196
 7197
 7198
 7199
 7200
 7201
 7202
 7203
 7204
 7205
 7206
 7207
 7208
 7209
 7210
 7211
 7212
 7213
 7214
 7215
 7216
 7217
 7218
 7219
 7220
 7221
 7222
 7223
 7224
 7225
 7226
 7227
 7228
 7229
 7230
 7231
 7232
 7233
 7234
 7235
 7236
 7237
 7238
 7239
 7240
 7241
 7242
 7243
 7244
 7245
 7246
 7247
 7248
 7249
 7250
 7251
 7252
 7253
 7254
 7255
 7256
 7257
 7258
 7259
 7260
 7261
 7262
 7263
 7264
 7265
 7266
 7267
 7268
 7269
 7270
 7271
 7272
 7273
 7274
 7275
 7276
 7277
 7278
 7279
 7280
 7281
 7282
 7283
 7284
 7285
 7286
 7287
 7288
 7289
 7290
 7291
 7292
 7293
 7294
 7295
 7296
 7297
 7298
 7299
 7300
 7301
 7302
 7303
 7304
 7305
 7306
 7307
 7308
 7309
 7310
 7311
 7312
 7313
 7314
 7315
 7316
 7317
 7318
 7319
 7320
 7321
 7322
 7323
 7324
 7325
 7326
 7327
 7328
 7329
 7330
 7331
 7332
 7333
 7334
 7335
 7336
 7337
 7338
 7339
 7340
 7341
 7342
 7343
 7344
 7345
 7346
 7347
 7348
 7349
 7350
 7351
 7352
 7353
 7354
 7355
 7356
 7357
 7358
 7359
 7360
 7361
 7362
 7363
 7364
 7365
 7366
 7367
 7368
 7369
 7370
 7371
 7372
 7373
 7374
 7375
 7376
 7377
 7378
 7379
 7380
 7381
 7382
 7383
 7384
 7385
 7386
 7387
 7388
 7389
 7390
 7391
 7392
 7393
 7394
 7395
 7396
 7397
 7398
 7399
 7400
 7401
 7402
 7403
 7404
 7405
 7406
 7407
 7408
 7409
 7410
 7411
 7412
 7413
 7414
 7415
 7416
 7417
 7418
 7419
 7420
 7421
 7422
 7423
 7424
 7425
 7426
 7427
 7428
 7429
 7430
 7431
 7432
 7433
 7434
 7435
 7436
 7437
 7438
 7439
 7440
 7441
 7442
 7443
 7444
 7445
 7446
 7447
 7448
 7449
 7450
 7451
 7452
 7453
 7454
 7455
 7456
 7457
 7458
 7459
 7460
 7461
 7462
 7463
 7464
 7465
 7466
 7467
 7468
 7469
 7470
 7471
 7472
 7473
 7474
 7475
 7476
 7477
 7478
 7479
 7480
 7481
 7482
 7483
 7484
 7485
 7486
 7487
 7488
 7489
 7490
 7491
 7492
 7493
 7494
 7495
 7496
 7497
 7498
 7499
 7500
 7501
 7502
 7503
 7504
 7505
 7506
 7507
 7508
 7509
 7510
 7511
 7512
 7513
 7514
 7515
 7516
 7517
 7518
 7519
 7520
 7521
 7522
 7523
 7524
 7525
 7526
 7527
 7528
 7529
 7530
 7531
 7532
 7533
 7534
 7535
 7536
 7537
 7538
 7539
 7540
 7541
 7542
 7543
 7544
 7545
 7546
 7547
 7548
 7549
 7550
 7551
 7552
 7553
 7554
 7555
 7556
 7557
 7558
 7559
 7560
 7561
 7562
 7563
 7564
 7565
 7566
 7567
 7568
 7569
 7570
 7571
 7572
 7573
 7574
 7575
 7576
 7577
 7578
 7579
 7580
 7581
 7582
 7583
 7584
 7585
 7586
 7587
 7588
 7589
 7590
 7591
 7592
 7593
 7594
 7595
 7596
 7597
 7598
 7599
 7600
 7601
 7602
 7603
 7604
 7605
 7606
 7607
 7608
 7609
 7610
 7611
 7612
 7613
 7614
 7615
 7616
 7617
 7618
 7619
 7620
 7621
 7622
 7623
 7624
 7625
 7626
 7627
 7628
 7629
 7630
 7631
 7632
 7633
 7634
 7635
 7636
 7637
 7638
 7639
 7640
 7641
 7642
 7643
 7644
 7645
 7646
 7647
 7648
 7649
 7650
 7651
 7652
 7653
 7654
 7655
 7656
 7657
 7658
 7659
 7660
 7661
 7662
 7663
 7664
 7665
 7666
 7667
 7668
 7669
 7670
 7671
 7672
 7673
 7674
 7675
 7676
 7677
 7678
 7679
 7680
 7681
 7682
 7683
 7684
 7685
 7686
 7687
 7688
 7689
 7690
 7691
 7692
 7693
 7694
 7695
 7696
 7697
 7698
 7699
 7700
 7701
 7702
 7703
 7704
 7705
 7706
 7707
 7708
 7709
 7710
 7711
 7712
 7713
 7714
 7715
 7716
 7717
 7718
 7719
 7720
 7721
 7722
 7723
 7724
 7725
 7726
 7727
 7728
 7729
 7730
 7731
 7732
 7733
 7734
 7735
 7736
 7737
 7738
 7739
 7740
 7741
 7742
 7743
 7744
 7745
 7746
 7747
 7748
 7749
 7750
 7751
 7752
 7753
 7754
 7755
 7756
 7757
 7758
 7759
 7760
 7761
 7762
 7763
 7764
 7765
 7766
 7767
 7768
 7769
 7770
 7771
 7772
 7773
 7774
 7775
 7776
 7777
 7778
 7779
 7780
 7781
 7782
 7783
 7784
 7785
 7786
 7787
 7788
 7789
 7790
 7791
 7792
 7793
 7794
 7795
 7796
 7797
 7798
 7799
 7800
 7801
 7802
 7803
 7804
 7805
 7806
 7807
 7808
 7809
 7810
 7811
 7812
 7813
 7814
 7815
 7816
 7817
 7818
 7819
 7820
 7821
 7822
 7823
 7824
 7825
 7826
 7827
 7828
 7829
 7830
 7831
 7832
 7833
 7834
 7835
 7836
 7837
 7838
 7839
 7840
 7841
 7842
 7843
 7844
 7845
 7846
 7847
 7848
 7849
 7850
 7851
 7852
 7853
 7854
 7855
 7856
 7857
 7858
 7859
 7860
 7861
 7862
 7863
 7864
 7865
 7866
 7867
 7868
 7869
 7870
 7871
 7872
 7873
 7874
 7875
 7876
 7877
 7878
 7879
 7880
 7881
 7882
 7883
 7884
 7885
 7886
 7887
 7888
 7889
 7890
 7891
 7892
 7893
 7894
 7895
 7896
 7897
 7898
 7899
 7900
 7901
 7902
 7903
 7904
 7905
 7906
 7907
 7908
 7909
 7910
 7911
 7912
 7913
 7914
 7915
 7916
 7917
 7918
 7919
 7920
 7921
 7922
 7923
 7924
 7925
 7926
 7927
 7928
 7929
 7930
 7931
 7932
 7933
 7934
 7935
 7936
 7937
 7938
 7939
 7940
 7941
 7942
 7943
 7944
 7945
 7946
 7947
 7948
 7949
 7950
 7951
 7952
 7953
 7954
 7955
 7956
 7957
 7958
 7959
 7960
 7961
 7962
 7963
 7964
 7965
 7966
 7967
 7968
 7969
 7970
 7971
 7972
 7973
 7974
 7975
 7976
 7977
 7978
 7979
 7980
 7981
 7982
 7983
 7984
 7985
 7986
 7987
 7988
 7989
 7990
 7991
 7992
 7993
 7994
 7995
 7996
 7997
 7998
 7999
 8000
 8001
 8002
 8003
 8004
 8005
 8006
 8007
 8008
 8009
 8010
 8011
 8012
 8013
 8014
 8015
 8016
 8017
 8018
 8019
 8020
 8021
 8022
 8023
 8024
 8025
 8026
 8027
 8028
 8029
 8030
 8031
 8032
 8033
 8034
 8035
 8036
 8037
 8038
 8039
 8040
 8041
 8042
 8043
 8044
 8045
 8046
 8047
 8048
 8049
 8050
 8051
 8052
 8053
 8054
 8055
 8056
 8057
 8058
 8059
 8060
 8061
 8062
 8063
 8064
 8065
 8066
 8067
 8068
 8069
 8070
 8071
 8072
 8073
 8074
 8075
 8076
 8077
 8078
 8079
 8080
 8081
 8082
 8083
 8084
 8085
 8086
 8087
 8088
 8089
 8090
 8091
 8092
 8093
 8094
 8095
 8096
 8097
 8098
 8099
 8100
 8101
 8102
 8103
 8104
 8105
 8106
 8107
 8108
 8109
 8110
 8111
 8112
 8113
 8114
 8115
 8116
 8117
 8118
 8119
 8120
 8121
 8122
 8123
 8124
 8125
 8126
 8127
 8128
 8129
 8130
 8131
 8132
 8133
 8134
 8135
 8136
 8137
 8138
 8139
 8140
 8141
 8142
 8143
 8144
 8145
 8146
 8147
 8148
 8149
 8150
 8151
 8152
 8153
 8154
 8155
 8156
 8157
 8158
 8159
 8160
 8161
 8162
 8163
 8164
 8165
 8166
 8167
 8168
 8169
 8170
 8171
 8172
 8173
 8174
 8175
 8176
 8177
 8178
 8179
 8180
 8181
 8182
 8183
 8184
 8185
 8186
 8187
 8188
 8189
 8190
 8191
 8192
 8193
 8194
 8195
 8196
 8197
 8198
 8199
 8200
 8201
 8202
 8203
 8204
 8205
 8206
 8207
 8208
 8209
 8210
 8211
 8212
 8213
 8214
 8215
 8216
 8217
 8218
 8219
 8220
 8221
 8222
 8223
 8224
 8225
 8226
 8227
 8228
 8229
 8230
 8231
 8232
 8233
 8234
 8235
 8236
 8237
 8238
 8239
 8240
 8241
 8242
 8243
 8244
 8245
 8246
 8247
 8248
 8249
 8250
 8251
 8252
 8253
 8254
 8255
 8256
 8257
 8258
 8259
 8260
 8261
 8262
 8263
 8264
 8265
 8266
 8267
 8268
 8269
 8270
 8271
 8272
 8273
 8274
 8275
 8276
 8277
 8278
 8279
 8280
 8281
 8282
 8283
 8284
 8285
 8286
 8287
 8288
 8289
 8290
 8291
 8292
 8293
 8294
 8295
 8296
 8297
 8298
 8299
 8300
 8301
 8302
 8303
 8304
 8305
 8306
 8307
 8308
 8309
 8310
 8311
 8312
 8313
 8314
 8315
 8316
 8317
 8318
 8319
 8320
 8321
 8322
 8323
 8324
 8325
 8326
 8327
 8328
 8329
 8330
 8331
 8332
 8333
 8334
 8335
 8336
 8337
 8338
 8339
 8340
 8341
 8342
 8343
 8344
 8345
 8346
 8347
 8348
 8349
 8350
 8351
 8352
 8353
 8354
 8355
 8356
 8357
 8358
 8359
 8360
 8361
 8362
 8363
 8364
 8365
 8366
 8367
 8368
 8369
 8370
 8371
 8372
 8373
 8374
 8375
 8376
 8377
 8378
 8379
 8380
 8381
 8382
 8383
 8384
 8385
 8386
 8387
 8388
 8389
 8390
 8391
 8392
 8393
 8394
 8395
 8396
 8397
 8398
 8399
 8400
 8401
 8402
 8403
 8404
 8405
 8406
 8407
 8408
 8409
 8410
 8411
 8412
 8413
 8414
 8415
 8416
 8417
 8418
 8419
 8420
 8421
 8422
 8423
 8424
 8425
 8426
 8427
 8428
 8429
 8430
 8431
 8432
 8433
 8434
 8435
 8436
 8437
 8438
 8439
 8440
 8441
 8442
 8443
 8444
 8445
 8446
 8447
 8448
 8449
 8450
 8451
 8452
 8453
 8454
 8455
 8456
 8457
 8458
 8459
 8460
 8461
 8462
 8463
 8464
 8465
 8466
 8467
 8468
 8469
 8470
 8471
 8472
 8473
 8474
 8475
 8476
 8477
 8478
 8479
 8480
 8481
 8482
 8483
 8484
 8485
 8486
 8487
 8488
 8489
 8490
 8491
 8492
 8493
 8494
 8495
 8496
 8497
 8498
 8499
 8500
 8501
 8502
 8503
 8504
 8505
 8506
 8507
 8508
 8509
 8510
 8511
 8512
 8513
 8514
 8515
 8516
 8517
 8518
 8519
 8520
 8521
 8522
 8523
 8524
 8525
 8526
 8527
 8528
 8529
 8530
 8531
 8532
 8533
 8534
 8535
 8536
 8537
 8538
 8539
 8540
 8541
 8542
 8543
 8544
 8545
 8546
 8547
 8548
 8549
 8550
 8551
 8552
 8553
 8554
 8555
 8556
 8557
 8558
 8559
 8560
 8561
 8562
 8563
 8564
 8565
 8566
 8567
 8568
 8569
 8570
 8571
 8572
 8573
 8574
 8575
 8576
 8577
 8578
 8579
 8580
 8581
 8582
 8583
 8584
 8585
 8586
 8587
 8588
 8589
 8590
 8591
 8592
 8593
 8594
 8595
 8596
 8597
 8598
 8599
 8600
 8601
 8602
 8603
 8604
 8605
 8606
 8607
 8608
 8609
 8610
 8611
 8612
 8613
 8614
 8615
 8616
 8617
 8618
 8619
 8620
 8621
 8622
 8623
 8624
 8625
 8626
 8627
 8628
 8629
 8630
 8631
 8632
 8633
 8634
 8635
 8636
 8637
 8638
 8639
 8640
 8641
 8642
 8643
 8644
 8645
 8646
 8647
 8648
 8649
 8650
 8651
 8652
 8653
 8654
 8655
 8656
 8657
 8658
 8659
 8660
 8661
 8662
 8663
 8664
 8665
 8666
 8667
 8668
 8669
 8670
 8671
 8672
 8673
 8674
 8675
 8676
 8677
 8678
 8679
 8680
 8681
 8682
 8683
 8684
 8685
 8686
 8687
 8688
 8689
 8690
 8691
 8692
 8693
 8694
 8695
 8696
 8697
 8698
 8699
 8700
 8701
 8702
 8703
 8704
 8705
 8706
 8707
 8708
 8709
 8710
 8711
 8712
 8713
 8714
 8715
 8716
 8717
 8718
 8719
 8720
 8721
 8722
 8723
 8724
 8725
 8726
 8727
 8728
 8729
 8730
 8731
 8732
 8733
 8734
 8735
 8736
 8737
 8738
 8739
 8740
 8741
 8742
 8743
 8744
 8745
 8746
 8747
 8748
 8749
 8750
 8751
 8752
 8753
 8754
 8755
 8756
 8757
 8758
 8759
 8760
 8761
 8762
 8763
 8764
 8765
 8766
 8767
 8768
 8769
 8770
 8771
 8772
 8773
 8774
 8775
 8776
 8777
 8778
 8779
 8780
 8781
 8782
 8783
 8784
 8785
 8786
 8787
 8788
 8789
 8790
 8791
 8792
 8793
 8794
 8795
 8796
 8797
 8798
 8799
 8800
 8801
 8802
 8803
 8804
 8805
 8806
 8807
 8808
 8809
 8810
 8811
 8812
 8813
 8814
 8815
 8816
 8817
 8818
 8819
 8820
 8821
 8822
 8823
 8824
 8825
 8826
 8827
 8828
 8829
 8830
 8831
 8832
 8833
 8834
 8835
 8836
 8837
 8838
 8839
 8840
 8841
 8842
 8843
 8844
 8845
 8846
 8847
 8848
 8849
 8850
 8851
 8852
 8853
 8854
 8855
 8856
 8857
 8858
 8859
 8860
 8861
 8862
 8863
 8864
 8865
 8866
 8867
 8868
 8869
 8870
 8871
 8872
 8873
 8874
 8875
 8876
 8877
 8878
 8879
 8880
 8881
 8882
 8883
 8884
 8885
 8886
 8887
 8888
 8889
 8890
 8891
 8892
 8893
 8894
 8895
 8896
 8897
 8898
 8899
 8900
 8901
 8902
 8903
 8904
 8905
 8906
 8907
 8908
 8909
 8910
 8911
 8912
 8913
 8914
 8915
 8916
 8917
 8918
 8919
 8920
 8921
 8922
 8923
 8924
 8925
 8926
 8927
 8928
 8929
 8930
 8931
 8932
 8933
 8934
 8935
 8936
 8937
 8938
 8939
 8940
 8941
 8942
 8943
 8944
 8945
 8946
 8947
 8948
 8949
 8950
 8951
 8952
 8953
 8954
 8955
 8956
 8957
 8958
 8959
 8960
 8961
 8962
 8963
 8964
 8965
 8966
 8967
 8968
 8969
 8970
 8971
 8972
 8973
 8974
 8975
 8976
 8977
 8978
 8979
 8980
 8981
 8982
 8983
 8984
 8985
 8986
 8987
 8988
 8989
 8990
 8991
 8992
 8993
 8994
 8995
 8996
 8997
 8998
 8999
 9000
 9001
 9002
 9003
 9004
 9005
 9006
 9007
 9008
 9009
 9010
 9011
 9012
 9013
 9014
 9015
 9016
 9017
 9018
 9019
 9020
 9021
 9022
 9023
 9024
 9025
 9026
 9027
 9028
 9029
 9030
 9031
 9032
 9033
 9034
 9035
 9036
 9037
 9038
 9039
 9040
 9041
 9042
 9043
 9044
 9045
 9046
 9047
 9048
 9049
 9050
 9051
 9052
 9053
 9054
 9055
 9056
 9057
 9058
 9059
 9060
 9061
 9062
 9063
 9064
 9065
 9066
 9067
 9068
 9069
 9070
 9071
 9072
 9073
 9074
 9075
 9076
 9077
 9078
 9079
 9080
 9081
 9082
 9083
 9084
 9085
 9086
 9087
 9088
 9089
 9090
 9091
 9092
 9093
 9094
 9095
 9096
 9097
 9098
 9099
 9100
 9101
 9102
 9103
 9104
 9105
 9106
 9107
 9108
 9109
 9110
 9111
 9112
 9113
 9114
 9115
 9116
 9117
 9118
 9119
 9120
 9121
 9122
 9123
 9124
 9125
 9126
 9127
 9128
 9129
 9130
 9131
 9132
 9133
 9134
 9135
 9136
 9137
 9138
 9139
 9140
 9141
 9142
 9143
 9144
 9145
 9146
 9147
 9148
 9149
 9150
 9151
 9152
 9153
 9154
 9155
 9156
 9157
 9158
 9159
 9160
 9161
 9162
 9163
 9164
 9165
 9166
 9167
 9168
 9169
 9170
 9171
 9172
 9173
 9174
 9175
 9176
 9177
 9178
 9179
 9180
 9181
 9182
 9183
 9184
 9185
 9186
 9187
 9188
 9189
 9190
 9191
 9192
 9193
 9194
 9195
 9196
 9197
 9198
 9199
 9200
 9201
 9202
 9203
 9204
 9205
 9206
 9207
 9208
 9209
 9210
 9211
 9212
 9213
 9214
 9215
 9216
 9217
 9218
 9219
 9220
 9221
 9222
 9223
 9224
 9225
 9226
 9227
 9228
 9229
 9230
 9231
 9232
 9233
 9234
 9235
 9236
 9237
 9238
 9239
 9240
 9241
 9242
 9243
 9244
 9245
 9246
 9247
 9248
 9249
 9250
 9251
 9252
 9253
 9254
 9255
 9256
 9257
 9258
 9259
 9260
 9261
 9262
 9263
 9264
 9265
 9266
 9267
 9268
 9269
 9270
 9271
 9272
 9273
 9274
 9275
 9276
 9277
 9278
 9279
 9280
 9281
 9282
 9283
 9284
 9285
 9286
 9287
 9288
 9289
 9290
 9291
 9292
 9293
 9294
 9295
 9296
 9297
 9298
 9299
 9300
 9301
 9302
 9303
 9304
 9305
 9306
 9307
 9308
 9309
 9310
 9311
 9312
 9313
 9314
 9315
 9316
 9317
 9318
 9319
 9320
 9321
 9322
 9323
 9324
 9325
 9326
 9327
 9328
 9329
 9330
 9331
 9332
 9333
 9334
 9335
 9336
 9337
 9338
 9339
 9340
 9341
 9342
 9343
 9344
 9345
 9346
 9347
 9348
 9349
 9350
 9351
 9352
 9353
 9354
 9355
 9356
 9357
 9358
 9359
 9360
 9361
 9362
 9363
 9364
 9365
 9366
 9367
 9368
 9369
 9370
 9371
 9372
 9373
 9374
 9375
 9376
 9377
 9378
 9379
 9380
 9381
 9382
 9383
 9384
 9385
 9386
 9387
 9388
 9389
 9390
 9391
 9392
 9393
 9394
 9395
 9396
 9397
 9398
 9399
 9400
 9401
 9402
 9403
 9404
 9405
 9406
 9407
 9408
 9409
 9410
 9411
 9412
 9413
 9414
 9415
 9416
 9417
 9418
 9419
 9420
 9421
 9422
 9423
 9424
 9425
 9426
 9427
 9428
 9429
 9430
 9431
 9432
 9433
 9434
 9435
 9436
 9437
 9438
 9439
 9440
 9441
 9442
 9443
 9444
 9445
 9446
 9447
 9448
 9449
 9450
 9451
 9452
 9453
 9454
 9455
 9456
 9457
 9458
 9459
 9460
 9461
 9462
 9463
 9464
 9465
 9466
 9467
 9468
 9469
 9470
 9471
 9472
 9473
 9474
 9475
 9476
 9477
 9478
 9479
 9480
 9481
 9482
 9483
 9484
 9485
 9486
 9487
 9488
 9489
 9490
 9491
 9492
 9493
 9494
 9495
 9496
 9497
 9498
 9499
 9500
 9501
 9502
 9503
 9504
 9505
 9506
 9507
 9508
 9509
 9510
 9511
 9512
 9513
 9514
 9515
 9516
 9517
 9518
 9519
 9520
 9521
 9522
 9523
 9524
 9525
 9526
 9527
 9528
 9529
 9530
 9531
 9532
 9533
 9534
 9535
 9536
 9537
 9538
 9539
 9540
 9541
 9542
 9543
 9544
 9545
 9546
 9547
 9548
 9549
 9550
 9551
 9552
 9553
 9554
 9555
 9556
 9557
 9558
 9559
 9560
 9561
 9562
 9563
 9564
 9565
 9566
 9567
 9568
 9569
 9570
 9571
 9572
 9573
 9574
 9575
 9576
 9577
 9578
 9579
 9580
 9581
 9582
 9583
 9584
 9585
 9586
 9587
 9588
 9589
 9590
 9591
 9592
 9593
 9594
 9595
 9596
 9597
 9598
 9599
 9600
 9601
 9602
 9603
 9604
 9605
 9606
 9607
 9608
 9609
 9610
 9611
 9612
 9613
 9614
 9615
 9616
 9617
 9618
 9619
 9620
 9621
 9622
 9623
 9624
 9625
 9626
 9627
 9628
 9629
 9630
 9631
 9632
 9633
 9634
 9635
 9636
 9637
 9638
 9639
 9640
 9641
 9642
 9643
 9644
 9645
 9646
 9647
 9648
 9649
 9650
 9651
 9652
 9653
 9654
 9655
 9656
 9657
 9658
 9659
 9660
 9661
 9662
 9663
 9664
 9665
 9666
 9667
 9668
 9669
 9670
 9671
 9672
 9673
 9674
 9675
 9676
 9677
 9678
 9679
 9680
 9681
 9682
 9683
 9684
 9685
 9686
 9687
 9688
 9689
 9690
 9691
 9692
 9693
 9694
 9695
 9696
 9697
 9698
 9699
 9700
 9701
 9702
 9703
 9704
 9705
 9706
 9707
 9708
 9709
 9710
 9711
 9712
 9713
 9714
 9715
 9716
 9717
 9718
 9719
 9720
 9721
 9722
 9723
 9724
 9725
 9726
 9727
 9728
 9729
 9730
 9731
 9732
 9733
 9734
 9735
 9736
 9737
 9738
 9739
 9740
 9741
 9742
 9743
 9744
 9745
 9746
 9747
 9748
 9749
 9750
 9751
 9752
 9753
 9754
 9755
 9756
 9757
 9758
 9759
 9760
 9761
 9762
 9763
 9764
 9765
 9766
 9767
 9768
 9769
 9770
 9771
 9772
 9773
 9774
 9775
 9776
 9777
 9778
 9779
 9780
 9781
 9782
 9783
 9784
 9785
 9786
 9787
 9788
 9789
 9790
 9791
 9792
 9793
 9794
 9795
 9796
 9797
 9798
 9799
 9800
 9801
 9802
 9803
 9804
 9805
 9806
 9807
 9808
 9809
 9810
 9811
 9812
 9813
 9814
 9815
 9816
 9817
 9818
 9819
 9820
 9821
 9822
 9823
 9824
 9825
 9826
 9827
 9828
 9829
 9830
 9831
 9832
 9833
 9834
 9835
 9836
 9837
 9838
 9839
 9840
 9841
 9842
 9843
 9844
 9845
 9846
 9847
 9848
 9849
 9850
 9851
 9852
 9853
 9854
 9855
 9856
 9857
 9858
 9859
 9860
 9861
 9862
 9863
 9864
 9865
 9866
 9867
 9868
 9869
 9870
 9871
 9872
 9873
 9874
 9875
 9876
 9877
 9878
 9879
 9880
 9881
 9882
 9883
 9884
 9885
 9886
 9887
 9888
 9889
 9890
 9891
 9892
 9893
 9894
 9895
 9896
 9897
 9898
 9899
 9900
 9901
 9902
 9903
 9904
 9905
 9906
 9907
 9908
 9909
 9910
 9911
 9912
 9913
 9914
 9915
 9916
 9917
 9918
 9919
 9920
 9921
 9922
 9923
 9924
 9925
 9926
 9927
 9928
 9929
 9930
 9931
 9932
 9933
 9934
 9935
 9936
 9937
 9938
 9939
 9940
 9941
 9942
 9943
 9944
 9945
 9946
 9947
 9948
 9949
 9950
 9951
 9952
 9953
 9954
 9955
 9956
 9957
 9958
 9959
 9960
 9961
 9962
 9963
 9964
 9965
 9966
 9967
 9968
 9969
 9970
 9971
 9972
 9973
 9974
 9975
 9976
 9977
 9978
 9979
 9980
 9981
 9982
 9983
 9984
 9985
 9986
 9987
 9988
 9989
 9990
 9991
 9992
 9993
 9994
 9995
 9996
 9997
 9998
 9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
%% CMU Common Lisp User's Manual.
%%
%% Aug 97 Raymond Toy
%% This is a modified version of the original CMUCL User's Manual.
%% The key changes are modification of this file to use standard
%% LaTeX2e. This means latexinfo isn't going to work anymore.
%% However, Latex2html support has been added.
%%
%% Jan 1998 Paul Werkowski
%% A few of the packages below are not part of the standard LaTeX2e
%% distribution, and must be obtained from a repository. At this time
%% I was able to fetch from
%% ftp.cdrom.com:pub/tex/ctan/macros/latex/contrib/supported/
%% camel/index.ins
%% camel/index.dtx
%% calc/calc.ins
%% calc/calc.dtx
%% changebar/changebar.ins
%% changebar/changebar.dtx
%% One runs latex on the .ins file to produce .tex and/or .sty
%% files that must be put in a path searched by latex.
%%
\documentclass{report}
\usepackage{changebar}
\usepackage{xspace}
\usepackage{alltt}
\usepackage{index}
\usepackage{verbatim}
\usepackage{ifthen}
\usepackage{calc}
%\usepackage{html2e}
\usepackage{html,color}
\usepackage{varioref}
%% Define the indices. We need one for Types, Variables, Functions,
%% and a general concept index.
\makeindex
\newindex{types}{tdx}{tnd}{Type Index}
\newindex{vars}{vdx}{vnd}{Variable Index}
\newindex{funs}{fdx}{fnd}{Function Index}
\newindex{concept}{cdx}{cnd}{Concept Index}
\newcommand{\tindexed}[1]{\index[types]{#1}\textsf{#1}}
\newcommand{\findexed}[1]{\index[funs]{#1}\textsf{#1}}
\newcommand{\vindexed}[1]{\index[vars]{#1}\textsf{*#1*}}
\newcommand{\cindex}[1]{\index[concept]{#1}}
\newcommand{\cpsubindex}[2]{\index[concept]{#1!#2}}
%% This code taken from the LaTeX companion. It's meant as a
%% replacement for the description environment. We want one that
%% prints description items in a fixed size box and puts the
%% description itself on the same line or the next depending on the
%% size of the item.
\newcommand{\entrylabel}[1]{\mbox{#1}\hfil}
\newenvironment{entry}{%
\begin{list}{}%
{\renewcommand{\makelabel}{\entrylabel}%
\setlength{\labelwidth}{45pt}%
\setlength{\leftmargin}{\labelwidth+\labelsep}}}%
{\end{list}}
\newlength{\Mylen}
\newcommand{\Lentrylabel}[1]{%
\settowidth{\Mylen}{#1}%
\ifthenelse{\lengthtest{\Mylen > \labelwidth}}%
{\parbox[b]{\labelwidth}% term > labelwidth
{\makebox[0pt][l]{#1}\\}}%
{#1}%
\hfil\relax}
\newenvironment{Lentry}{%
\renewcommand{\entrylabel}{\Lentrylabel}
\begin{entry}}%
{\end{entry}}
\newcommand{\fcntype}[1]{\textit{#1}}
\newcommand{\argtype}[1]{\textit{#1}}
\newcommand{\fcnname}[1]{\textsf{#1}}
\newlength{\formnamelen} % length of a name of a form
\newlength{\pboxargslen} % length of parbox for arguments
\newlength{\typelen} % length of the type label for the form
\newcommand{\args}[1]{#1}
\newcommand{\keys}[1]{\textsf{\&key} \= #1}
\newcommand{\morekeys}[1]{\\ \> #1}
\newcommand{\yetmorekeys}[1]{\\ \> #1}
\newcommand{\defunvspace}{\ifhmode\unskip \par\fi\addvspace{18pt plus 12pt minus 6pt}}
%% \layout[pkg]{name}{param list}{type}
%%
%% This lays out a entry like so:
%%
%% pkg:name arg1 arg2 [Function]
%%
%% where [Function] is flush right.
%%
\newcommand{\layout}[4][\mbox{}]{%
\par\noindent
\fcnname{#1#2\hspace{1em}}%
\settowidth{\formnamelen}{\fcnname{#1#2\hspace{1em}}}%
\settowidth{\typelen}{[\argtype{#4}]}%
\setlength{\pboxargslen}{\linewidth}%
\addtolength{\pboxargslen}{-1\formnamelen}%
\addtolength{\pboxargslen}{-1\typelen}%
\begin{minipage}[t]{\pboxargslen}
\begin{tabbing}
#3
\end{tabbing}
\end{minipage}
\hfill[\fcntype{#4}]%
\par\addvspace{2pt plus 2pt minus 2pt}}
\newcommand{\vrindexbold}[1]{\index[vars]{#1|textbf}}
\newcommand{\fnindexbold}[1]{\index[funs]{#1|textbf}}
%% Define a new type
%%
%% \begin{deftp}{typeclass}{typename}{args}
%% some description
%% \end{deftp}
\newenvironment{deftp}[3]{%
\par\bigskip\index[types]{#2|textbf}%
\layout{#2}{\var{#3}}{#1}
}{}
%% Define a function
%%
%% \begin{defun}{pkg}{name}{params}
%% \defunx[pkg]{name}{params}
%% description of function
%% \end{defun}
\newenvironment{defun}[3]{%
\par\defunvspace\fnindexbold{#2}\label{FN:#2}%
\layout[#1]{#2}{#3}{Function}
}{}
\newcommand{\defunx}[3][\mbox{}]{%
\par\fnindexbold{#2}\label{FN:#2}%
\layout[#1]{#2}{#3}{Function}}
%% Define a macro
%%
%% \begin{defmac}{pkg}{name}{params}
%% \defmacx[pkg]{name}{params}
%% description of macro
%% \end{defmac}
\newenvironment{defmac}[3]{%
\par\defunvspace\fnindexbold{#2}\label{FN:#2}%
\layout[#1]{#2}{#3}{Macro}}{}
\newcommand{\defmacx}[3][\mbox{}]{%
\par\fnindexbold{#2}\label{FN:#2}%
\layout[#1]{#2}{#3}{Function}}
%% Define a variable
%%
%% \begin{defvar}{pkg}{name}
%% \defvarx[pkg]{name}
%% description of defvar
%% \end{defvar}
\newenvironment{defvar}[2]{%
\par\defunvspace\vrindexbold{#2}\label{VR:#2}
\layout[#1]{*#2*}{}{Variable}}{}
\newcommand{\defvarx}[2][\mbox{}]{%
\par\vrindexbold{#2}\label{VR:#2}
\layout[#1]{*#2*}{}{Variable}}
%% Define a constant
%%
%% \begin{defconst}{pkg}{name}
%% \ddefconstx[pkg]{name}
%% description of defconst
%% \end{defconst}
\newcommand{\defconstx}[2][\mbox{}]{%
\layout[#1]{#2}{}{Constant}}
\newenvironment{defconst}[2]{%
\defunvspace\defconstx[#1]{#2}}
\newenvironment{example}{\begin{quote}\begin{alltt}}{\end{alltt}\end{quote}}
\newenvironment{lisp}{\begin{example}}{\end{example}}
\newenvironment{display}{\begin{quote}\begin{alltt}}{\end{alltt}\end{quote}}
\newcommand{\hide}[1]{}
\newcommand{\trnumber}[1]{#1}
\newcommand{\citationinfo}[1]{#1}
\newcommand{\var}[1]{{\textsf{\textsl{#1}}\xspace}}
\newcommand{\code}[1]{\textnormal{{\sffamily #1}}}
\newcommand{\file}[1]{`\texttt{#1}'}
\newcommand{\samp}[1]{`\texttt{#1}'}
\newcommand{\kwd}[1]{\code{:#1}}
\newcommand{\F}[1]{\code{#1}}
\newcommand{\w}[1]{\hbox{#1}}
\renewcommand{\b}[1]{\textrm{\textbf{#1}}}
\renewcommand{\i}[1]{\textit{#1}}
\newcommand{\ctrl}[1]{$\uparrow$\textsf{#1}}
\newcommand{\result}{$\Rightarrow$}
\newcommand{\myequiv}{$\equiv$}
\newcommand{\back}[1]{\(\backslash\)#1}
\newcommand{\pxlref}[1]{see section~\ref{#1}, page~\pageref{#1}}
\newcommand{\xlref}[1]{See section~\ref{#1}, page~\pageref{#1}}
\newcommand{\false}{\textsf{nil}}
\newcommand{\true}{\textsf{t}}
\newcommand{\nil}{\textsf{nil}}
\newcommand{\FALSE}{\textsf{nil}}
\newcommand{\TRUE}{\textsf{t}}
\newcommand{\NIL}{\textsf{nil}}
\newcommand{\ampoptional}{\textsf{\&optional}}
\newcommand{\amprest}{\textsf{\&rest}}
\newcommand{\ampbody}{\textsf{\&body}}
\newcommand{\mopt}[1]{{$\,\{$}\textnormal{\textsf{\textsl{#1\/}}}{$\}\,$}}
\newcommand{\mstar}[1]{{$\,\{$}\textnormal{\textsf{\textsl{#1\/}}}{$\}^*\,$}}
\newcommand{\mplus}[1]{{$\,\{$}\textnormal{\textsf{\textsl{#1\/}}}{$\}^+\,$}}
\newcommand{\mgroup}[1]{{$\,\{$}\textnormal{\textsf{\textsl{#1\/}}}{$\}\,$}}
\newcommand{\mor}{$|$}
\newcommand{\funref}[1]{\findexed{#1} (page~\pageref{FN:#1})}
\newcommand{\specref}[1]{\findexed{#1} (page~\pageref{FN:#1})}
\newcommand{\macref}[1]{\findexed{#1} (page~\pageref{FN:#1})}
\newcommand{\varref}[1]{\vindexed{#1} (page~\pageref{VR:#1})}
\newcommand{\conref}[1]{\conindexed{#1} (page~\pageref{VR:#1})}
%% Some common abbreviations
\newcommand{\clisp}{Common Lisp}
\newcommand{\dash}{---}
\newcommand{\alien}{Alien}
\newcommand{\aliens}{Aliens}
\newcommand{\Aliens}{Aliens}
\newcommand{\Alien}{Alien}
\newcommand{\Hemlock}{Hemlock}
\newcommand{\hemlock}{Hemlock}
\newcommand{\python}{Python}
\newcommand{\Python}{Python}
\newcommand{\cmucl}{CMU Common Lisp}
\newcommand{\llisp}{Common Lisp}
\newcommand{\Llisp}{Common Lisp}
\newcommand{\cltl}{\emph{Common Lisp: The Language}}
\newcommand{\cltltwo}{\emph{Common Lisp: The Language 2}}
%% Replacement commands when we run latex2html. This should be last
%% so that latex2html uses these commands instead of the LaTeX
%% commands above.
\begin{htmlonly}
\usepackage{makeidx}
\newcommand{\var}[1]{\textnormal{\textit{#1}}}
\newcommand{\code}[1]{\textnormal{\texttt{#1}}}
%%\newcommand{\printindex}[1][\mbox{}]{}
%% We need the quote environment because the alltt is broken. The
%% quote environment helps us in postprocessing to result to get
%% what we want.
\newenvironment{example}{\begin{quote}\begin{alltt}}{\end{alltt}\end{quote}}
\newenvironment{display}{\begin{quote}\begin{alltt}}{\end{alltt}\end{quote}}
\newcommand{\textnormal}[1]{\rm #1}
\newcommand{\hbox}[1]{\mbox{#1}}
\newcommand{\xspace}{}
\newcommand{newindex}[4]{}
\newcommand{\pxlref}[1]{see section~\ref{#1}}
\newcommand{\xlref}[1]{See section~\ref{#1}}
\newcommand{\tindexed}[1]{\index{#1}\texttt{#1}}
\newcommand{\findexed}[1]{\index{#1}\texttt{#1}}
\newcommand{\vindexed}[1]{\index{#1}\texttt{*#1*}}
\newcommand{\cindex}[1]{\index{#1}}
\newcommand{\cpsubindex}[2]{\index{#1!#2}}
\newcommand{\keys}[1]{\texttt{\&key} #1}
\newcommand{\morekeys}[1]{#1}
\newcommand{\yetmorekeys}[1]{#1}
\newenvironment{defun}[3]{%
\textbf{[Function]}\\
\texttt{#1#2} \emph{#3}\\}{}
\newcommand{\defunx}[3][\mbox{}]{%
\texttt{#1#2} {\em #3}\\}
\newenvironment{defmac}[3]{%
\textbf{[Macro]}\\
\texttt{#1#2} \emph{#3}\\}{}
\newcommand{\defmacx}[3][\mbox{}]{%
\texttt{#1#2} {\em #3}\\}
\newenvironment{defvar}[2]{%
\textbf{[Variable]}\\
\texttt{#1*#2*}\\ \\}{}
\newcommand{\defvarx}[2][\mbox{}]{%
\texttt{#1*#2*}\\}
\newenvironment{defconst}[2]{%
\textbf{[Constant]}\\
\texttt{#1#2}\\}{}
\newcommand{\defconstx}[2][\mbox{}]{\texttt{#1#2}\\}
\newenvironment{deftp}[3]{%
\textbf{[#1]}\\
\texttt{#2} \textit{#3}\\}{}
\newenvironment{Lentry}{\begin{description}}{\end{description}}
\end{htmlonly}
%% Set up margins
\setlength{\oddsidemargin}{-10pt}
\setlength{\evensidemargin}{-10pt}
\setlength{\topmargin}{-40pt}
\setlength{\headheight}{12pt}
\setlength{\headsep}{25pt}
\setlength{\footskip}{30pt}
\setlength{\textheight}{9.25in}
\setlength{\textwidth}{6.75in}
\setlength{\columnsep}{0.375in}
\setlength{\columnseprule}{0pt}
\setcounter{tocdepth}{2}
\setcounter{secnumdepth}{3}
\def\textfraction{.1}
\def\bottomfraction{.9} % was .3
\def\topfraction{.9}
\pagestyle{headings}
\begin{document}
%%\alwaysrefill
\relax
%%\newindex{cp}
%%\newindex{ky}
\newcommand{\theabstract}{%
CMU Common Lisp is an implementation of that Common Lisp runs on
various Unix workstations. See the README file in the distribution
for current platforms. The largest single part of this document
describes the Python compiler and the programming styles and
techniques that the compiler encourages. The rest of the document
describes extensions and the implementation dependent choices made
in developing this implementation of Common Lisp. We have added
several extensions, including a source level debugger, an interface
to Unix system calls, a foreign function call interface, support for
interprocess communication and remote procedure call, and other
features that provide a good environment for developing Lisp code.
}
\newcommand{\researchcredit}{%
This research was sponsored by the Defense Advanced Research
Projects Agency, Information Science and Technology Office, under
the title \emph{Research on Parallel Computing} issued by DARPA/CMO
under Contract MDA972-90-C-0035 ARPA Order No. 7330.
The views and conclusions contained in this document are those of
the authors and should not be interpreted as representing the
official policies, either expressed or implied, of the Defense
Advanced Research Projects Agency or the U.S. government.}
\pagestyle{empty}
\title{CMU Common Lisp User's Manual}
%%\author{Robert A. MacLachlan, \var{Editor}}
%%\date{July 1992}
%%\trnumber{CMU-CS-92-161}
%%\citationinfo{
%%\begin{center}
%%Supersedes Technical Reports CMU-CS-87-156 and CMU-CS-91-108.
%%\end{center}
%%}
%%%%\arpasupport{strategic}
%%\abstract{\theabstract}
%%%%\keywords{lisp, Common Lisp, manual, compiler,
%%%% programming language implementation, programming environment}
%%\maketitle
\begin{latexonly}
%% \title{CMU Common Lisp User's Manual}
\author{Robert A. MacLachlan,
\emph{Editor}%
\thanks{\small This research was sponsored by the Defense Advanced
Research Projects Agency, Information Science and Technology
Office, under the title \emph{Research on Parallel Computing}
issued by DARPA/CMO under Contract MDA972-90-C-0035 ARPA Order No.
7330. The views and conclusions contained in this document are
those of the authors and should not be interpreted as representing
the official policies, either expressed or implied, of the Defense
Advanced Research Projects Agency or the U.S. government.}}
\date{\bigskip
July 1992 \\ CMU-CS-92-161 \\
\vspace{0.25in}
October 31, 1997 \\
Net Version \\
\vspace{0.75in} {\small
School of Computer Science \\
Carnegie Mellon University \\
Pittsburgh, PA 15213} \\
\vspace{0.5in} \small Supersedes Technical Reports CMU-CS-87-156 and
CMU-CS-91-108.\\
\vspace{0.5in} \textbf{Abstract} \medskip
\begin{quote}
\theabstract
\end{quote}
}
\maketitle
\end{latexonly}
%% Nice HTML version of the title page
\begin{rawhtml}
<h1 align=center>CMU Common Lisp User's Manual</h1>
<p align=center>Robert A. MacLachlan, <EM>Editor</EM>
</p>
<p align=center>
July 1992 <BR>
CMU-CS-92-161 <BR>
</p>
<br>
<p align=center>
July 1997 <BR>
Net Version <BR>
</p>
<p align=center>
School of Computer Science <BR>
Carnegie Mellon University <BR>
Pittsburgh, PA 15213 <BR>
</p>
<br>
<p>
Supersedes Technical Reports CMU-CS-87-156 and
CMU-CS-91-108.<BR>
</p>
<p align=center>
<b>Abstract</b>
<blockquote>
CMU Common Lisp is an implementation of that Common Lisp runs on
various Unix workstations. See the README file in the
distribution for current platforms. The largest single part of
this document describes the Python compiler and the programming
styles and techniques that the compiler encourages. The rest of
the document describes extensions and the implementation
dependent choices made in developing this implementation of
Common Lisp. We have added several extensions, including a
source level debugger, an interface to Unix system calls, a
foreign function call interface, support for interprocess
communication and remote procedure call, and other features that
provide a good environment for developing Lisp code.
</blockquote>
</p>
<blockquote><font size=-1>
This research was sponsored by the Defense Advanced Research
Projects Agency, Information Science and Technology Office, under
the title <em>Research on Parallel Computing</em> issued by DARPA/CMO
under Contract MDA972-90-C-0035 ARPA Order No. 7330.
<p>
The views and conclusions contained in this document are those of
the authors and should not be interpreted as representing the
official policies, either expressed or implied, of the Defense
Advanced Research Projects Agency or the U.S. government.
</p></font>
</blockquote>
</p>
\end{rawhtml}
\clearpage
\vspace*{\fill}
\textbf{Keywords:} lisp, Common Lisp, manual, compiler,
programming language implementation, programming environment
\clearpage
\pagestyle{headings}
\pagenumbering{roman}
\tableofcontents
\clearpage
\pagenumbering{arabic}
%%\end{iftex}
%%\setfilename{cmu-user.info}
%%\node Top, Introduction, (dir), (dir)
\hide{File:/afs/cs.cmu.edu/project/clisp/hackers/ram/docs/cmu-user/intro.ms}
\hide{ -*- Dictionary: cmu-user -*- }
\begin{comment}
* Introduction::
* Design Choices and Extensions::
* The Debugger::
* The Compiler::
* Advanced Compiler Use and Efficiency Hints::
* UNIX Interface::
* Event Dispatching with SERVE-EVENT::
* Alien Objects::
* Interprocess Communication under LISP::
* Debugger Programmer's Interface::
* Function Index::
* Variable Index::
* Type Index::
* Concept Index::
--- The Detailed Node Listing ---
Introduction
* Support::
* Local Distribution of CMU Common Lisp::
* Net Distribution of CMU Common Lisp::
* Source Availability::
* Command Line Options::
* Credits::
Design Choices and Extensions
* Data Types::
* Default Interrupts for Lisp::
* Packages::
* The Editor::
* Garbage Collection::
* Describe::
* The Inspector::
* Load::
* The Reader::
* Running Programs from Lisp::
* Saving a Core Image::
* Pathnames::
* Filesystem Operations::
* Time Parsing and Formatting::
* Lisp Library::
Data Types
* Symbols::
* Integers::
* Floats::
* Characters::
* Array Initialization::
Floats
* IEEE Special Values::
* Negative Zero::
* Denormalized Floats::
* Floating Point Exceptions::
* Floating Point Rounding Mode::
* Accessing the Floating Point Modes::
The Inspector
* The Graphical Interface::
* The TTY Inspector::
Running Programs from Lisp
* Process Accessors::
Pathnames
* Unix Pathnames::
* Wildcard Pathnames::
* Logical Pathnames::
* Search Lists::
* Predefined Search-Lists::
* Search-List Operations::
* Search List Example::
Logical Pathnames
* Search Lists::
* Search List Example::
Search-List Operations
* Search List Example::
Filesystem Operations
* Wildcard Matching::
* File Name Completion::
* Miscellaneous Filesystem Operations::
The Debugger
* Debugger Introduction::
* The Command Loop::
* Stack Frames::
* Variable Access::
* Source Location Printing::
* Compiler Policy Control::
* Exiting Commands::
* Information Commands::
* Breakpoint Commands::
* Function Tracing::
* Specials::
Stack Frames
* Stack Motion::
* How Arguments are Printed::
* Function Names::
* Funny Frames::
* Debug Tail Recursion::
* Unknown Locations and Interrupts::
Variable Access
* Variable Value Availability::
* Note On Lexical Variable Access::
Source Location Printing
* How the Source is Found::
* Source Location Availability::
Breakpoint Commands
* Breakpoint Example::
Function Tracing
* Encapsulation Functions::
The Compiler
* Compiler Introduction::
* Calling the Compiler::
* Compilation Units::
* Interpreting Error Messages::
* Types in Python::
* Getting Existing Programs to Run::
* Compiler Policy::
* Open Coding and Inline Expansion::
Compilation Units
* Undefined Warnings::
Interpreting Error Messages
* The Parts of the Error Message::
* The Original and Actual Source::
* The Processing Path::
* Error Severity::
* Errors During Macroexpansion::
* Read Errors::
* Error Message Parameterization::
Types in Python
* Compile Time Type Errors::
* Precise Type Checking::
* Weakened Type Checking::
Compiler Policy
* The Optimize Declaration::
* The Optimize-Interface Declaration::
Advanced Compiler Use and Efficiency Hints
* Advanced Compiler Introduction::
* More About Types in Python::
* Type Inference::
* Source Optimization::
* Tail Recursion::
* Local Call::
* Block Compilation::
* Inline Expansion::
* Byte Coded Compilation::
* Object Representation::
* Numbers::
* General Efficiency Hints::
* Efficiency Notes::
* Profiling::
Advanced Compiler Introduction
* Types::
* Optimization::
* Function Call::
* Representation of Objects::
* Writing Efficient Code::
More About Types in Python
* More Types Meaningful::
* Canonicalization::
* Member Types::
* Union Types::
* The Empty Type::
* Function Types::
* The Values Declaration::
* Structure Types::
* The Freeze-Type Declaration::
* Type Restrictions::
* Type Style Recommendations::
Type Inference
* Variable Type Inference::
* Local Function Type Inference::
* Global Function Type Inference::
* Operation Specific Type Inference::
* Dynamic Type Inference::
* Type Check Optimization::
Source Optimization
* Let Optimization::
* Constant Folding::
* Unused Expression Elimination::
* Control Optimization::
* Unreachable Code Deletion::
* Multiple Values Optimization::
* Source to Source Transformation::
* Style Recommendations::
Tail Recursion
* Tail Recursion Exceptions::
Local Call
* Self-Recursive Calls::
* Let Calls::
* Closures::
* Local Tail Recursion::
* Return Values::
Block Compilation
* Block Compilation Semantics::
* Block Compilation Declarations::
* Compiler Arguments::
* Practical Difficulties::
* Context Declarations::
* Context Declaration Example::
Inline Expansion
* Inline Expansion Recording::
* Semi-Inline Expansion::
* The Maybe-Inline Declaration::
Object Representation
* Think Before You Use a List::
* Structure Representation::
* Arrays::
* Vectors::
* Bit-Vectors::
* Hashtables::
Numbers
* Descriptors::
* Non-Descriptor Representations::
* Variables::
* Generic Arithmetic::
* Fixnums::
* Word Integers::
* Floating Point Efficiency::
* Specialized Arrays::
* Specialized Structure Slots::
* Interactions With Local Call::
* Representation of Characters::
General Efficiency Hints
* Compile Your Code::
* Avoid Unnecessary Consing::
* Complex Argument Syntax::
* Mapping and Iteration::
* Trace Files and Disassembly::
Efficiency Notes
* Type Uncertainty::
* Efficiency Notes and Type Checking::
* Representation Efficiency Notes::
* Verbosity Control::
Profiling
* Profile Interface::
* Profiling Techniques::
* Nested or Recursive Calls::
* Clock resolution::
* Profiling overhead::
* Additional Timing Utilities::
* A Note on Timing::
* Benchmarking Techniques::
UNIX Interface
* Reading the Command Line::
* Lisp Equivalents for C Routines::
* Type Translations::
* System Area Pointers::
* Unix System Calls::
* File Descriptor Streams::
* Making Sense of Mach Return Codes::
* Unix Interrupts::
Unix Interrupts
* Changing Interrupt Handlers::
* Examples of Signal Handlers::
Event Dispatching with SERVE-EVENT
* Object Sets::
* The SERVE-EVENT Function::
* Using SERVE-EVENT with Unix File Descriptors::
* Using SERVE-EVENT with the CLX Interface to X::
* A SERVE-EVENT Example::
Using SERVE-EVENT with the CLX Interface to X
* Without Object Sets::
* With Object Sets::
A SERVE-EVENT Example
* Without Object Sets Example::
* With Object Sets Example::
Alien Objects
* Introduction to Aliens::
* Alien Types::
* Alien Operations::
* Alien Variables::
* Alien Data Structure Example::
* Loading Unix Object Files::
* Alien Function Calls::
* Step-by-Step Alien Example::
Alien Types
* Defining Alien Types::
* Alien Types and Lisp Types::
* Alien Type Specifiers::
* The C-Call Package::
Alien Operations
* Alien Access Operations::
* Alien Coercion Operations::
* Alien Dynamic Allocation::
Alien Variables
* Local Alien Variables::
* External Alien Variables::
Alien Function Calls
* alien-funcall:: The alien-funcall Primitive
* def-alien-routine:: The def-alien-routine Macro
* def-alien-routine Example::
* Calling Lisp from C::
Interprocess Communication under LISP
* The REMOTE Package::
* The WIRE Package::
* Out-Of-Band Data::
The REMOTE Package
* Connecting Servers and Clients::
* Remote Evaluations::
* Remote Objects::
* Host Addresses::
The WIRE Package
* Untagged Data::
* Tagged Data::
* Making Your Own Wires::
Debugger Programmer's Interface
* DI Exceptional Conditions::
* Debug-variables::
* Frames::
* Debug-functions::
* Debug-blocks::
* Breakpoints::
* Code-locations::
* Debug-sources::
* Source Translation Utilities::
DI Exceptional Conditions
* Debug-conditions::
* Debug-errors::
\end{comment}
%%\node Introduction, Design Choices and Extensions, Top, Top
\chapter{Introduction}
CMU Common Lisp is a public-domain implementation of Common Lisp developed in
the Computer Science Department of Carnegie Mellon University. \cmucl{} runs
on various Unix workstations---see the README file in the distribution for
current platforms. This document describes the implementation based on the
Python compiler. Previous versions of CMU Common Lisp ran on the IBM RT PC
and (when known as Spice Lisp) on the Perq workstation. See \code{man cmucl}
(\file{man/man1/cmucl.1}) for other general information.
\cmucl{} sources and executables are freely available via anonymous FTP; this
software is ``as is'', and has no warranty of any kind. CMU and the
authors assume no responsibility for the consequences of any use of this
software. See \file{doc/release-notes.txt} for a description of the
state of the release you have.
\begin{comment}
* Support::
* Local Distribution of CMU Common Lisp::
* Net Distribution of CMU Common Lisp::
* Source Availability::
* Command Line Options::
* Credits::
\end{comment}
%%\node Support, Local Distribution of CMU Common Lisp, Introduction, Introduction
\section{Support}
The CMU Common Lisp project is no longer funded, so only minimal support is
being done at CMU. There is a net community of \cmucl{} users and maintainers
who communicate via comp.lang.lisp and the cmucl-bugs@cs.cmu.edu
\begin{changebar}
cmucl-imp@cons.org
\end{changebar}
mailing lists.
This manual contains only implementation-specific information about
\cmucl. Users will also need a separate manual describing the
\clisp{} standard. \clisp{} was initially defined in \i{Common Lisp:
The Language}, by Guy L. Steele Jr. \clisp{} is now undergoing
standardization by the X3J13 committee of ANSI. The X3J13 spec is not
yet completed, but a number of clarifications and modification have
been approved. We intend that \cmucl{} will eventually adhere to the
X3J13 spec, and we have already implemented many of the changes
approved by X3J13.
Until the X3J13 standard is completed, the second edition of
\cltltwo{} is probably the best available manual for the language and
for our implementation of it. This book has no official role in the
standardization process, but it does include many of the changes
adopted since the first edition was completed.
In addition to the language itself, this document describes a number
of useful library modules that run in \cmucl. \hemlock, an Emacs-like
text editor, is included as an integral part of the \cmucl{}
environment. Two documents describe \hemlock{}: the \i{Hemlock User's
Manual}, and the \i{Hemlock Command Implementor's Manual}.
%%\node Local Distribution of CMU Common Lisp, Net Distribution of CMU Common Lisp, Support, Introduction
\section{Local Distribution of CMU Common Lisp}
In CMU CS, \cmucl{} should be runnable as \file{/usr/local/bin/cmucl}.
The full binary distribution should appear under
\file{/usr/local/lib/cmucl/}. Note that the first time you run Lisp,
it will take AFS several minutes to copy the image into its local
cache. Subsequent starts will be much faster.
Or, you can run directly out of the AFS release area (which may be
necessary on SunOS machines). Put this in your \file{.login} shell
script:
\begin{example}
setenv CMUCLLIB "/afs/cs/misc/cmucl/@sys/beta/lib"
setenv PATH \${PATH}:/afs/cs/misc/cmucl/@sys/beta/bin
\end{example}
If you also set \code{MANPATH} or \code{MPATH} (depending on the Unix)
to point to \file{/usr/local/lib/cmucl/man/}, then `\code{man cmucl}'
will give an introduction to CMU CL and \samp{man lisp} will describe
command line options. For installation notes, see the \file{README}
file in the release area.
See \file{/usr/local/lib/cmucl/doc} for release notes and
documentation. Hardcopy documentation is available in the document
room. Documentation supplements may be available for recent
additions: see the \file{README} file.
Send bug reports and questions to \samp{cmucl-bugs@cs.cmu.edu}. If
you send a bug report to \samp{gripe} or \samp{help}, they will just
forward it to this mailing list.
%%\node Net Distribution of CMU Common Lisp, Source Availability, Local Distribution of CMU Common Lisp, Introduction
\section{Net Distribution of CMU Common Lisp}
\subsection{CMU Distribution}
Externally, CMU Common Lisp is only available via anonymous FTP. We
don't have the manpower to make tapes. These are our distribution
machines:
\begin{example}
lisp-rt1.slisp.cs.cmu.edu (128.2.217.9)
lisp-rt2.slisp.cs.cmu.edu (128.2.217.10)
\end{example}
Log in with the user \samp{anonymous} and \samp{username@host} as
password (i.e. your EMAIL address.) When you log in, the current
directory should be set to the \cmucl{} release area. If you have any
trouble with FTP access, please send mail to \samp{slisp@cs.cmu.edu}.
The release area holds compressed tar files with names of the form:
\begin{example}
\var{version}-\var{machine}_\var{os}.tar.Z
\end{example}
FTP compressed tar archives in binary mode. To extract, \samp{cd} to
the directory that is to be the root of the tree, then type:
\begin{example}
uncompress <file.tar.Z | tar xf - .
\end{example}
The resulting tree is about 23 megabytes. For installation
directions, see the section ``site initialization'' in README file at
the root of the tree.
If poor network connections make it difficult to transfer a 10 meg
file, the release is also available split into five parts, with the
suffix \file{.0} to \file{.4}. To extract from multiple files, use:
\begin{example}
cat file.tar.Z.* | uncompress | tar xf - .
\end{example}
The release area also contains source distributions and other binary
distributions. A listing of the current contents of the release area
is in \file{FILES}. Major release announcements will be made to
\code{comp.lang.lisp} until there is enough volume to warrant a
\code{comp.lang.lisp.cmu}.
\begin{changebar}
\subsection{Net Distribution}
Although the CMU Common Lisp project is no longer actively developed
by CMU, development has continued. You can obtain this version from
either
\begin{example}
ftp://ftp2.cons.org/pub/languages/lisp/cmucl
http://www2.cons.org:8000/ftp-area/cmucl/
\end{example}
Further information can be found via the World Wide Web at
\begin{example}
http://www.cons.org/cmucl
\end{example}
\end{changebar}
%%\node Source Availability, Command Line Options, Net Distribution of CMU Common Lisp, Introduction
\section{Source Availability}
Lisp and documentation sources are available via anonymous FTP ftp to
any CMU CS machine. All CMU written code is public domain, but CMU CL
also makes use of two imported packages: PCL and CLX. Although these
packages are copyrighted, they may be freely distributed without any
licensing agreement or fee. See the \file{README} file in the binary
distribution for up-to-date source pointers.
The release area contains a source distribution, which is an image of
all the \file{.lisp} source files used to build a particular system
\var{version}:
\begin{example}
\var{version}-source.tar.Z (3.6 meg)
\end{example}
All of our files (including the release area) are actually in the AFS
file system. On the release machines, the FTP server's home is the
release directory: \file{/afs/cs.cmu.edu/project/clisp/release}. The
actual working source areas are in other subdirectories of
\file{clisp}, and you can directly ``cd'' to those directories if you
know the name. Due to the way anonymous FTP access control is done,
it is important to ``cd'' to the source directory with a single
command, and then do a ``get'' operation.
\begin{changebar}
Alternatively, you can obtain the current sources via WWW at
\begin{example}
http://www.cons.org/cmucl
\end{example}
which contains pointers on how to get a \code{tar} file of the
current sources or how to get an individual file from the sources.
Binary versions for selected platforms are also available as well.
\end{changebar}
%%\node Command Line Options, Credits, Source Availability, Introduction
\section{Command Line Options}
The command line syntax and environment is described in the lisp(1)
man page in the man/man1 directory of the distribution. See also
cmucl(1). Currently Lisp accepts the following switches:
\begin{Lentry}
\begin{changebar}
\item[\code{-batch}] specifies batch mode, where all input is
directed from standard-input. An error code of 0 is returned upon
encountering an EOF and 1 otherwise.
\end{changebar}
\item[\code{-core}] requires an argument that should be the name of a
core file. Rather than using the default core file
(\file{lib/lisp.core}), the specified core file is loaded.
\item[\code{-edit}] specifies to enter Hemlock. A file to edit may be
specified by placing the name of the file between the program name
(usually \file{lisp}) and the first switch.
\item[\code{-eval}] accepts one argument which should be a Lisp form
to evaluate during the start up sequence. The value of the form
will not be printed unless it is wrapped in a form that does output.
\item[\code{-hinit}] accepts an argument that should be the name of
the hemlock init file to load the first time the function
\findexed{ed} is invoked. The default is to load
\file{hemlock-init.\var{object-type}}, or if that does not exist,
\file{hemlock-init.lisp} from the user's home directory. If the
file is not in the user's home directory, the full path must be
specified.
\item[\code{-init}] accepts an argument that should be the name of an
init file to load during the normal start up sequence. The default
is to load \file{init.\var{object-type}} or, if that does not exist,
\file{init.lisp} from the user's home directory. If the file is not
in the user's home directory, the full path must be specified.
\item[\code{-noinit}] accepts no arguments and specifies that an init
file should not be loaded during the normal start up sequence.
Also, this switch suppresses the loading of a hemlock init file when
Hemlock is started up with the \code{-edit} switch.
\item[\code{-load}] accepts an argument which should be the name of a
file to load into Lisp before entering Lisp's read-eval-print loop.
\item[\code{-slave}] specifies that Lisp should start up as a
\i{slave} Lisp and try to connect to an editor Lisp. The name of
the editor to connect to must be specified\dash{}to find the
editor's name, use the \hemlock{} ``\code{Accept Slave
Connections}'' command. The name for the editor Lisp is of the
form:
\begin{example}
\var{machine-name}\code{:}\var{socket}
\end{example}
where \var{machine-name} is the internet host name for the machine
and \var{socket} is the decimal number of the socket to connect to.
\end{Lentry}
For more details on the use of the \code{-edit} and \code{-slave}
switches, see the \i{Hemlock User's Manual}.
Arguments to the above switches can be specified in one of two ways:
\w{\var{switch}\code{=}\var{value}} or
\w{\var{switch}<\var{space}>\var{value}}. For example, to start up
the saved core file mylisp.core use either of the following two
commands:
\begin{example}
\code{lisp -core=mylisp.core
lisp -core mylisp.core}
\end{example}
%%\node Credits, , Command Line Options, Introduction
\section{Credits}
Since 1981 many people have contributed to the development of CMU
Common Lisp. The currently active members are:
\begin{display}
Marco Antoniotti
David Axmark
Miles Bader
Casper Dik
Scott Fahlman * (fearless leader)
Paul Gleichauf *
Richard Harris
Joerg-Cyril Hoehl
Chris Hoover
Simon Leinen
Sandra Loosemore
William Lott *
Robert A. Maclachlan *
\end{display}
\noindent
Many people are voluntarily working on improving CMU Common Lisp. ``*''
means a full-time CMU employee, and ``+'' means a part-time student
employee. A partial listing of significant past contributors follows:
\begin{display}
Tim Moore
Sean Hallgren +
Mike Garland +
Ted Dunning
Rick Busdiecker
Bill Chiles *
John Kolojejchick
Todd Kaufmann +
Dave McDonald *
Skef Wholey *
\end{display}
\vspace{2 em}
\researchcredit
\begin{changebar}
From 1995, development of CMU Common Lisp has been continued by a
group of volunteers. A partial list of volunteers includes the
following
\begin{table}[h]
\begin{center}
\begin{tabular}{ll}
Paul Werkowski & pw@snoopy.mv.com \\
Peter VanEynde & s950045@uia.ua.ac.be \\
Marco Antoniotti & marcoxa@PATH.Berkeley.EDU\\
Martin Cracauer & cracauer@cons.org\\
Douglas Thomas Crosher & dtc@scrooge.ee.swin.oz.au\\
Simon Leinen & simon@switch.ch\\
Rob MacLachlan & ram+@CS.cmu.edu\\
Raymond Toy & toy@rtp.ericsson.se
\end{tabular}
\end{center}
\end{table}
In particular Paul Werkowski completed the port for the x86
architecture for FreeBSD. Peter VanEnyde took the FreeBSD port and
created a Linux version.
\end{changebar}
\hide{File:/afs/cs.cmu.edu/project/clisp/hackers/ram/docs/cmu-user/design.ms}
\hide{ -*- Dictionary: cmu-user -*- }
%%\node Design Choices and Extensions, The Debugger, Introduction, Top
\chapter{Design Choices and Extensions}
Several design choices in Common Lisp are left to the individual
implementation, and some essential parts of the programming environment
are left undefined. This chapter discusses the most important design
choices and extensions.
\begin{comment}
* Data Types::
* Default Interrupts for Lisp::
* Packages::
* The Editor::
* Garbage Collection::
* Describe::
* The Inspector::
* Load::
* The Reader::
* Running Programs from Lisp::
* Saving a Core Image::
* Pathnames::
* Filesystem Operations::
* Time Parsing and Formatting::
* Lisp Library::
\end{comment}
%%\node Data Types, Default Interrupts for Lisp, Design Choices and Extensions, Design Choices and Extensions
\section{Data Types}
\begin{comment}
* Symbols::
* Integers::
* Floats::
* Characters::
* Array Initialization::
\end{comment}
%%\node Symbols, Integers, Data Types, Data Types
\subsection{Symbols}
As in \cltl, all symbols and package names are printed in lower case, as
a user is likely to type them. Internally, they are normally stored
upper case only.
%%\node Integers, Floats, Symbols, Data Types
\subsection{Integers}
The \tindexed{fixnum} type is equivalent to \code{(signed-byte 30)}.
Integers outside this range are represented as a \tindexed{bignum} or
a word integer (\pxlref{word-integers}.) Almost all integers that
appear in programs can be represented as a \code{fixnum}, so integer
number consing is rare.
%%\node Floats, Characters, Integers, Data Types
\subsection{Floats}
\label{ieee-float}
\cmucl{} supports two floating point formats: \tindexed{single-float}
and \tindexed{double-float}. These are implemented with IEEE single
and double float arithmetic, respectively. \code{short-float} is a
synonym for \code{single-float}, and \code{long-float} is a synonym
for \code{double-float}. The initial value of
\vindexed{read-default-float-format} is \code{single-float}.
Both \code{single-float} and \code{double-float} are represented with
a pointer descriptor, so float operations can cause number consing.
Number consing is greatly reduced if programs are written to allow the
use of non-descriptor representations (\pxlref{numeric-types}.)
\begin{comment}
* IEEE Special Values::
* Negative Zero::
* Denormalized Floats::
* Floating Point Exceptions::
* Floating Point Rounding Mode::
* Accessing the Floating Point Modes::
\end{comment}
%%\node IEEE Special Values, Negative Zero, Floats, Floats
\subsubsection{IEEE Special Values}
\cmucl{} supports the IEEE infinity and NaN special values. These
non-numeric values will only be generated when trapping is disabled
for some floating point exception (\pxlref{float-traps}), so users of
the default configuration need not concern themselves with special
values.
\begin{defconst}{extensions:}{short-float-positive-infinity}
\defconstx[extensions:]{short-float-negative-infinity}
\defconstx[extensions:]{single-float-positive-infinity}
\defconstx[extensions:]{single-float-negative-infinity}
\defconstx[extensions:]{double-float-positive-infinity}
\defconstx[extensions:]{double-float-negative-infinity}
\defconstx[extensions:]{long-float-positive-infinity}
\defconstx[extensions:]{long-float-negative-infinity}
The values of these constants are the IEEE positive and negative
infinity objects for each float format.
\end{defconst}
\begin{defun}{extensions:}{float-infinity-p}{\args{\var{x}}}
This function returns true if \var{x} is an IEEE float infinity (of
either sign.) \var{x} must be a float.
\end{defun}
\begin{defun}{extensions:}{float-nan-p}{\args{\var{x}}}
\defunx[extensions:]{float-trapping-nan-p}{\args{\var{x}}}
\code{float-nan-p} returns true if \var{x} is an IEEE NaN (Not A
Number) object. \code{float-trapping-nan-p} returns true only if
\var{x} is a trapping NaN. With either function, \var{x} must be a
float.
\end{defun}
%%\node Negative Zero, Denormalized Floats, IEEE Special Values, Floats
\subsubsection{Negative Zero}
The IEEE float format provides for distinct positive and negative
zeros. To test the sign on zero (or any other float), use the
\clisp{} \findexed{float-sign} function. Negative zero prints as
\code{-0.0f0} or \code{-0.0d0}.
%%\node Denormalized Floats, Floating Point Exceptions, Negative Zero, Floats
\subsubsection{Denormalized Floats}
\cmucl{} supports IEEE denormalized floats. Denormalized floats
provide a mechanism for gradual underflow. The \clisp{}
\findexed{float-precision} function returns the actual precision of a
denormalized float, which will be less than \findexed{float-digits}.
Note that in order to generate (or even print) denormalized floats,
trapping must be disabled for the underflow exception
(\pxlref{float-traps}.) The \clisp{}
\w{\code{least-positive-}\var{format}-\code{float}} constants are
denormalized.
\begin{defun}{extensions:}{float-normalized-p}{\args{\var{x}}}
This function returns true if \var{x} is a denormalized float.
\var{x} must be a float.
\end{defun}
%%\node Floating Point Exceptions, Floating Point Rounding Mode, Denormalized Floats, Floats
\subsubsection{Floating Point Exceptions}
\label{float-traps}
The IEEE floating point standard defines several exceptions that occur
when the result of a floating point operation is unclear or
undesirable. Exceptions can be ignored, in which case some default
action is taken, such as returning a special value. When trapping is
enabled for an exception, a error is signalled whenever that exception
occurs. These are the possible floating point exceptions:
\begin{Lentry}
\item[\kwd{underflow}] This exception occurs when the result of an
operation is too small to be represented as a normalized float in
its format. If trapping is enabled, the
\tindexed{floating-point-underflow} condition is signalled.
Otherwise, the operation results in a denormalized float or zero.
\item[\kwd{overflow}] This exception occurs when the result of an
operation is too large to be represented as a float in its format.
If trapping is enabled, the \tindexed{floating-point-overflow}
exception is signalled. Otherwise, the operation results in the
appropriate infinity.
\item[\kwd{inexact}] This exception occurs when the result of a
floating point operation is not exact, i.e. the result was rounded.
If trapping is enabled, the \code{extensions:floating-point-inexact}
condition is signalled. Otherwise, the rounded result is returned.
\item[\kwd{invalid}] This exception occurs when the result of an
operation is ill-defined, such as \code{\w{(/ 0.0 0.0)}}. If
trapping is enabled, the \code{extensions:floating-point-invalid}
condition is signalled. Otherwise, a quiet NaN is returned.
\item[\kwd{divide-by-zero}] This exception occurs when a float is
divided by zero. If trapping is enabled, the
\tindexed{divide-by-zero} condition is signalled. Otherwise, the
appropriate infinity is returned.
\end{Lentry}
%%\node Floating Point Rounding Mode, Accessing the Floating Point Modes, Floating Point Exceptions, Floats
\subsubsection{Floating Point Rounding Mode}
\label{float-rounding-modes}
IEEE floating point specifies four possible rounding modes:
\begin{Lentry}
\item[\kwd{nearest}] In this mode, the inexact results are rounded to
the nearer of the two possible result values. If the neither
possibility is nearer, then the even alternative is chosen. This
form of rounding is also called ``round to even'', and is the form
of rounding specified for the \clisp{} \findexed{round} function.
\item[\kwd{positive-infinity}] This mode rounds inexact results to the
possible value closer to positive infinity. This is analogous to
the \clisp{} \findexed{ceiling} function.
\item[\kwd{negative-infinity}] This mode rounds inexact results to the
possible value closer to negative infinity. This is analogous to
the \clisp{} \findexed{floor} function.
\item[\kwd{zero}] This mode rounds inexact results to the possible
value closer to zero. This is analogous to the \clisp{}
\findexed{truncate} function.
\end{Lentry}
\paragraph{Warning:}
Although the rounding mode can be changed with
\code{set-floating-point-modes}, use of any value other than the
default (\kwd{nearest}) can cause unusual behavior, since it will
affect rounding done by \llisp{} system code as well as rounding in
user code. In particular, the unary \code{round} function will stop
doing round-to-nearest on floats, and instead do the selected form of
rounding.
%%\node Accessing the Floating Point Modes, , Floating Point Rounding Mode, Floats
\subsubsection{Accessing the Floating Point Modes}
These functions can be used to modify or read the floating point modes:
\begin{defun}{extensions:}{set-floating-point-modes}{%
\keys{\kwd{traps} \kwd{rounding-mode}}
\morekeys{\kwd{fast-mode} \kwd{accrued-exceptions}}
\yetmorekeys{\kwd{current-exceptions}}}
\defunx[extensions:]{get-floating-point-modes}{}
The keyword arguments to \code{set-floating-point-modes} set various
modes controlling how floating point arithmetic is done:
\begin{Lentry}
\item[\kwd{traps}] A list of the exception conditions that should
cause traps. Possible exceptions are \kwd{underflow},
\kwd{overflow}, \kwd{inexact}, \kwd{invalid} and
\kwd{divide-by-zero}. Initially all traps except \kwd{inexact}
are enabled. \xlref{float-traps}.
\item[\kwd{rounding-mode}] The rounding mode to use when the result
is not exact. Possible values are \kwd{nearest},
\latex{\kwd{positive\-infinity}}\html{\kwd{positive-infinity}},
\kwd{negative-infinity} and \kwd{zero}. Initially, the rounding
mode is \kwd{nearest}. See the warning in section
\ref{float-rounding-modes} about use of other rounding modes.
\item[\kwd{current-exceptions}, \kwd{accrued-exceptions}] Lists of
exception keywords used to set the exception flags. The
\var{current-exceptions} are the exceptions for the previous
operation, so setting it is not very useful. The
\var{accrued-exceptions} are a cumulative record of the exceptions
that occurred since the last time these flags were cleared.
Specifying \code{()} will clear any accrued exceptions.
\item[\kwd{fast-mode}] Set the hardware's ``fast mode'' flag, if
any. When set, IEEE conformance or debuggability may be impaired.
Some machines may not have this feature, in which case the value
is always \false. No currently supported machines have a fast
mode.
\end{Lentry}
If a keyword argument is not supplied, then the associated state is
not changed.
\code{get-floating-point-modes} returns a list representing the
state of the floating point modes. The list is in the same format
as the keyword arguments to \code{set-floating-point-modes}, so
\code{apply} could be used with \code{set-floating-point-modes} to
restore the modes in effect at the time of the call to
\code{get-floating-point-modes}.
\end{defun}
\begin{changebar}
To make handling control of floating-point exceptions, the following
macro is useful.
\begin{defmac}{ext:}{with-float-traps-masked}{traps \ampbody\ body}
\code{body} is executed with the selected floating-point exceptions
given by \code{traps} masked out (disabled). \code{traps} should be
a list of possible floating-point exceptions that should be ignored.
Possible values are \kwd{underflow}, \kwd{overflow}, \kwd{inexact},
\kwd{invalid} and \kwd{divide-by-zero}.
This is equivalent to saving the current traps from
\code{get-floating-point-modes}, setting the floating-point modes to
the desired exceptions, running the \code{body}, and restoring the
saved floating-point modes. The advantage of this macro is that it
causes less consing to occur.
Some points about the with-float-traps-masked:
\begin{itemize}
\item Two approaches are available for detecting FP exceptions:
\begin{enumerate}
\item enabling the traps and handling the exceptions
\item disabling the traps and either handling the return values or
checking the accrued exceptions.
\end{enumerate}
Of these the latter is the most portable because on the alpha port
it is not possible to enable some traps at run-time.
\item To assist the checking of the exceptions within the body any
accrued exceptions matching the given traps are cleared at the
start of the body when the traps are masked.
\item To allow the macros to be nested these accrued exceptions are
restored at the end of the body to their values at the start of
the body. Thus any exceptions that occurred within the body will
not affect the accrued exceptions outside the macro.
\item Note that only the given exceptions are restored at the end of
the body so other exception will be visible in the accrued
exceptions outside the body.
\item On the x86, setting the accrued exceptions of an unmasked
exception would cause a FP trap. The macro behaviour of restoring
the accrued exceptions ensures than if an accrued exception is
initially not flagged and occurs within the body it will be
restored/cleared at the exit of the body and thus not cause a
trap.
\item On the x86, and, perhaps, the hppa, the FP exceptions may be
delivered at the next FP instruction which requires a FP
\code{wait} instruction (\code{%vm::float-wait}) if using the lisp
conditions to catch trap within a \code{handler-bind}. The
\code{handler-bind} macro does the right thing and inserts a
float-wait (at the end of its body on the x86). The masking and
noting of exceptions is also safe here.
\item The setting of the FP flags uses the
\code{(floating-point-modes)} and the \code{(set
(floating-point-modes)\ldots)} VOPs. These VOPs blindly update
the flags which may include other state. We assume this state
hasn't changed in between getting and setting the state. For
example, if you used the FP unit between the above calls, the
state may be incorrectly restored! The
\code{with-float-traps-masked} macro keeps the intervening code to
a minimum and uses only integer operations.
%% Safe byte-compiled?
%% Perhaps the VOPs (x86) should be smarter and only update some of
%% the flags, the trap masks and exceptions?
\end{itemize}
\end{defmac}
\end{changebar}
%%\node Characters, Array Initialization, Floats, Data Types
\subsection{Characters}
\cmucl{} implements characters according to \i{Common Lisp: the
Language II}. The main difference from the first version is that
character bits and font have been eliminated, and the names of the
types have been changed. \tindexed{base-character} is the new
equivalent of the old \tindexed{string-char}. In this implementation,
all characters are base characters (there are no extended characters.)
Character codes range between \code{0} and \code{255}, using the ASCII
encoding.
\begin{changebar}
Table~\ref{tbl:chars}~\vpageref{tbl:chars} shows characters
recognized by \cmucl.
\end{changebar}
\begin{changebar}
\begin{table}[tbhp]
\begin{center}
\begin{tabular}{|c|c|l|l|l|l|}
\hline
\multicolumn{2}{|c|}{ASCII} & \multicolumn{1}{|c}{Lisp} &
\multicolumn{3}{|c|}{} \\
\cline{1-2}
Name & Code & \multicolumn{1}{|c|}{Name} & \multicolumn{3}{|c|}{\raisebox{1.5ex}{Alternatives}}\\
\hline
\hline
\code{nul} & 0 & \code{\#\back{NULL}} & \code{\#\back{NUL}} & &\\
\code{bel} & 7 & \code{\#\back{BELL}} & & &\\
\code{bs} & 8 & \code{\#\back{BACKSPACE}} & \code{\#\back{BS}} & &\\
\code{tab} & 9 & \code{\#\back{TAB}} & & &\\
\code{lf} & 10 & \code{\#\back{NEWLINE}} & \code{\#\back{NL}} & \code{\#\back{LINEFEED}} & \code{\#\back{LF}}\\
\code{ff} & 11 & \code{\#\back{VT}} & \code{\#\back{PAGE}} & \code{\#\back{FORM}} &\\
\code{cr} & 13 & \code{\#\back{RETURN}} & \code{\#\back{CR}} & &\\
\code{esc} & 27 & \code{\#\back{ESCAPE}} & \code{\#\back{ESC}} & \code{\#\back{ALTMODE}} & \code{\#\back{ALT}}\\
\code{sp} & 32 & \code{\#\back{SPACE}} & \code{\#\back{SP}} & &\\
\code{del} & 127 & \code{\#\back{DELETE}} & \code{\#\back{RUBOUT}} & &\\
\hline
\end{tabular}
\caption{Characters recognized by \cmucl}
\label{tbl:chars}
\end{center}
\end{table}
\end{changebar}
%%\node Array Initialization, , Characters, Data Types
\subsection{Array Initialization}
If no \kwd{initial-value} is specified, arrays are initialized to zero.
%%\node Default Interrupts for Lisp, Packages, Data Types, Design Choices and Extensions
\section{Default Interrupts for Lisp}
CMU Common Lisp has several interrupt handlers defined when it starts up,
as follows:
\begin{Lentry}
\item[\code{SIGINT} (\ctrl{c})] causes Lisp to enter a break loop.
This puts you into the debugger which allows you to look at the
current state of the computation. If you proceed from the break
loop, the computation will proceed from where it was interrupted.
\item[\code{SIGQUIT} (\ctrl{L})] causes Lisp to do a throw to the
top-level. This causes the current computation to be aborted, and
control returned to the top-level read-eval-print loop.
\item[\code{SIGTSTP} (\ctrl{z})] causes Lisp to suspend execution and
return to the Unix shell. If control is returned to Lisp, the
computation will proceed from where it was interrupted.
\item[\code{SIGILL}, \code{SIGBUS}, \code{SIGSEGV}, and \code{SIGFPE}]
cause Lisp to signal an error.
\end{Lentry}
For keyboard interrupt signals, the standard interrupt character is in
parentheses. Your \file{.login} may set up different interrupt
characters. When a signal is generated, there may be some delay before
it is processed since Lisp cannot be interrupted safely in an arbitrary
place. The computation will continue until a safe point is reached and
then the interrupt will be processed. \xlref{signal-handlers} to define
your own signal handlers.
%%\node Packages, The Editor, Default Interrupts for Lisp, Design Choices and Extensions
\section{Packages}
When CMU Common Lisp is first started up, the default package is the
\code{user} package. The \code{user} package uses the
\code{common-lisp}, \code{extensions}, and \code{pcl} packages. The
symbols exported from these three packages can be referenced without
package qualifiers. This section describes packages which have
exported interfaces that may concern users. The numerous internal
packages which implement parts of the system are not described here.
Package nicknames are in parenthesis after the full name.
\begin{Lentry}
\item[\code{alien}, \code{c-call}] Export the features of the Alien
foreign data structure facility (\pxlref{aliens}.)
\item[\code{pcl}] This package contains PCL (Portable CommonLoops),
which is a portable implementation of CLOS (the Common Lisp Object
System.) This implements most (but not all) of the features in the
CLOS chapter of \cltltwo.
\item[\code{debug}] The \code{debug} package contains the command-line
oriented debugger. It exports utility various functions and
switches.
\item[\code{debug-internals}] The \code{debug-internals} package
exports the primitives used to write debuggers.
\xlref{debug-internals}.
\item[\code{extensions (ext)}] The \code{extensions} packages exports
local extensions to Common Lisp that are documented in this manual.
Examples include the \code{save-lisp} function and time parsing.
\item[\code{hemlock (ed)}] The \code{hemlock} package contains all the
code to implement Hemlock commands. The \code{hemlock} package
currently exports no symbols.
\item[\code{hemlock-internals (hi)}] The \code{hemlock-internals}
package contains code that implements low level primitives and
exports those symbols used to write Hemlock commands.
\item[\code{keyword}] The \code{keyword} package contains keywords
(e.g., \kwd{start}). All symbols in the \code{keyword} package are
exported and evaluate to themselves (i.e., the value of the symbol
is the symbol itself).
\item[\code{profile}] The \code{profile} package exports a simple
run-time profiling facility (\pxlref{profiling}).
\item[\code{common-lisp (cl lisp)}] The \code{common-lisp} package
exports all the symbols defined by \i{Common Lisp: the Language} and
only those symbols. Strictly portable Lisp code will depend only on
the symbols exported from the \code{lisp} package.
\item[\code{unix}, \code{mach}] These packages export system call
interfaces to generic BSD Unix and Mach (\pxlref{unix-interface}).
\item[\code{system (sys)}] The \code{system} package contains
functions and information necessary for system interfacing. This
package is used by the \code{lisp} package and exports several
symbols that are necessary to interface to system code.
\item[\code{common-lisp-user (user cl-user)}] The
\code{common-lisp-user} package is the default package and is where
a user's code and data is placed unless otherwise specified. This
package exports no symbols.
\item[\code{xlib}] The \code{xlib} package contains the Common Lisp X
interface (CLX) to the X11 protocol. This is mostly Lisp code with
a couple of functions that are defined in C to connect to the
server.
\item[\code{wire}] The \code{wire} package exports a remote procedure
call facility (\pxlref{remote}).
\end{Lentry}
%%\node The Editor, Garbage Collection, Packages, Design Choices and Extensions
\section{The Editor}
The \code{ed} function invokes the Hemlock editor which is described
in \i{Hemlock User's Manual} and \i{Hemlock Command Implementor's
Manual}. Most users at CMU prefer to use Hemlock's slave \Llisp{}
mechanism which provides an interactive buffer for the
\code{read-eval-print} loop and editor commands for evaluating and
compiling text from a buffer into the slave \Llisp. Since the editor
runs in the \Llisp, using slaves keeps users from trashing their
editor by developing in the same \Llisp{} with \Hemlock.
%%\node Garbage Collection, Describe, The Editor, Design Choices and Extensions
\section{Garbage Collection}
CMU Common Lisp uses a stop-and-copy garbage collector that compacts
the items in dynamic space every time it runs. Most users cause the
system to garbage collect (GC) frequently, long before space is
exhausted. With 16 or 24 megabytes of memory, causing GC's more
frequently on less garbage allows the system to GC without much (if
any) paging.
\hide{
With the default value for the following variable, you can expect a GC to take
about one minute of elapsed time on a 6 megabyte machine running X as well as
Lisp. On machines with 8 megabytes or more of memory a GC should run without
much (if any) paging. GC's run more frequently but tend to take only about 5
seconds.
}
The following functions invoke the garbage collector or control whether
automatic garbage collection is in effect:
\begin{defun}{extensions:}{gc}{}
This function runs the garbage collector. If
\code{ext:*gc-verbose*} is non-\nil, then it invokes
\code{ext:*gc-notify-before*} before GC'ing and
\code{ext:*gc-notify-after*} afterwards.
\end{defun}
\begin{defun}{extensions:}{gc-off}{}
This function inhibits automatic garbage collection. After calling
it, the system will not GC unless you call \code{ext:gc} or
\code{ext:gc-on}.
\end{defun}
\begin{defun}{extensions:}{gc-on}{}
This function reinstates automatic garbage collection. If the
system would have GC'ed while automatic GC was inhibited, then this
will call \code{ext:gc}.
\end{defun}
%%\node
\subsection{GC Parameters}
The following variables control the behavior of the garbage collector:
\begin{defvar}{extensions:}{bytes-consed-between-gcs}
CMU Common Lisp automatically GC's whenever the amount of memory
allocated to dynamic objects exceeds the value of an internal
variable. After each GC, the system sets this internal variable to
the amount of dynamic space in use at that point plus the value of
the variable \code{ext:*bytes-consed-between-gcs*}. The default
value is 2000000.
\end{defvar}
\begin{defvar}{extensions:}{gc-verbose}
This variable controls whether \code{ext:gc} invokes the functions
in \code{ext:*gc-notify-before*} and
\code{ext:*gc-notify-after*}. If \code{*gc-verbose*} is \nil,
\code{ext:gc} foregoes printing any messages. The default value is
\code{T}.
\end{defvar}
\begin{defvar}{extensions:}{gc-notify-before}
This variable's value is a function that should notify the user that
the system is about to GC. It takes one argument, the amount of
dynamic space in use before the GC measured in bytes. The default
value of this variable is a function that prints a message similar
to the following:
\begin{display}
\b{[GC threshold exceeded with 2,107,124 bytes in use. Commencing GC.]}
\end{display}
\end{defvar}
\begin{defvar}{extensions:}{gc-notify-after}
This variable's value is a function that should notify the user when
a GC finishes. The function must take three arguments, the amount
of dynamic spaced retained by the GC, the amount of dynamic space
freed, and the new threshold which is the minimum amount of space in
use before the next GC will occur. All values are byte quantities.
The default value of this variable is a function that prints a
message similar to the following:
\begin{display}
\b{[GC completed with 25,680 bytes retained and 2,096,808 bytes freed.]}
\b{[GC will next occur when at least 2,025,680 bytes are in use.]}
\end{display}
\end{defvar}
Note that a garbage collection will not happen at exactly the new
threshold printed by the default \code{ext:*gc-notify-after*}
function. The system periodically checks whether this threshold has
been exceeded, and only then does a garbage collection.
\begin{defvar}{extensions:}{gc-inhibit-hook}
This variable's value is either a function of one argument or \nil.
When the system has triggered an automatic GC, if this variable is a
function, then the system calls the function with the amount of
dynamic space currently in use (measured in bytes). If the function
returns \nil, then the GC occurs; otherwise, the system inhibits
automatic GC as if you had called \code{ext:gc-off}. The writer of
this hook is responsible for knowing when automatic GC has been
turned off and for calling or providing a way to call
\code{ext:gc-on}. The default value of this variable is \nil.
\end{defvar}
\begin{defvar}{extensions:}{before-gc-hooks}
\defvarx[extensions:]{after-gc-hooks}
These variables' values are lists of functions to call before or
after any GC occurs. The system provides these purely for
side-effect, and the functions take no arguments.
\end{defvar}
%%\node
\subsection{Weak Pointers}
A weak pointer provides a way to maintain a reference to an object
without preventing an object from being garbage collected. If the
garbage collector discovers that the only pointers to an object are
weak pointers, then it breaks the weak pointers and deallocates the
object.
\begin{defun}{extensions:}{make-weak-pointer}{\args{\var{object}}}
\defunx[extensions:]{weak-pointer-value}{\args{\var{weak-pointer}}}
\code{make-weak-pointer} returns a weak pointer to an object.
\code{weak-pointer-value} follows a weak pointer, returning the two
values: the object pointed to (or \false{} if broken) and a boolean
value which is true if the pointer has been broken.
\end{defun}
%%\node
\subsection{Finalization}
Finalization provides a ``hook'' that is triggered when the garbage
collector reclaims an object. It is usually used to recover non-Lisp
resources that were allocated to implement the finalized Lisp object.
For example, when a unix file-descriptor stream is collected,
finalization is used to close the underlying file descriptor.
\begin{defun}{extensions:}{finalize}{\args{\var{object} \var{function}}}
This function registers \var{object} for finalization.
\var{function} is called with no arguments when \var{object} is
reclaimed. Normally \var{function} will be a closure over the
underlying state that needs to be freed, e.g. the unix file
descriptor in the fd-stream case. Note that \var{function} must not
close over \var{object} itself, as this prevents the object from
ever becoming garbage.
\end{defun}
\begin{defun}{extensions:}{cancel-finalization}{\args{\var{object}}}
This function cancel any finalization request for \var{object}.
\end{defun}
%%\node Describe, The Inspector, Garbage Collection, Design Choices and Extensions
\section{Describe}
In addition to the basic function described below, there are a number of
switches and other things that can be used to control \code{describe}'s
behavior.
\begin{defun}{}{describe}{ \args{\var{object} \&optional{} \var{stream}}}
The \code{describe} function prints useful information about
\var{object} on \var{stream}, which defaults to
\code{*standard-output*}. For any object, \code{describe} will
print out the type. Then it prints other information based on the
type of \var{object}. The types which are presently handled are:
\begin{Lentry}
\item[\tindexed{hash-table}] \code{describe} prints the number of
entries currently in the hash table and the number of buckets
currently allocated.
\item[\tindexed{function}] \code{describe} prints a list of the
function's name (if any) and its formal parameters. If the name
has function documentation, then it will be printed. If the
function is compiled, then the file where it is defined will be
printed as well.
\item[\tindexed{fixnum}] \code{describe} prints whether the integer
is prime or not.
\item[\tindexed{symbol}] The symbol's value, properties, and
documentation are printed. If the symbol has a function
definition, then the function is described.
\end{Lentry}
If there is anything interesting to be said about some component of
the object, describe will invoke itself recursively to describe that
object. The level of recursion is indicated by indenting output.
\end{defun}
\begin{defvar}{extensions:}{describe-level}
The maximum level of recursive description allowed. Initially two.
\end{defvar}
\begin{defvar}{extensions:}{describe-indentation}
The number of spaces to indent for each level of recursive
description, initially three.
\end{defvar}
\begin{defvar}{extensions:}{describe-print-level}
\defvarx[extensions:]{describe-print-length}
The values of \code{*print-level*} and \code{*print-length*} during
description. Initially two and five.
\end{defvar}
%%\node The Inspector, Load, Describe, Design Choices and Extensions
\section{The Inspector}
\cmucl{} has both a graphical inspector that uses X windows and a simple
terminal-based inspector.
\begin{defun}{}{inspect}{ \args{\ampoptional{} \var{object}}}
\code{inspect} calls the inspector on the optional argument
\var{object}. If \var{object} is unsupplied, \code{inspect}
immediately returns \false. Otherwise, the behavior of inspect
depends on whether Lisp is running under X. When \code{inspect} is
eventually exited, it returns some selected Lisp object.
\end{defun}
\begin{comment}
* The Graphical Interface::
* The TTY Inspector::
\end{comment}
%%\node The Graphical Interface, The TTY Inspector, The Inspector, The Inspector
\subsection{The Graphical Interface}
\label{motif-interface}
CMU Common Lisp has an interface to Motif which is functionally similar to
CLM, but works better in CMU CL. See:
\begin{example}
\file{doc/motif-toolkit.doc}
\file{doc/motif-internals.doc}
\end{example}
This motif interface has been used to write the inspector and graphical
debugger. There is also a Lisp control panel with a simple file management
facility, apropos and inspector dialogs, and controls for setting global
options. See the \code{interface} and \code{toolkit} packages.
\begin{defun}{interface:}{lisp-control-panel}{}
This function creates a control panel for the Lisp process.
\end{defun}
\begin{defvar}{interface:}{interface-style}
When the graphical interface is loaded, this variable controls
whether it is used by \code{inspect} and the error system. If the
value is \kwd{graphics} (the default) and the \code{DISPLAY}
environment variable is defined, the graphical inspector and
debugger will be invoked by \findexed{inspect} or when an error is
signalled. Possible values are \kwd{graphics} and {tty}. If the
value is \kwd{graphics}, but there is no X display, then we quietly
use the TTY interface.
\end{defvar}
%%\node The TTY Inspector, , The Graphical Interface, The Inspector
\subsection{The TTY Inspector}
If X is unavailable, a terminal inspector is invoked. The TTY inspector
is a crude interface to \code{describe} which allows objects to be
traversed and maintains a history. This inspector prints information
about and object and a numbered list of the components of the object.
The command-line based interface is a normal
\code{read}--\code{eval}--\code{print} loop, but an integer \var{n}
descends into the \var{n}'th component of the current object, and
symbols with these special names are interpreted as commands:
\begin{Lentry}
\item[U] Move back to the enclosing object. As you descend into the
components of an object, a stack of all the objects previously seen is
kept. This command pops you up one level of this stack.
\item[Q, E] Return the current object from \code{inspect}.
\item[R] Recompute object display, and print again. Useful if the
object may have changed.
\item[D] Display again without recomputing.
\item[H, ?] Show help message.
\end{Lentry}
%%\node Load, The Reader, The Inspector, Design Choices and Extensions
\section{Load}
\begin{defun}{}{load}{%
\args{\var{filename}
\keys{\kwd{verbose} \kwd{print} \kwd{if-does-not-exist}}
\morekeys{\kwd{if-source-newer} \kwd{contents}}}}
As in standard Common Lisp, this function loads a file containing
source or object code into the running Lisp. Several CMU extensions
have been made to \code{load} to conveniently support a variety of
program file organizations. \var{filename} may be a wildcard
pathname such as \file{*.lisp}, in which case all matching files are
loaded.
If \var{filename} has a \code{pathname-type} (or extension), then
that exact file is loaded. If the file has no extension, then this
tells \code{load} to use a heuristic to load the ``right'' file.
The \code{*load-source-types*} and \code{*load-object-types*}
variables below are used to determine the default source and object
file types. If only the source or the object file exists (but not
both), then that file is quietly loaded. Similarly, if both the
source and object file exist, and the object file is newer than the
source file, then the object file is loaded. The value of the
\var{if-source-newer} argument is used to determine what action to
take when both the source and object files exist, but the object
file is out of date:
\begin{Lentry}
\item[\kwd{load-object}] The object file is loaded even though the
source file is newer.
\item[\kwd{load-source}] The source file is loaded instead of the
older object file.
\item[\kwd{compile}] The source file is compiled and then the new
object file is loaded.
\item[\kwd{query}] The user is asked a yes or no question to
determine whether the source or object file is loaded.
\end{Lentry}
This argument defaults to the value of
\code{ext:*load-if-source-newer*} (initially \kwd{load-object}.)
The \var{contents} argument can be used to override the heuristic
(based on the file extension) that normally determines whether to
load the file as a source file or an object file. If non-null, this
argument must be either \kwd{source} or \kwd{binary}, which forces
loading in source and binary mode, respectively. You really
shouldn't ever need to use this argument.
\end{defun}
\begin{defvar}{extensions:}{load-source-types}
\defvarx[extensions:]{load-object-types}
These variables are lists of possible \code{pathname-type} values
for source and object files to be passed to \code{load}. These
variables are only used when the file passed to \code{load} has no
type; in this case, the possible source and object types are used to
default the type in order to determine the names of the source and
object files.
\end{defvar}
\begin{defvar}{extensions:}{load-if-source-newer}
This variable determines the default value of the
\var{if-source-newer} argument to \code{load}. Its initial value is
\kwd{load-object}.
\end{defvar}
%%\node The Reader, Stream Extensions, Load, Design Choices and Extensions
\section{The Reader}
\begin{defvar}{extensions:}{ignore-extra-close-parentheses}
If this variable is \true{} (the default), then the reader merely
prints a warning when an extra close parenthesis is detected
(instead of signalling an error.)
\end{defvar}
%%\node Stream Extensions, Running Programs from Lisp, The Reader, Design Choices and Extensions
\section{Stream Extensions}
\begin{defun}{extensions:}{read-n-bytes}{%
\args{\var{stream buffer start numbytes}
\ampoptional{} \var{eof-error-p}}}
On streams that support it, this function reads multiple bytes of
data into a buffer. The buffer must be a \code{simple-string} or
\code{(simple-array (unsigned-byte 8) (*))}. The argument
\var{nbytes} specifies the desired number of bytes, and the return
value is the number of bytes actually read.
\begin{itemize}
\item If \var{eof-error-p} is true, an \tindexed{end-of-file}
condition is signalled if end-of-file is encountered before
\var{count} bytes have been read.
\item If \var{eof-error-p} is false, \code{read-n-bytes reads} as
much data is currently available (up to count bytes.) On pipes or
similar devices, this function returns as soon as any data is
available, even if the amount read is less than \var{count} and
eof has not been hit. See also \funref{make-fd-stream}.
\end{itemize}
\end{defun}
%%\node Running Programs from Lisp, Saving a Core Image, The Reader, Design Choices and Extensions
\section{Running Programs from Lisp}
It is possible to run programs from Lisp by using the following function.
\begin{defun}{extensions:}{run-program}{%
\args{\var{program} \var{args}
\keys{\kwd{env} \kwd{wait} \kwd{pty} \kwd{input}}
\morekeys{\kwd{if-input-does-not-exist}}
\yetmorekeys{\kwd{output} \kwd{if-output-exists}}
\yetmorekeys{\kwd{error} \kwd{if-error-exists}}
\yetmorekeys{\kwd{status-hook} \kwd{before-execve}}}}
\code{run-program} runs \var{program} in a child process.
\var{Program} should be a pathname or string naming the program.
\var{Args} should be a list of strings which this passes to
\var{program} as normal Unix parameters. For no arguments, specify
\var{args} as \nil. The value returned is either a process
structure or \nil. The process interface follows the description of
\code{run-program}. If \code{run-program} fails to fork the child
process, it returns \nil.
Except for sharing file descriptors as explained in keyword argument
descriptions, \code{run-program} closes all file descriptors in the
child process before running the program. When you are done using a
process, call \code{process-close} to reclaim system resources. You
only need to do this when you supply \kwd{stream} for one of
\kwd{input}, \kwd{output}, or \kwd{error}, or you supply \kwd{pty}
non-\nil. You can call \code{process-close} regardless of whether
you must to reclaim resources without penalty if you feel safer.
\code{run-program} accepts the following keyword arguments:
\begin{Lentry}
\item[\kwd{env}] This is an a-list mapping keywords and
simple-strings. The default is \code{ext:*environment-list*}. If
\kwd{env} is specified, \code{run-program} uses the value given
and does not combine the environment passed to Lisp with the one
specified.
\item[\kwd{wait}] If non-\nil{} (the default), wait until the child
process terminates. If \nil, continue running Lisp while the
child process runs.
\item[\kwd{pty}] This should be one of \true, \nil, or a stream. If
specified non-\nil, the subprocess executes under a Unix \i{PTY}.
If specified as a stream, the system collects all output to this
pty and writes it to this stream. If specified as \true, the
\code{process-pty} slot contains a stream from which you can read
the program's output and to which you can write input for the
program. The default is \nil.
\item[\kwd{input}] This specifies how the program gets its input.
If specified as a string, it is the name of a file that contains
input for the child process. \code{run-program} opens the file as
standard input. If specified as \nil{} (the default), then
standard input is the file \file{/dev/null}. If specified as
\true, the program uses the current standard input. This may
cause some confusion if \kwd{wait} is \nil{} since two processes
may use the terminal at the same time. If specified as
\kwd{stream}, then the \code{process-input} slot contains an
output stream. Anything written to this stream goes to the
program as input. \kwd{input} may also be an input stream that
already contains all the input for the process. In this case
\code{run-program} reads all the input from this stream before
returning, so this cannot be used to interact with the process.
\item[\kwd{if-input-does-not-exist}] This specifies what to do if
the input file does not exist. The following values are valid:
\nil{} (the default) causes \code{run-program} to return \nil{}
without doing anything; \kwd{create} creates the named file; and
\kwd{error} signals an error.
\item[\kwd{output}] This specifies what happens with the program's
output. If specified as a pathname, it is the name of a file that
contains output the program writes to its standard output. If
specified as \nil{} (the default), all output goes to
\file{/dev/null}. If specified as \true, the program writes to
the Lisp process's standard output. This may cause confusion if
\kwd{wait} is \nil{} since two processes may write to the terminal
at the same time. If specified as \kwd{stream}, then the
\code{process-output} slot contains an input stream from which you
can read the program's output.
\item[\kwd{if-output-exists}] This specifies what to do if the
output file already exists. The following values are valid:
\nil{} causes \code{run-program} to return \nil{} without doing
anything; \kwd{error} (the default) signals an error;
\kwd{supersede} overwrites the current file; and \kwd{append}
appends all output to the file.
\item[\kwd{error}] This is similar to \kwd{output}, except the file
becomes the program's standard error. Additionally, \kwd{error}
can be \kwd{output} in which case the program's error output is
routed to the same place specified for \kwd{output}. If specified
as \kwd{stream}, the \code{process-error} contains a stream
similar to the \code{process-output} slot when specifying the
\kwd{output} argument.
\item[\kwd{if-error-exists}] This specifies what to do if the error
output file already exists. It accepts the same values as
\kwd{if-output-exists}.
\item[\kwd{status-hook}] This specifies a function to call whenever
the process changes status. This is especially useful when
specifying \kwd{wait} as \nil. The function takes the process as
a required argument.
\item[\kwd{before-execve}] This specifies a function to run in the
child process before it becomes the program to run. This is
useful for actions such as authenticating the child process
without modifying the parent Lisp process.
\end{Lentry}
\end{defun}
\begin{comment}
* Process Accessors::
\end{comment}
%%\node Process Accessors, , Running Programs from Lisp, Running Programs from Lisp
\subsection{Process Accessors}
The following functions interface the process returned by \code{run-program}:
\begin{defun}{extensions:}{process-p}{\args{\var{thing}}}
This function returns \true{} if \var{thing} is a process.
Otherwise it returns \nil{}
\end{defun}
\begin{defun}{extensions:}{process-pid}{\args{\var{process}}}
This function returns the process ID, an integer, for the
\var{process}.
\end{defun}
\begin{defun}{extensions:}{process-status}{\args{\var{process}}}
This function returns the current status of \var{process}, which is
one of \kwd{running}, \kwd{stopped}, \kwd{exited}, or
\kwd{signaled}.
\end{defun}
\begin{defun}{extensions:}{process-exit-code}{\args{\var{process}}}
This function returns either the exit code for \var{process}, if it
is \kwd{exited}, or the termination signal \var{process} if it is
\kwd{signaled}. The result is undefined for processes that are
still alive.
\end{defun}
\begin{defun}{extensions:}{process-core-dumped}{\args{\var{process}}}
This function returns \true{} if someone used a Unix signal to
terminate the \var{process} and caused it to dump a Unix core image.
\end{defun}
\begin{defun}{extensions:}{process-pty}{\args{\var{process}}}
This function returns either the two-way stream connected to
\var{process}'s Unix \i{PTY} connection or \nil{} if there is none.
\end{defun}
\begin{defun}{extensions:}{process-input}{\args{\var{process}}}
\defunx[extensions:]{process-output}{\args{\var{process}}}
\defunx[extensions:]{process-error}{\args{\var{process}}}
If the corresponding stream was created, these functions return the
input, output or error file descriptor. \nil{} is returned if there
is no stream.
\end{defun}
\begin{defun}{extensions:}{process-status-hook}{\args{\var{process}}}
This function returns the current function to call whenever
\var{process}'s status changes. This function takes the
\var{process} as a required argument. \code{process-status-hook} is
\code{setf}'able.
\end{defun}
\begin{defun}{extensions:}{process-plist}{\args{\var{process}}}
This function returns annotations supplied by users, and it is
\code{setf}'able. This is available solely for users to associate
information with \var{process} without having to build a-lists or
hash tables of process structures.
\end{defun}
\begin{defun}{extensions:}{process-wait}{
\args{\var{process} \ampoptional{} \var{check-for-stopped}}}
This function waits for \var{process} to finish. If
\var{check-for-stopped} is non-\nil, this also returns when
\var{process} stops.
\end{defun}
\begin{defun}{extensions:}{process-kill}{%
\args{\var{process} \var{signal} \ampoptional{} \var{whom}}}
This function sends the Unix \var{signal} to \var{process}.
\var{Signal} should be the number of the signal or a keyword with
the Unix name (for example, \kwd{sigsegv}). \var{Whom} should be
one of the following:
\begin{Lentry}
\item[\kwd{pid}] This is the default, and it indicates sending the
signal to \var{process} only.
\item[\kwd{process-group}] This indicates sending the signal to
\var{process}'s group.
\item[\kwd{pty-process-group}] This indicates sending the signal to
the process group currently in the foreground on the Unix \i{PTY}
connected to \var{process}. This last option is useful if the
running program is a shell, and you wish to signal the program
running under the shell, not the shell itself. If
\code{process-pty} of \var{process} is \nil, using this option is
an error.
\end{Lentry}
\end{defun}
\begin{defun}{extensions:}{process-alive-p}{\args{\var{process}}}
This function returns \true{} if \var{process}'s status is either
\kwd{running} or \kwd{stopped}.
\end{defun}
\begin{defun}{extensions:}{process-close}{\args{\var{process}}}
This function closes all the streams associated with \var{process}.
When you are done using a process, call this to reclaim system
resources.
\end{defun}
%%\node Saving a Core Image, Pathnames, Running Programs from Lisp, Design Choices and Extensions
\section{Saving a Core Image}
A mechanism has been provided to save a running Lisp core image and to
later restore it. This is convenient if you don't want to load several files
into a Lisp when you first start it up. The main problem is the large
size of each saved Lisp image, typically at least 20 megabytes.
\begin{defun}{extensions:}{save-lisp}{%
\args{\var{file}
\keys{\kwd{purify} \kwd{root-structures} \kwd{init-function}}
\morekeys{\kwd{load-init-file} \kwd{print-herald} \kwd{site-init}}
\yetmorekeys{\kwd{process-command-line}}}}
The \code{save-lisp} function saves the state of the currently
running Lisp core image in \var{file}. The keyword arguments have
the following meaning:
\begin{Lentry}
\item[\kwd{purify}] If non-NIL (the default), the core image is
purified before it is saved (see \funref{purify}.) This reduces
the amount of work the garbage collector must do when the
resulting core image is being run. Also, if more than one Lisp is
running on the same machine, this maximizes the amount of memory
that can be shared between the two processes.
\item[\kwd{root-structures}]
\begin{changebar}
This should be a list of the main entry points in any newly
loaded systems. This need not be supplied, but locality and/or
GC performance will be better if they are. Meaningless if
\kwd{purify} is \nil. See \funref{purify}.
\end{changebar}
\item[\kwd{init-function}] This is the function that starts running
when the created core file is resumed. The default function
simply invokes the top level read-eval-print loop. If the
function returns the lisp will exit.
\item[\kwd{load-init-file}] If non-NIL, then load an init file;
either the one specified on the command line or
``\w{\file{init.}\var{fasl-type}}'', or, if
``\w{\file{init.}\var{fasl-type}}'' does not exist,
\code{init.lisp} from the user's home directory. If the init file
is found, it is loaded into the resumed core file before the
read-eval-print loop is entered.
\item[\kwd{site-init}] If non-NIL, the name of the site init file to
quietly load. The default is \file{library:site-init}. No error
is signalled if the file does not exist.
\item[\kwd{print-herald}] If non-NIL (the default), then print out
the standard Lisp herald when starting.
\item[\kwd{process-command-line}] If non-NIL (the default),
processes the command line switches and performs the appropriate
actions.
\end{Lentry}
\end{defun}
To resume a saved file, type:
\begin{example}
lisp -core file
\end{example}
\begin{defun}{extensions:}{purify}{
\args{\var{file}
\keys{\kwd{root-structures} \kwd{environment-name}}}}
This function optimizes garbage collection by moving all currently
live objects into non-collected storage. Once statically allocated,
the objects can never be reclaimed, even if all pointers to them are
dropped. This function should generally be called after a large
system has been loaded and initialized.
\begin{Lentry}
\item[\kwd{root-structures}] is an optional list of objects which
should be copied first to maximize locality. This should be a
list of the main entry points for the resulting core image. The
purification process tries to localize symbols, functions, etc.,
in the core image so that paging performance is improved. The
default value is NIL which means that Lisp objects will still be
localized but probably not as optimally as they could be.
\var{defstruct} structures defined with the \code{(:pure t)}
option are moved into read-only storage, further reducing GC cost.
List and vector slots of pure structures are also moved into
read-only storage.
\item[\kwd{environment-name}] is gratuitous documentation for the
compacted version of the current global environment (as seen in
\code{c::*info-environment*}.) If \false{} is supplied, then
environment compaction is inhibited.
\end{Lentry}
\end{defun}
%%\node Pathnames, Filesystem Operations, Saving a Core Image, Design Choices and Extensions
\section{Pathnames}
In \clisp{} quite a few aspects of \tindexed{pathname} semantics are left to
the implementation.
\begin{comment}
* Unix Pathnames::
* Wildcard Pathnames::
* Logical Pathnames::
* Search Lists::
* Predefined Search-Lists::
* Search-List Operations::
* Search List Example::
\end{comment}
%%\node Unix Pathnames, Wildcard Pathnames, Pathnames, Pathnames
\subsection{Unix Pathnames}
\cpsubindex{unix}{pathnames}
Unix pathnames are always parsed with a \code{unix-host} object as the host and
\code{nil} as the device. The last two dots (\code{.}) in the namestring mark
the type and version, however if the first character is a dot, it is considered
part of the name. If the last character is a dot, then the pathname has the
empty-string as its type. The type defaults to \code{nil} and the version
defaults to \kwd{newest}.
\begin{example}
(defun parse (x)
(values (pathname-name x) (pathname-type x) (pathname-version x)))
(parse "foo") \result "foo", NIL, :NEWEST
(parse "foo.bar") \result "foo", "bar", :NEWEST
(parse ".foo") \result ".foo", NIL, :NEWEST
(parse ".foo.bar") \result ".foo", "bar", :NEWEST
(parse "..") \result ".", "", :NEWEST
(parse "foo.") \result "foo", "", :NEWEST
(parse "foo.bar.1") \result "foo", "bar", 1
(parse "foo.bar.baz") \result "foo.bar", "baz", :NEWEST
\end{example}
The directory of pathnames beginning with a slash (or a search-list,
\pxlref{search-lists}) is starts \kwd{absolute}, others start with
\kwd{relative}. The \code{..} directory is parsed as \kwd{up}; there is no
namestring for \kwd{back}:
\begin{example}
(pathname-directory "/usr/foo/bar.baz") \result (:ABSOLUTE "usr" "foo")
(pathname-directory "../foo/bar.baz") \result (:RELATIVE :UP "foo")
\end{example}
%%\node Wildcard Pathnames, Logical Pathnames, Unix Pathnames, Pathnames
\subsection{Wildcard Pathnames}
Wildcards are supported in Unix pathnames. If `\code{*}' is specified for a
part of a pathname, that is parsed as \kwd{wild}. `\code{**}' can be used as a
directory name to indicate \kwd{wild-inferiors}. Filesystem operations
treat \kwd{wild-inferiors} the same as\ \kwd{wild}, but pathname pattern
matching (e.g. for logical pathname translation, \pxlref{logical-pathnames})
matches any number of directory parts with `\code{**}' (see
\pxlref{wildcard-matching}.)
`\code{*}' embedded in a pathname part matches any number of characters.
Similarly, `\code{?}' matches exactly one character, and `\code{[a,b]}'
matches the characters `\code{a}' or `\code{b}'. These pathname parts are
parsed as \code{pattern} objects.
Backslash can be used as an escape character in namestring
parsing to prevent the next character from being treated as a wildcard. Note
that if typed in a string constant, the backslash must be doubled, since the
string reader also uses backslash as a quote:
\begin{example}
(pathname-name "foo\(\backslash\backslash\)*bar") => "foo*bar"
\end{example}
%%\node Logical Pathnames, Search Lists, Wildcard Pathnames, Pathnames
\subsection{Logical Pathnames}
\cindex{logical pathnames}
\label{logical-pathnames}
If a namestring begins with the name of a defined logical pathname
host followed by a colon, then it will be parsed as a logical
pathname. Both `\code{*}' and `\code{**}' wildcards are implemented.
\findexed{load-logical-pathname-defaults} on \var{name} looks for a
logical host definition file in
\w{\file{library:\var{name}.translations}}. Note that \file{library:}
designates the search list (\pxlref{search-lists}) initialized to the
\cmucl{} \file{lib/} directory, not a logical pathname. The format of
the file is a single list of two-lists of the from and to patterns:
\begin{example}
(("foo;*.text" "/usr/ram/foo/*.txt")
("foo;*.lisp" "/usr/ram/foo/*.l"))
\end{example}
\begin{comment}
* Search Lists::
* Search List Example::
\end{comment}
%%\node Search Lists, Predefined Search-Lists, Logical Pathnames, Pathnames
\subsection{Search Lists}
\cindex{search lists}
\label{search-lists}
Search lists are an extension to Common Lisp pathnames. They serve a function
somewhat similar to Common Lisp logical pathnames, but work more like Unix PATH
variables. Search lists are used for two purposes:
\begin{itemize}
\item They provide a convenient shorthand for commonly used directory names,
and
\item They allow the abstract (directory structure independent) specification
of file locations in program pathname constants (similar to logical pathnames.)
\end{itemize}
Each search list has an associated list of directories (represented as
pathnames with no name or type component.) The namestring for any relative
pathname may be prefixed with ``\var{slist}\code{:}'', indicating that the
pathname is relative to the search list \var{slist} (instead of to the current
working directory.) Once qualified with a search list, the pathname is no
longer considered to be relative.
When a search list qualified pathname is passed to a file-system operation such
as \code{open}, \code{load} or \code{truename}, each directory in the search
list is successively used as the root of the pathname until the file is
located. When a file is written to a search list directory, the file is always
written to the first directory in the list.
%%\node Predefined Search-Lists, Search-List Operations, Search Lists, Pathnames
\subsection{Predefined Search-Lists}
These search-lists are initialized from the Unix environment or when Lisp was
built:
\begin{Lentry}
\item[\code{default:}] The current directory at startup.
\item[\code{home:}] The user's home directory.
\item[\code{library:}] The \cmucl{} \file{lib/} directory (\code{CMUCLLIB} environment
variable.)
\item[\code{path:}] The Unix command path (\code{PATH} environment variable.)
\item[\code{target:}] The root of the tree where \cmucl{} was compiled.
\end{Lentry}
It can be useful to redefine these search-lists, for example, \file{library:}
can be augmented to allow logical pathname translations to be located, and
\file{target:} can be redefined to point to where \cmucl{} system sources are
locally installed.
%%\node Search-List Operations, Search List Example, Predefined Search-Lists, Pathnames
\subsection{Search-List Operations}
These operations define and access search-list definitions. A search-list name
may be parsed into a pathname before the search-list is actually defined, but
the search-list must be defined before it can actually be used in a filesystem
operation.
\begin{defun}{extensions:}{search-list}{\var{name}}
This function returns the list of directories associated with the
search list \var{name}. If \var{name} is not a defined search list,
then an error is signaled. When set with \code{setf}, the list of
directories is changed to the new value. If the new value is just a
namestring or pathname, then it is interpreted as a one-element
list. Note that (unlike Unix pathnames), search list names are
case-insensitive.
\end{defun}
\begin{defun}{extensions:}{search-list-defined-p}{\var{name}}
\defunx[extensions:]{clear-search-list}{\var{name}}
\code{search-list-defined-p} returns \true{} if \var{name} is a
defined search list name, \false{} otherwise.
\code{clear-search-list} make the search list \var{name} undefined.
\end{defun}
\begin{defmac}{extensions:}{enumerate-search-list}{%
\args{(\var{var} \var{pathname} \mopt{result}) \mstar{form}}}
This macro provides an interface to search list resolution. The
body \var{forms} are executed with \var{var} bound to each
successive possible expansion for \var{name}. If \var{name} does
not contain a search-list, then the body is executed exactly once.
Everything is wrapped in a block named \nil, so \code{return} can be
used to terminate early. The \var{result} form (default \nil) is
evaluated to determine the result of the iteration.
\end{defmac}
\begin{comment}
* Search List Example::
\end{comment}
%%\node Search List Example, , Search-List Operations, Pathnames
\subsection{Search List Example}
The search list \code{code:} can be defined as follows:
\begin{example}
(setf (ext:search-list "code:") '("/usr/lisp/code/"))
\end{example}
It is now possible to use \code{code:} as an abbreviation for the directory
\file{/usr/lisp/code/} in all file operations. For example, you can now specify
\code{code:eval.lisp} to refer to the file \file{/usr/lisp/code/eval.lisp}.
To obtain the value of a search-list name, use the function search-list
as follows:
\begin{example}
(ext:search-list \var{name})
\end{example}
Where \var{name} is the name of a search list as described above. For example,
calling \code{ext:search-list} on \code{code:} as follows:
\begin{example}
(ext:search-list "code:")
\end{example}
returns the list \code{("/usr/lisp/code/")}.
%%\node Filesystem Operations, Time Parsing and Formatting, Pathnames, Design Choices and Extensions
\section{Filesystem Operations}
\cmucl{} provides a number of extensions and optional features beyond those
require by \clisp.
\begin{comment}
* Wildcard Matching::
* File Name Completion::
* Miscellaneous Filesystem Operations::
\end{comment}
%%\node Wildcard Matching, File Name Completion, Filesystem Operations, Filesystem Operations
\subsection{Wildcard Matching}
\label{wildcard-matching}
Unix filesystem operations such as \code{open} will accept wildcard pathnames
that match a single file (of course, \code{directory} allows any number of
matches.) Filesystem operations treat \kwd{wild-inferiors} the same as\
\kwd{wild}.
\begin{defun}{}{directory}{\var{wildname} \keys{\kwd{all} \kwd{check-for-subdirs}}
\morekeys{\kwd{follow-links}}}
The keyword arguments to this \clisp{} function are a CMU extension.
The arguments (all default to \code{t}) have the following
functions:
\begin{Lentry}
\item[\kwd{all}] Include files beginning with dot such as
\file{.login}, similar to ``\code{ls -a}''.
\item[\kwd{check-for-subdirs}] Test whether files are directories,
similar to ``\code{ls -F}''.
\item[\kwd{follow-links}] Call \code{truename} on each file, which
expands out all symbolic links. Note that this option can easily
result in pathnames being returned which have a different
directory from the one in the \var{wildname} argument.
\end{Lentry}
\end{defun}
\begin{defun}{extensions:}{print-directory}{%
\args{\var{wildname}
\ampoptional{} \var{stream}
\keys{\kwd{all} \kwd{verbose}}
\morekeys{\kwd{return-list}}}}
Print a directory of \var{wildname} listing to \var{stream} (default
\code{*standard-output*}.) \kwd{all} and \kwd{verbose} both default
to \false{} and correspond to the ``\code{-a}'' and ``\code{-l}''
options of \file{ls}. Normally this function returns \false{}, but
if \kwd{return-list} is true, a list of the matched pathnames are
returned.
\end{defun}
%%\node File Name Completion, Miscellaneous Filesystem Operations, Wildcard Matching, Filesystem Operations
\subsection{File Name Completion}
\begin{defun}{extensions:}{complete-file}{%
\args{\var{pathname}
\keys{\kwd{defaults} \kwd{ignore-types}}}}
Attempt to complete a file name to the longest unambiguous prefix.
If supplied, directory from \kwd{defaults} is used as the ``working
directory'' when doing completion. \kwd{ignore-types} is a list of
strings of the pathname types (a.k.a. extensions) that should be
disregarded as possible matches (binary file names, etc.)
\end{defun}
\begin{defun}{extensions:}{ambiguous-files}{%
\args{\var{pathname}
\ampoptional{} \var{defaults}}}
Return a list of pathnames for all the possible completions of
\var{pathname} with respect to \var{defaults}.
\end{defun}
%%\node Miscellaneous Filesystem Operations, , File Name Completion, Filesystem Operations
\subsection{Miscellaneous Filesystem Operations}
\begin{defun}{extensions:}{default-directory}{}
Return the current working directory as a pathname. If set with
\code{setf}, set the working directory.
\end{defun}
\begin{defun}{extensions:}{file-writable}{\var{name}}
This function accepts a pathname and returns \true{} if the current
process can write it, and \false{} otherwise.
\end{defun}
\begin{defun}{extensions:}{unix-namestring}{%
\args{\var{pathname}
\ampoptional{} \var{for-input}}}
This function converts \var{pathname} into a string that can be used
with UNIX system calls. Search-lists and wildcards are expanded.
\var{for-input} controls the treatment of search-lists: when true
(the default) and the file exists anywhere on the search-list, then
that absolute pathname is returned; otherwise the first element of
the search-list is used as the directory.
\end{defun}
%%\node Time Parsing and Formatting, Lisp Library, Filesystem Operations, Design Choices and Extensions
\section{Time Parsing and Formatting}
\cindex{time parsing} \cindex{time formatting}
Functions are provided to allow parsing strings containing time information
and printing time in various formats are available.
\begin{defun}{extensions:}{parse-time}{%
\args{\var{time-string}
\keys{\kwd{error-on-mismatch} \kwd{default-seconds}}
\morekeys{\kwd{default-minutes} \kwd{default-hours}}
\yetmorekeys{\kwd{default-day} \kwd{default-month}}
\yetmorekeys{\kwd{default-year} \kwd{default-zone}}
\yetmorekeys{\kwd{default-weekday}}}}
\code{parse-time} accepts a string containing a time (e.g.,
\w{"\code{Jan 12, 1952}"}) and returns the universal time if it is
successful. If it is unsuccessful and the keyword argument
\kwd{error-on-mismatch} is non-\FALSE, it signals an error.
Otherwise it returns \FALSE. The other keyword arguments have the
following meaning:
\begin{Lentry}
\item[\kwd{default-seconds}] specifies the default value for the
seconds value if one is not provided by \var{time-string}. The
default value is 0.
\item[\kwd{default-minutes}] specifies the default value for the
minutes value if one is not provided by \var{time-string}. The
default value is 0.
\item[\kwd{default-hours}] specifies the default value for the hours
value if one is not provided by \var{time-string}. The default
value is 0.
\item[\kwd{default-day}] specifies the default value for the day
value if one is not provided by \var{time-string}. The default
value is the current day.
\item[\kwd{default-month}] specifies the default value for the month
value if one is not provided by \var{time-string}. The default
value is the current month.
\item[\kwd{default-year}] specifies the default value for the year
value if one is not provided by \var{time-string}. The default
value is the current year.
\item[\kwd{default-zone}] specifies the default value for the time
zone value if one is not provided by \var{time-string}. The
default value is the current time zone.
\item[\kwd{default-weekday}] specifies the default value for the day
of the week if one is not provided by \var{time-string}. The
default value is the current day of the week.
\end{Lentry}
Any of the above keywords can be given the value \kwd{current} which
means to use the current value as determined by a call to the
operating system.
\end{defun}
\begin{defun}{extensions:}{format-universal-time}{
\args{\var{dest} \var{universal-time}
\\
\keys{\kwd{timezone}}
\morekeys{\kwd{style} \kwd{date-first}}
\yetmorekeys{\kwd{print-seconds} \kwd{print-meridian}}
\yetmorekeys{\kwd{print-timezone} \kwd{print-weekday}}}}
\defunx[extensions:]{format-decoded-time}{
\args{\var{dest} \var{seconds} \var{minutes} \var{hours} \var{day} \var{month} \var{year}
\\
\keys{\kwd{timezone}}
\morekeys{\kwd{style} \kwd{date-first}}
\yetmorekeys{\kwd{print-seconds} \kwd{print-meridian}}
\yetmorekeys{\kwd{print-timezone} \kwd{print-weekday}}}}
\code{format-universal-time} formats the time specified by
\var{universal-time}. \code{format-decoded-time} formats the time
specified by \var{seconds}, \var{minutes}, \var{hours}, \var{day},
\var{month}, and \var{year}. \var{Dest} is any destination
accepted by the \code{format} function. The keyword arguments have
the following meaning:
\begin{Lentry}
\item[\kwd{timezone}] is an integer specifying the hours west of
Greenwich. \kwd{timezone} defaults to the current time zone.
\item[\kwd{style}] specifies the style to use in formatting the
time. The legal values are:
\begin{Lentry}
\item[\kwd{short}] specifies to use a numeric date.
\item[\kwd{long}] specifies to format months and weekdays as
words instead of numbers.
\item[\kwd{abbreviated}] is similar to long except the words are
abbreviated.
\item[\kwd{government}] is similar to abbreviated, except the
date is of the form ``day month year'' instead of ``month day,
year''.
\end{Lentry}
\item[\kwd{date-first}] if non-\false{} (default) will place the
date first. Otherwise, the time is placed first.
\item[\kwd{print-seconds}] if non-\false{} (default) will format
the seconds as part of the time. Otherwise, the seconds will be
omitted.
\item[\kwd{print-meridian}] if non-\false{} (default) will format
``AM'' or ``PM'' as part of the time. Otherwise, the ``AM'' or
``PM'' will be omitted.
\item[\kwd{print-timezone}] if non-\false{} (default) will format
the time zone as part of the time. Otherwise, the time zone will
be omitted.
%%\item[\kwd{print-seconds}]
%%if non-\false{} (default) will format the seconds as part of
%%the time. Otherwise, the seconds will be omitted.
\item[\kwd{print-weekday}] if non-\false{} (default) will format
the weekday as part of date. Otherwise, the weekday will be
omitted.
\end{Lentry}
\end{defun}
%% New stuff
\begin{changebar}
\section{Random Number Generation}
\cindex{random number generation}
\clisp{} includes a random number generator as a standard part of the
language; however, the implementation of the generator is not
specified. Two random number generators are available in \cmucl{},
depending on the version.
\subsection{Original Generator}
\cpsubindex{random number generation}{original generator}
The default random number generator uses a lagged Fibonacci generator
given by
\begin{displaymath}
z[i] = z[i - 24] - z[i - 55] \bmod 536870908
\end{displaymath}
where $z[i]$ is the $i$'th random number. This generator produces
small integer-valued numbers. For larger integer, the small random
integers are concatenated to produce larger integers. For
floating-point numbers, the bits from this generator are used as the
bits of the floating-point significand.
\subsection{New Generator}
\cpsubindex{random number generation}{new generator}
In some versions of \cmucl{}, the original generator above has been
replaced with a subtract-with-borrow generator
combined with a Weyl generator.\footnote{The generator described here
is available if the feature \kwd{new-random} is available.} The
reason for the change was to use a documented generator which has
passed tests for randomness.
The subtract-with-borrow generator is described by the following
equation
\begin{displaymath}
z[i] = z[i + 20] - z[i + 5] - b
\end{displaymath}
where $z[i]$ is the $i$'th random number, which is a
\code{double-float}. All of the indices in this equation are
interpreted modulo 32. The quantity $b$ is carried over from the
previous iteration and is either 0 or \code{double-float-epsilon}. If
$z[i]$ is positive, $b$ is set to zero. Otherwise, $b$ is set to
\code{double-float-epsilon}.
To increase the randomness of this generator, this generator is
combined with a Weyl generator defined by
\begin{displaymath}
x[i] = x[i - 1] - y \bmod 1,
\end{displaymath}
where $y = 7097293079245107 \times 2^{-53}$. Thus, the resulting
random number $r[i]$ is
\begin{displaymath}
r[i] = (z[i] - x[i]) \bmod 1
\end{displaymath}
This generator has been tested by Peter VanEynde using Marsaglia's
diehard test suite for random number generators; this generator
passes the test suite.
This generator is designed for generating floating-point random
numbers. To obtain integers, the bits from the significand of the
floating-point number are used as the bits of the integer. As many
floating-point numbers as needed are generated to obtain the desired
number of bits in the random integer.
For floating-point numbers, this generator can by significantly faster
than the original generator.
\end{changebar}
%%\node Lisp Library, , Time Parsing and Formatting, Design Choices and Extensions
\section{Lisp Library}
\label{lisp-lib}
The CMU Common Lisp project maintains a collection of useful or interesting
programs written by users of our system. The library is in
\file{lib/contrib/}. Two files there that users should read are:
\begin{Lentry}
\item[CATALOG.TXT]
This file contains a page for each entry in the library. It
contains information such as the author, portability or dependency issues, how
to load the entry, etc.
\item[READ-ME.TXT]
This file describes the library's organization and all the
possible pieces of information an entry's catalog description could contain.
\end{Lentry}
Hemlock has a command \F{Library Entry} that displays a list of the current
library entries in an editor buffer. There are mode specific commands that
display catalog descriptions and load entries. This is a simple and convenient
way to browse the library.
\hide{File:/afs/cs.cmu.edu/project/clisp/hackers/ram/docs/cmu-user/debug.ms}
%%\node The Debugger, The Compiler, Design Choices and Extensions, Top
\chapter{The Debugger} \hide{-*- Dictionary: cmu-user -*-}
\begin{center}
\b{By Robert MacLachlan}
\end{center}
\cindex{debugger}
\label{debugger}
\begin{comment}
* Debugger Introduction::
* The Command Loop::
* Stack Frames::
* Variable Access::
* Source Location Printing::
* Compiler Policy Control::
* Exiting Commands::
* Information Commands::
* Breakpoint Commands::
* Function Tracing::
* Specials::
\end{comment}
%%\node Debugger Introduction, The Command Loop, The Debugger, The Debugger
\section{Debugger Introduction}
The \cmucl{} debugger is unique in its level of support for source-level
debugging of compiled code. Although some other debuggers allow access of
variables by name, this seems to be the first \llisp{} debugger that:
\begin{itemize}
\item
Tells you when a variable doesn't have a value because it hasn't been
initialized yet or has already been deallocated, or
\item
Can display the precise source location corresponding to a code
location in the debugged program.
\end{itemize}
These features allow the debugging of compiled code to be made almost
indistinguishable from interpreted code debugging.
The debugger is an interactive command loop that allows a user to examine
the function call stack. The debugger is invoked when:
\begin{itemize}
\item
A \tindexed{serious-condition} is signaled, and it is not handled, or
\item
\findexed{error} is called, and the condition it signals is not handled, or
\item
The debugger is explicitly invoked with the \clisp{} \findexed{break}
or \findexed{debug} functions.
\end{itemize}
{\it Note: there are two debugger interfaces in CMU CL: the TTY debugger
(described below) and the Motif debugger. Since the difference is only in the
user interface, much of this chapter also applies to the Motif version.
\xlref{motif-interface} for a very brief discussion of the graphical
interface.}
When you enter the TTY debugger, it looks something like this:
\begin{example}
Error in function CAR.
Wrong type argument, 3, should have been of type LIST.
Restarts:
0: Return to Top-Level.
Debug (type H for help)
(CAR 3)
0]
\end{example}
The first group of lines describe what the error was that put us in the
debugger. In this case \code{car} was called on \code{3}. After \code{Restarts:}
is a list of all the ways that we can restart execution after this error. In
this case, the only option is to return to top-level. After printing its
banner, the debugger prints the current frame and the debugger prompt.
%%
%%\node The Command Loop, Stack Frames, Debugger Introduction, The Debugger
\section{The Command Loop}
The debugger is an interactive read-eval-print loop much like the normal
top-level, but some symbols are interpreted as debugger commands instead
of being evaluated. A debugger command starts with the symbol name of
the command, possibly followed by some arguments on the same line. Some
commands prompt for additional input. Debugger commands can be
abbreviated by any unambiguous prefix: \code{help} can be typed as
\code{h}, \code{he}, etc. For convenience, some commands have
ambiguous one-letter abbreviations: \code{f} for \code{frame}.
The package is not significant in debugger commands; any symbol with the
name of a debugger command will work. If you want to show the value of
a variable that happens also to be the name of a debugger command, you
can use the \code{list-locals} command or the \code{debug:var}
function, or you can wrap the variable in a \code{progn} to hide it from
the command loop.
The debugger prompt is ``\var{frame}\code{]}'', where \var{frame} is the number
of the current frame. Frames are numbered starting from zero at the top (most
recent call), increasing down to the bottom. The current frame is the frame
that commands refer to. The current frame also provides the lexical
environment for evaluation of non-command forms.
\cpsubindex{evaluation}{debugger} The debugger evaluates forms in the lexical
environment of the functions being debugged. The debugger can only
access variables. You can't \code{go} or \code{return-from} into a
function, and you can't call local functions. Special variable
references are evaluated with their current value (the innermost binding
around the debugger invocation)\dash{}you don't get the value that the
special had in the current frame. \xlref{debug-vars} for more
information on debugger variable access.
%%
%%\node Stack Frames, Variable Access, The Command Loop, The Debugger
\section{Stack Frames}
\cindex{stack frames} \cpsubindex{frames}{stack}
A stack frame is the run-time representation of a call to a function;
the frame stores the state that a function needs to remember what it is
doing. Frames have:
\begin{itemize}
\item
Variables (\pxlref{debug-vars}), which are the values being operated
on, and
\item
Arguments to the call (which are really just particularly interesting
variables), and
\item
A current location (\pxlref{source-locations}), which is the place in
the program where the function was running when it stopped to call another
function, or because of an interrupt or error.
\end{itemize}
%%
\begin{comment}
* Stack Motion::
* How Arguments are Printed::
* Function Names::
* Funny Frames::
* Debug Tail Recursion::
* Unknown Locations and Interrupts::
\end{comment}
%%\node Stack Motion, How Arguments are Printed, Stack Frames, Stack Frames
\subsection{Stack Motion}
These commands move to a new stack frame and print the name of the function
and the values of its arguments in the style of a Lisp function call:
\begin{Lentry}
\item[\code{up}]
Move up to the next higher frame. More recent function calls are considered
to be higher on the stack.
\item[\code{down}]
Move down to the next lower frame.
\item[\code{top}]
Move to the highest frame.
\item[\code{bottom}]
Move to the lowest frame.
\item[\code{frame} [\textit{n}]]
Move to the frame with the specified number. Prompts for the number if not
supplied.
\begin{comment}
\key{S} [\var{function-name} [\var{n}]]
\item
Search down the stack for function. Prompts for the function name if not
supplied. Searches an optional number of times, but doesn't prompt for
this number; enter it following the function.
\item[\key{R} [\var{function-name} [\var{n}]]]
Search up the stack for function. Prompts for the function name if not
supplied. Searches an optional number of times, but doesn't prompt for
this number; enter it following the function.
\end{comment}
\end{Lentry}
%%
%%\node How Arguments are Printed, Function Names, Stack Motion, Stack Frames
\subsection{How Arguments are Printed}
A frame is printed to look like a function call, but with the actual argument
values in the argument positions. So the frame for this call in the source:
\begin{lisp}
(myfun (+ 3 4) 'a)
\end{lisp}
would look like this:
\begin{example}
(MYFUN 7 A)
\end{example}
All keyword and optional arguments are displayed with their actual
values; if the corresponding argument was not supplied, the value will
be the default. So this call:
\begin{lisp}
(subseq "foo" 1)
\end{lisp}
would look like this:
\begin{example}
(SUBSEQ "foo" 1 3)
\end{example}
And this call:
\begin{lisp}
(string-upcase "test case")
\end{lisp}
would look like this:
\begin{example}
(STRING-UPCASE "test case" :START 0 :END NIL)
\end{example}
The arguments to a function call are displayed by accessing the argument
variables. Although those variables are initialized to the actual argument
values, they can be set inside the function; in this case the new value will be
displayed.
\code{\amprest} arguments are handled somewhat differently. The value of
the rest argument variable is displayed as the spread-out arguments to
the call, so:
\begin{lisp}
(format t "~A is a ~A." "This" 'test)
\end{lisp}
would look like this:
\begin{example}
(FORMAT T "~A is a ~A." "This" 'TEST)
\end{example}
Rest arguments cause an exception to the normal display of keyword
arguments in functions that have both \code{\amprest} and \code{\&key}
arguments. In this case, the keyword argument variables are not
displayed at all; the rest arg is displayed instead. So for these
functions, only the keywords actually supplied will be shown, and the
values displayed will be the argument values, not values of the
(possibly modified) variables.
If the variable for an argument is never referenced by the function, it will be
deleted. The variable value is then unavailable, so the debugger prints
\code{<unused-arg>} instead of the value. Similarly, if for any of a number of
reasons (described in more detail in section \ref{debug-vars}) the value of the
variable is unavailable or not known to be available, then
\code{<unavailable-arg>} will be printed instead of the argument value.
Printing of argument values is controlled by \code{*debug-print-level*} and
\varref{debug-print-length}.
%%
%%\node Function Names, Funny Frames, How Arguments are Printed, Stack Frames
\subsection{Function Names}
\cpsubindex{function}{names}
\cpsubindex{names}{function}
If a function is defined by \code{defun}, \code{labels}, or \code{flet}, then the
debugger will print the actual function name after the open parenthesis, like:
\begin{example}
(STRING-UPCASE "test case" :START 0 :END NIL)
((SETF AREF) \#\back{a} "for" 1)
\end{example}
Otherwise, the function name is a string, and will be printed in quotes:
\begin{example}
("DEFUN MYFUN" BAR)
("DEFMACRO DO" (DO ((I 0 (1+ I))) ((= I 13))) NIL)
("SETQ *GC-NOTIFY-BEFORE*")
\end{example}
This string name is derived from the \w{\code{def}\var{mumble}} form that encloses
or expanded into the lambda, or the outermost enclosing form if there is no
\w{\code{def}\var{mumble}}.
%%
%%\node Funny Frames, Debug Tail Recursion, Function Names, Stack Frames
\subsection{Funny Frames}
\cindex{external entry points}
\cpsubindex{entry points}{external}
\cpsubindex{block compilation}{debugger implications}
\cpsubindex{external}{stack frame kind}
\cpsubindex{optional}{stack frame kind}
\cpsubindex{cleanup}{stack frame kind}
Sometimes the evaluator introduces new functions that are used to implement a
user function, but are not directly specified in the source. The main place
this is done is for checking argument type and syntax. Usually these functions
do their thing and then go away, and thus are not seen on the stack in the
debugger. But when you get some sort of error during lambda-list processing,
you end up in the debugger on one of these funny frames.
These funny frames are flagged by printing ``\code{[}\var{keyword}\code{]}'' after the
parentheses. For example, this call:
\begin{lisp}
(car 'a 'b)
\end{lisp}
will look like this:
\begin{example}
(CAR 2 A) [:EXTERNAL]
\end{example}
And this call:
\begin{lisp}
(string-upcase "test case" :end)
\end{lisp}
would look like this:
\begin{example}
("DEFUN STRING-UPCASE" "test case" 335544424 1) [:OPTIONAL]
\end{example}
As you can see, these frames have only a vague resemblance to the original
call. Fortunately, the error message displayed when you enter the debugger
will usually tell you what problem is (in these cases, too many arguments
and odd keyword arguments.) Also, if you go down the stack to the frame for
the calling function, you can display the original source (\pxlref{source-locations}.)
With recursive or block compiled functions (\pxlref{block-compilation}), an \kwd{EXTERNAL} frame may appear before the frame
representing the first call to the recursive function or entry to the compiled
block. This is a consequence of the way the compiler does block compilation:
there is nothing odd with your program. You will also see \kwd{CLEANUP} frames
during the execution of \code{unwind-protect} cleanup code. Note that inline
expansion and open-coding affect what frames are present in the debugger, see
sections \ref{debugger-policy} and \ref{open-coding}.
%%
%%\node Debug Tail Recursion, Unknown Locations and Interrupts, Funny Frames, Stack Frames
\subsection{Debug Tail Recursion}
\label{debug-tail-recursion}
\cindex{tail recursion}
\cpsubindex{recursion}{tail}
Both the compiler and the interpreter are ``properly tail recursive.'' If a
function call is in a tail-recursive position, the stack frame will be
deallocated \i{at the time of the call}, rather than after the call returns.
Consider this backtrace:
\begin{example}
(BAR ...)
(FOO ...)
\end{example}
Because of tail recursion, it is not necessarily the case that
\code{FOO} directly called \code{BAR}. It may be that \code{FOO} called
some other function \code{FOO2} which then called \code{BAR}
tail-recursively, as in this example:
\begin{example}
(defun foo ()
...
(foo2 ...)
...)
(defun foo2 (...)
...
(bar ...))
(defun bar (...)
...)
\end{example}
Usually the elimination of tail-recursive frames makes debugging more
pleasant, since these frames are mostly uninformative. If there is any
doubt about how one function called another, it can usually be
eliminated by finding the source location in the calling frame (section
\ref{source-locations}.)
For a more thorough discussion of tail recursion, \pxlref{tail-recursion}.
%%
%%\node Unknown Locations and Interrupts, , Debug Tail Recursion, Stack Frames
\subsection{Unknown Locations and Interrupts}
\label{unknown-locations}
\cindex{unknown code locations}
\cpsubindex{locations}{unknown}
\cindex{interrupts}
\cpsubindex{errors}{run-time}
The debugger operates using special debugging information attached to
the compiled code. This debug information tells the debugger what it
needs to know about the locations in the code where the debugger can be
invoked. If the debugger somehow encounters a location not described in
the debug information, then it is said to be \var{unknown}. If the code
location for a frame is unknown, then some variables may be
inaccessible, and the source location cannot be precisely displayed.
There are three reasons why a code location could be unknown:
\begin{itemize}
\item
There is inadequate debug information due to the value of the \code{debug}
optimization quality. \xlref{debugger-policy}.
\item
The debugger was entered because of an interrupt such as \code{$\hat{ }C$}.
\item
A hardware error such as ``\code{bus error}'' occurred in code that was
compiled unsafely due to the value of the \code{safety} optimization
quality. \xlref{optimize-declaration}.
\end{itemize}
In the last two cases, the values of argument variables are accessible,
but may be incorrect. \xlref{debug-var-validity} for more details on
when variable values are accessible.
It is possible for an interrupt to happen when a function call or return is in
progress. The debugger may then flame out with some obscure error or insist
that the bottom of the stack has been reached, when the real problem is that
the current stack frame can't be located. If this happens, return from the
interrupt and try again.
When running interpreted code, all locations should be known. However,
an interrupt might catch some subfunction of the interpreter at an
unknown location. In this case, you should be able to go up the stack a
frame or two and reach an interpreted frame which can be debugged.
%%
%%\node Variable Access, Source Location Printing, Stack Frames, The Debugger
\section{Variable Access}
\label{debug-vars}
\cpsubindex{variables}{debugger access}
\cindex{debug variables}
There are three ways to access the current frame's local variables in the
debugger. The simplest is to type the variable's name into the debugger's
read-eval-print loop. The debugger will evaluate the variable reference as
though it had appeared inside that frame.
The debugger doesn't really understand lexical scoping; it has just one
namespace for all the variables in a function. If a symbol is the name of
multiple variables in the same function, then the reference appears ambiguous,
even though lexical scoping specifies which value is visible at any given
source location. If the scopes of the two variables are not nested, then the
debugger can resolve the ambiguity by observing that only one variable is
accessible.
When there are ambiguous variables, the evaluator assigns each one a
small integer identifier. The \code{debug:var} function and the
\code{list-locals} command use this identifier to distinguish between
ambiguous variables:
\begin{Lentry}
\item[\code{list-locals} \mopt{\var{prefix}}]%%\hfill\\
This command prints the name and value of all variables in the current
frame whose name has the specified \var{prefix}. \var{prefix} may be a
string or a symbol. If no \var{prefix} is given, then all available
variables are printed. If a variable has a potentially ambiguous name,
then the name is printed with a ``\code{\#}\var{identifier}'' suffix, where
\var{identifier} is the small integer used to make the name unique.
\end{Lentry}
\begin{defun}{debug:}{var}{\args{\var{name} \ampoptional{} \var{identifier}}}
This function returns the value of the variable in the current frame
with the specified \var{name}. If supplied, \var{identifier}
determines which value to return when there are ambiguous variables.
When \var{name} is a symbol, it is interpreted as the symbol name of
the variable, i.e. the package is significant. If \var{name} is an
uninterned symbol (gensym), then return the value of the uninterned
variable with the same name. If \var{name} is a string,
\code{debug:var} interprets it as the prefix of a variable name, and
must unambiguously complete to the name of a valid variable.
This function is useful mainly for accessing the value of uninterned
or ambiguous variables, since most variables can be evaluated
directly.
\end{defun}
%%
\begin{comment}
* Variable Value Availability::
* Note On Lexical Variable Access::
\end{comment}
%%\node Variable Value Availability, Note On Lexical Variable Access, Variable Access, Variable Access
\subsection{Variable Value Availability}
\label{debug-var-validity}
\cindex{availability of debug variables}
\cindex{validity of debug variables}
\cindex{debug optimization quality}
The value of a variable may be unavailable to the debugger in portions of the
program where \clisp{} says that the variable is defined. If a variable value is
not available, the debugger will not let you read or write that variable. With
one exception, the debugger will never display an incorrect value for a
variable. Rather than displaying incorrect values, the debugger tells you the
value is unavailable.
The one exception is this: if you interrupt (e.g., with \code{$\hat{ }C$}) or if there is
an unexpected hardware error such as ``\code{bus error}'' (which should only happen
in unsafe code), then the values displayed for arguments to the interrupted
frame might be incorrect.\footnote{Since the location of an interrupt or hardware
error will always be an unknown location (\pxlref{unknown-locations}),
non-argument variable values will never be available in the interrupted frame.}
This exception applies only to the interrupted frame: any frame farther down
the stack will be fine.
The value of a variable may be unavailable for these reasons:
\begin{itemize}
\item
The value of the \code{debug} optimization quality may have omitted debug
information needed to determine whether the variable is available.
Unless a variable is an argument, its value will only be available when
\code{debug} is at least \code{2}.
\item
The compiler did lifetime analysis and determined that the value was no longer
needed, even though its scope had not been exited. Lifetime analysis is
inhibited when the \code{debug} optimization quality is \code{3}.
\item
The variable's name is an uninterned symbol (gensym). To save space, the
compiler only dumps debug information about uninterned variables when the
\code{debug} optimization quality is \code{3}.
\item
The frame's location is unknown (\pxlref{unknown-locations}) because
the debugger was entered due to an interrupt or unexpected hardware error.
Under these conditions the values of arguments will be available, but might be
incorrect. This is the exception above.
\item
The variable was optimized out of existence. Variables with no reads are
always optimized away, even in the interpreter. The degree to which the
compiler deletes variables will depend on the value of the \code{compile-speed}
optimization quality, but most source-level optimizations are done under all
compilation policies.
\end{itemize}
Since it is especially useful to be able to get the arguments to a function,
argument variables are treated specially when the \code{speed} optimization
quality is less than \code{3} and the \code{debug} quality is at least \code{1}.
With this compilation policy, the values of argument variables are almost
always available everywhere in the function, even at unknown locations. For
non-argument variables, \code{debug} must be at least \code{2} for values to be
available, and even then, values are only available at known locations.
%%
%%\node Note On Lexical Variable Access, , Variable Value Availability, Variable Access
\subsection{Note On Lexical Variable Access}
\cpsubindex{evaluation}{debugger}
When the debugger command loop establishes variable bindings for available
variables, these variable bindings have lexical scope and dynamic
extent.\footnote{The variable bindings are actually created using the \clisp{}
\code{symbol-macro-let} special form.} You can close over them, but such closures
can't be used as upward funargs.
You can also set local variables using \code{setq}, but if the variable was closed
over in the original source and never set, then setting the variable in the
debugger may not change the value in all the functions the variable is defined
in. Another risk of setting variables is that you may assign a value of a type
that the compiler proved the variable could never take on. This may result in
bad things happening.
%%
%%\node Source Location Printing, Compiler Policy Control, Variable Access, The Debugger
\section{Source Location Printing}
\label{source-locations}
\cpsubindex{source location printing}{debugger}
One of CMU \clisp{}'s unique capabilities is source level debugging of compiled
code. These commands display the source location for the current frame:
\begin{Lentry}
\item[\code{source} \mopt{\var{context}}]%%\hfill\\
This command displays the file that the current frame's function was defined
from (if it was defined from a file), and then the source form responsible for
generating the code that the current frame was executing. If \var{context} is
specified, then it is an integer specifying the number of enclosing levels of
list structure to print.
\item[\code{vsource} \mopt{\var{context}}]%%\hfill\\
This command is identical to \code{source}, except that it uses the
global values of \code{*print-level*} and \code{*print-length*} instead
of the debugger printing control variables \code{*debug-print-level*}
and \code{*debug-print-length*}.
\end{Lentry}
The source form for a location in the code is the innermost list present
in the original source that encloses the form responsible for generating
that code. If the actual source form is not a list, then some enclosing
list will be printed. For example, if the source form was a reference
to the variable \code{*some-random-special*}, then the innermost
enclosing evaluated form will be printed. Here are some possible
enclosing forms:
\begin{example}
(let ((a *some-random-special*))
...)
(+ *some-random-special* ...)
\end{example}
If the code at a location was generated from the expansion of a macro or a
source-level compiler optimization, then the form in the original source that
expanded into that code will be printed. Suppose the file
\file{/usr/me/mystuff.lisp} looked like this:
\begin{example}
(defmacro mymac ()
'(myfun))
(defun foo ()
(mymac)
...)
\end{example}
If \code{foo} has called \code{myfun}, and is waiting for it to return, then the
\code{source} command would print:
\begin{example}
; File: /usr/me/mystuff.lisp
(MYMAC)
\end{example}
Note that the macro use was printed, not the actual function call form,
\code{(myfun)}.
If enclosing source is printed by giving an argument to \code{source} or
\code{vsource}, then the actual source form is marked by wrapping it in a list
whose first element is \code{\#:***HERE***}. In the previous example,
\w{\code{source 1}} would print:
\begin{example}
; File: /usr/me/mystuff.lisp
(DEFUN FOO ()
(#:***HERE***
(MYMAC))
...)
\end{example}
%%
\begin{comment}
* How the Source is Found::
* Source Location Availability::
\end{comment}
%%\node How the Source is Found, Source Location Availability, Source Location Printing, Source Location Printing
\subsection{How the Source is Found}
If the code was defined from \llisp{} by \code{compile} or
\code{eval}, then the source can always be reliably located. If the
code was defined from a \code{fasl} file created by
\findexed{compile-file}, then the debugger gets the source forms it
prints by reading them from the original source file. This is a
potential problem, since the source file might have moved or changed
since the time it was compiled.
The source file is opened using the \code{truename} of the source file
pathname originally given to the compiler. This is an absolute pathname
with all logical names and symbolic links expanded. If the file can't
be located using this name, then the debugger gives up and signals an
error.
If the source file can be found, but has been modified since the time it was
compiled, the debugger prints this warning:
\begin{example}
; File has been modified since compilation:
; \var{filename}
; Using form offset instead of character position.
\end{example}
where \var{filename} is the name of the source file. It then proceeds using a
robust but not foolproof heuristic for locating the source. This heuristic
works if:
\begin{itemize}
\item
No top-level forms before the top-level form containing the source have been
added or deleted, and
\item
The top-level form containing the source has not been modified much. (More
precisely, none of the list forms beginning before the source form have been
added or deleted.)
\end{itemize}
If the heuristic doesn't work, the displayed source will be wrong, but will
probably be near the actual source. If the ``shape'' of the top-level form in
the source file is too different from the original form, then an error will be
signaled. When the heuristic is used, the the source location commands are
noticeably slowed.
Source location printing can also be confused if (after the source was
compiled) a read-macro you used in the code was redefined to expand into
something different, or if a read-macro ever returns the same \code{eq}
list twice. If you don't define read macros and don't use \code{\#\#} in
perverted ways, you don't need to worry about this.
%%
%%\node Source Location Availability, , How the Source is Found, Source Location Printing
\subsection{Source Location Availability}
\cindex{debug optimization quality}
Source location information is only available when the \code{debug}
optimization quality is at least \code{2}. If source location information is
unavailable, the source commands will give an error message.
If source location information is available, but the source location is
unknown because of an interrupt or unexpected hardware error
(\pxlref{unknown-locations}), then the command will print:
\begin{example}
Unknown location: using block start.
\end{example}
and then proceed to print the source location for the start of the \i{basic
block} enclosing the code location. \cpsubindex{block}{basic}
\cpsubindex{block}{start location}
It's a bit complicated to explain exactly what a basic block is, but
here are some properties of the block start location:
\begin{itemize}
\item The block start location may be the same as the true location.
\item The block start location will never be later in the the
program's flow of control than the true location.
\item No conditional control structures (such as \code{if},
\code{cond}, \code{or}) will intervene between the block start and
the true location (but note that some conditionals present in the
original source could be optimized away.) Function calls \i{do not}
end basic blocks.
\item The head of a loop will be the start of a block.
\item The programming language concept of ``block structure'' and the
\clisp{} \code{block} special form are totally unrelated to the
compiler's basic block.
\end{itemize}
In other words, the true location lies between the printed location and the
next conditional (but watch out because the compiler may have changed the
program on you.)
%%
%%\node Compiler Policy Control, Exiting Commands, Source Location Printing, The Debugger
\section{Compiler Policy Control}
\label{debugger-policy}
\cpsubindex{policy}{debugger}
\cindex{debug optimization quality}
\cindex{optimize declaration}
The compilation policy specified by \code{optimize} declarations affects the
behavior seen in the debugger. The \code{debug} quality directly affects the
debugger by controlling the amount of debugger information dumped. Other
optimization qualities have indirect but observable effects due to changes in
the way compilation is done.
Unlike the other optimization qualities (which are compared in relative value
to evaluate tradeoffs), the \code{debug} optimization quality is directly
translated to a level of debug information. This absolute interpretation
allows the user to count on a particular amount of debug information being
available even when the values of the other qualities are changed during
compilation. These are the levels of debug information that correspond to the
values of the \code{debug} quality:
\begin{Lentry}
\item[\code{0}]
Only the function name and enough information to allow the stack to
be parsed.
\item[\code{\w{$>$ 0}}]
Any level greater than \code{0} gives level \code{0} plus all
argument variables. Values will only be accessible if the argument
variable is never set and
\code{speed} is not \code{3}. \cmucl{} allows any real value for optimization
qualities. It may be useful to specify \code{0.5} to get backtrace argument
display without argument documentation.
\item[\code{1}] Level \code{1} provides argument documentation
(printed arglists) and derived argument/result type information.
This makes \findexed{describe} more informative, and allows the
compiler to do compile-time argument count and type checking for any
calls compiled at run-time.
\item[\code{2}]
Level \code{1} plus all interned local variables, source location
information, and lifetime information that tells the debugger when arguments
are available (even when \code{speed} is \code{3} or the argument is set.) This is
the default.
\item[\code{3}]
Level \code{2} plus all uninterned variables. In addition, lifetime
analysis is disabled (even when \code{speed} is \code{3}), ensuring that all variable
values are available at any known location within the scope of the binding.
This has a speed penalty in addition to the obvious space penalty.
\end{Lentry}
As you can see, if the \code{speed} quality is \code{3}, debugger performance is
degraded. This effect comes from the elimination of argument variable
special-casing (\pxlref{debug-var-validity}.) Some degree of
speed/debuggability tradeoff is unavoidable, but the effect is not too drastic
when \code{debug} is at least \code{2}.
\cindex{inline expansion}
\cindex{semi-inline expansion}
In addition to \code{inline} and \code{notinline} declarations, the relative values
of the \code{speed} and \code{space} qualities also change whether functions are
inline expanded (\pxlref{inline-expansion}.) If a function is inline
expanded, then there will be no frame to represent the call, and the arguments
will be treated like any other local variable. Functions may also be
``semi-inline'', in which case there is a frame to represent the call, but the
call is to an optimized local version of the function, not to the original
function.
%%
%%\node Exiting Commands, Information Commands, Compiler Policy Control, The Debugger
\section{Exiting Commands}
These commands get you out of the debugger.
\begin{Lentry}
\item[\code{quit}]
Throw to top level.
\item[\code{restart} \mopt{\var{n}}]%%\hfill\\
Invokes the \var{n}th restart case as displayed by the \code{error}
command. If \var{n} is not specified, the available restart cases are
reported.
\item[\code{go}]
Calls \code{continue} on the condition given to \code{debug}. If there is no
restart case named \var{continue}, then an error is signaled.
\item[\code{abort}]
Calls \code{abort} on the condition given to \code{debug}. This is
useful for popping debug command loop levels or aborting to top level,
as the case may be.
\begin{comment}
(\code{debug:debug-return} \var{expression} \mopt{\var{frame}})
\item
From the current or specified frame, return the result of evaluating
expression. If multiple values are expected, then this function should be
called for multiple values.
\end{comment}
\end{Lentry}
%%
%%\node Information Commands, Breakpoint Commands, Exiting Commands, The Debugger
\section{Information Commands}
Most of these commands print information about the current frame or
function, but a few show general information.
\begin{Lentry}
\item[\code{help}, \code{?}]
Displays a synopsis of debugger commands.
\item[\code{describe}]
Calls \code{describe} on the current function, displays number of local
variables, and indicates whether the function is compiled or interpreted.
\item[\code{print}]
Displays the current function call as it would be displayed by moving to
this frame.
\item[\code{vprint} (or \code{pp}) \mopt{\var{verbosity}}]%%\hfill\\
Displays the current function call using \code{*print-level*} and
\code{*print-length*} instead of \code{*debug-print-level*} and
\code{*debug-print-length*}. \var{verbosity} is a small integer
(default 2) that controls other dimensions of verbosity.
\item[\code{error}]
Prints the condition given to \code{invoke-debugger} and the active
proceed cases.
\item[\code{backtrace} \mopt{\var{n}}]\hfill\\
Displays all the frames from the current to the bottom. Only shows
\var{n} frames if specified. The printing is controlled by
\code{*debug-print-level*} and \code{*debug-print-length*}.
\begin{comment}
(\code{debug:debug-function} \mopt{\var{n}})
\item
Returns the function from the current or specified frame.
\item[(\code{debug:function-name} \mopt{\var{n}])]
Returns the function name from the current or specified frame.
\item[(\code{debug:pc} \mopt{\var{frame}})]
Returns the index of the instruction for the function in the current or
specified frame. This is useful in conjunction with \code{disassemble}.
The pc returned points to the instruction after the one that was fatal.
\end{comment}
\end{Lentry}
%%
%%\node Breakpoint Commands, Function Tracing, Information Commands, The Debugger
\section{Breakpoint Commands}
\cmucl{} supports setting of breakpoints inside compiled functions and
stepping of compiled code. Breakpoints can only be set at at known
locations (\pxlref{unknown-locations}), so these commands are largely
useless unless the \code{debug} optimize quality is at least \code{2}
(\pxlref{debugger-policy}). These commands manipulate breakpoints:
\begin{Lentry}
\item[\code{breakpoint} \var{location} \mstar{\var{option} \var{value}}]
%%\hfill\\
Set a breakpoint in some function. \var{location} may be an integer
code location number (as displayed by \code{list-locations}) or a
keyword. The keyword can be used to indicate setting a breakpoint at
the function start (\kwd{start}, \kwd{s}) or function end
(\kwd{end}, \kwd{e}). The \code{breakpoint} command has
\kwd{condition}, \kwd{break}, \kwd{print} and \kwd{function}
options which work similarly to the \code{trace} options.
\item[\code{list-locations} (or \code{ll}) \mopt{\var{function}}]%%\hfill\\
List all the code locations in the current frame's function, or in
\var{function} if it is supplied. The display format is the code
location number, a colon and then the source form for that location:
\begin{example}
3: (1- N)
\end{example}
If consecutive locations have the same source, then a numeric range like
\code{3-5:} will be printed. For example, a default function call has a
known location both immediately before and after the call, which would
result in two code locations with the same source. The listed function
becomes the new default function for breakpoint setting (via the
\code{breakpoint}) command.
\item[\code{list-breakpoints} (or \code{lb})]%%\hfill\\
List all currently active breakpoints with their breakpoint number.
\item[\code{delete-breakpoint} (or \code{db}) \mopt{\var{number}}]%%\hfill\\
Delete a breakpoint specified by its breakpoint number. If no number is
specified, delete all breakpoints.
\item[\code{step}]%%\hfill\\
Step to the next possible breakpoint location in the current function.
This always steps over function calls, instead of stepping into them
\end{Lentry}
\begin{comment}
* Breakpoint Example::
\end{comment}
%%\node Breakpoint Example, , Breakpoint Commands, Breakpoint Commands
\subsection{Breakpoint Example}
Consider this definition of the factorial function:
\begin{lisp}
(defun ! (n)
(if (zerop n)
1
(* n (! (1- n)))))
\end{lisp}
This debugger session demonstrates the use of breakpoints:
\begin{example}
common-lisp-user> (break) ; Invoke debugger
Break
Restarts:
0: [CONTINUE] Return from BREAK.
1: [ABORT ] Return to Top-Level.
Debug (type H for help)
(INTERACTIVE-EVAL (BREAK))
0] ll #'!
0: #'(LAMBDA (N) (BLOCK ! (IF # 1 #)))
1: (ZEROP N)
2: (* N (! (1- N)))
3: (1- N)
4: (! (1- N))
5: (* N (! (1- N)))
6: #'(LAMBDA (N) (BLOCK ! (IF # 1 #)))
0] br 2
(* N (! (1- N)))
1: 2 in !
Added.
0] q
common-lisp-user> (! 10) ; Call the function
*Breakpoint hit*
Restarts:
0: [CONTINUE] Return from BREAK.
1: [ABORT ] Return to Top-Level.
Debug (type H for help)
(! 10) ; We are now in first call (arg 10) before the multiply
Source: (* N (! (1- N)))
3] st
*Step*
(! 10) ; We have finished evaluation of (1- n)
Source: (1- N)
3] st
*Breakpoint hit*
Restarts:
0: [CONTINUE] Return from BREAK.
1: [ABORT ] Return to Top-Level.
Debug (type H for help)
(! 9) ; We hit the breakpoint in the recursive call
Source: (* N (! (1- N)))
3]
\end{example}
%%
%%\node Function Tracing, Specials, Breakpoint Commands, The Debugger
\section{Function Tracing}
\cindex{tracing}
\cpsubindex{function}{tracing}
The tracer causes selected functions to print their arguments and
their results whenever they are called. Options allow conditional
printing of the trace information and conditional breakpoints on
function entry or exit.
\begin{defmac}{}{trace}{%
\args{\mstar{option global-value} \mstar{name \mstar{option
value}}}}
\code{trace} is a debugging tool that prints information when
specified functions are called. In its simplest form:
\begin{example}
(trace \var{name-1} \var{name-2} ...)
\end{example}
\code{trace} causes a printout on \vindexed{trace-output} each time
that one of the named functions is entered or returns (the
\var{names} are not evaluated.) Trace output is indented according
to the number of pending traced calls, and this trace depth is
printed at the beginning of each line of output. Printing verbosity
of arguments and return values is controlled by
\vindexed{debug-print-level} and \vindexed{debug-print-length}.
If no \var{names} or \var{options} are are given, \code{trace}
returns the list of all currently traced functions,
\code{*traced-function-list*}.
Trace options can cause the normal printout to be suppressed, or
cause extra information to be printed. Each option is a pair of an
option keyword and a value form. Options may be interspersed with
function names. Options only affect tracing of the function whose
name they appear immediately after. Global options are specified
before the first name, and affect all functions traced by a given
use of \code{trace}. If an already traced function is traced again,
any new options replace the old options. The following options are
defined:
\begin{Lentry}
\item[\kwd{condition} \var{form}, \kwd{condition-after} \var{form},
\kwd{condition-all} \var{form}] If \kwd{condition} is specified,
then \code{trace} does nothing unless \var{form} evaluates to true
at the time of the call. \kwd{condition-after} is similar, but
suppresses the initial printout, and is tested when the function
returns. \kwd{condition-all} tries both before and after.
\item[\kwd{wherein} \var{names}] If specified, \var{names} is a
function name or list of names. \code{trace} does nothing unless
a call to one of those functions encloses the call to this
function (i.e. it would appear in a backtrace.) Anonymous
functions have string names like \code{"DEFUN FOO"}.
\item[\kwd{break} \var{form}, \kwd{break-after} \var{form},
\kwd{break-all} \var{form}] If specified, and \var{form} evaluates
to true, then the debugger is invoked at the start of the
function, at the end of the function, or both, according to the
respective option.
\item[\kwd{print} \var{form}, \kwd{print-after} \var{form},
\kwd{print-all} \var{form}] In addition to the usual printout, the
result of evaluating \var{form} is printed at the start of the
function, at the end of the function, or both, according to the
respective option. Multiple print options cause multiple values
to be printed.
\item[\kwd{function} \var{function-form}] This is a not really an
option, but rather another way of specifying what function to
trace. The \var{function-form} is evaluated immediately, and the
resulting function is traced.
\item[\kwd{encapsulate \mgroup{:default | t | nil}}] In \cmucl,
tracing can be done either by temporarily redefining the function
name (encapsulation), or using breakpoints. When breakpoints are
used, the function object itself is destructively modified to
cause the tracing action. The advantage of using breakpoints is
that tracing works even when the function is anonymously called
via \code{funcall}.
When \kwd{encapsulate} is true, tracing is done via encapsulation.
\kwd{default} is the default, and means to use encapsulation for
interpreted functions and funcallable instances, breakpoints
otherwise. When encapsulation is used, forms are {\it not}
evaluated in the function's lexical environment, but
\code{debug:arg} can still be used.
\end{Lentry}
\kwd{condition}, \kwd{break} and \kwd{print} forms are evaluated in
the lexical environment of the called function; \code{debug:var} and
\code{debug:arg} can be used. The \code{-after} and \code{-all}
forms are evaluated in the null environment.
\end{defmac}
\begin{defmac}{}{untrace}{ \args{\amprest{} \var{function-names}}}
This macro turns off tracing for the specified functions, and
removes their names from \code{*traced-function-list*}. If no
\var{function-names} are given, then all currently traced functions
are untraced.
\end{defmac}
\begin{defvar}{extensions:}{traced-function-list}
A list of function names maintained and used by \code{trace},
\code{untrace}, and \code{untrace-all}. This list should contain
the names of all functions currently being traced.
\end{defvar}
\begin{defvar}{extensions:}{max-trace-indentation}
The maximum number of spaces which should be used to indent trace
printout. This variable is initially set to 40.
\end{defvar}
\begin{comment}
* Encapsulation Functions::
\end{comment}
%%\node Encapsulation Functions, , Function Tracing, Function Tracing
\subsection{Encapsulation Functions}
\cindex{encapsulation}
\cindex{advising}
The encapsulation functions provide a mechanism for intercepting the
arguments and results of a function. \code{encapsulate} changes the
function definition of a symbol, and saves it so that it can be
restored later. The new definition normally calls the original
definition. The \clisp{} \findexed{fdefinition} function always returns
the original definition, stripping off any encapsulation.
The original definition of the symbol can be restored at any time by
the \code{unencapsulate} function. \code{encapsulate} and \code{unencapsulate}
allow a symbol to be multiply encapsulated in such a way that different
encapsulations can be completely transparent to each other.
Each encapsulation has a type which may be an arbitrary lisp object.
If a symbol has several encapsulations of different types, then any
one of them can be removed without affecting more recent ones.
A symbol may have more than one encapsulation of the same type, but
only the most recent one can be undone.
\begin{defun}{extensions:}{encapsulate}{%
\args{\var{symbol} \var{type} \var{body}}}
Saves the current definition of \var{symbol}, and replaces it with a
function which returns the result of evaluating the form,
\var{body}. \var{Type} is an arbitrary lisp object which is the
type of encapsulation.
When the new function is called, the following variables are bound
for the evaluation of \var{body}:
\begin{Lentry}
\item[\code{extensions:argument-list}] A list of the arguments to
the function.
\item[\code{extensions:basic-definition}] The unencapsulated
definition of the function.
\end{Lentry}
The unencapsulated definition may be called with the original
arguments by including the form
\begin{lisp}
(apply extensions:basic-definition extensions:argument-list)
\end{lisp}
\code{encapsulate} always returns \var{symbol}.
\end{defun}
\begin{defun}{extensions:}{unencapsulate}{\args{\var{symbol} \var{type}}}
Undoes \var{symbol}'s most recent encapsulation of type \var{type}.
\var{Type} is compared with \code{eq}. Encapsulations of other
types are left in place.
\end{defun}
\begin{defun}{extensions:}{encapsulated-p}{%
\args{\var{symbol} \var{type}}}
Returns \true{} if \var{symbol} has an encapsulation of type
\var{type}. Returns \nil{} otherwise. \var{type} is compared with
\code{eq}.
\end{defun}
%%
\begin{comment}
section{The Single Stepper}
\begin{defmac}{}{step}{ \args{\var{form}}}
Evaluates form with single stepping enabled or if \var{form} is
\code{T}, enables stepping until explicitly disabled. Stepping can
be disabled by quitting to the lisp top level, or by evaluating the
form \w{\code{(step ())}}.
While stepping is enabled, every call to eval will prompt the user
for a single character command. The prompt is the form which is
about to be \code{eval}ed. It is printed with \code{*print-level*}
and \code{*print-length*} bound to \code{*step-print-level*} and
\code{*step-print-length*}. All interaction is done through the
stream \code{*query-io*}. Because of this, the stepper can not be
used in Hemlock eval mode. When connected to a slave Lisp, the
stepper can be used from Hemlock.
The commands are:
\begin{Lentry}
\item[\key{n} (next)] Evaluate the expression with stepping still
enabled.
\item[\key{s} (skip)] Evaluate the expression with stepping
disabled.
\item[\key{q} (quit)] Evaluate the expression, but disable all
further stepping inside the current call to \code{step}.
\item[\key{p} (print)] Print current form. (does not use
\code{*step-print-level*} or \code{*step-print-length*}.)
\item[\key{b} (break)] Enter break loop, and then prompt for the
command again when the break loop returns.
\item[\key{e} (eval)] Prompt for and evaluate an arbitrary
expression. The expression is evaluated with stepping disabled.
\item[\key{?} (help)] Prints a brief list of the commands.
\item[\key{r} (return)] Prompt for an arbitrary value to return as
result of the current call to eval.
\item[\key{g}] Throw to top level.
\end{Lentry}
\end{defmac}
\begin{defvar}{extensions:}{step-print-level}
\defvarx[extensions:]{step-print-length}
\code{*print-level*} and \code{*print-length*} are bound to these
values while printing the current form. \code{*step-print-level*}
and \code{*step-print-length*} are initially bound to 4 and 5,
respectively.
\end{defvar}
\begin{defvar}{extensions:}{max-step-indentation}
Step indents the prompts to highlight the nesting of the evaluation.
This variable contains the maximum number of spaces to use for
indenting. Initially set to 40.
\end{defvar}
\end{comment}
%%
%%\node Specials, , Function Tracing, The Debugger
\section{Specials}
These are the special variables that control the debugger action.
\begin{changebar}
\begin{defvar}{debug:}{debug-print-level}
\defvarx[debug:]{debug-print-length}
\code{*print-level*} and \code{*print-length*} are bound to these
values during the execution of some debug commands. When evaluating
arbitrary expressions in the debugger, the normal values of
\code{*print-level*} and \code{*print-length*} are in effect. These
variables are initially set to 3 and 5, respectively.
\end{defvar}
\end{changebar}
%%
\hide{File:/afs/cs.cmu.edu/project/clisp/hackers/ram/docs/cmu-user/compiler.ms}
%%\node The Compiler, Advanced Compiler Use and Efficiency Hints, The Debugger, Top
\chapter{The Compiler} \hide{ -*- Dictionary: cmu-user -*-}
\begin{comment}
* Compiler Introduction::
* Calling the Compiler::
* Compilation Units::
* Interpreting Error Messages::
* Types in Python::
* Getting Existing Programs to Run::
* Compiler Policy::
* Open Coding and Inline Expansion::
\end{comment}
%%\node Compiler Introduction, Calling the Compiler, The Compiler, The Compiler
\section{Compiler Introduction}
This chapter contains information about the compiler that every \cmucl{} user
should be familiar with. Chapter \ref{advanced-compiler} goes into greater
depth, describing ways to use more advanced features.
The \cmucl{} compiler (also known as \Python{}) has many features
that are seldom or never supported by conventional \llisp{}
compilers:
\begin{itemize}
\item Source level debugging of compiled code (see chapter
\ref{debugger}.)
\item Type error compiler warnings for type errors detectable at
compile time.
\item Compiler error messages that provide a good indication of where
the error appeared in the source.
\item Full run-time checking of all potential type errors, with
optimization of type checks to minimize the cost.
\item Scheme-like features such as proper tail recursion and extensive
source-level optimization.
\item Advanced tuning and optimization features such as comprehensive
efficiency notes, flow analysis, and untagged number representations
(see chapter \ref{advanced-compiler}.)
\end{itemize}
%%
%%\node Calling the Compiler, Compilation Units, Compiler Introduction, The Compiler
\section{Calling the Compiler}
\cindex{compiling}
Functions may be compiled using \code{compile}, \code{compile-file}, or
\code{compile-from-stream}.
\begin{defun}{}{compile}{ \args{\var{name} \ampoptional{} \var{definition}}}
This function compiles the function whose name is \var{name}. If
\var{name} is \false, the compiled function object is returned. If
\var{definition} is supplied, it should be a lambda expression that
is to be compiled and then placed in the function cell of
\var{name}. As per the proposed X3J13 cleanup
``compile-argument-problems'', \var{definition} may also be an
interpreted function.
The return values are as per the proposed X3J13 cleanup
``compiler-diagnostics''. The first value is the function name or
function object. The second value is \false{} if no compiler
diagnostics were issued, and \true{} otherwise. The third value is
\false{} if no compiler diagnostics other than style warnings were
issued. A non-\false{} value indicates that there were ``serious''
compiler diagnostics issued, or that other conditions of type
\tindexed{error} or \tindexed{warning} (but not
\tindexed{style-warning}) were signaled during compilation.
\end{defun}
\begin{defun}{}{compile-file}{
\args{\var{input-pathname}
\keys{\kwd{output-file} \kwd{error-file} \kwd{trace-file}}
\morekeys{\kwd{error-output} \kwd{verbose} \kwd{print} \kwd{progress}}
\yetmorekeys{\kwd{load} \kwd{block-compile} \kwd{entry-points}}
\yetmorekeys{\kwd{byte-compile}}}}
The \cmucl{} \code{compile-file} is extended through the addition of
several new keywords and an additional interpretation of
\var{input-pathname}:
\begin{Lentry}
\item[\var{input-pathname}] If this argument is a list of input
files, rather than a single input pathname, then all the source
files are compiled into a single object file. In this case, the
name of the first file is used to determine the default output
file names. This is especially useful in combination with
\var{block-compile}.
\item[\kwd{output-file}] This argument specifies the name of the
output file. \true{} gives the default name, \false{} suppresses
the output file.
\item[\kwd{error-file}] A listing of all the error output is
directed to this file. If there are no errors, then no error file
is produced (and any existing error file is deleted.) \true{}
gives \w{"\var{name}\code{.err}"} (the default), and \false{}
suppresses the output file.
\item[\kwd{error-output}] If \true{} (the default), then error
output is sent to \code{*error-output*}. If a stream, then output
is sent to that stream instead. If \false, then error output is
suppressed. Note that this error output is in addition to (but
the same as) the output placed in the \var{error-file}.
\item[\kwd{verbose}] If \true{} (the default), then the compiler
prints to error output at the start and end of compilation of each
file. See \varref{compile-verbose}.
\item[\kwd{print}] If \true{} (the default), then the compiler
prints to error output when each function is compiled. See
\varref{compile-print}.
\item[\kwd{progress}] If \true{} (default \false{}), then the
compiler prints to error output progress information about the
phases of compilation of each function. This is a CMU extension
that is useful mainly in large block compilations. See
\varref{compile-progress}.
\item[\kwd{trace-file}] If \true{}, several of the intermediate
representations (including annotated assembly code) are dumped out
to this file. \true{} gives \w{"\var{name}\code{.trace}"}. Trace
output is off by default. \xlref{trace-files}.
\item[\kwd{load}] If \true{}, load the resulting output file.
\item[\kwd{block-compile}] Controls the compile-time resolution of
function calls. By default, only self-recursive calls are
resolved, unless an \code{ext:block-start} declaration appears in
the source file. \xlref{compile-file-block}.
\item[\kwd{entry-points}] If non-null, then this is a list of the
names of all functions in the file that should have global
definitions installed (because they are referenced in other
files.) \xlref{compile-file-block}.
\item[\kwd{byte-compile}] If \true{}, compiling to a compact
interpreted byte code is enabled. Possible values are \true{},
\false{}, and \kwd{maybe} (the default.) See
\varref{byte-compile-default} and \xlref{byte-compile}.
\end{Lentry}
The return values are as per the proposed X3J13 cleanup
``compiler-diagnostics''. The first value from \code{compile-file}
is the truename of the output file, or \false{} if the file could
not be created. The interpretation of the second and third values
is described above for \code{compile}.
\end{defun}
\begin{defvar}{}{compile-verbose}
\defvarx{compile-print}
\defvarx{compile-progress}
These variables determine the default values for the \kwd{verbose},
\kwd{print} and \kwd{progress} arguments to \code{compile-file}.
\end{defvar}
\begin{defun}{extensions:}{compile-from-stream}{%
\args{\var{input-stream}
\keys{\kwd{error-stream}}
\morekeys{\kwd{trace-stream}}
\yetmorekeys{\kwd{block-compile} \kwd{entry-points}}
\yetmorekeys{\kwd{byte-compile}}}}
This function is similar to \code{compile-file}, but it takes all
its arguments as streams. It reads \llisp{} code from
\var{input-stream} until end of file is reached, compiling into the
current environment. This function returns the same two values as
the last two values of \code{compile}. No output files are
produced.
\end{defun}
%%
%%\node Compilation Units, Interpreting Error Messages, Calling the Compiler, The Compiler
\section{Compilation Units}
\cpsubindex{compilation}{units}
\cmucl{} supports the \code{with-compilation-unit} macro added to the
language by the proposed X3J13 ``with-compilation-unit'' compiler
cleanup. This provides a mechanism for eliminating spurious undefined
warnings when there are forward references across files, and also
provides a standard way to access compiler extensions.
\begin{defmac}{}{with-compilation-unit}{%
\args{(\mstar{\var{key} \var{value}}) \mstar{\var{form}}}}
This macro evaluates the \var{forms} in an environment that causes
warnings for undefined variables, functions and types to be delayed
until all the forms have been evaluated. Each keyword \var{value}
is an evaluated form. These keyword options are recognized:
\begin{Lentry}
\item[\kwd{override}] If uses of \code{with-compilation-unit} are
dynamically nested, the outermost use will take precedence,
suppressing printing of undefined warnings by inner uses.
However, when the \code{override} option is true this shadowing is
inhibited; an inner use will print summary warnings for the
compilations within the inner scope.
\item[\kwd{optimize}] This is a CMU extension that specifies of the
``global'' compilation policy for the dynamic extent of the body.
The argument should evaluate to an \code{optimize} declare form,
like:
\begin{lisp}
(optimize (speed 3) (safety 0))
\end{lisp}
\xlref{optimize-declaration}
\item[\kwd{optimize-interface}] Similar to \kwd{optimize}, but
specifies the compilation policy for function interfaces (argument
count and type checking) for the dynamic extent of the body.
\xlref{optimize-interface-declaration}.
\item[\kwd{context-declarations}] This is a CMU extension that
pattern-matches on function names, automatically splicing in any
appropriate declarations at the head of the function definition.
\xlref{context-declarations}.
\end{Lentry}
\end{defmac}
\begin{comment}
* Undefined Warnings::
\end{comment}
%%\node Undefined Warnings, , Compilation Units, Compilation Units
\subsection{Undefined Warnings}
\cindex{undefined warnings}
Warnings about undefined variables, functions and types are delayed until the
end of the current compilation unit. The compiler entry functions
(\code{compile}, etc.) implicitly use \code{with-compilation-unit}, so undefined
warnings will be printed at the end of the compilation unless there is an
enclosing \code{with-compilation-unit}. In order the gain the benefit of this
mechanism, you should wrap a single \code{with-compilation-unit} around the calls
to \code{compile-file}, i.e.:
\begin{lisp}
(with-compilation-unit ()
(compile-file "file1")
(compile-file "file2")
...)
\end{lisp}
Unlike for functions and types, undefined warnings for variables are
not suppressed when a definition (e.g. \code{defvar}) appears after
the reference (but in the same compilation unit.) This is because
doing special declarations out of order just doesn't
work\dash{}although early references will be compiled as special,
bindings will be done lexically.
Undefined warnings are printed with full source context
(\pxlref{error-messages}), which tremendously simplifies the problem
of finding undefined references that resulted from macroexpansion.
After printing detailed information about the undefined uses of each
name, \code{with-compilation-unit} also prints summary listings of the
names of all the undefined functions, types and variables.
\begin{defvar}{}{undefined-warning-limit}
This variable controls the number of undefined warnings for each
distinct name that are printed with full source context when the
compilation unit ends. If there are more undefined references than
this, then they are condensed into a single warning:
\begin{example}
Warning: \var{count} more uses of undefined function \var{name}.
\end{example}
When the value is \code{0}, then the undefined warnings are not
broken down by name at all: only the summary listing of undefined
names is printed.
\end{defvar}
%%
%%\node Interpreting Error Messages, Types in Python, Compilation Units, The Compiler
\section{Interpreting Error Messages}
\label{error-messages}
\cpsubindex{error messages}{compiler}
\cindex{compiler error messages}
One of \Python{}'s unique features is the level of source location
information it provides in error messages. The error messages contain
a lot of detail in a terse format, to they may be confusing at first.
Error messages will be illustrated using this example program:
\begin{lisp}
(defmacro zoq (x)
`(roq (ploq (+ ,x 3))))
(defun foo (y)
(declare (symbol y))
(zoq y))
\end{lisp}
The main problem with this program is that it is trying to add \code{3} to a
symbol. Note also that the functions \code{roq} and \code{ploq} aren't defined
anywhere.
\begin{comment}
* The Parts of the Error Message::
* The Original and Actual Source::
* The Processing Path::
* Error Severity::
* Errors During Macroexpansion::
* Read Errors::
* Error Message Parameterization::
\end{comment}
%%\node The Parts of the Error Message, The Original and Actual Source, Interpreting Error Messages, Interpreting Error Messages
\subsection{The Parts of the Error Message}
The compiler will produce this warning:
\begin{example}
File: /usr/me/stuff.lisp
In: DEFUN FOO
(ZOQ Y)
--> ROQ PLOQ +
==>
Y
Warning: Result is a SYMBOL, not a NUMBER.
\end{example}
In this example we see each of the six possible parts of a compiler error
message:
\begin{Lentry}
\item[\w{\code{File: /usr/me/stuff.lisp}}] This is the \var{file} that
the compiler read the relevant code from. The file name is
displayed because it may not be immediately obvious when there is an
error during compilation of a large system, especially when
\code{with-compilation-unit} is used to delay undefined warnings.
\item[\w{\code{In: DEFUN FOO}}] This is the \var{definition} or
top-level form responsible for the error. It is obtained by taking
the first two elements of the enclosing form whose first element is
a symbol beginning with ``\code{DEF}''. If there is no enclosing
\w{\var{def}mumble}, then the outermost form is used. If there are
multiple \w{\var{def}mumbles}, then they are all printed from the
out in, separated by \code{$=>$}'s. In this example, the problem
was in the \code{defun} for \code{foo}.
\item[\w{\code{(ZOQ Y)}}] This is the \i{original source} form
responsible for the error. Original source means that the form
directly appeared in the original input to the compiler, i.e. in the
lambda passed to \code{compile} or the top-level form read from the
source file. In this example, the expansion of the \code{zoq} macro
was responsible for the error.
\item[\w{\code{--$>$ ROQ PLOQ +}} ] This is the \i{processing path}
that the compiler used to produce the errorful code. The processing
path is a representation of the evaluated forms enclosing the actual
source that the compiler encountered when processing the original
source. The path is the first element of each form, or the form
itself if the form is not a list. These forms result from the
expansion of macros or source-to-source transformation done by the
compiler. In this example, the enclosing evaluated forms are the
calls to \code{roq}, \code{ploq} and \code{+}. These calls resulted
from the expansion of the \code{zoq} macro.
\item[\code{==$>$ Y}] This is the \i{actual source} responsible for
the error. If the actual source appears in the explanation, then we
print the next enclosing evaluated form, instead of printing the
actual source twice. (This is the form that would otherwise have
been the last form of the processing path.) In this example, the
problem is with the evaluation of the reference to the variable
\code{y}.
\item[\w{\code{Warning: Result is a SYMBOL, not a NUMBER.}}] This is
the \var{explanation} the problem. In this example, the problem is
that \code{y} evaluates to a \code{symbol}, but is in a context
where a number is required (the argument to \code{+}).
\end{Lentry}
Note that each part of the error message is distinctively marked:
\begin{itemize}
\item \code{File:} and \code{In:} mark the file and definition,
respectively.
\item The original source is an indented form with no prefix.
\item Each line of the processing path is prefixed with \code{--$>$}.
\item The actual source form is indented like the original source, but
is marked by a preceding \code{==$>$} line. This is like the
``macroexpands to'' notation used in \cltl.
\item The explanation is prefixed with the error severity
(\pxlref{error-severity}), either \code{Error:}, \code{Warning:}, or
\code{Note:}.
\end{itemize}
Each part of the error message is more specific than the preceding
one. If consecutive error messages are for nearby locations, then the
front part of the error messages would be the same. In this case, the
compiler omits as much of the second message as in common with the
first. For example:
\begin{example}
File: /usr/me/stuff.lisp
In: DEFUN FOO
(ZOQ Y)
--> ROQ
==>
(PLOQ (+ Y 3))
Warning: Undefined function: PLOQ
==>
(ROQ (PLOQ (+ Y 3)))
Warning: Undefined function: ROQ
\end{example}
In this example, the file, definition and original source are
identical for the two messages, so the compiler omits them in the
second message. If consecutive messages are entirely identical, then
the compiler prints only the first message, followed by:
\begin{example}
[Last message occurs \var{repeats} times]
\end{example}
where \var{repeats} is the number of times the message was given.
If the source was not from a file, then no file line is printed. If
the actual source is the same as the original source, then the
processing path and actual source will be omitted. If no forms
intervene between the original source and the actual source, then the
processing path will also be omitted.
%%
%%\node The Original and Actual Source, The Processing Path, The Parts of the Error Message, Interpreting Error Messages
\subsection{The Original and Actual Source}
\cindex{original source}
\cindex{actual source}
The \i{original source} displayed will almost always be a list. If the actual
source for an error message is a symbol, the original source will be the
immediately enclosing evaluated list form. So even if the offending symbol
does appear in the original source, the compiler will print the enclosing list
and then print the symbol as the actual source (as though the symbol were
introduced by a macro.)
When the \i{actual source} is displayed (and is not a symbol), it will always
be code that resulted from the expansion of a macro or a source-to-source
compiler optimization. This is code that did not appear in the original
source program; it was introduced by the compiler.
Keep in mind that when the compiler displays a source form in an error message,
it always displays the most specific (innermost) responsible form. For
example, compiling this function:
\begin{lisp}
(defun bar (x)
(let (a)
(declare (fixnum a))
(setq a (foo x))
a))
\end{lisp}
Gives this error message:
\begin{example}
In: DEFUN BAR
(LET (A) (DECLARE (FIXNUM A)) (SETQ A (FOO X)) A)
Warning: The binding of A is not a FIXNUM:
NIL
\end{example}
This error message is not saying ``there's a problem somewhere in this
\code{let}''\dash{}it is saying that there is a problem with the
\code{let} itself. In this example, the problem is that \code{a}'s
\false{} initial value is not a \code{fixnum}.
%%
%%\node The Processing Path, Error Severity, The Original and Actual Source, Interpreting Error Messages
\subsection{The Processing Path}
\cindex{processing path}
\cindex{macroexpansion}
\cindex{source-to-source transformation}
The processing path is mainly useful for debugging macros, so if you don't
write macros, you can ignore the processing path. Consider this example:
\begin{lisp}
(defun foo (n)
(dotimes (i n *undefined*)))
\end{lisp}
Compiling results in this error message:
\begin{example}
In: DEFUN FOO
(DOTIMES (I N *UNDEFINED*))
--> DO BLOCK LET TAGBODY RETURN-FROM
==>
(PROGN *UNDEFINED*)
Warning: Undefined variable: *UNDEFINED*
\end{example}
Note that \code{do} appears in the processing path. This is because \code{dotimes}
expands into:
\begin{lisp}
(do ((i 0 (1+ i)) (#:g1 n))
((>= i #:g1) *undefined*)
(declare (type unsigned-byte i)))
\end{lisp}
The rest of the processing path results from the expansion of \code{do}:
\begin{lisp}
(block nil
(let ((i 0) (#:g1 n))
(declare (type unsigned-byte i))
(tagbody (go #:g3)
#:g2 (psetq i (1+ i))
#:g3 (unless (>= i #:g1) (go #:g2))
(return-from nil (progn *undefined*)))))
\end{lisp}
In this example, the compiler descended into the \code{block},
\code{let}, \code{tagbody} and \code{return-from} to reach the
\code{progn} printed as the actual source. This is a place where the
``actual source appears in explanation'' rule was applied. The
innermost actual source form was the symbol \code{*undefined*} itself,
but that also appeared in the explanation, so the compiler backed out
one level.
%%
%%\node Error Severity, Errors During Macroexpansion, The Processing Path, Interpreting Error Messages
\subsection{Error Severity}
\label{error-severity}
\cindex{severity of compiler errors}
\cindex{compiler error severity}
There are three levels of compiler error severity:
\begin{Lentry}
\item[Error] This severity is used when the compiler encounters a
problem serious enough to prevent normal processing of a form.
Instead of compiling the form, the compiler compiles a call to
\code{error}. Errors are used mainly for signaling syntax errors.
If an error happens during macroexpansion, the compiler will handle
it. The compiler also handles and attempts to proceed from read
errors.
\item[Warning] Warnings are used when the compiler can prove that
something bad will happen if a portion of the program is executed,
but the compiler can proceed by compiling code that signals an error
at runtime if the problem has not been fixed:
\begin{itemize}
\item Violation of type declarations, or
\item Function calls that have the wrong number of arguments or
malformed keyword argument lists, or
\item Referencing a variable declared \code{ignore}, or unrecognized
declaration specifiers.
\end{itemize}
In the language of the \clisp{} standard, these are situations where
the compiler can determine that a situation with undefined
consequences or that would cause an error to be signaled would
result at runtime.
\item[Note] Notes are used when there is something that seems a bit
odd, but that might reasonably appear in correct programs.
\end{Lentry}
Note that the compiler does not fully conform to the proposed X3J13
``compiler-diagnostics'' cleanup. Errors, warnings and notes mostly
correspond to errors, warnings and style-warnings, but many things
that the cleanup considers to be style-warnings are printed as
warnings rather than notes. Also, warnings, style-warnings and most
errors aren't really signaled using the condition system.
%%
%%\node Errors During Macroexpansion, Read Errors, Error Severity, Interpreting Error Messages
\subsection{Errors During Macroexpansion}
\cpsubindex{macroexpansion}{errors during}
The compiler handles errors that happen during macroexpansion, turning
them into compiler errors. If you want to debug the error (to debug a
macro), you can set \code{*break-on-signals*} to \code{error}. For
example, this definition:
\begin{lisp}
(defun foo (e l)
(do ((current l (cdr current))
((atom current) nil))
(when (eq (car current) e) (return current))))
\end{lisp}
gives this error:
\begin{example}
In: DEFUN FOO
(DO ((CURRENT L #) (# NIL)) (WHEN (EQ # E) (RETURN CURRENT)) )
Error: (during macroexpansion)
Error in function LISP::DO-DO-BODY.
DO step variable is not a symbol: (ATOM CURRENT)
\end{example}
%%
%%\node Read Errors, Error Message Parameterization, Errors During Macroexpansion, Interpreting Error Messages
\subsection{Read Errors}
\cpsubindex{read errors}{compiler}
The compiler also handles errors while reading the source. For example:
\begin{example}
Error: Read error at 2:
"(,/\back{foo})"
Error in function LISP::COMMA-MACRO.
Comma not inside a backquote.
\end{example}
The ``\code{at 2}'' refers to the character position in the source file at
which the error was signaled, which is generally immediately after the
erroneous text. The next line, ``\code{(,/\back{foo})}'', is the line in
the source that contains the error file position. The ``\code{/\back{} }''
indicates the error position within that line (in this example,
immediately after the offending comma.)
When in \hemlock{} (or any other EMACS-like editor), you can go to a
character position with:
\begin{example}
M-< C-u \var{position} C-f
\end{example}
Note that if the source is from a \hemlock{} buffer, then the position
is relative to the start of the compiled region or \code{defun}, not the
file or buffer start.
After printing a read error message, the compiler attempts to recover from the
error by backing up to the start of the enclosing top-level form and reading
again with \code{*read-suppress*} true. If the compiler can recover from the
error, then it substitutes a call to \code{cerror} for the unreadable form and
proceeds to compile the rest of the file normally.
If there is a read error when the file position is at the end of the file
(i.e., an unexpected EOF error), then the error message looks like this:
\begin{example}
Error: Read error in form starting at 14:
"(defun test ()"
Error in function LISP::FLUSH-WHITESPACE.
EOF while reading #<Stream for file "/usr/me/test.lisp">
\end{example}
In this case, ``\code{starting at 14}'' indicates the character
position at which the compiler started reading, i.e. the position
before the start of the form that was missing the closing delimiter.
The line \w{"\code{(defun test ()}"} is first line after the starting
position that the compiler thinks might contain the unmatched open
delimiter.
%%
%%\node Error Message Parameterization, , Read Errors, Interpreting Error Messages
\subsection{Error Message Parameterization}
\cpsubindex{error messages}{verbosity}
\cpsubindex{verbosity}{of error messages}
There is some control over the verbosity of error messages. See also
\varref{undefined-warning-limit}, \code{*efficiency-note-limit*} and
\varref{efficiency-note-cost-threshold}.
\begin{defvar}{}{enclosing-source-cutoff}
This variable specifies the number of enclosing actual source forms
that are printed in full, rather than in the abbreviated processing
path format. Increasing the value from its default of \code{1}
allows you to see more of the guts of the macroexpanded source,
which is useful when debugging macros.
\end{defvar}
\begin{defvar}{}{error-print-length}
\defvarx{error-print-level}
These variables are the print level and print length used in
printing error messages. The default values are \code{5} and
\code{3}. If null, the global values of \code{*print-level*} and
\code{*print-length*} are used.
\end{defvar}
\begin{defmac}{extensions:}{def-source-context}{%
\args{\var{name} \var{lambda-list} \mstar{form}}}
This macro defines how to extract an abbreviated source context from
the \var{name}d form when it appears in the compiler input.
\var{lambda-list} is a \code{defmacro} style lambda-list used to
parse the arguments. The \var{body} should return a list of
subforms that can be printed on about one line. There are
predefined methods for \code{defstruct}, \code{defmethod}, etc. If
no method is defined, then the first two subforms are returned.
Note that this facility implicitly determines the string name
associated with anonymous functions.
\end{defmac}
%%
%%\node Types in Python, Getting Existing Programs to Run, Interpreting Error Messages, The Compiler
\section{Types in Python}
\cpsubindex{types}{in python}
A big difference between \Python{} and all other \llisp{} compilers
is the approach to type checking and amount of knowledge about types:
\begin{itemize}
\item \Python{} treats type declarations much differently that other
Lisp compilers do. \Python{} doesn't blindly believe type
declarations; it considers them assertions about the program that
should be checked.
\item \Python{} also has a tremendously greater knowledge of the
\clisp{} type system than other compilers. Support is incomplete
only for the \code{not}, \code{and} and \code{satisfies} types.
\end{itemize}
See also sections \ref{advanced-type-stuff} and \ref{type-inference}.
%%
\begin{comment}
* Compile Time Type Errors::
* Precise Type Checking::
* Weakened Type Checking::
\end{comment}
%%\node Compile Time Type Errors, Precise Type Checking, Types in Python, Types in Python
\subsection{Compile Time Type Errors}
\cindex{compile time type errors}
\cpsubindex{type checking}{at compile time}
If the compiler can prove at compile time that some portion of the
program cannot be executed without a type error, then it will give a
warning at compile time. It is possible that the offending code would
never actually be executed at run-time due to some higher level
consistency constraint unknown to the compiler, so a type warning
doesn't always indicate an incorrect program. For example, consider
this code fragment:
\begin{lisp}
(defun raz (foo)
(let ((x (case foo
(:this 13)
(:that 9)
(:the-other 42))))
(declare (fixnum x))
(foo x)))
\end{lisp}
Compilation produces this warning:
\begin{example}
In: DEFUN RAZ
(CASE FOO (:THIS 13) (:THAT 9) (:THE-OTHER 42))
--> LET COND IF COND IF COND IF
==>
(COND)
Warning: This is not a FIXNUM:
NIL
\end{example}
In this case, the warning is telling you that if \code{foo} isn't any
of \kwd{this}, \kwd{that} or \kwd{the-other}, then \code{x} will be
initialized to \false, which the \code{fixnum} declaration makes
illegal. The warning will go away if \code{ecase} is used instead of
\code{case}, or if \kwd{the-other} is changed to \true.
This sort of spurious type warning happens moderately often in the
expansion of complex macros and in inline functions. In such cases,
there may be dead code that is impossible to correctly execute. The
compiler can't always prove this code is dead (could never be
executed), so it compiles the erroneous code (which will always signal
an error if it is executed) and gives a warning.
\begin{defun}{extensions:}{required-argument}{}
This function can be used as the default value for keyword arguments
that must always be supplied. Since it is known by the compiler to
never return, it will avoid any compile-time type warnings that
would result from a default value inconsistent with the declared
type. When this function is called, it signals an error indicating
that a required keyword argument was not supplied. This function is
also useful for \code{defstruct} slot defaults corresponding to
required arguments. \xlref{empty-type}.
Although this function is a CMU extension, it is relatively harmless
to use it in otherwise portable code, since you can easily define it
yourself:
\begin{lisp}
(defun required-argument ()
(error "A required keyword argument was not supplied."))
\end{lisp}
\end{defun}
Type warnings are inhibited when the
\code{extensions:inhibit-warnings} optimization quality is \code{3}
(\pxlref{compiler-policy}.) This can be used in a local declaration
to inhibit type warnings in a code fragment that has spurious
warnings.
%%
%%\node Precise Type Checking, Weakened Type Checking, Compile Time Type Errors, Types in Python
\subsection{Precise Type Checking}
\label{precise-type-checks}
\cindex{precise type checking}
\cpsubindex{type checking}{precise}
With the default compilation policy, all type
assertions\footnote{There are a few circumstances where a type
declaration is discarded rather than being used as type assertion.
This doesn't affect safety much, since such discarded declarations
are also not believed to be true by the compiler.} are precisely
checked. Precise checking means that the check is done as though
\code{typep} had been called with the exact type specifier that
appeared in the declaration. \Python{} uses \var{policy} to determine
whether to trust type assertions (\pxlref{compiler-policy}). Type
assertions from declarations are indistinguishable from the type
assertions on arguments to built-in functions. In \Python, adding
type declarations makes code safer.
If a variable is declared to be \w{\code{(integer 3 17)}}, then its
value must always always be an integer between \code{3} and \code{17}.
If multiple type declarations apply to a single variable, then all the
declarations must be correct; it is as though all the types were
intersected producing a single \code{and} type specifier.
Argument type declarations are automatically enforced. If you declare
the type of a function argument, a type check will be done when that
function is called. In a function call, the called function does the
argument type checking, which means that a more restrictive type
assertion in the calling function (e.g., from \code{the}) may be lost.
The types of structure slots are also checked. The value of a
structure slot must always be of the type indicated in any \kwd{type}
slot option.\footnote{The initial value need not be of this type as
long as the corresponding argument to the constructor is always
supplied, but this will cause a compile-time type warning unless
\code{required-argument} is used.} Because of precise type checking,
the arguments to slot accessors are checked to be the correct type of
structure.
In traditional \llisp{} compilers, not all type assertions are
checked, and type checks are not precise. Traditional compilers
blindly trust explicit type declarations, but may check the argument
type assertions for built-in functions. Type checking is not precise,
since the argument type checks will be for the most general type legal
for that argument. In many systems, type declarations suppress what
little type checking is being done, so adding type declarations makes
code unsafe. This is a problem since it discourages writing type
declarations during initial coding. In addition to being more error
prone, adding type declarations during tuning also loses all the
benefits of debugging with checked type assertions.
To gain maximum benefit from \Python{}'s type checking, you should
always declare the types of function arguments and structure slots as
precisely as possible. This often involves the use of \code{or},
\code{member} and other list-style type specifiers. Paradoxically,
even though adding type declarations introduces type checks, it
usually reduces the overall amount of type checking. This is
especially true for structure slot type declarations.
\Python{} uses the \code{safety} optimization quality (rather than
presence or absence of declarations) to choose one of three levels of
run-time type error checking: \pxlref{optimize-declaration}.
\xlref{advanced-type-stuff} for more information about types in
\Python.
%%
%%\node Weakened Type Checking, , Precise Type Checking, Types in Python
\subsection{Weakened Type Checking}
\label{weakened-type-checks}
\cindex{weakened type checking}
\cpsubindex{type checking}{weakened}
When the value for the \code{speed} optimization quality is greater
than \code{safety}, and \code{safety} is not \code{0}, then type
checking is weakened to reduce the speed and space penalty. In
structure-intensive code this can double the speed, yet still catch
most type errors. Weakened type checks provide a level of safety
similar to that of ``safe'' code in other \llisp{} compilers.
A type check is weakened by changing the check to be for some
convenient supertype of the asserted type. For example,
\code{\w{(integer 3 17)}} is changed to \code{fixnum},
\code{\w{(simple-vector 17)}} to \code{simple-vector}, and structure
types are changed to \code{structure}. A complex check like:
\begin{example}
(or node hunk (member :foo :bar :baz))
\end{example}
will be omitted entirely (i.e., the check is weakened to \code{*}.) If
a precise check can be done for no extra cost, then no weakening is
done.
Although weakened type checking is similar to type checking done by
other compilers, it is sometimes safer and sometimes less safe.
Weakened checks are done in the same places is precise checks, so all
the preceding discussion about where checking is done still applies.
Weakened checking is sometimes somewhat unsafe because although the
check is weakened, the precise type is still input into type
inference. In some contexts this will result in type inferences not
justified by the weakened check, and hence deletion of some type
checks that would be done by conventional compilers.
For example, if this code was compiled with weakened checks:
\begin{lisp}
(defstruct foo
(a nil :type simple-string))
(defstruct bar
(a nil :type single-float))
(defun myfun (x)
(declare (type bar x))
(* (bar-a x) 3.0))
\end{lisp}
and \code{myfun} was passed a \code{foo}, then no type error would be
signaled, and we would try to multiply a \code{simple-vector} as
though it were a float (with unpredictable results.) This is because
the check for \code{bar} was weakened to \code{structure}, yet when
compiling the call to \code{bar-a}, the compiler thinks it knows it
has a \code{bar}.
Note that normally even weakened type checks report the precise type
in error messages. For example, if \code{myfun}'s \code{bar} check is
weakened to \code{structure}, and the argument is \false{}, then the
error will be:
\begin{example}
Type-error in MYFUN:
NIL is not of type BAR
\end{example}
However, there is some speed and space cost for signaling a precise
error, so the weakened type is reported if the \code{speed}
optimization quality is \code{3} or \code{debug} quality is less than
\code{1}:
\begin{example}
Type-error in MYFUN:
NIL is not of type STRUCTURE
\end{example}
\xlref{optimize-declaration} for further discussion of the
\code{optimize} declaration.
%%
%%\node Getting Existing Programs to Run, Compiler Policy, Types in Python, The Compiler
\section{Getting Existing Programs to Run}
\cpsubindex{existing programs}{to run}
\cpsubindex{types}{portability}
\cindex{compatibility with other Lisps}
Since \Python{} does much more comprehensive type checking than other
Lisp compilers, \Python{} will detect type errors in many programs
that have been debugged using other compilers. These errors are
mostly incorrect declarations, although compile-time type errors can
find actual bugs if parts of the program have never been tested.
Some incorrect declarations can only be detected by run-time type
checking. It is very important to initially compile programs with
full type checks and then test this version. After the checking
version has been tested, then you can consider weakening or
eliminating type checks. \b{This applies even to previously debugged
programs.} \Python{} does much more type inference than other
\llisp{} compilers, so believing an incorrect declaration does much
more damage.
The most common problem is with variables whose initial value doesn't
match the type declaration. Incorrect initial values will always be
flagged by a compile-time type error, and they are simple to fix once
located. Consider this code fragment:
\begin{example}
(prog (foo)
(declare (fixnum foo))
(setq foo ...)
...)
\end{example}
Here the variable \code{foo} is given an initial value of \false, but
is declared to be a \code{fixnum}. Even if it is never read, the
initial value of a variable must match the declared type. There are
two ways to fix this problem. Change the declaration:
\begin{example}
(prog (foo)
(declare (type (or fixnum null) foo))
(setq foo ...)
...)
\end{example}
or change the initial value:
\begin{example}
(prog ((foo 0))
(declare (fixnum foo))
(setq foo ...)
...)
\end{example}
It is generally preferable to change to a legal initial value rather
than to weaken the declaration, but sometimes it is simpler to weaken
the declaration than to try to make an initial value of the
appropriate type.
Another declaration problem occasionally encountered is incorrect
declarations on \code{defmacro} arguments. This probably usually
happens when a function is converted into a macro. Consider this
macro:
\begin{lisp}
(defmacro my-1+ (x)
(declare (fixnum x))
`(the fixnum (1+ ,x)))
\end{lisp}
Although legal and well-defined \clisp, this meaning of this
definition is almost certainly not what the writer intended. For
example, this call is illegal:
\begin{lisp}
(my-1+ (+ 4 5))
\end{lisp}
The call is illegal because the argument to the macro is \w{\code{(+ 4
5)}}, which is a \code{list}, not a \code{fixnum}. Because of
macro semantics, it is hardly ever useful to declare the types of
macro arguments. If you really want to assert something about the
type of the result of evaluating a macro argument, then put a
\code{the} in the expansion:
\begin{lisp}
(defmacro my-1+ (x)
`(the fixnum (1+ (the fixnum ,x))))
\end{lisp}
In this case, it would be stylistically preferable to change this
macro back to a function and declare it inline. Macros have no
efficiency advantage over inline functions when using \Python.
\xlref{inline-expansion}.
Some more subtle problems are caused by incorrect declarations that
can't be detected at compile time. Consider this code:
\begin{example}
(do ((pos 0 (position #\back{a} string :start (1+ pos))))
((null pos))
(declare (fixnum pos))
...)
\end{example}
Although \code{pos} is almost always a \code{fixnum}, it is \false{}
at the end of the loop. If this example is compiled with full type
checks (the default), then running it will signal a type error at the
end of the loop. If compiled without type checks, the program will go
into an infinite loop (or perhaps \code{position} will complain
because \w{\code{(1+ nil)}} isn't a sensible start.) Why? Because if
you compile without type checks, the compiler just quietly believes
the type declaration. Since \code{pos} is always a \code{fixnum}, it
is never \nil, so \w{\code{(null pos)}} is never true, and the loop
exit test is optimized away. Such errors are sometimes flagged by
unreachable code notes (\pxlref{dead-code-notes}), but it is still
important to initially compile any system with full type checks, even
if the system works fine when compiled using other compilers.
In this case, the fix is to weaken the type declaration to
\w{\code{(or fixnum null)}}.\footnote{Actually, this declaration is
totally unnecessary in \Python, since it already knows
\code{position} returns a non-negative \code{fixnum} or \false.}
Note that there is usually little performance penalty for weakening a
declaration in this way. Any numeric operations in the body can still
assume the variable is a \code{fixnum}, since \false{} is not a legal
numeric argument. Another possible fix would be to say:
\begin{example}
(do ((pos 0 (position #\back{a} string :start (1+ pos))))
((null pos))
(let ((pos pos))
(declare (fixnum pos))
...))
\end{example}
This would be preferable in some circumstances, since it would allow a
non-standard representation to be used for the local \code{pos}
variable in the loop body (see section \ref{ND-variables}.)
In summary, remember that \i{all} values that a variable \i{ever}
has must be of the declared type, and that you should test using safe
code initially.
%%
%%\node Compiler Policy, Open Coding and Inline Expansion, Getting Existing Programs to Run, The Compiler
\section{Compiler Policy}
\label{compiler-policy}
\cpsubindex{policy}{compiler}
\cindex{compiler policy}
The policy is what tells the compiler \var{how} to compile a program.
This is logically (and often textually) distinct from the program
itself. Broad control of policy is provided by the \code{optimize}
declaration; other declarations and variables control more specific
aspects of compilation.
%%
\begin{comment}
* The Optimize Declaration::
* The Optimize-Interface Declaration::
\end{comment}
%%\node The Optimize Declaration, The Optimize-Interface Declaration, Compiler Policy, Compiler Policy
\subsection{The Optimize Declaration}
\label{optimize-declaration}
\cindex{optimize declaration}
\cpsubindex{declarations}{\code{optimize}}
The \code{optimize} declaration recognizes six different
\var{qualities}. The qualities are conceptually independent aspects
of program performance. In reality, increasing one quality tends to
have adverse effects on other qualities. The compiler compares the
relative values of qualities when it needs to make a trade-off; i.e.,
if \code{speed} is greater than \code{safety}, then improve speed at
the cost of safety.
The default for all qualities (except \code{debug}) is \code{1}.
Whenever qualities are equal, ties are broken according to a broad
idea of what a good default environment is supposed to be. Generally
this downplays \code{speed}, \code{compile-speed} and \code{space} in
favor of \code{safety} and \code{debug}. Novice and casual users
should stick to the default policy. Advanced users often want to
improve speed and memory usage at the cost of safety and
debuggability.
If the value for a quality is \code{0} or \code{3}, then it may have a
special interpretation. A value of \code{0} means ``totally
unimportant'', and a \code{3} means ``ultimately important.'' These
extreme optimization values enable ``heroic'' compilation strategies
that are not always desirable and sometimes self-defeating.
Specifying more than one quality as \code{3} is not desirable, since
it doesn't tell the compiler which quality is most important.
These are the optimization qualities:
\begin{Lentry}
\item[\code{speed}] \cindex{speed optimization quality}How fast the
program should is run. \code{speed 3} enables some optimizations
that hurt debuggability.
\item[\code{compilation-speed}] \cindex{compilation-speed optimization
quality}How fast the compiler should run. Note that increasing
this above \code{safety} weakens type checking.
\item[\code{space}] \cindex{space optimization quality}How much space
the compiled code should take up. Inline expansion is mostly
inhibited when \code{space} is greater than \code{speed}. A value
of \code{0} enables promiscuous inline expansion. Wide use of a
\code{0} value is not recommended, as it may waste so much space
that run time is slowed. \xlref{inline-expansion} for a discussion
of inline expansion.
\item[\code{debug}] \cindex{debug optimization quality}How debuggable
the program should be. The quality is treated differently from the
other qualities: each value indicates a particular level of debugger
information; it is not compared with the other qualities.
\xlref{debugger-policy} for more details.
\item[\code{safety}] \cindex{safety optimization quality}How much
error checking should be done. If \code{speed}, \code{space} or
\code{compilation-speed} is more important than \code{safety}, then
type checking is weakened (\pxlref{weakened-type-checks}). If
\code{safety} if \code{0}, then no run time error checking is done.
In addition to suppressing type checks, \code{0} also suppresses
argument count checking, unbound-symbol checking and array bounds
checks.
\item[\code{extensions:inhibit-warnings}] \cindex{inhibit-warnings
optimization quality}This is a CMU extension that determines how
little (or how much) diagnostic output should be printed during
compilation. This quality is compared to other qualities to
determine whether to print style notes and warnings concerning those
qualities. If \code{speed} is greater than \code{inhibit-warnings},
then notes about how to improve speed will be printed, etc. The
default value is \code{1}, so raising the value for any standard
quality above its default enables notes for that quality. If
\code{inhibit-warnings} is \code{3}, then all notes and most
non-serious warnings are inhibited. This is useful with
\code{declare} to suppress warnings about unavoidable problems.
\end{Lentry}
%%\node The Optimize-Interface Declaration, , The Optimize Declaration, Compiler Policy
\subsection{The Optimize-Interface Declaration}
\label{optimize-interface-declaration}
\cindex{optimize-interface declaration}
\cpsubindex{declarations}{\code{optimize-interface}}
The \code{extensions:optimize-interface} declaration is identical in
syntax to the \code{optimize} declaration, but it specifies the policy
used during compilation of code the compiler automatically generates
to check the number and type of arguments supplied to a function. It
is useful to specify this policy separately, since even thoroughly
debugged functions are vulnerable to being passed the wrong arguments.
The \code{optimize-interface} declaration can specify that arguments
should be checked even when the general \code{optimize} policy is
unsafe.
Note that this argument checking is the checking of user-supplied
arguments to any functions defined within the scope of the
declaration, \code{not} the checking of arguments to \llisp{}
primitives that appear in those definitions.
The idea behind this declaration is that it allows the definition of
functions that appear fully safe to other callers, but that do no
internal error checking. Of course, it is possible that arguments may
be invalid in ways other than having incorrect type. Functions
compiled unsafely must still protect themselves against things like
user-supplied array indices that are out of bounds and improper lists.
See also the \kwd{context-declarations} option to
\macref{with-compilation-unit}.
%%
%%\node Open Coding and Inline Expansion, , Compiler Policy, The Compiler
\section{Open Coding and Inline Expansion}
\label{open-coding}
\cindex{open-coding}
\cindex{inline expansion}
\cindex{static functions}
Since \clisp{} forbids the redefinition of standard functions\footnote{See the
proposed X3J13 ``lisp-symbol-redefinition'' cleanup.}, the compiler can have
special knowledge of these standard functions embedded in it. This special
knowledge is used in various ways (open coding, inline expansion, source
transformation), but the implications to the user are basically the same:
\begin{itemize}
\item Attempts to redefine standard functions may be frustrated, since
the function may never be called. Although it is technically
illegal to redefine standard functions, users sometimes want to
implicitly redefine these functions when they are debugging using
the \code{trace} macro. Special-casing of standard functions can be
inhibited using the \code{notinline} declaration.
\item The compiler can have multiple alternate implementations of
standard functions that implement different trade-offs of speed,
space and safety. This selection is based on the compiler policy,
\pxlref{compiler-policy}.
\end{itemize}
When a function call is \i{open coded}, inline code whose effect is
equivalent to the function call is substituted for that function call.
When a function call is \i{closed coded}, it is usually left as is,
although it might be turned into a call to a different function with
different arguments. As an example, if \code{nthcdr} were to be open
coded, then
\begin{lisp}
(nthcdr 4 foobar)
\end{lisp}
might turn into
\begin{lisp}
(cdr (cdr (cdr (cdr foobar))))
\end{lisp}
or even
\begin{lisp}
(do ((i 0 (1+ i))
(list foobar (cdr foobar)))
((= i 4) list))
\end{lisp}
If \code{nth} is closed coded, then
\begin{lisp}
(nth x l)
\end{lisp}
might stay the same, or turn into something like:
\begin{lisp}
(car (nthcdr x l))
\end{lisp}
In general, open coding sacrifices space for speed, but some functions (such as
\code{car}) are so simple that they are always open-coded. Even when not
open-coded, a call to a standard function may be transformed into a different
function call (as in the last example) or compiled as \i{static call}. Static
function call uses a more efficient calling convention that forbids
redefinition.
\hide{File:/afs/cs.cmu.edu/project/clisp/hackers/ram/docs/cmu-user/efficiency.ms}
\hide{ -*- Dictionary: cmu-user -*- }
%%\node Advanced Compiler Use and Efficiency Hints, UNIX Interface, The Compiler, Top
\chapter{Advanced Compiler Use and Efficiency Hints}
\begin{center}
\b{By Robert MacLachlan}
\end{center}
\vspace{1 cm}
\label{advanced-compiler}
\begin{comment}
* Advanced Compiler Introduction::
* More About Types in Python::
* Type Inference::
* Source Optimization::
* Tail Recursion::
* Local Call::
* Block Compilation::
* Inline Expansion::
* Byte Coded Compilation::
* Object Representation::
* Numbers::
* General Efficiency Hints::
* Efficiency Notes::
* Profiling::
\end{comment}
%%\node Advanced Compiler Introduction, More About Types in Python, Advanced Compiler Use and Efficiency Hints, Advanced Compiler Use and Efficiency Hints
\section{Advanced Compiler Introduction}
In \cmucl, as is any language on any computer, the path to efficient
code starts with good algorithms and sensible programming techniques,
but to avoid inefficiency pitfalls, you need to know some of this
implementation's quirks and features. This chapter is mostly a fairly
long and detailed overview of what optimizations \python{} does.
Although there are the usual negative suggestions of inefficient
features to avoid, the main emphasis is on describing the things that
programmers can count on being efficient.
The optimizations described here can have the effect of speeding up
existing programs written in conventional styles, but the potential
for new programming styles that are clearer and less error-prone is at
least as significant. For this reason, several sections end with a
discussion of the implications of these optimizations for programming
style.
\begin{comment}
* Types::
* Optimization::
* Function Call::
* Representation of Objects::
* Writing Efficient Code::
\end{comment}
%%\node Types, Optimization, Advanced Compiler Introduction, Advanced Compiler Introduction
\subsection{Types}
Python's support for types is unusual in three major ways:
\begin{itemize}
\item Precise type checking encourages the specific use of type
declarations as a form of run-time consistency checking. This
speeds development by localizing type errors and giving more
meaningful error messages. \xlref{precise-type-checks}. \python{}
produces completely safe code; optimized type checking maintains
reasonable efficiency on conventional hardware
(\pxlref{type-check-optimization}.)
\item Comprehensive support for the \clisp{} type system makes complex
type specifiers useful. Using type specifiers such as \code{or} and
\code{member} has both efficiency and robustness advantages.
\xlref{advanced-type-stuff}.
\item Type inference eliminates the need for some declarations, and
also aids compile-time detection of type errors. Given detailed
type declarations, type inference can often eliminate type checks
and enable more efficient object representations and code sequences.
Checking all types results in fewer type checks. See sections
\ref{type-inference} and \ref{non-descriptor}.
\end{itemize}
%%\node Optimization, Function Call, Types, Advanced Compiler Introduction
\subsection{Optimization}
The main barrier to efficient Lisp programs is not that there is no
efficient way to code the program in Lisp, but that it is difficult to
arrive at that efficient coding. Common Lisp is a highly complex
language, and usually has many semantically equivalent ``reasonable''
ways to code a given problem. It is desirable to make all of these
equivalent solutions have comparable efficiency so that programmers
don't have to waste time discovering the most efficient solution.
Source level optimization increases the number of efficient ways to
solve a problem. This effect is much larger than the increase in the
efficiency of the ``best'' solution. Source level optimization
transforms the original program into a more efficient (but equivalent)
program. Although the optimizer isn't doing anything the programmer
couldn't have done, this high-level optimization is important because:
\begin{itemize}
\item The programmer can code simply and directly, rather than
obfuscating code to please the compiler.
\item When presented with a choice of similar coding alternatives, the
programmer can chose whichever happens to be most convenient,
instead of worrying about which is most efficient.
\end{itemize}
Source level optimization eliminates the need for macros to optimize
their expansion, and also increases the effectiveness of inline
expansion. See sections \ref{source-optimization} and
\ref{inline-expansion}.
Efficient support for a safer programming style is the biggest
advantage of source level optimization. Existing tuned programs
typically won't benefit much from source optimization, since their
source has already been optimized by hand. However, even tuned
programs tend to run faster under \python{} because:
\begin{itemize}
\item Low level optimization and register allocation provides modest
speedups in any program.
\item Block compilation and inline expansion can reduce function call
overhead, but may require some program restructuring. See sections
\ref{inline-expansion}, \ref{local-call} and
\ref{block-compilation}.
\item Efficiency notes will point out important type declarations that
are often missed even in highly tuned programs.
\xlref{efficiency-notes}.
\item Existing programs can be compiled safely without prohibitive
speed penalty, although they would be faster and safer with added
declarations. \xlref{type-check-optimization}.
\item The context declaration mechanism allows both space and runtime
of large systems to be reduced without sacrificing robustness by
semi-automatically varying compilation policy without addition any
\code{optimize} declarations to the source.
\xlref{context-declarations}.
\item Byte compilation can be used to dramatically reduce the size of
code that is not speed-critical. \xlref{byte-compile}
\end{itemize}
%%\node Function Call, Representation of Objects, Optimization, Advanced Compiler Introduction
\subsection{Function Call}
The sort of symbolic programs generally written in \llisp{} often
favor recursion over iteration, or have inner loops so complex that
they involve multiple function calls. Such programs spend a larger
fraction of their time doing function calls than is the norm in other
languages; for this reason \llisp{} implementations strive to make the
general (or full) function call as inexpensive as possible. \python{}
goes beyond this by providing two good alternatives to full call:
\begin{itemize}
\item Local call resolves function references at compile time,
allowing better calling sequences and optimization across function
calls. \xlref{local-call}.
\item Inline expansion totally eliminates call overhead and allows
many context dependent optimizations. This provides a safe and
efficient implementation of operations with function semantics,
eliminating the need for error-prone macro definitions or manual
case analysis. Although most \clisp{} implementations support
inline expansion, it becomes a more powerful tool with \python{}'s
source level optimization. See sections \ref{source-optimization}
and \ref{inline-expansion}.
\end{itemize}
Generally, \python{} provides simple implementations for simple uses
of function call, rather than having only a single calling convention.
These features allow a more natural programming style:
\begin{itemize}
\item Proper tail recursion. \xlref{tail-recursion}
\item Relatively efficient closures.
\item A \code{funcall} that is as efficient as normal named call.
\item Calls to local functions such as from \code{labels} are
optimized:
\begin{itemize}
\item Control transfer is a direct jump.
\item The closure environment is passed in registers rather than heap
allocated.
\item Keyword arguments and multiple values are implemented more
efficiently.
\end{itemize}
\xlref{local-call}.
\end{itemize}
%%\node Representation of Objects, Writing Efficient Code, Function Call, Advanced Compiler Introduction
\subsection{Representation of Objects}
Sometimes traditional \llisp{} implementation techniques compare so
poorly to the techniques used in other languages that \llisp{} can
become an impractical language choice. Terrible inefficiencies appear
in number-crunching programs, since \llisp{} numeric operations often
involve number-consing and generic arithmetic. \python{} supports
efficient natural representations for numbers (and some other types),
and allows these efficient representations to be used in more
contexts. \python{} also provides good efficiency notes that warn
when a crucial declaration is missing.
See section \ref{non-descriptor} for more about object representations and
numeric types. Also \pxlref{efficiency-notes} about efficiency notes.
%%\node Writing Efficient Code, , Representation of Objects, Advanced Compiler Introduction
\subsection{Writing Efficient Code}
\label{efficiency-overview}
Writing efficient code that works is a complex and prolonged process.
It is important not to get so involved in the pursuit of efficiency
that you lose sight of what the original problem demands. Remember
that:
\begin{itemize}
\item The program should be correct\dash{}it doesn't matter how
quickly you get the wrong answer.
\item Both the programmer and the user will make errors, so the
program must be robust\dash{}it must detect errors in a way that
allows easy correction.
\item A small portion of the program will consume most of the
resources, with the bulk of the code being virtually irrelevant to
efficiency considerations. Even experienced programmers familiar
with the problem area cannot reliably predict where these ``hot
spots'' will be.
\end{itemize}
The best way to get efficient code that is still worth using, is to separate
coding from tuning. During coding, you should:
\begin{itemize}
\item Use a coding style that aids correctness and robustness without
being incompatible with efficiency.
\item Choose appropriate data structures that allow efficient
algorithms and object representations
(\pxlref{object-representation}). Try to make interfaces abstract
enough so that you can change to a different representation if
profiling reveals a need.
\item Whenever you make an assumption about a function argument or
global data structure, add consistency assertions, either with type
declarations or explicit uses of \code{assert}, \code{ecase}, etc.
\end{itemize}
During tuning, you should:
\begin{itemize}
\item Identify the hot spots in the program through profiling (section
\ref{profiling}.)
\item Identify inefficient constructs in the hot spot with efficiency
notes, more profiling, or manual inspection of the source. See
sections \ref{general-efficiency} and \ref{efficiency-notes}.
\item Add declarations and consider the application of optimizations.
See sections \ref{local-call}, \ref{inline-expansion} and
\ref{non-descriptor}.
\item If all else fails, consider algorithm or data structure changes.
If you did a good job coding, changes will be easy to introduce.
\end{itemize}
%%
%%\node More About Types in Python, Type Inference, Advanced Compiler Introduction, Advanced Compiler Use and Efficiency Hints
\section{More About Types in Python}
\label{advanced-type-stuff}
\cpsubindex{types}{in python}
This section goes into more detail describing what types and declarations are
recognized by \python. The area where \python{} differs most radically from
previous \llisp{} compilers is in its support for types:
\begin{itemize}
\item Precise type checking helps to find bugs at run time.
\item Compile-time type checking helps to find bugs at compile time.
\item Type inference minimizes the need for generic operations, and
also increases the efficiency of run time type checking and the
effectiveness of compile time type checking.
\item Support for detailed types provides a wealth of opportunity for
operation-specific type inference and optimization.
\end{itemize}
\begin{comment}
* More Types Meaningful::
* Canonicalization::
* Member Types::
* Union Types::
* The Empty Type::
* Function Types::
* The Values Declaration::
* Structure Types::
* The Freeze-Type Declaration::
* Type Restrictions::
* Type Style Recommendations::
\end{comment}
%%\node More Types Meaningful, Canonicalization, More About Types in Python, More About Types in Python
\subsection{More Types Meaningful}
\clisp{} has a very powerful type system, but conventional \llisp{}
implementations typically only recognize the small set of types
special in that implementation. In these systems, there is an
unfortunate paradox: a declaration for a relatively general type like
\code{fixnum} will be recognized by the compiler, but a highly
specific declaration such as \code{\w{(integer 3 17)}} is totally
ignored.
This is obviously a problem, since the user has to know how to specify
the type of an object in the way the compiler wants it. A very
minimal (but rarely satisfied) criterion for type system support is
that it be no worse to make a specific declaration than to make a
general one. \python{} goes beyond this by exploiting a number of
advantages obtained from detailed type information.
Using more restrictive types in declarations allows the compiler to do
better type inference and more compile-time type checking. Also, when
type declarations are considered to be consistency assertions that
should be verified (conditional on policy), then complex types are
useful for making more detailed assertions.
Python ``understands'' the list-style \code{or}, \code{member},
\code{function}, array and number type specifiers. Understanding
means that:
\begin{itemize}
\item If the type contains more information than is used in a
particular context, then the extra information is simply ignored,
rather than derailing type inference.
\item In many contexts, the extra information from these type
specifier is used to good effect. In particular, type checking in
\code{Python} is \var{precise}, so these complex types can be used
in declarations to make interesting assertions about functions and
data structures (\pxlref{precise-type-checks}.) More specific
declarations also aid type inference and reduce the cost for type
checking.
\end{itemize}
For related information, \pxlref{numeric-types} for numeric types, and
section \ref{array-types} for array types.
%%\node Canonicalization, Member Types, More Types Meaningful, More About Types in Python
\subsection{Canonicalization}
\cpsubindex{types}{equivalence}
\cindex{canonicalization of types}
\cindex{equivalence of types}
When given a type specifier, \python{} will often rewrite it into a
different (but equivalent) type. This is the mechanism that \python{}
uses for detecting type equivalence. For example, in \python{}'s
canonical representation, these types are equivalent:
\begin{example}
(or list (member :end)) \myequiv (or cons (member nil :end))
\end{example}
This has two implications for the user:
\begin{itemize}
\item The standard symbol type specifiers for \code{atom},
\code{null}, \code{fixnum}, etc., are in no way magical. The
\tindexed{null} type is actually defined to be \code{\w{(member
nil)}}, \tindexed{list} is \code{\w{(or cons null)}}, and
\tindexed{fixnum} is \code{\w{(signed-byte 30)}}.
\item When the compiler prints out a type, it may not look like the
type specifier that originally appeared in the program. This is
generally not a problem, but it must be taken into consideration
when reading compiler error messages.
\end{itemize}
%%\node Member Types, Union Types, Canonicalization, More About Types in Python
\subsection{Member Types}
\cindex{member types}
The \tindexed{member} type specifier can be used to represent
``symbolic'' values, analogous to the enumerated types of Pascal. For
example, the second value of \code{find-symbol} has this type:
\begin{lisp}
(member :internal :external :inherited nil)
\end{lisp}
Member types are very useful for expressing consistency constraints on data
structures, for example:
\begin{lisp}
(defstruct ice-cream
(flavor :vanilla :type (member :vanilla :chocolate :strawberry)))
\end{lisp}
Member types are also useful in type inference, as the number of members can
sometimes be pared down to one, in which case the value is a known constant.
%%\node Union Types, The Empty Type, Member Types, More About Types in Python
\subsection{Union Types}
\cindex{union (\code{or}) types}
\cindex{or (union) types}
The \tindexed{or} (union) type specifier is understood, and is
meaningfully applied in many contexts. The use of \code{or} allows
assertions to be made about types in dynamically typed programs. For
example:
\begin{lisp}
(defstruct box
(next nil :type (or box null))
(top :removed :type (or box-top (member :removed))))
\end{lisp}
The type assertion on the \code{top} slot ensures that an error will be signaled
when there is an attempt to store an illegal value (such as \kwd{rmoved}.)
Although somewhat weak, these union type assertions provide a useful input into
type inference, allowing the cost of type checking to be reduced. For example,
this loop is safely compiled with no type checks:
\begin{lisp}
(defun find-box-with-top (box)
(declare (type (or box null) box))
(do ((current box (box-next current)))
((null current))
(unless (eq (box-top current) :removed)
(return current))))
\end{lisp}
Union types are also useful in type inference for representing types that are
partially constrained. For example, the result of this expression:
\begin{lisp}
(if foo
(logior x y)
(list x y))
\end{lisp}
can be expressed as \code{\w{(or integer cons)}}.
%%\node The Empty Type, Function Types, Union Types, More About Types in Python
\subsection{The Empty Type}
\label{empty-type}
\cindex{NIL type}
\cpsubindex{empty type}{the}
\cpsubindex{errors}{result type of}
The type \false{} is also called the empty type, since no object is of
type \false{}. The union of no types, \code{(or)}, is also empty.
\python{}'s interpretation of an expression whose type is \false{} is
that the expression never yields any value, but rather fails to
terminate, or is thrown out of. For example, the type of a call to
\code{error} or a use of \code{return} is \false{}. When the type of
an expression is empty, compile-time type warnings about its value are
suppressed; presumably somebody else is signaling an error. If a
function is declared to have return type \false{}, but does in fact
return, then (in safe compilation policies) a ``\code{NIL Function
returned}'' error will be signaled. See also the function
\funref{required-argument}.
%%\node Function Types, The Values Declaration, The Empty Type, More About Types in Python
\subsection{Function Types}
\label{function-types}
\cpsubindex{function}{types}
\cpsubindex{types}{function}
\findexed{function} types are understood in the restrictive sense, specifying:
\begin{itemize}
\item The argument syntax that the function must be called with. This
is information about what argument counts are acceptable, and which
keyword arguments are recognized. In \python, warnings about
argument syntax are a consequence of function type checking.
\item The types of the argument values that the caller must pass. If
the compiler can prove that some argument to a call is of a type
disallowed by the called function's type, then it will give a
compile-time type warning. In addition to being used for
compile-time type checking, these type assertions are also used as
output type assertions in code generation. For example, if
\code{foo} is declared to have a \code{fixnum} argument, then the
\code{1+} in \w{\code{(foo (1+ x))}} is compiled with knowledge that
the result must be a fixnum.
\item The types the values that will be bound to argument variables in
the function's definition. Declaring a function's type with
\code{ftype} implicitly declares the types of the arguments in the
definition. \python{} checks for consistency between the definition
and the \code{ftype} declaration. Because of precise type checking,
an error will be signaled when a function is called with an
argument of the wrong type.
\item The type of return value(s) that the caller can expect. This
information is a useful input to type inference. For example, if a
function is declared to return a \code{fixnum}, then when a call to
that function appears in an expression, the expression will be
compiled with knowledge that the call will return a \code{fixnum}.
\item The type of return value(s) that the definition must return.
The result type in an \code{ftype} declaration is treated like an
implicit \code{the} wrapped around the body of the definition. If
the definition returns a value of the wrong type, an error will be
signaled. If the compiler can prove that the function returns the
wrong type, then it will give a compile-time warning.
\end{itemize}
This is consistent with the new interpretation of function types and
the \code{ftype} declaration in the proposed X3J13
``function-type-argument-type-semantics'' cleanup. Note also, that if
you don't explicitly declare the type of a function using a global
\code{ftype} declaration, then \python{} will compute a function type
from the definition, providing a degree of inter-routine type
inference, \pxlref{function-type-inference}.
%%\node The Values Declaration, Structure Types, Function Types, More About Types in Python
\subsection{The Values Declaration}
\cindex{values declaration}
\cmucl{} supports the \code{values} declaration as an extension to
\clisp. The syntax is {\code{(values \var{type1}
\var{type2}$\ldots$\var{typen})}}. This declaration is
semantically equivalent to a \code{the} form wrapped around the body
of the special form in which the \code{values} declaration appears.
The advantage of \code{values} over \findexed{the} is purely
syntactic\dash{}it doesn't introduce more indentation. For example:
\begin{example}
(defun foo (x)
(declare (values single-float))
(ecase x
(:this ...)
(:that ...)
(:the-other ...)))
\end{example}
is equivalent to:
\begin{example}
(defun foo (x)
(the single-float
(ecase x
(:this ...)
(:that ...)
(:the-other ...))))
\end{example}
and
\begin{example}
(defun floor (number &optional (divisor 1))
(declare (values integer real))
...)
\end{example}
is equivalent to:
\begin{example}
(defun floor (number &optional (divisor 1))
(the (values integer real)
...))
\end{example}
In addition to being recognized by \code{lambda} (and hence by
\code{defun}), the \code{values} declaration is recognized by all the
other special forms with bodies and declarations: \code{let},
\code{let*}, \code{labels} and \code{flet}. Macros with declarations
usually splice the declarations into one of the above forms, so they
will accept this declaration too, but the exact effect of a
\code{values} declaration will depend on the macro.
If you declare the types of all arguments to a function, and also
declare the return value types with \code{values}, you have described
the type of the function. \python{} will use this argument and result
type information to derive a function type that will then be applied
to calls of the function (\pxlref{function-types}.) This provides a
way to declare the types of functions that is much less syntactically
awkward than using the \code{ftype} declaration with a \code{function}
type specifier.
Although the \code{values} declaration is non-standard, it is
relatively harmless to use it in otherwise portable code, since any
warning in non-CMU implementations can be suppressed with the standard
\code{declaration} proclamation.
%%\node Structure Types, The Freeze-Type Declaration, The Values Declaration, More About Types in Python
\subsection{Structure Types}
\label{structure-types}
\cindex{structure types}
\cindex{defstruct types}
\cpsubindex{types}{structure}
Because of precise type checking, structure types are much better supported by
Python than by conventional compilers:
\begin{itemize}
\item The structure argument to structure accessors is precisely
checked\dash{}if you call \code{foo-a} on a \code{bar}, an error
will be signaled.
\item The types of slot values are precisely checked\dash{}if you pass
the wrong type argument to a constructor or a slot setter, then an
error will be signaled.
\end{itemize}
This error checking is tremendously useful for detecting bugs in
programs that manipulate complex data structures.
An additional advantage of checking structure types and enforcing slot
types is that the compiler can safely believe slot type declarations.
\python{} effectively moves the type checking from the slot access to
the slot setter or constructor call. This is more efficient since
caller of the setter or constructor often knows the type of the value,
entirely eliminating the need to check the value's type. Consider
this example:
\begin{lisp}
(defstruct coordinate
(x nil :type single-float)
(y nil :type single-float))
(defun make-it ()
(make-coordinate :x 1.0 :y 1.0))
(defun use-it (it)
(declare (type coordinate it))
(sqrt (expt (coordinate-x it) 2) (expt (coordinate-y it) 2)))
\end{lisp}
\code{make-it} and \code{use-it} are compiled with no checking on the
types of the float slots, yet \code{use-it} can use
\code{single-float} arithmetic with perfect safety. Note that
\code{make-coordinate} must still check the values of \code{x} and
\code{y} unless the call is block compiled or inline expanded
(\pxlref{local-call}.) But even without this advantage, it is almost
always more efficient to check slot values on structure
initialization, since slots are usually written once and read many
times.
%%\node The Freeze-Type Declaration, Type Restrictions, Structure Types, More About Types in Python
\subsection{The Freeze-Type Declaration}
\cindex{freeze-type declaration}
\label{freeze-type}
The \code{extensions:freeze-type} declaration is a CMU extension that
enables more efficient compilation of user-defined types by asserting
that the definition is not going to change. This declaration may only
be used globally (with \code{declaim} or \code{proclaim}). Currently
\code{freeze-type} only affects structure type testing done by
\code{typep}, \code{typecase}, etc. Here is an example:
\begin{lisp}
(declaim (freeze-type foo bar))
\end{lisp}
This asserts that the types \code{foo} and \code{bar} and their
subtypes are not going to change. This allows more efficient type
testing, since the compiler can open-code a test for all possible
subtypes, rather than having to examine the type hierarchy at
run-time.
%%\node Type Restrictions, Type Style Recommendations, The Freeze-Type Declaration, More About Types in Python
\subsection{Type Restrictions}
\cpsubindex{types}{restrictions on}
Avoid use of the \code{and}, \code{not} and \code{satisfies} types in
declarations, since type inference has problems with them. When these
types do appear in a declaration, they are still checked precisely,
but the type information is of limited use to the compiler.
\code{and} types are effective as long as the intersection can be
canonicalized to a type that doesn't use \code{and}. For example:
\begin{example}
(and fixnum unsigned-byte)
\end{example}
is fine, since it is the same as:
\begin{example}
(integer 0 \var{most-positive-fixnum})
\end{example}
but this type:
\begin{example}
(and symbol (not (member :end)))
\end{example}
will not be fully understood by type interference since the \code{and}
can't be removed by canonicalization.
Using any of these type specifiers in a type test with \code{typep} or
\code{typecase} is fine, since as tests, these types can be translated
into the \code{and} macro, the \code{not} function or a call to the
satisfies predicate.
%%\node Type Style Recommendations, , Type Restrictions, More About Types in Python
\subsection{Type Style Recommendations}
\cindex{style recommendations}
Python provides good support for some currently unconventional ways of
using the \clisp{} type system. With \python, it is desirable to make
declarations as precise as possible, but type inference also makes
some declarations unnecessary. Here are some general guidelines for
maximum robustness and efficiency:
\begin{itemize}
\item Declare the types of all function arguments and structure slots
as precisely as possible (while avoiding \code{not}, \code{and} and
\code{satisfies}). Put these declarations in during initial coding
so that type assertions can find bugs for you during debugging.
\item Use the \tindexed{member} type specifier where there are a small
number of possible symbol values, for example: \w{\code{(member :red
:blue :green)}}.
\item Use the \tindexed{or} type specifier in situations where the
type is not certain, but there are only a few possibilities, for
example: \w{\code{(or list vector)}}.
\item Declare integer types with the tightest bounds that you can,
such as \code{\w{(integer 3 7)}}.
\item Define \findexed{deftype} or \findexed{defstruct} types before
they are used. Definition after use is legal (producing no
``undefined type'' warnings), but type tests and structure
operations will be compiled much less efficiently.
\item Use the \code{extensions:freeze-type} declaration to speed up
type testing for structure types which won't have new subtypes added
later. \xlref{freeze-type}
\item In addition to declaring the array element type and simpleness,
also declare the dimensions if they are fixed, for example:
\begin{example}
(simple-array single-float (1024 1024))
\end{example}
This bounds information allows array indexing for multi-dimensional
arrays to be compiled much more efficiently, and may also allow
array bounds checking to be done at compile time.
\xlref{array-types}.
\item Avoid use of the \findexed{the} declaration within expressions.
Not only does it clutter the code, but it is also almost worthless
under safe policies. If the need for an output type assertion is
revealed by efficiency notes during tuning, then you can consider
\code{the}, but it is preferable to constrain the argument types
more, allowing the compiler to prove the desired result type.
\item Don't bother declaring the type of \findexed{let} or other
non-argument variables unless the type is non-obvious. If you
declare function return types and structure slot types, then the
type of a variable is often obvious both to the programmer and to
the compiler. An important case where the type isn't obvious, and a
declaration is appropriate, is when the value for a variable is
pulled out of untyped structure (e.g., the result of \code{car}), or
comes from some weakly typed function, such as \code{read}.
\item Declarations are sometimes necessary for integer loop variables,
since the compiler can't always prove that the value is of a good
integer type. These declarations are best added during tuning, when
an efficiency note indicates the need.
\end{itemize}
%%
%%\node Type Inference, Source Optimization, More About Types in Python, Advanced Compiler Use and Efficiency Hints
\section{Type Inference}
\label{type-inference}
\cindex{type inference}
\cindex{inference of types}
\cindex{derivation of types}
Type inference is the process by which the compiler tries to figure
out the types of expressions and variables, given an inevitable lack
of complete type information. Although \python{} does much more type
inference than most \llisp{} compilers, remember that the more precise
and comprehensive type declarations are, the more type inference will
be able to do.
\begin{comment}
* Variable Type Inference::
* Local Function Type Inference::
* Global Function Type Inference::
* Operation Specific Type Inference::
* Dynamic Type Inference::
* Type Check Optimization::
\end{comment}
%%\node Variable Type Inference, Local Function Type Inference, Type Inference, Type Inference
\subsection{Variable Type Inference}
\label{variable-type-inference}
The type of a variable is the union of the types of all the
definitions. In the degenerate case of a let, the type of the
variable is the type of the initial value. This inferred type is
intersected with any declared type, and is then propagated to all the
variable's references. The types of \findexed{multiple-value-bind}
variables are similarly inferred from the types of the individual
values of the values form.
If multiple type declarations apply to a single variable, then all the
declarations must be correct; it is as though all the types were intersected
producing a single \tindexed{and} type specifier. In this example:
\begin{example}
(defmacro my-dotimes ((var count) &body body)
`(do ((,var 0 (1+ ,var)))
((>= ,var ,count))
(declare (type (integer 0 *) ,var))
,@body))
(my-dotimes (i ...)
(declare (fixnum i))
...)
\end{example}
the two declarations for \code{i} are intersected, so \code{i} is
known to be a non-negative fixnum.
In practice, this type inference is limited to lets and local
functions, since the compiler can't analyze all the calls to a global
function. But type inference works well enough on local variables so
that it is often unnecessary to declare the type of local variables.
This is especially likely when function result types and structure
slot types are declared. The main areas where type inference breaks
down are:
\begin{itemize}
\item When the initial value of a variable is a untyped expression,
such as \code{\w{(car x)}}, and
\item When the type of one of the variable's definitions is a function
of the variable's current value, as in: \code{(setq x (1+ x))}
\end{itemize}
%%\node Local Function Type Inference, Global Function Type Inference, Variable Type Inference, Type Inference
\subsection{Local Function Type Inference}
\cpsubindex{local call}{type inference}
The types of arguments to local functions are inferred in the same was
as any other local variable; the type is the union of the argument
types across all the calls to the function, intersected with the
declared type. If there are any assignments to the argument
variables, the type of the assigned value is unioned in as well.
The result type of a local function is computed in a special way that
takes tail recursion (\pxlref{tail-recursion}) into consideration.
The result type is the union of all possible return values that aren't
tail-recursive calls. For example, \python{} will infer that the
result type of this function is \code{integer}:
\begin{lisp}
(defun ! (n res)
(declare (integer n res))
(if (zerop n)
res
(! (1- n) (* n res))))
\end{lisp}
Although this is a rather obvious result, it becomes somewhat less
trivial in the presence of mutual tail recursion of multiple
functions. Local function result type inference interacts with the
mechanisms for ensuring proper tail recursion mentioned in section
\ref{local-call-return}.
%%\node Global Function Type Inference, Operation Specific Type Inference, Local Function Type Inference, Type Inference
\subsection{Global Function Type Inference}
\label{function-type-inference}
\cpsubindex{function}{type inference}
As described in section \ref{function-types}, a global function type
(\tindexed{ftype}) declaration places implicit type assertions on the
call arguments, and also guarantees the type of the return value. So
wherever a call to a declared function appears, there is no doubt as
to the types of the arguments and return value. Furthermore,
\python{} will infer a function type from the function's definition if
there is no \code{ftype} declaration. Any type declarations on the
argument variables are used as the argument types in the derived
function type, and the compiler's best guess for the result type of
the function is used as the result type in the derived function type.
This method of deriving function types from the definition implicitly assumes
that functions won't be redefined at run-time. Consider this example:
\begin{lisp}
(defun foo-p (x)
(let ((res (and (consp x) (eq (car x) 'foo))))
(format t "It is ~:[not ~;~]foo." res)))
(defun frob (it)
(if (foo-p it)
(setf (cadr it) 'yow!)
(1+ it)))
\end{lisp}
Presumably, the programmer really meant to return \code{res} from
\code{foo-p}, but he seems to have forgotten. When he tries to call
do \code{\w{(frob (list 'foo nil))}}, \code{frob} will flame out when
it tries to add to a \code{cons}. Realizing his error, he fixes
\code{foo-p} and recompiles it. But when he retries his test case, he
is baffled because the error is still there. What happened in this
example is that \python{} proved that the result of \code{foo-p} is
\code{null}, and then proceeded to optimize away the \code{setf} in
\code{frob}.
Fortunately, in this example, the error is detected at compile time
due to notes about unreachable code (\pxlref{dead-code-notes}.)
Still, some users may not want to worry about this sort of problem
during incremental development, so there is a variable to control
deriving function types.
\begin{defvar}{extensions:}{derive-function-types}
If true (the default), argument and result type information derived
from compilation of \code{defun}s is used when compiling calls to
that function. If false, only information from \code{ftype}
proclamations will be used.
\end{defvar}
%%\node Operation Specific Type Inference, Dynamic Type Inference, Global Function Type Inference, Type Inference
\subsection{Operation Specific Type Inference}
\label{operation-type-inference}
\cindex{operation specific type inference}
\cindex{arithmetic type inference}
\cpsubindex{numeric}{type inference}
Many of the standard \clisp{} functions have special type inference
procedures that determine the result type as a function of the
argument types. For example, the result type of \code{aref} is the
array element type. Here are some other examples of type inferences:
\begin{lisp}
(logand x #xFF) \result{} (unsigned-byte 8)
(+ (the (integer 0 12) x) (the (integer 0 1) y)) \result{} (integer 0 13)
(ash (the (unsigned-byte 16) x) -8) \result{} (unsigned-byte 8)
\end{lisp}
%%\node Dynamic Type Inference, Type Check Optimization, Operation Specific Type Inference, Type Inference
\subsection{Dynamic Type Inference}
\label{constraint-propagation}
\cindex{dynamic type inference}
\cindex{conditional type inference}
\cpsubindex{type inference}{dynamic}
Python uses flow analysis to infer types in dynamically typed
programs. For example:
\begin{example}
(ecase x
(list (length x))
...)
\end{example}
Here, the compiler knows the argument to \code{length} is a list,
because the call to \code{length} is only done when \code{x} is a
list. The most significant efficiency effect of inference from
assertions is usually in type check optimization.
Dynamic type inference has two inputs: explicit conditionals and
implicit or explicit type assertions. Flow analysis propagates these
constraints on variable type to any code that can be executed only
after passing though the constraint. Explicit type constraints come
from \findexed{if}s where the test is either a lexical variable or a
function of lexical variables and constants, where the function is
either a type predicate, a numeric comparison or \code{eq}.
If there is an \code{eq} (or \code{eql}) test, then the compiler will
actually substitute one argument for the other in the true branch.
For example:
\begin{lisp}
(when (eq x :yow!) (return x))
\end{lisp}
becomes:
\begin{lisp}
(when (eq x :yow!) (return :yow!))
\end{lisp}
This substitution is done when one argument is a constant, or one
argument has better type information than the other. This
transformation reveals opportunities for constant folding or
type-specific optimizations. If the test is against a constant, then
the compiler can prove that the variable is not that constant value in
the false branch, or \w{\code{(not (member :yow!))}} in the example
above. This can eliminate redundant tests, for example:
\begin{example}
(if (eq x nil)
...
(if x a b))
\end{example}
is transformed to this:
\begin{example}
(if (eq x nil)
...
a)
\end{example}
Variables appearing as \code{if} tests are interpreted as
\code{\w{(not (eq \var{var} nil))}} tests. The compiler also converts
\code{=} into \code{eql} where possible. It is difficult to do
inference directly on \code{=} since it does implicit coercions.
When there is an explicit \code{$<$} or \code{$>$} test on
\begin{changebar}
numeric
\end{changebar}
variables, the compiler makes inferences about the ranges the
variables can assume in the true and false branches. This is mainly
useful when it proves that the values are small enough in magnitude to
allow open-coding of arithmetic operations. For example, in many uses
of \code{dotimes} with a \code{fixnum} repeat count, the compiler
proves that fixnum arithmetic can be used.
Implicit type assertions are quite common, especially if you declare
function argument types. Dynamic inference from implicit type
assertions sometimes helps to disambiguate programs to a useful
degree, but is most noticeable when it detects a dynamic type error.
For example:
\begin{lisp}
(defun foo (x)
(+ (car x) x))
\end{lisp}
results in this warning:
\begin{example}
In: DEFUN FOO
(+ (CAR X) X)
==>
X
Warning: Result is a LIST, not a NUMBER.
\end{example}
Note that \llisp{}'s dynamic type checking semantics make dynamic type
inference useful even in programs that aren't really dynamically
typed, for example:
\begin{lisp}
(+ (car x) (length x))
\end{lisp}
Here, \code{x} presumably always holds a list, but in the absence of a
declaration the compiler cannot assume \code{x} is a list simply
because list-specific operations are sometimes done on it. The
compiler must consider the program to be dynamically typed until it
proves otherwise. Dynamic type inference proves that the argument to
\code{length} is always a list because the call to \code{length} is
only done after the list-specific \code{car} operation.
%%\node Type Check Optimization, , Dynamic Type Inference, Type Inference
\subsection{Type Check Optimization}
\label{type-check-optimization}
\cpsubindex{type checking}{optimization}
\cpsubindex{optimization}{type check}
Python backs up its support for precise type checking by minimizing
the cost of run-time type checking. This is done both through type
inference and though optimizations of type checking itself.
Type inference often allows the compiler to prove that a value is of
the correct type, and thus no type check is necessary. For example:
\begin{lisp}
(defstruct foo a b c)
(defstruct link
(foo (required-argument) :type foo)
(next nil :type (or link null)))
(foo-a (link-foo x))
\end{lisp}
Here, there is no need to check that the result of \code{link-foo} is
a \code{foo}, since it always is. Even when some type checks are
necessary, type inference can often reduce the number:
\begin{example}
(defun test (x)
(let ((a (foo-a x))
(b (foo-b x))
(c (foo-c x)))
...))
\end{example}
In this example, only one \w{\code{(foo-p x)}} check is needed. This
applies to a lesser degree in list operations, such as:
\begin{lisp}
(if (eql (car x) 3) (cdr x) y)
\end{lisp}
Here, we only have to check that \code{x} is a list once.
Since \python{} recognizes explicit type tests, code that explicitly
protects itself against type errors has little introduced overhead due
to implicit type checking. For example, this loop compiles with no
implicit checks checks for \code{car} and \code{cdr}:
\begin{lisp}
(defun memq (e l)
(do ((current l (cdr current)))
((atom current) nil)
(when (eq (car current) e) (return current))))
\end{lisp}
\cindex{complemented type checks}
Python reduces the cost of checks that must be done through an
optimization called \var{complementing}. A complemented check for
\var{type} is simply a check that the value is not of the type
\w{\code{(not \var{type})}}. This is only interesting when something
is known about the actual type, in which case we can test for the
complement of \w{\code{(and \var{known-type} (not \var{type}))}}, or
the difference between the known type and the assertion. An example:
\begin{lisp}
(link-foo (link-next x))
\end{lisp}
Here, we change the type check for \code{link-foo} from a test for
\code{foo} to a test for:
\begin{lisp}
(not (and (or foo null) (not foo)))
\end{lisp}
or more simply \w{\code{(not null)}}. This is probably the most
important use of complementing, since the situation is fairly common,
and a \code{null} test is much cheaper than a structure type test.
Here is a more complicated example that illustrates the combination of
complementing with dynamic type inference:
\begin{lisp}
(defun find-a (a x)
(declare (type (or link null) x))
(do ((current x (link-next current)))
((null current) nil)
(let ((foo (link-foo current)))
(when (eq (foo-a foo) a) (return foo)))))
\end{lisp}
This loop can be compiled with no type checks. The \code{link} test
for \code{link-foo} and \code{link-next} is complemented to
\w{\code{(not null)}}, and then deleted because of the explicit
\code{null} test. As before, no check is necessary for \code{foo-a},
since the \code{link-foo} is always a \code{foo}. This sort of
situation shows how precise type checking combined with precise
declarations can actually result in reduced type checking.
%%
%%\node Source Optimization, Tail Recursion, Type Inference, Advanced Compiler Use and Efficiency Hints
\section{Source Optimization}
\label{source-optimization}
\cindex{optimization}
This section describes source-level transformations that \python{} does on
programs in an attempt to make them more efficient. Although source-level
optimizations can make existing programs more efficient, the biggest advantage
of this sort of optimization is that it makes it easier to write efficient
programs. If a clean, straightforward implementation is can be transformed
into an efficient one, then there is no need for tricky and dangerous hand
optimization.
\begin{comment}
* Let Optimization::
* Constant Folding::
* Unused Expression Elimination::
* Control Optimization::
* Unreachable Code Deletion::
* Multiple Values Optimization::
* Source to Source Transformation::
* Style Recommendations::
\end{comment}
%%\node Let Optimization, Constant Folding, Source Optimization, Source Optimization
\subsection{Let Optimization}
\label{let-optimization}
\cindex{let optimization} \cpsubindex{optimization}{let}
The primary optimization of let variables is to delete them when they
are unnecessary. Whenever the value of a let variable is a constant,
a constant variable or a constant (local or non-notinline) function,
the variable is deleted, and references to the variable are replaced
with references to the constant expression. This is useful primarily
in the expansion of macros or inline functions, where argument values
are often constant in any given call, but are in general non-constant
expressions that must be bound to preserve order of evaluation. Let
variable optimization eliminates the need for macros to carefully
avoid spurious bindings, and also makes inline functions just as
efficient as macros.
A particularly interesting class of constant is a local function.
Substituting for lexical variables that are bound to a function can
substantially improve the efficiency of functional programming styles,
for example:
\begin{lisp}
(let ((a #'(lambda (x) (zow x))))
(funcall a 3))
\end{lisp}
effectively transforms to:
\begin{lisp}
(zow 3)
\end{lisp}
This transformation is done even when the function is a closure, as in:
\begin{lisp}
(let ((a (let ((y (zug)))
#'(lambda (x) (zow x y)))))
(funcall a 3))
\end{lisp}
becoming:
\begin{lisp}
(zow 3 (zug))
\end{lisp}
A constant variable is a lexical variable that is never assigned to,
always keeping its initial value. Whenever possible, avoid setting
lexical variables\dash{}instead bind a new variable to the new value.
Except for loop variables, it is almost always possible to avoid
setting lexical variables. This form:
\begin{example}
(let ((x (f x)))
...)
\end{example}
is \var{more} efficient than this form:
\begin{example}
(setq x (f x))
...
\end{example}
Setting variables makes the program more difficult to understand, both
to the compiler and to the programmer. \python{} compiles assignments
at least as efficiently as any other \llisp{} compiler, but most let
optimizations are only done on constant variables.
Constant variables with only a single use are also optimized away,
even when the initial value is not constant.\footnote{The source
transformation in this example doesn't represent the preservation of
evaluation order implicit in the compiler's internal representation.
Where necessary, the back end will reintroduce temporaries to
preserve the semantics.} For example, this expansion of
\code{incf}:
\begin{lisp}
(let ((#:g3 (+ x 1)))
(setq x #:G3))
\end{lisp}
becomes:
\begin{lisp}
(setq x (+ x 1))
\end{lisp}
The type semantics of this transformation are more important than the
elimination of the variable itself. Consider what happens when
\code{x} is declared to be a \code{fixnum}; after the transformation,
the compiler can compile the addition knowing that the result is a
\code{fixnum}, whereas before the transformation the addition would
have to allow for fixnum overflow.
Another variable optimization deletes any variable that is never read.
This causes the initial value and any assigned values to be unused,
allowing those expressions to be deleted if they have no side-effects.
Note that a let is actually a degenerate case of local call
(\pxlref{let-calls}), and that let optimization can be done on calls
that weren't created by a let. Also, local call allows an applicative
style of iteration that is totally assignment free.
%%\node Constant Folding, Unused Expression Elimination, Let Optimization, Source Optimization
\subsection{Constant Folding}
\cindex{constant folding}
\cpsubindex{folding}{constant}
Constant folding is an optimization that replaces a call of constant
arguments with the constant result of that call. Constant folding is
done on all standard functions for which it is legal. Inline
expansion allows folding of any constant parts of the definition, and
can be done even on functions that have side-effects.
It is convenient to rely on constant folding when programming, as in this
example:
\begin{example}
(defconstant limit 42)
(defun foo ()
(... (1- limit) ...))
\end{example}
Constant folding is also helpful when writing macros or inline
functions, since it usually eliminates the need to write a macro that
special-cases constant arguments.
\cindex{constant-function declaration} Constant folding of a user
defined function is enabled by the \code{extensions:constant-function}
proclamation. In this example:
\begin{example}
(declaim (ext:constant-function myfun))
(defun myexp (x y)
(declare (single-float x y))
(exp (* (log x) y)))
... (myexp 3.0 1.3) ...
\end{example}
The call to \code{myexp} is constant-folded to \code{4.1711674}.
%%\node Unused Expression Elimination, Control Optimization, Constant Folding, Source Optimization
\subsection{Unused Expression Elimination}
\cindex{unused expression elimination}
\cindex{dead code elimination}
If the value of any expression is not used, and the expression has no
side-effects, then it is deleted. As with constant folding, this
optimization applies most often when cleaning up after inline
expansion and other optimizations. Any function declared an
\code{extensions:constant-function} is also subject to unused
expression elimination.
Note that \python{} will eliminate parts of unused expressions known
to be side-effect free, even if there are other unknown parts. For
example:
\begin{lisp}
(let ((a (list (foo) (bar))))
(if t
(zow)
(raz a)))
\end{lisp}
becomes:
\begin{lisp}
(progn (foo) (bar))
(zow)
\end{lisp}
%%\node Control Optimization, Unreachable Code Deletion, Unused Expression Elimination, Source Optimization
\subsection{Control Optimization}
\cindex{control optimization}
\cpsubindex{optimization}{control}
The most important optimization of control is recognizing when an
\findexed{if} test is known at compile time, then deleting the
\code{if}, the test expression, and the unreachable branch of the
\code{if}. This can be considered a special case of constant folding,
although the test doesn't have to be truly constant as long as it is
definitely not \false. Note also, that type inference propagates the
result of an \code{if} test to the true and false branches,
\pxlref{constraint-propagation}.
A related \code{if} optimization is this transformation:\footnote{Note
that the code for \code{x} and \code{y} isn't actually replicated.}
\begin{lisp}
(if (if a b c) x y)
\end{lisp}
into:
\begin{lisp}
(if a
(if b x y)
(if c x y))
\end{lisp}
The opportunity for this sort of optimization usually results from a
conditional macro. For example:
\begin{lisp}
(if (not a) x y)
\end{lisp}
is actually implemented as this:
\begin{lisp}
(if (if a nil t) x y)
\end{lisp}
which is transformed to this:
\begin{lisp}
(if a
(if nil x y)
(if t x y))
\end{lisp}
which is then optimized to this:
\begin{lisp}
(if a y x)
\end{lisp}
Note that due to \python{}'s internal representations, the
\code{if}\dash{}\code{if} situation will be recognized even if other
forms are wrapped around the inner \code{if}, like:
\begin{example}
(if (let ((g ...))
(loop
...
(return (not g))
...))
x y)
\end{example}
In \python, all the \clisp{} macros really are macros, written in
terms of \code{if}, \code{block} and \code{tagbody}, so user-defined
control macros can be just as efficient as the standard ones.
\python{} emits basic blocks using a heuristic that minimizes the
number of unconditional branches. The code in a \code{tagbody} will
not be emitted in the order it appeared in the source, so there is no
point in arranging the code to make control drop through to the
target.
%%\node Unreachable Code Deletion, Multiple Values Optimization, Control Optimization, Source Optimization
\subsection{Unreachable Code Deletion}
\label{dead-code-notes}
\cindex{unreachable code deletion}
\cindex{dead code elimination}
Python will delete code whenever it can prove that the code can never be
executed. Code becomes unreachable when:
\begin{itemize}
\item
An \code{if} is optimized away, or
\item
There is an explicit unconditional control transfer such as \code{go} or
\code{return-from}, or
\item
The last reference to a local function is deleted (or there never was any
reference.)
\end{itemize}
When code that appeared in the original source is deleted, the compiler prints
a note to indicate a possible problem (or at least unnecessary code.) For
example:
\begin{lisp}
(defun foo ()
(if t
(write-line "True.")
(write-line "False.")))
\end{lisp}
will result in this note:
\begin{example}
In: DEFUN FOO
(WRITE-LINE "False.")
Note: Deleting unreachable code.
\end{example}
It is important to pay attention to unreachable code notes, since they often
indicate a subtle type error. For example:
\begin{example}
(defstruct foo a b)
(defun lose (x)
(let ((a (foo-a x))
(b (if x (foo-b x) :none)))
...))
\end{example}
results in this note:
\begin{example}
In: DEFUN LOSE
(IF X (FOO-B X) :NONE)
==>
:NONE
Note: Deleting unreachable code.
\end{example}
The \kwd{none} is unreachable, because type inference knows that the argument
to \code{foo-a} must be a \code{foo}, and thus can't be \false. Presumably the
programmer forgot that \code{x} could be \false{} when he wrote the binding for
\code{a}.
Here is an example with an incorrect declaration:
\begin{lisp}
(defun count-a (string)
(do ((pos 0 (position #\back{a} string :start (1+ pos)))
(count 0 (1+ count)))
((null pos) count)
(declare (fixnum pos))))
\end{lisp}
This time our note is:
\begin{example}
In: DEFUN COUNT-A
(DO ((POS 0 #) (COUNT 0 #))
((NULL POS) COUNT)
(DECLARE (FIXNUM POS)))
--> BLOCK LET TAGBODY RETURN-FROM PROGN
==>
COUNT
Note: Deleting unreachable code.
\end{example}
The problem here is that \code{pos} can never be null since it is declared a
\code{fixnum}.
It takes some experience with unreachable code notes to be able to
tell what they are trying to say. In non-obvious cases, the best
thing to do is to call the function in a way that should cause the
unreachable code to be executed. Either you will get a type error, or
you will find that there truly is no way for the code to be executed.
Not all unreachable code results in a note:
\begin{itemize}
\item A note is only given when the unreachable code textually appears
in the original source. This prevents spurious notes due to the
optimization of macros and inline functions, but sometimes also
foregoes a note that would have been useful.
\item Since accurate source information is not available for non-list
forms, there is an element of heuristic in determining whether or
not to give a note about an atom. Spurious notes may be given when
a macro or inline function defines a variable that is also present
in the calling function. Notes about \false{} and \true{} are never
given, since it is too easy to confuse these constants in expanded
code with ones in the original source.
\item Notes are only given about code unreachable due to control flow.
There is no note when an expression is deleted because its value is
unused, since this is a common consequence of other optimizations.
\end{itemize}
Somewhat spurious unreachable code notes can also result when a macro
inserts multiple copies of its arguments in different contexts, for
example:
\begin{lisp}
(defmacro t-and-f (var form)
`(if ,var ,form ,form))
(defun foo (x)
(t-and-f x (if x "True." "False.")))
\end{lisp}
results in these notes:
\begin{example}
In: DEFUN FOO
(IF X "True." "False.")
==>
"False."
Note: Deleting unreachable code.
==>
"True."
Note: Deleting unreachable code.
\end{example}
It seems like it has deleted both branches of the \code{if}, but it has really
deleted one branch in one copy, and the other branch in the other copy. Note
that these messages are only spurious in not satisfying the intent of the rule
that notes are only given when the deleted code appears in the original source;
there is always \var{some} code being deleted when a unreachable code note is
printed.
%%\node Multiple Values Optimization, Source to Source Transformation, Unreachable Code Deletion, Source Optimization
\subsection{Multiple Values Optimization}
\cindex{multiple value optimization}
\cpsubindex{optimization}{multiple value}
Within a function, \python{} implements uses of multiple values
particularly efficiently. Multiple values can be kept in arbitrary
registers, so using multiple values doesn't imply stack manipulation
and representation conversion. For example, this code:
\begin{example}
(let ((a (if x (foo x) u))
(b (if x (bar x) v)))
...)
\end{example}
is actually more efficient written this way:
\begin{example}
(multiple-value-bind
(a b)
(if x
(values (foo x) (bar x))
(values u v))
...)
\end{example}
Also, \pxlref{local-call-return} for information on how local call
provides efficient support for multiple function return values.
%%\node Source to Source Transformation, Style Recommendations, Multiple Values Optimization, Source Optimization
\subsection{Source to Source Transformation}
\cindex{source-to-source transformation}
\cpsubindex{transformation}{source-to-source}
The compiler implements a number of operation-specific optimizations as
source-to-source transformations. You will often see unfamiliar code in error
messages, for example:
\begin{lisp}
(defun my-zerop () (zerop x))
\end{lisp}
gives this warning:
\begin{example}
In: DEFUN MY-ZEROP
(ZEROP X)
==>
(= X 0)
Warning: Undefined variable: X
\end{example}
The original \code{zerop} has been transformed into a call to
\code{=}. This transformation is indicated with the same \code{==$>$}
used to mark macro and function inline expansion. Although it can be
confusing, display of the transformed source is important, since
warnings are given with respect to the transformed source. This a
more obscure example:
\begin{lisp}
(defun foo (x) (logand 1 x))
\end{lisp}
gives this efficiency note:
\begin{example}
In: DEFUN FOO
(LOGAND 1 X)
==>
(LOGAND C::Y C::X)
Note: Forced to do static-function Two-arg-and (cost 53).
Unable to do inline fixnum arithmetic (cost 1) because:
The first argument is a INTEGER, not a FIXNUM.
etc.
\end{example}
Here, the compiler commuted the call to \code{logand}, introducing
temporaries. The note complains that the \var{first} argument is not
a \code{fixnum}, when in the original call, it was the second
argument. To make things more confusing, the compiler introduced
temporaries called \code{c::x} and \code{c::y} that are bound to
\code{y} and \code{1}, respectively.
You will also notice source-to-source optimizations when efficiency
notes are enabled (\pxlref{efficiency-notes}.) When the compiler is
unable to do a transformation that might be possible if there was more
information, then an efficiency note is printed. For example,
\code{my-zerop} above will also give this efficiency note:
\begin{example}
In: DEFUN FOO
(ZEROP X)
==>
(= X 0)
Note: Unable to optimize because:
Operands might not be the same type, so can't open code.
\end{example}
%%\node Style Recommendations, , Source to Source Transformation, Source Optimization
\subsection{Style Recommendations}
\cindex{style recommendations}
Source level optimization makes possible a clearer and more relaxed programming
style:
\begin{itemize}
\item Don't use macros purely to avoid function call. If you want an
inline function, write it as a function and declare it inline. It's
clearer, less error-prone, and works just as well.
\item Don't write macros that try to ``optimize'' their expansion in
trivial ways such as avoiding binding variables for simple
expressions. The compiler does these optimizations too, and is less
likely to make a mistake.
\item Make use of local functions (i.e., \code{labels} or \code{flet})
and tail-recursion in places where it is clearer. Local function
call is faster than full call.
\item Avoid setting local variables when possible. Binding a new
\code{let} variable is at least as efficient as setting an existing
variable, and is easier to understand, both for the compiler and the
programmer.
\item Instead of writing similar code over and over again so that it
can be hand customized for each use, define a macro or inline
function, and let the compiler do the work.
\end{itemize}
%%
%%\node Tail Recursion, Local Call, Source Optimization, Advanced Compiler Use and Efficiency Hints
\section{Tail Recursion}
\label{tail-recursion}
\cindex{tail recursion}
\cindex{recursion}
A call is tail-recursive if nothing has to be done after the the call
returns, i.e. when the call returns, the returned value is immediately
returned from the calling function. In this example, the recursive
call to \code{myfun} is tail-recursive:
\begin{lisp}
(defun myfun (x)
(if (oddp (random x))
(isqrt x)
(myfun (1- x))))
\end{lisp}
Tail recursion is interesting because it is form of recursion that can be
implemented much more efficiently than general recursion. In general, a
recursive call requires the compiler to allocate storage on the stack at
run-time for every call that has not yet returned. This memory consumption
makes recursion unacceptably inefficient for representing repetitive algorithms
having large or unbounded size. Tail recursion is the special case of
recursion that is semantically equivalent to the iteration constructs normally
used to represent repetition in programs. Because tail recursion is equivalent
to iteration, tail-recursive programs can be compiled as efficiently as
iterative programs.
So why would you want to write a program recursively when you can write it
using a loop? Well, the main answer is that recursion is a more general
mechanism, so it can express some solutions simply that are awkward to write as
a loop. Some programmers also feel that recursion is a stylistically
preferable way to write loops because it avoids assigning variables.
For example, instead of writing:
\begin{lisp}
(defun fun1 (x)
something-that-uses-x)
(defun fun2 (y)
something-that-uses-y)
(do ((x something (fun2 (fun1 x))))
(nil))
\end{lisp}
You can write:
\begin{lisp}
(defun fun1 (x)
(fun2 something-that-uses-x))
(defun fun2 (y)
(fun1 something-that-uses-y))
(fun1 something)
\end{lisp}
The tail-recursive definition is actually more efficient, in addition to being
(arguably) clearer. As the number of functions and the complexity of their
call graph increases, the simplicity of using recursion becomes compelling.
Consider the advantages of writing a large finite-state machine with separate
tail-recursive functions instead of using a single huge \code{prog}.
It helps to understand how to use tail recursion if you think of a
tail-recursive call as a \code{psetq} that assigns the argument values to the
called function's variables, followed by a \code{go} to the start of the called
function. This makes clear an inherent efficiency advantage of tail-recursive
call: in addition to not having to allocate a stack frame, there is no need to
prepare for the call to return (e.g., by computing a return PC.)
Is there any disadvantage to tail recursion? Other than an increase
in efficiency, the only way you can tell that a call has been compiled
tail-recursively is if you use the debugger. Since a tail-recursive
call has no stack frame, there is no way the debugger can print out
the stack frame representing the call. The effect is that backtrace
will not show some calls that would have been displayed in a
non-tail-recursive implementation. In practice, this is not as bad as
it sounds\dash{}in fact it isn't really clearly worse, just different.
\xlref{debug-tail-recursion} for information about the debugger
implications of tail recursion.
In order to ensure that tail-recursion is preserved in arbitrarily
complex calling patterns across separately compiled functions, the
compiler must compile any call in a tail-recursive position as a
tail-recursive call. This is done regardless of whether the program
actually exhibits any sort of recursive calling pattern. In this
example, the call to \code{fun2} will always be compiled as a
tail-recursive call:
\begin{lisp}
(defun fun1 (x)
(fun2 x))
\end{lisp}
So tail recursion doesn't necessarily have anything to do with recursion
as it is normally thought of. \xlref{local-tail-recursion} for more
discussion of using tail recursion to implement loops.
\begin{comment}
* Tail Recursion Exceptions::
\end{comment}
%%\node Tail Recursion Exceptions, , Tail Recursion, Tail Recursion
\subsection{Tail Recursion Exceptions}
Although \python{} is claimed to be ``properly'' tail-recursive, some
might dispute this, since there are situations where tail recursion is
inhibited:
\begin{itemize}
\item When the call is enclosed by a special binding, or
\item When the call is enclosed by a \code{catch} or
\code{unwind-protect}, or
\item When the call is enclosed by a \code{block} or \code{tagbody}
and the block name or \code{go} tag has been closed over.
\end{itemize}
These dynamic extent binding forms inhibit tail recursion because they
allocate stack space to represent the binding. Shallow-binding
implementations of dynamic scoping also require cleanup code to be
evaluated when the scope is exited.
%%
%%\node Local Call, Block Compilation, Tail Recursion, Advanced Compiler Use and Efficiency Hints
\section{Local Call}
\label{local-call}
\cindex{local call}
\cpsubindex{call}{local}
\cpsubindex{function call}{local}
Python supports two kinds of function call: full call and local call.
Full call is the standard calling convention; its late binding and
generality make \llisp{} what it is, but create unavoidable overheads.
When the compiler can compile the calling function and the called
function simultaneously, it can use local call to avoid some of the
overhead of full call. Local call is really a collection of
compilation strategies. If some aspect of call overhead is not needed
in a particular local call, then it can be omitted. In some cases,
local call can be totally free. Local call provides two main
advantages to the user:
\begin{itemize}
\item Local call makes the use of the lexical function binding forms
\findexed{flet} and \findexed{labels} much more efficient. A local
call is always faster than a full call, and in many cases is much
faster.
\item Local call is a natural approach to \i{block compilation}, a
compilation technique that resolves function references at compile
time. Block compilation speeds function call, but increases
compilation times and prevents function redefinition.
\end{itemize}
\begin{comment}
* Self-Recursive Calls::
* Let Calls::
* Closures::
* Local Tail Recursion::
* Return Values::
\end{comment}
%%\node Self-Recursive Calls, Let Calls, Local Call, Local Call
\subsection{Self-Recursive Calls}
\cpsubindex{recursion}{self}
Local call is used when a function defined by \code{defun} calls itself. For
example:
\begin{lisp}
(defun fact (n)
(if (zerop n)
1
(* n (fact (1- n)))))
\end{lisp}
This use of local call speeds recursion, but can also complicate
debugging, since \findexed{trace} will only show the first call to
\code{fact}, and not the recursive calls. This is because the
recursive calls directly jump to the start of the function, and don't
indirect through the \code{symbol-function}. Self-recursive local
call is inhibited when the \kwd{block-compile} argument to
\code{compile-file} is \false{} (\pxlref{compile-file-block}.)
%%\node Let Calls, Closures, Self-Recursive Calls, Local Call
\subsection{Let Calls}
\label{let-calls}
Because local call avoids unnecessary call overheads, the compiler
internally uses local call to implement some macros and special forms
that are not normally thought of as involving a function call. For
example, this \code{let}:
\begin{example}
(let ((a (foo))
(b (bar)))
...)
\end{example}
is internally represented as though it was macroexpanded into:
\begin{example}
(funcall #'(lambda (a b)
...)
(foo)
(bar))
\end{example}
This implementation is acceptable because the simple cases of local
call (equivalent to a \code{let}) result in good code. This doesn't
make \code{let} any more efficient, but does make local calls that are
semantically the same as \code{let} much more efficient than full
calls. For example, these definitions are all the same as far as the
compiler is concerned:
\begin{example}
(defun foo ()
...some other stuff...
(let ((a something))
...some stuff...))
(defun foo ()
(flet ((localfun (a)
...some stuff...))
...some other stuff...
(localfun something)))
(defun foo ()
(let ((funvar #'(lambda (a)
...some stuff...)))
...some other stuff...
(funcall funvar something)))
\end{example}
Although local call is most efficient when the function is called only
once, a call doesn't have to be equivalent to a \code{let} to be more
efficient than full call. All local calls avoid the overhead of
argument count checking and keyword argument parsing, and there are a
number of other advantages that apply in many common situations.
\xlref{let-optimization} for a discussion of the optimizations done on
let calls.
%%\node Closures, Local Tail Recursion, Let Calls, Local Call
\subsection{Closures}
\cindex{closures}
Local call allows for much more efficient use of closures, since the
closure environment doesn't need to be allocated on the heap, or even
stored in memory at all. In this example, there is no penalty for
\code{localfun} referencing \code{a} and \code{b}:
\begin{lisp}
(defun foo (a b)
(flet ((localfun (x)
(1+ (* a b x))))
(if (= a b)
(localfun (- x))
(localfun x))))
\end{lisp}
In local call, the compiler effectively passes closed-over values as
extra arguments, so there is no need for you to ``optimize'' local
function use by explicitly passing in lexically visible values.
Closures may also be subject to let optimization
(\pxlref{let-optimization}.)
Note: indirect value cells are currently always allocated on the heap
when a variable is both assigned to (with \code{setq} or \code{setf})
and closed over, regardless of whether the closure is a local function
or not. This is another reason to avoid setting variables when you
don't have to.
%%\node Local Tail Recursion, Return Values, Closures, Local Call
\subsection{Local Tail Recursion}
\label{local-tail-recursion}
\cindex{tail recursion}
\cpsubindex{recursion}{tail}
Tail-recursive local calls are particularly efficient, since they are
in effect an assignment plus a control transfer. Scheme programmers
write loops with tail-recursive local calls, instead of using the
imperative \code{go} and \code{setq}. This has not caught on in the
\clisp{} community, since conventional \llisp{} compilers don't
implement local call. In \python, users can choose to write loops
such as:
\begin{lisp}
(defun ! (n)
(labels ((loop (n total)
(if (zerop n)
total
(loop (1- n) (* n total)))))
(loop n 1)))
\end{lisp}
\begin{defmac}{extensions:}{iterate}{%
\args{\var{name} (\mstar{(\var{var} \var{initial-value})})
\mstar{\var{declaration}} \mstar{\var{form}}}}
This macro provides syntactic sugar for using \findexed{labels} to
do iteration. It creates a local function \var{name} with the
specified \var{var}s as its arguments and the \var{declaration}s and
\var{form}s as its body. This function is then called with the
\var{initial-values}, and the result of the call is return from the
macro.
Here is our factorial example rewritten using \code{iterate}:
\begin{lisp}
(defun ! (n)
(iterate loop
((n n)
(total 1))
(if (zerop n)
total
(loop (1- n) (* n total)))))
\end{lisp}
The main advantage of using \code{iterate} over \code{do} is that
\code{iterate} naturally allows stepping to be done differently
depending on conditionals in the body of the loop. \code{iterate}
can also be used to implement algorithms that aren't really
iterative by simply doing a non-tail call. For example, the
standard recursive definition of factorial can be written like this:
\begin{lisp}
(iterate fact
((n n))
(if (zerop n)
1
(* n (fact (1- n)))))
\end{lisp}
\end{defmac}
%%\node Return Values, , Local Tail Recursion, Local Call
\subsection{Return Values}
\label{local-call-return}
\cpsubindex{return values}{local call}
\cpsubindex{local call}{return values}
One of the more subtle costs of full call comes from allowing
arbitrary numbers of return values. This overhead can be avoided in
local calls to functions that always return the same number of values.
For efficiency reasons (as well as stylistic ones), you should write
functions so that they always return the same number of values. This
may require passing extra \false{} arguments to \code{values} in some
cases, but the result is more efficient, not less so.
When efficiency notes are enabled (\pxlref{efficiency-notes}), and the
compiler wants to use known values return, but can't prove that the
function always returns the same number of values, then it will print
a note like this:
\begin{example}
In: DEFUN GRUE
(DEFUN GRUE (X) (DECLARE (FIXNUM X)) (COND (# #) (# NIL) (T #)))
Note: Return type not fixed values, so can't use known return convention:
(VALUES (OR (INTEGER -536870912 -1) NULL) &REST T)
\end{example}
In order to implement proper tail recursion in the presence of known
values return (\pxlref{tail-recursion}), the compiler sometimes must
prove that multiple functions all return the same number of values.
When this can't be proven, the compiler will print a note like this:
\begin{example}
In: DEFUN BLUE
(DEFUN BLUE (X) (DECLARE (FIXNUM X)) (COND (# #) (# #) (# #) (T #)))
Note: Return value count mismatch prevents known return from
these functions:
BLUE
SNOO
\end{example}
\xlref{number-local-call} for the interaction between local call
and the representation of numeric types.
%%
%%\node Block Compilation, Inline Expansion, Local Call, Advanced Compiler Use and Efficiency Hints
\section{Block Compilation}
\label{block-compilation}
\cindex{block compilation}
\cpsubindex{compilation}{block}
Block compilation allows calls to global functions defined by
\findexed{defun} to be compiled as local calls. The function call
can be in a different top-level form than the \code{defun}, or even in a
different file.
In addition, block compilation allows the declaration of the \i{entry points}
to the block compiled portion. An entry point is any function that may be
called from outside of the block compilation. If a function is not an entry
point, then it can be compiled more efficiently, since all calls are known at
compile time. In particular, if a function is only called in one place, then
it will be let converted. This effectively inline expands the function, but
without the code duplication that results from defining the function normally
and then declaring it inline.
The main advantage of block compilation is that it it preserves efficiency in
programs even when (for readability and syntactic convenience) they are broken
up into many small functions. There is absolutely no overhead for calling a
non-entry point function that is defined purely for modularity (i.e. called
only in one place.)
Block compilation also allows the use of non-descriptor arguments and return
values in non-trivial programs (\pxlref{number-local-call}).
\begin{comment}
* Block Compilation Semantics::
* Block Compilation Declarations::
* Compiler Arguments::
* Practical Difficulties::
* Context Declarations::
* Context Declaration Example::
\end{comment}
%%\node Block Compilation Semantics, Block Compilation Declarations, Block Compilation, Block Compilation
\subsection{Block Compilation Semantics}
The effect of block compilation can be envisioned as the compiler turning all
the \code{defun}s in the block compilation into a single \code{labels} form:
\begin{example}
(declaim (start-block fun1 fun3))
(defun fun1 ()
...)
(defun fun2 ()
...
(fun1)
...)
(defun fun3 (x)
(if x
(fun1)
(fun2)))
(declaim (end-block))
\end{example}
becomes:
\begin{example}
(labels ((fun1 ()
...)
(fun2 ()
...
(fun1)
...)
(fun3 (x)
(if x
(fun1)
(fun2))))
(setf (fdefinition 'fun1) #'fun1)
(setf (fdefinition 'fun3) #'fun3))
\end{example}
Calls between the block compiled functions are local calls, so changing the
global definition of \code{fun1} will have no effect on what \code{fun2} does;
\code{fun2} will keep calling the old \code{fun1}.
The entry points \code{fun1} and \code{fun3} are still installed in
the \code{symbol-function} as the global definitions of the functions,
so a full call to an entry point works just as before. However,
\code{fun2} is not an entry point, so it is not globally defined. In
addition, \code{fun2} is only called in one place, so it will be let
converted.
%%\node Block Compilation Declarations, Compiler Arguments, Block Compilation Semantics, Block Compilation
\subsection{Block Compilation Declarations}
\cpsubindex{declarations}{block compilation}
\cindex{start-block declaration}
\cindex{end-block declaration}
The \code{extensions:start-block} and \code{extensions:end-block}
declarations allow fine-grained control of block compilation. These
declarations are only legal as a global declarations (\code{declaim}
or \code{proclaim}).
\noindent
\vspace{1 em}
The \code{start-block} declaration has this syntax:
\begin{example}
(start-block \mstar{\var{entry-point-name}})
\end{example}
When processed by the compiler, this declaration marks the start of
block compilation, and specifies the entry points to that block. If
no entry points are specified, then \var{all} functions are made into
entry points. If already block compiling, then the compiler ends the
current block and starts a new one.
\noindent
\vspace{1 em}
The \code{end-block} declaration has no arguments:
\begin{lisp}
(end-block)
\end{lisp}
The \code{end-block} declaration ends a block compilation unit without
starting a new one. This is useful mainly when only a portion of a file
is worth block compiling.
%%\node Compiler Arguments, Practical Difficulties, Block Compilation Declarations, Block Compilation
\subsection{Compiler Arguments}
\label{compile-file-block}
\cpsubindex{compile-file}{block compilation arguments}
The \kwd{block-compile} and \kwd{entry-points} arguments to
\code{extensions:compile-from-stream} and \funref{compile-file} provide overall
control of block compilation, and allow block compilation without requiring
modification of the program source.
There are three possible values of the \kwd{block-compile} argument:
\begin{Lentry}
\item[\false{}] Do no compile-time resolution of global function
names, not even for self-recursive calls. This inhibits any
\code{start-block} declarations appearing in the file, allowing all
functions to be incrementally redefined.
\item[\true{}] Start compiling in block compilation mode. This is
mainly useful for block compiling small files that contain no
\code{start-block} declarations. See also the \kwd{entry-points}
argument.
\item[\kwd{specified}] Start compiling in form-at-a-time mode, but
exploit \code{start-block} declarations and compile self-recursive
calls as local calls. Normally \kwd{specified} is the default for
this argument (see \varref{block-compile-default}.)
\end{Lentry}
The \kwd{entry-points} argument can be used in conjunction with
\w{\kwd{block-compile} \true{}} to specify the entry-points to a
block-compiled file. If not specified or \nil, all global functions
will be compiled as entry points. When \kwd{block-compile} is not
\true, this argument is ignored.
\begin{defvar}{}{block-compile-default}
This variable determines the default value for the
\kwd{block-compile} argument to \code{compile-file} and
\code{compile-from-stream}. The initial value of this variable is
\kwd{specified}, but \false{} is sometimes useful for totally
inhibiting block compilation.
\end{defvar}
%%\node Practical Difficulties, Context Declarations, Compiler Arguments, Block Compilation
\subsection{Practical Difficulties}
The main problem with block compilation is that the compiler uses
large amounts of memory when it is block compiling. This places an
upper limit on the amount of code that can be block compiled as a
unit. To make best use of block compilation, it is necessary to
locate the parts of the program containing many internal calls, and
then add the appropriate \code{start-block} declarations. When writing
new code, it is a good idea to put in block compilation declarations
from the very beginning, since writing block declarations correctly
requires accurate knowledge of the program's function call structure.
If you want to initially develop code with full incremental
redefinition, you can compile with \varref{block-compile-default} set to
\false.
Note if a \code{defun} appears in a non-null lexical environment, then
calls to it cannot be block compiled.
Unless files are very small, it is probably impractical to block compile
multiple files as a unit by specifying a list of files to \code{compile-file}.
Semi-inline expansion (\pxlref{semi-inline}) provides another way to
extend block compilation across file boundaries.
%%
%%\node Context Declarations, Context Declaration Example, Practical Difficulties, Block Compilation
\subsection{Context Declarations}
\label{context-declarations}
\cindex{context sensitive declarations}
\cpsubindex{declarations}{context-sensitive}
\cmucl{} has a context-sensitive declaration mechanism which is useful
because it allows flexible control of the compilation policy in large
systems without requiring changes to the source files. The primary
use of this feature is to allow the exported interfaces of a system to
be compiled more safely than the system internals. The context used
is the name being defined and the kind of definition (function, macro,
etc.)
The \kwd{context-declarations} option to \macref{with-compilation-unit} has
dynamic scope, affecting all compilation done during the evaluation of the
body. The argument to this option should evaluate to a list of lists of the
form:
\begin{example}
(\var{context-spec} \mplus{\var{declare-form}})
\end{example}
In the indicated context, the specified declare forms are inserted at
the head of each definition. The declare forms for all contexts that
match are appended together, with earlier declarations getting
precedence over later ones. A simple example:
\begin{example}
:context-declarations
'((:external (declare (optimize (safety 2)))))
\end{example}
This will cause all functions that are named by external symbols to be
compiled with \code{safety 2}.
The full syntax of context specs is:
\begin{Lentry}
\item[\kwd{internal}, \kwd{external}] True if the symbol is internal
(external) in its home package.
\item[\kwd{uninterned}] True if the symbol has no home package.
\item[\code{\w{(:package \mstar{\var{package-name}})}}] True if the
symbol's home package is in any of the named packages (false if
uninterned.)
\item[\kwd{anonymous}] True if the function doesn't have any
interesting name (not \code{defmacro}, \code{defun}, \code{labels}
or \code{flet}).
\item[\kwd{macro}, \kwd{function}] \kwd{macro} is a global
(\code{defmacro}) macro. \kwd{function} is anything else.
\item[\kwd{local}, \kwd{global}] \kwd{local} is a \code{labels} or
\code{flet}. \kwd{global} is anything else.
\item[\code{\w{(:or \mstar{\var{context-spec}})}}] True when any
supplied \var{context-spec} is true.
\item[\code{\w{(:and \mstar{\var{context-spec}})}}] True only when all
supplied \var{context-spec}s are true.
\item[\code{\w{(:not \mstar{\var{context-spec}})}}] True when
\var{context-spec} is false.
\item[\code{\w{(:member \mstar{\var{name}})}}] True when the defined
name is one of these names (\code{equal} test.)
\item[\code{\w{(:match \mstar{\var{pattern}})}}] True when any of the
patterns is a substring of the name. The name is wrapped with
\code{\$}'s, so ``\code{\$FOO}'' matches names beginning with
``\code{FOO}'', etc.
\end{Lentry}
%%\node Context Declaration Example, , Context Declarations, Block Compilation
\subsection{Context Declaration Example}
Here is a more complex example of \code{with-compilation-unit} options:
\begin{example}
:optimize '(optimize (speed 2) (space 2) (inhibit-warnings 2)
(debug 1) (safety 0))
:optimize-interface '(optimize-interface (safety 1) (debug 1))
:context-declarations
'(((:or :external (:and (:match "\%") (:match "SET")))
(declare (optimize-interface (safety 2))))
((:or (:and :external :macro)
(:match "\$PARSE-"))
(declare (optimize (safety 2)))))
\end{example}
The \code{optimize} and \code{extensions:optimize-interface}
declarations (\pxlref{optimize-declaration}) set up the global
compilation policy. The bodies of functions are to be compiled
completely unsafe (\code{safety 0}), but argument count and weakened
argument type checking is to be done when a function is called
(\code{speed 2 safety 1}).
The first declaration specifies that all functions that are external
or whose names contain both ``\code{\%}'' and ``\code{SET}'' are to be
compiled compiled with completely safe interfaces (\code{safety 2}).
The reason for this particular \kwd{match} rule is that \code{setf}
inverse functions in this system tend to have both strings in their
name somewhere. We want \code{setf} inverses to be safe because they
are implicitly called by users even though their name is not exported.
The second declaration makes external macros or functions whose names
start with ``\code{PARSE-}'' have safe bodies (as well as interfaces).
This is desirable because a syntax error in a macro may cause a type
error inside the body. The \kwd{match} rule is used because macros
often have auxiliary functions whose names begin with this string.
This particular example is used to build part of the standard \cmucl{}
system. Note however, that context declarations must be set up
according to the needs and coding conventions of a particular system;
different parts of \cmucl{} are compiled with different context
declarations, and your system will probably need its own declarations.
In particular, any use of the \kwd{match} option depends on naming
conventions used in coding.
%%
%%\node Inline Expansion, Byte Coded Compilation, Block Compilation, Advanced Compiler Use and Efficiency Hints
\section{Inline Expansion}
\label{inline-expansion}
\cindex{inline expansion}
\cpsubindex{expansion}{inline}
\cpsubindex{call}{inline}
\cpsubindex{function call}{inline}
\cpsubindex{optimization}{function call}
Python can expand almost any function inline, including functions
with keyword arguments. The only restrictions are that keyword
argument keywords in the call must be constant, and that global
function definitions (\code{defun}) must be done in a null lexical
environment (not nested in a \code{let} or other binding form.) Local
functions (\code{flet}) can be inline expanded in any environment.
Combined with \python{}'s source-level optimization, inline expansion
can be used for things that formerly required macros for efficient
implementation. In \python, macros don't have any efficiency
advantage, so they need only be used where a macro's syntactic
flexibility is required.
Inline expansion is a compiler optimization technique that reduces
the overhead of a function call by simply not doing the call:
instead, the compiler effectively rewrites the program to appear as
though the definition of the called function was inserted at each
call site. In \llisp, this is straightforwardly expressed by
inserting the \code{lambda} corresponding to the original definition:
\begin{lisp}
(proclaim '(inline my-1+))
(defun my-1+ (x) (+ x 1))
(my-1+ someval) \result{} ((lambda (x) (+ x 1)) someval)
\end{lisp}
When the function expanded inline is large, the program after inline
expansion may be substantially larger than the original program. If
the program becomes too large, inline expansion hurts speed rather
than helping it, since hardware resources such as physical memory and
cache will be exhausted. Inline expansion is called for:
\begin{itemize}
\item When profiling has shown that a relatively simple function is
called so often that a large amount of time is being wasted in the
calling of that function (as opposed to running in that function.)
If a function is complex, it will take a long time to run relative
the time spent in call, so the speed advantage of inline expansion
is diminished at the same time the space cost of inline expansion is
increased. Of course, if a function is rarely called, then the
overhead of calling it is also insignificant.
\item With functions so simple that they take less space to inline
expand than would be taken to call the function (such as
\code{my-1+} above.) It would require intimate knowledge of the
compiler to be certain when inline expansion would reduce space, but
it is generally safe to inline expand functions whose definition is
a single function call, or a few calls to simple \clisp{} functions.
\end{itemize}
In addition to this speed/space tradeoff from inline expansion's
avoidance of the call, inline expansion can also reveal opportunities
for optimization. \python{}'s extensive source-level optimization can
make use of context information from the caller to tremendously
simplify the code resulting from the inline expansion of a function.
The main form of caller context is local information about the actual
argument values: what the argument types are and whether the arguments
are constant. Knowledge about argument types can eliminate run-time
type tests (e.g., for generic arithmetic.) Constant arguments in a
call provide opportunities for constant folding optimization after
inline expansion.
A hidden way that constant arguments are often supplied to functions
is through the defaulting of unsupplied optional or keyword arguments.
There can be a huge efficiency advantage to inline expanding functions
that have complex keyword-based interfaces, such as this definition of
the \code{member} function:
\begin{lisp}
(proclaim '(inline member))
(defun member (item list &key
(key #'identity)
(test #'eql testp)
(test-not nil notp))
(do ((list list (cdr list)))
((null list) nil)
(let ((car (car list)))
(if (cond (testp
(funcall test item (funcall key car)))
(notp
(not (funcall test-not item (funcall key car))))
(t
(funcall test item (funcall key car))))
(return list)))))
\end{lisp}
After inline expansion, this call is simplified to the obvious code:
\begin{lisp}
(member a l :key #'foo-a :test #'char=) \result{}
(do ((list list (cdr list)))
((null list) nil)
(let ((car (car list)))
(if (char= item (foo-a car))
(return list))))
\end{lisp}
In this example, there could easily be more than an order of magnitude
improvement in speed. In addition to eliminating the original call to
\code{member}, inline expansion also allows the calls to \code{char=}
and \code{foo-a} to be open-coded. We go from a loop with three tests
and two calls to a loop with one test and no calls.
\xlref{source-optimization} for more discussion of source level
optimization.
\begin{comment}
* Inline Expansion Recording::
* Semi-Inline Expansion::
* The Maybe-Inline Declaration::
\end{comment}
%%\node Inline Expansion Recording, Semi-Inline Expansion, Inline Expansion, Inline Expansion
\subsection{Inline Expansion Recording}
\cindex{recording of inline expansions}
Inline expansion requires that the source for the inline expanded function to
be available when calls to the function are compiled. The compiler doesn't
remember the inline expansion for every function, since that would take an
excessive about of space. Instead, the programmer must tell the compiler to
record the inline expansion before the definition of the inline expanded
function is compiled. This is done by globally declaring the function inline
before the function is defined, by using the \code{inline} and
\code{extensions:maybe-inline} (\pxlref{maybe-inline-declaration})
declarations.
In addition to recording the inline expansion of inline functions at the time
the function is compiled, \code{compile-file} also puts the inline expansion in
the output file. When the output file is loaded, the inline expansion is made
available for subsequent compilations; there is no need to compile the
definition again to record the inline expansion.
If a function is declared inline, but no expansion is recorded, then the
compiler will give an efficiency note like:
\begin{example}
Note: MYFUN is declared inline, but has no expansion.
\end{example}
When you get this note, check that the \code{inline} declaration and the
definition appear before the calls that are to be inline expanded. This note
will also be given if the inline expansion for a \code{defun} could not be
recorded because the \code{defun} was in a non-null lexical environment.
%%\node Semi-Inline Expansion, The Maybe-Inline Declaration, Inline Expansion Recording, Inline Expansion
\subsection{Semi-Inline Expansion}
\label{semi-inline}
Python supports \var{semi-inline} functions. Semi-inline expansion
shares a single copy of a function across all the calls in a component
by converting the inline expansion into a local function
(\pxlref{local-call}.) This takes up less space when there are
multiple calls, but also provides less opportunity for context
dependent optimization. When there is only one call, the result is
identical to normal inline expansion. Semi-inline expansion is done
when the \code{space} optimization quality is \code{0}, and the
function has been declared \code{extensions:maybe-inline}.
This mechanism of inline expansion combined with local call also
allows recursive functions to be inline expanded. If a recursive
function is declared \code{inline}, calls will actually be compiled
semi-inline. Although recursive functions are often so complex that
there is little advantage to semi-inline expansion, it can still be
useful in the same sort of cases where normal inline expansion is
especially advantageous, i.e. functions where the calling context can
help a lot.
%%\node The Maybe-Inline Declaration, , Semi-Inline Expansion, Inline Expansion
\subsection{The Maybe-Inline Declaration}
\label{maybe-inline-declaration}
\cindex{maybe-inline declaration}
The \code{extensions:maybe-inline} declaration is a \cmucl{}
extension. It is similar to \code{inline}, but indicates that inline
expansion may sometimes be desirable, rather than saying that inline
expansion should almost always be done. When used in a global
declaration, \code{extensions:maybe-inline} causes the expansion for
the named functions to be recorded, but the functions aren't actually
inline expanded unless \code{space} is \code{0} or the function is
eventually (perhaps locally) declared \code{inline}.
Use of the \code{extensions:maybe-inline} declaration followed by the
\code{defun} is preferable to the standard idiom of:
\begin{lisp}
(proclaim '(inline myfun))
(defun myfun () ...)
(proclaim '(notinline myfun))
;;; \i{Any calls to \code{myfun} here are not inline expanded.}
(defun somefun ()
(declare (inline myfun))
;;
;; \i{Calls to \code{myfun} here are inline expanded.}
...)
\end{lisp}
The problem with using \code{notinline} in this way is that in
\clisp{} it does more than just suppress inline expansion, it also
forbids the compiler to use any knowledge of \code{myfun} until a
later \code{inline} declaration overrides the \code{notinline}. This
prevents compiler warnings about incorrect calls to the function, and
also prevents block compilation.
The \code{extensions:maybe-inline} declaration is used like this:
\begin{lisp}
(proclaim '(extensions:maybe-inline myfun))
(defun myfun () ...)
;;; \i{Any calls to \code{myfun} here are not inline expanded.}
(defun somefun ()
(declare (inline myfun))
;;
;; \i{Calls to \code{myfun} here are inline expanded.}
...)
(defun someotherfun ()
(declare (optimize (space 0)))
;;
;; \i{Calls to \code{myfun} here are expanded semi-inline.}
...)
\end{lisp}
In this example, the use of \code{extensions:maybe-inline} causes the
expansion to be recorded when the \code{defun} for \code{somefun} is
compiled, and doesn't waste space through doing inline expansion by
default. Unlike \code{notinline}, this declaration still allows the
compiler to assume that the known definition really is the one that
will be called when giving compiler warnings, and also allows the
compiler to do semi-inline expansion when the policy is appropriate.
When the goal is merely to control whether inline expansion is done by
default, it is preferable to use \code{extensions:maybe-inline} rather
than \code{notinline}. The \code{notinline} declaration should be
reserved for those special occasions when a function may be redefined
at run-time, so the compiler must be told that the obvious definition
of a function is not necessarily the one that will be in effect at the
time of the call.
%%
%%\node Byte Coded Compilation, Object Representation, Inline Expansion, Advanced Compiler Use and Efficiency Hints
\section{Byte Coded Compilation}
\label{byte-compile}
\cindex{byte coded compilation}
\cindex{space optimization}
\Python{} supports byte compilation to reduce the size of Lisp
programs by allowing functions to be compiled more compactly. Byte
compilation provides an extreme speed/space tradeoff: byte code is
typically six times more compact than native code, but runs fifty
times (or more) slower. This is about ten times faster than the
standard interpreter, which is itself considered fast in comparison to
other \clisp{} interpreters.
Large Lisp systems (such as \cmucl{} itself) often have large amounts
of user-interface code, compile-time (macro) code, debugging code, or
rarely executed special-case code. This code is a good target for
byte compilation: very little time is spent running in it, but it can
take up quite a bit of space. Straight-line code with many function
calls is much more suitable than inner loops.
When byte-compiling, the compiler compiles about twice as fast, and
can produce a hardware independent object file (\file{.bytef} type.)
This file can be loaded like a normal fasl file on any implementation
of CMU CL with the same byte-ordering (DEC PMAX has \file{.lbytef}
type.)
The decision to byte compile or native compile can be done on a
per-file or per-code-object basis. The \kwd{byte-compile} argument to
\funref{compile-file} has these possible values:
\begin{Lentry}
\item[\false{}] Don't byte compile anything in this file.
\item[\true{}] Byte compile everything in this file and produce a
processor-independent \file{.bytef} file.
\item[\kwd{maybe}] Produce a normal fasl file, but byte compile any
functions for which the \code{speed} optimization quality is
\code{0} and the \code{debug} quality is not greater than \code{1}.
\end{Lentry}
\begin{defvar}{extensions:}{byte-compile-top-level}
If this variable is true (the default) and the \kwd{byte-compi