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
|
WEBVTT
00:00.200 --> 00:02.340
Hi everybody, my name is Andrea Corallo,
00:02.440 --> 00:03.280
and this presentation is about
00:03.382 --> 00:05.802
the Emacs Lisp Native Compiler --
00:05.904 --> 00:07.083
having GNU Emacs able to
00:07.184 --> 00:08.805
compile and run Emacs Lisp as native code.
00:08.907 --> 00:11.565
This project has been my hobby project
00:11.667 --> 00:14.009
for the last about two years and a half
00:14.111 --> 00:15.408
And we will see a little bit
00:15.509 --> 00:16.969
where this project is coming from,
00:17.070 --> 00:18.913
where we are, and where we want to go.
00:19.015 --> 00:20.571
So essentially everything you need to know
00:20.672 --> 00:22.132
about the Emacs Lisp Native Compiler,
00:22.232 --> 00:23.416
and probably a little more.
00:23.521 --> 00:26.535
Just a little bit of context on Emacs Lisp.
00:26.635 --> 00:30.175
Well, Emacs Lisp is a programming language,
00:30.278 --> 00:33.544
it's indeed a Lisp,
00:33.647 --> 00:36.619
and one year ago I looked for some statistics,
00:36.722 --> 00:38.742
and I was kind of pleased to see
00:38.842 --> 00:40.030
-- surprised to see actually --
00:40.132 --> 00:40.972
that it's still kind of popular
00:41.073 --> 00:42.844
as a programming language.
00:42.944 --> 00:43.684
It doesn't rank that bad
00:43.785 --> 00:45.554
against other programming languages.
00:45.658 --> 00:48.387
Also, the other important fact about Emacs Lisp
00:48.487 --> 00:51.518
is that there is a lot of Emacs Lisp out there,
00:51.622 --> 00:55.922
and this will have an impact [on this project.]
00:56.025 --> 00:57.632
It's a programming language that is capable
00:57.734 --> 00:59.320
of almost any task, so it's
00:59.420 --> 01:01.728
almost a general-purpose programming language,
01:01.831 --> 01:04.116
and this reflects on Emacs itself,
01:04.217 --> 01:07.232
that it's capable of almost any task.
01:07.335 --> 01:09.679
Indeed this "almost" is something we want to fix,
01:09.781 --> 01:10.720
because we want to do everything,
01:10.820 --> 01:14.218
we want [to do] all of our computing [with Emacs].
01:14.321 --> 01:16.523
Also, an interesting aspect for me
01:16.625 --> 01:18.903
is that it's not specified by any standard.
01:19.005 --> 01:22.507
This implies it can evolve in a more agile way
01:22.609 --> 01:25.667
without having to change the standard, etc.
01:25.770 --> 01:27.870
And, in fact, it's kind of improving,
01:27.970 --> 01:30.370
I believe relatively fast.
01:30.473 --> 01:32.791
A little bit about Lisp in general.
01:32.892 --> 01:34.952
First, it's the best programming language ever,
01:35.052 --> 01:35.712
we all know it.
01:35.813 --> 01:37.833
It has a lot of very nice properties,
01:37.934 --> 01:40.356
like it's dynamic, it's homoiconic, etc.
01:40.462 --> 01:42.394
But the interesting thing for implementors,
01:42.496 --> 01:43.476
is that, in theory,
01:43.576 --> 01:46.716
it can be implemented with very few primitives.
01:46.817 --> 01:49.485
You build very few primitives that are like magic,
01:49.590 --> 01:51.838
and on top of this,
01:51.938 --> 01:53.770
you can implement the whole language.
01:53.873 --> 01:55.759
This sounds very nice,
01:55.860 --> 01:57.280
and very appealing for implementors
01:57.381 --> 02:00.175
meaning to implement a new Lisp implementation,
02:00.279 --> 02:02.539
or improving or modifying an existing one.
02:02.641 --> 02:04.163
So the question is:
02:04.263 --> 02:07.663
how many primitives do we have to implement
02:07.764 --> 02:09.384
if we want to change
02:09.485 --> 02:13.203
the GNU Emacs Lisp implementation?
02:13.308 --> 02:20.128
Unfortunately, not really as few as we would like.
02:20.234 --> 02:25.294
In GNU Emacs, we have about 1500 primitives,
02:25.400 --> 02:27.970
and the main reason for that is performance.
02:28.071 --> 02:30.961
Actually, GNU Emacs was written
02:31.064 --> 02:34.292
when performance was a big issue,
02:34.393 --> 02:36.493
and nowadays certain parts
02:36.594 --> 02:38.486
are still performance-critical.
02:38.591 --> 02:40.295
We have a lot of C code;
02:40.395 --> 02:46.331
30% of the GNU Emacs codebase is C code,
02:46.435 --> 02:49.177
and we have to maintain this.
02:49.279 --> 02:52.859
But not only that, this is the main barrier
02:52.959 --> 02:55.579
for people that tried in the past
02:55.681 --> 02:57.663
to change the Emacs Lisp implementation.
02:57.765 --> 02:59.101
Because not only do you have to
02:59.202 --> 03:01.582
replace these primitives,
03:01.683 --> 03:03.907
all of them or part of them,
03:04.012 --> 03:06.384
but sometimes they also share (these primitives),
03:06.484 --> 03:07.952
internal data structures.
03:08.055 --> 03:09.745
For instance, it's very difficult to say:
03:09.846 --> 03:12.826
Now I want to go from C
03:12.926 --> 03:13.906
to a different programming language
03:14.006 --> 03:15.638
for implementing these primitives.
03:15.740 --> 03:17.028
So this has been, effectively,
03:17.128 --> 03:20.380
the main barrier for doing this work.
03:20.486 --> 03:22.090
Another interesting aspect
03:22.190 --> 03:23.870
about the GNU Emacs implementation
03:23.970 --> 03:26.190
is that Lisp can run interpreted
03:26.291 --> 03:28.647
or byte-compiled for performance,
03:28.752 --> 03:30.632
and the byte compiler itself
03:30.733 --> 03:32.673
is written in Emacs Lisp.
03:32.773 --> 03:35.033
This implies that GNU Emacs has to go through
03:35.134 --> 03:37.214
a bootstrap procedure in order to be built.
03:37.319 --> 03:38.715
But it's kind of interesting
03:38.815 --> 03:41.835
for something that started as a text editor,
03:41.937 --> 03:43.101
or something like it.
03:43.203 --> 03:47.877
The byte-code that is Emacs Lisp
03:47.979 --> 03:50.279
when it's been byte compiled,
03:50.379 --> 03:53.079
it's running on a stack-based virtual machine
03:53.180 --> 03:55.146
that is implemented in C.
03:55.253 --> 03:59.741
OK, so I've listed a bunch of areas
03:59.842 --> 04:02.074
where Emacs Lisp could improve:
04:02.178 --> 04:06.924
Namespace, Extensibility, Performance,
04:07.025 --> 04:11.239
and Debuggability, and Diagnostic, we could say.
04:11.346 --> 04:14.326
This activity, this project in particular,
04:14.428 --> 04:17.088
is affecting primarily Performance
04:17.189 --> 04:21.314
and the performance area the Execution Engine.
04:21.414 --> 04:22.570
That said,
04:22.671 --> 04:25.855
I think it has an impact also on Extensibility,
04:25.957 --> 04:27.811
and I hope it will have an impact also
04:27.913 --> 04:29.779
on programming diagnostics,
04:29.881 --> 04:32.501
so giving better warnings, [unknown].
04:32.604 --> 04:36.694
So which are the benefits
04:36.795 --> 04:39.215
of increasing the Emacs Lisp performance?
04:39.316 --> 04:42.976
Indeed, we will have, if we do that,
04:43.078 --> 04:45.668
programs that run faster.
04:45.774 --> 04:48.738
But the main implication of that
04:48.840 --> 04:50.760
is that we could write less C;
04:50.860 --> 04:52.940
we could maintain and debug less C.
04:53.041 --> 04:56.437
That is kind of a time-consuming task.
04:56.542 --> 04:59.502
And we could also allow for
04:59.603 --> 05:01.723
writing performance-critical extensions
05:01.824 --> 05:03.804
directly in Lisp
05:03.909 --> 05:06.305
without having to use systems like
05:06.406 --> 05:09.686
[I think there's a bunch.]
05:09.927 --> 05:14.791
These are very consistent benefits.
05:14.899 --> 05:16.669
OK, Project Goals,
05:16.769 --> 05:18.829
but I think the title of this slide
05:18.930 --> 05:21.520
maybe should be Project Requirements.
05:21.623 --> 05:23.231
So when I started this activity,
05:23.331 --> 05:26.943
I set some requirements for the project,
05:27.049 --> 05:29.469
with the main goal in mind: to go upstream.
05:29.570 --> 05:31.494
So I wanted to create something,
05:31.594 --> 05:34.250
a modified implementation of GNU Emacs,
05:34.353 --> 05:36.675
that was compatible
05:36.776 --> 05:38.596
as close to 100% as possible
05:38.696 --> 05:40.514
to the current implementation.
05:40.620 --> 05:42.720
And when I say "current implementation,"
05:42.820 --> 05:44.758
I don't refer to what
05:44.859 --> 05:46.879
the Emacs Lisp Programming Manual specifies
05:46.980 --> 05:49.804
as expected behavior of the implementation,
05:49.907 --> 05:52.207
but really the implementation itself.
05:52.309 --> 05:53.841
This is because there are a lot of corner cases
05:53.942 --> 05:56.390
that are not specified by the manual,
05:56.493 --> 05:58.093
but programs do rely on that,
05:58.193 --> 06:00.523
and given there is a ton of Emacs Lisp
06:00.625 --> 06:01.935
already around,
06:02.037 --> 06:05.437
compatibility was definitely a major requirement.
06:05.541 --> 06:07.727
I wanted to produce something that had
06:07.827 --> 06:09.587
reduced impact on the Emacs codebase,
06:09.687 --> 06:11.543
at least as much as possible.
06:11.644 --> 06:14.724
So I didn't want to rewrite all of GNU Emacs.
06:14.827 --> 06:17.609
Indeed, because it would have been
06:17.710 --> 06:21.068
too much work for one single person,
06:21.171 --> 06:25.371
but also still thinking
06:25.473 --> 06:29.153
to an upstream outcome all of this time.
06:29.258 --> 06:31.974
Another requirement was to have
06:32.076 --> 06:34.700
no, or very reduced, impact on the user,
06:34.804 --> 06:36.456
so I didn't want to change
06:36.556 --> 06:38.604
the way Emacs is used by you.
06:38.708 --> 06:40.618
And last but not least,
06:40.718 --> 06:42.848
introducing new dependencies,
06:42.951 --> 06:45.379
those dependencies had to be Free Software,
06:45.479 --> 06:47.191
possibly GPL,
06:47.295 --> 06:49.995
and also an important requirement
06:50.097 --> 06:52.941
is that these dependencies had to be
06:53.043 --> 06:55.143
some kind of trusted software that we know
06:55.243 --> 06:56.681
is going to be maintained in the future.
06:56.781 --> 06:59.261
Given Emacs has been around since forever,
06:59.363 --> 07:01.183
and will be around forever and ever,
07:01.285 --> 07:05.265
this was another very important point.
07:05.367 --> 07:08.707
A little bit of history of this project/
07:08.808 --> 07:10.648
a quick timeline.
07:10.748 --> 07:14.388
2019, in May, I did my first commit,
07:14.490 --> 07:17.110
I think it was when I tried to write
07:17.210 --> 07:20.230
my first primitive function ever in C,
07:20.332 --> 07:21.752
in GNU Emacs.
07:21.852 --> 07:24.832
And this was an attempt to try to compile
07:24.934 --> 07:30.314
a function that, once executed, returning [?]
07:30.415 --> 07:33.755
That was it. Six months after (about),
07:33.857 --> 07:37.057
I had something that was kind of working,
07:37.157 --> 07:42.797
So I was able to start up a semi-standard Emacs
07:42.899 --> 07:44.879
and then to compile and load,
07:44.981 --> 07:47.221
and replacing most of the functions
07:47.321 --> 07:50.921
that I had defined floating in my Lisp universe.
07:51.022 --> 07:54.202
Those functions are the functions
07:54.304 --> 07:55.944
that are essentially composing Emacs,
07:56.044 --> 07:57.884
at least the Lisp side of Emacs.
07:57.984 --> 08:01.084
A lot of features were missing,
08:01.186 --> 08:03.426
like I had no Garbage Collector support,
08:03.526 --> 08:07.006
no bootstrap, I was not optimizing these functions
08:07.108 --> 08:10.068
Because optimization [would be broken].
08:10.169 --> 08:12.749
No image dump support, etc.
08:12.850 --> 08:16.330
But I think this proved the design could work.
08:16.431 --> 08:19.171
So I sent to email to emacs-devel. I said
08:19.272 --> 08:20.852
I have this stuff I'm working on,
08:20.953 --> 08:24.613
and I wanted some feedback from the upstream
08:24.714 --> 08:27.534
to see if there was some interest.
08:27.635 --> 08:30.455
I believe the outcome of this was positive
08:30.557 --> 08:32.837
because about one month after,
08:32.937 --> 08:35.697
I pushed my branch within the Emacs git
08:35.798 --> 08:38.438
as a feature branch, and shortly after,
08:38.539 --> 08:42.679
we started to use the bug tracker to track bugs.
08:42.779 --> 08:45.479
So essentially we moved the development
08:45.580 --> 08:50.040
on the upstream infrastructure.
08:50.140 --> 08:55.620
I believe two years after the first commit,
08:55.721 --> 08:57.781
the project was merged
08:57.882 --> 09:00.922
after literally hundreds of bugs solved,
09:01.022 --> 09:03.842
and improvements, suggestions [unknown]
09:03.943 --> 09:08.623
and this was about six months ago.
09:08.723 --> 09:12.363
Before discussing how the native compiler works,
09:12.464 --> 09:14.224
I think it's worth looking at
09:14.324 --> 09:17.644
how Lisp is implemented in GNU Emacs.
09:17.745 --> 09:19.305
We have Lisp_Objects
09:19.405 --> 09:21.945
floating around our Lisp universe,
09:22.045 --> 09:23.905
and they are internally represented in this way.
09:24.006 --> 09:25.606
We have what is called a tagged pointer,
09:25.706 --> 09:27.406
that is just a regular pointer
09:27.506 --> 09:29.286
that is pointing to the area of memory
09:29.386 --> 09:31.926
where we hold the real data of the object.
09:32.027 --> 09:34.187
But within this tagged pointer,
09:34.287 --> 09:36.747
we reserve a few bits
09:36.848 --> 09:38.968
to indicate the type of object we are pointing to.
09:39.068 --> 09:40.528
This is important because
09:40.628 --> 09:42.288
each time we access an object,
09:42.388 --> 09:46.168
we have to typically check those bits
09:46.269 --> 09:49.029
to check that the object we are manipulating
09:49.129 --> 09:50.529
is of the right kind,
09:50.630 --> 09:52.530
remove those bits, and, if we are happy,
09:52.630 --> 09:55.810
access the object, otherwise [unknown].
09:55.910 --> 09:57.690
All the objects are like this,
09:57.791 --> 09:59.731
except for typically Fixnums,
09:59.831 --> 10:01.031
that are small integers
10:01.131 --> 10:04.891
that we manage to fit directly within the pointer.
10:04.992 --> 10:07.292
Also for manipulating Fixnums,
10:07.392 --> 10:09.412
we have to check the tag bits each time.
10:09.513 --> 10:13.173
Whenever we are not sure of the type of object
10:13.273 --> 10:16.493
we are manipulating (read: almost every time),
10:16.594 --> 10:18.914
we have to check those bits and remove those bits
10:19.014 --> 10:21.754
before doing any manipulation on the Fixnum.
10:21.854 --> 10:26.014
How Emacs Lisp is byte-compiled and executed
10:26.115 --> 10:27.775
in, let's call it, "Vanilla".
10:27.875 --> 10:30.055
If we have a Lisp expression of this kind:
10:30.156 --> 10:32.776
We take the variable 'a' we do plus 2,
10:32.876 --> 10:34.876
and then we multiply the result by 3,
10:34.976 --> 10:37.376
the byte compiler will produce this LAP code.
10:37.477 --> 10:38.497
LAP code is essentially
10:38.597 --> 10:40.017
the assembly for the byte-code,
10:40.117 --> 10:43.697
so it's the "intermediate representation"
10:43.798 --> 10:48.458
that will assembled into byte-code. (.elc files)
10:48.558 --> 10:50.738
How is this program executed?
10:50.839 --> 10:53.639
As I mentioned, it's executed in a virtual machine
10:53.739 --> 10:55.699
that is stack-based,
10:55.800 --> 10:58.540
but we start with an execution stack that's empty,
10:58.640 --> 11:01.680
and a stack pointer pointing to its bottom.
11:01.780 --> 11:04.280
And we execute the first instruction,
11:04.380 --> 11:07.120
that is pushing in the stack the value of 'a',
11:07.220 --> 11:10.360
in this case, 100. Then we push the constant 2.
11:10.460 --> 11:12.400
Then we do the summation,
11:12.500 --> 11:14.040
and we have the result in the stack.
11:14.140 --> 11:16.860
Same: we push the constant 3,
11:16.960 --> 11:17.620
we do the multiplication,
11:17.720 --> 11:19.260
and we will be able to return.
11:19.360 --> 11:22.700
Now, what's good and what's bad about this?
11:22.800 --> 11:25.800
A good thing is that it's very simple
11:25.900 --> 11:27.460
to start from Lisp
11:27.560 --> 11:31.320
and compile this kind of LAP output.
11:31.420 --> 11:34.240
At least it's reasonably simple.
11:34.340 --> 11:36.240
The compiler is not that complex.
11:36.340 --> 11:39.000
The bad thing is that all this machinery
11:39.100 --> 11:40.660
-- push and pop, etc. --
11:40.760 --> 11:44.320
it's very different from how a modern CPU works.
11:44.420 --> 11:45.720
Because modern CPUs,
11:45.820 --> 11:47.660
they are not stack-based anymore
11:47.760 --> 11:50.900
but they have instead a fixed number of registers,
11:51.000 --> 11:54.020
and they work with assignment and operation
11:54.120 --> 11:55.040
within these registers
11:55.140 --> 11:57.040
that are generally called "general-purpose."
11:57.140 --> 11:59.260
So to execute this LAP program,
11:59.360 --> 12:00.760
there is another program,
12:00.860 --> 12:02.600
that is the implementation of the VM itself
12:02.700 --> 12:06.400
that is doing conversion during runtime.
12:06.500 --> 12:08.320
So it's interpreting the LAP program
12:08.420 --> 12:11.360
and it's converting it into instructions
12:11.460 --> 12:13.180
that we can execute on the CPU.
12:13.280 --> 12:14.940
This conversion is done each time
12:15.040 --> 12:17.100
we will run some byte-code.
12:17.200 --> 12:19.760
And it's something that we want to avoid.
12:19.860 --> 12:21.560
Instead of this live conversion,
12:21.660 --> 12:26.220
we want to convert once:
12:26.320 --> 12:28.920
our Lisp program into native code,
12:29.020 --> 12:32.380
that is, a binary program that can be executed
12:32.480 --> 12:34.400
directly by our CPU.
12:34.500 --> 12:36.680
We want to save all this unnecessary conversion
12:36.780 --> 12:39.000
that we do each time we are running a program
12:39.100 --> 12:39.760
while we are running it.
12:39.860 --> 12:42.060
And we want to do this process just once,
12:42.160 --> 12:43.740
when we are compiling.
12:43.840 --> 12:46.240
That's the main goal of this activity.
12:46.340 --> 12:50.200
How is the byte compiler implemented?
12:50.300 --> 12:53.940
As any compiler it's a pipeline of transformations.
12:54.040 --> 12:58.560
We go through macro expansion, closure conversion,
12:58.660 --> 13:02.120
we have a bunch of source level optimization.
13:02.220 --> 13:03.940
Then we go into LAP,
13:04.040 --> 13:06.800
that's the transformation we are interested in,
13:06.900 --> 13:10.600
and after a few optimizations on LAP,
13:10.700 --> 13:14.140
LAP is assembled into byte-code.
13:14.240 --> 13:16.880
So if we [list it]
13:16.980 --> 13:19.320
in terms of intermediate representations,
13:19.420 --> 13:23.600
we can simplify this pipeline like this.
13:23.700 --> 13:26.100
We start with Lisp, and at a certain point
13:26.200 --> 13:29.520
we are manipulating the program in LAP form,
13:29.620 --> 13:31.980
and then at the end we produce the byte-code
13:32.080 --> 13:34.560
that is the .elc file that [you run]
13:34.660 --> 13:37.660
What I wanted to realize was something like this.
13:37.760 --> 13:41.200
I wanted to start from LAP, do something,
13:41.300 --> 13:44.600
and jump into GCC using libgccjit
13:44.700 --> 13:45.560
and in particular
13:45.660 --> 13:48.000
the libgccjit Intermediate Representation
13:48.100 --> 13:50.340
that we will discuss.
13:50.440 --> 13:53.120
Now, why I wanted to do something like this?
13:53.220 --> 13:57.300
Essentially, writing a compiler from scratch
13:57.400 --> 14:01.520
for Emacs Lisp would have been a very big task.
14:01.620 --> 14:05.120
So I wanted to rely on, as much as I could,
14:05.220 --> 14:07.180
the Emacs Lisp byte compiler,
14:07.280 --> 14:10.280
because I had to produce something
14:10.380 --> 14:12.920
that was as compatible as possible
14:13.020 --> 14:14.240
to the current implementation.
14:14.340 --> 14:18.340
So this was (I believe) a very good idea
14:18.440 --> 14:20.520
to save an enormous quantity of work
14:20.620 --> 14:22.340
and to produce something
14:22.440 --> 14:24.940
that was compatible in terms of semantics
14:25.040 --> 14:26.820
with the original implementation.
14:26.920 --> 14:30.660
Also, I didn't want to implement a code generator
14:30.760 --> 14:32.860
for each architecture we were targeting,
14:32.960 --> 14:35.900
nor wanted to implement all these optimizations
14:36.000 --> 14:37.840
that are already in GCC,
14:37.940 --> 14:40.120
so I thought it was a good idea
14:40.220 --> 14:44.720
to rely on an existing compiler like GCC [?].
14:44.820 --> 14:47.240
Let's talk about libgccjit.
14:47.340 --> 14:50.180
It was added by David Malcolm in GCC 5
14:50.280 --> 14:55.680
It allows you to describe a C-ish semantic to GCC
14:55.780 --> 14:57.380
and have it compile.
14:57.480 --> 15:01.400
It's good for [reading] Jitters or AoT compilers.
15:01.500 --> 15:04.400
And if we talk about GCC:
15:04.500 --> 15:07.180
it's a compiler, it's a very good one,
15:07.280 --> 15:09.340
it has support for a remarkable number
15:09.440 --> 15:11.640
of target architectures.
15:11.740 --> 15:15.080
It's also very good at generating [fast code],
15:15.180 --> 15:17.980
and it's been around for a long time;
15:18.080 --> 15:21.200
I believe it's like 1 year younger than Emacs.
15:21.300 --> 15:23.220
It's still very well maintained,
15:23.320 --> 15:25.840
and we can assume it will be maintained
15:25.940 --> 15:28.920
for quite a while. And, as I mentioned,
15:29.020 --> 15:31.120
this was a very important point.
15:31.220 --> 15:33.860
Also, it's GPL; it's Free Software,
15:33.960 --> 15:36.120
and it's developed under the GNU umbrella,
15:36.220 --> 15:40.360
so I thought it was a very good option.
15:40.460 --> 15:43.300
So we can imagine a simple translation
15:43.400 --> 15:46.400
that goes from LAP to this subset of C
15:46.500 --> 15:48.880
that we can describe to libgccjit.
15:48.980 --> 15:52.880
This simple translation we can see here,
15:52.980 --> 15:55.680
it's actually pretty trivial.
15:55.780 --> 15:58.500
Instead of doing operations
15:58.600 --> 16:02.060
within the execution stack we have seen before,
16:02.160 --> 16:05.080
we have just an array that is replacing it,
16:05.180 --> 16:07.380
and it's called 'local' in this case,
16:07.480 --> 16:12.360
and we have assignments within this array,
16:12.460 --> 16:15.140
so that they are done in place of the original
16:15.240 --> 16:17.100
push and pop activity of the stack.
16:17.200 --> 16:18.280
The nice thing is that,
16:18.380 --> 16:20.260
when you have done this translation,
16:20.360 --> 16:23.160
GCC will be able to optimize this,
16:23.260 --> 16:25.840
and remove all the unnecessary operations,
16:25.940 --> 16:27.180
and generate code
16:27.280 --> 16:29.660
for the specific CPU you are targeting,
16:29.760 --> 16:32.020
[which will be running your code].
16:32.120 --> 16:34.920
This sounds great; it sounds like
16:35.020 --> 16:37.440
a very simple and effective translation,
16:37.540 --> 16:39.920
and in fact the first iteration of my compiler
16:40.020 --> 16:41.120
was doing just this.
16:41.220 --> 16:45.320
It was essentially a big C function
16:45.420 --> 16:48.240
that was taking LAP and doing this conversion
16:48.340 --> 16:50.120
describing the output to libgccjit.
16:50.220 --> 16:53.720
Unfortunately, if you do this,
16:53.820 --> 16:55.740
you will discover that you have
16:55.840 --> 17:00.080
a performance upper bound limit of about 3x.
17:00.180 --> 17:04.360
So it was an option,
17:04.460 --> 17:06.560
but I thought it was a good occasion
17:06.660 --> 17:08.980
for trying to do something more.
17:09.080 --> 17:11.640
And doing something more means
17:11.740 --> 17:13.680
implementing a smarter compiler
17:13.780 --> 17:17.180
that is doing some advanced analysis on the code,
17:17.280 --> 17:18.640
and will be able to perform
17:18.740 --> 17:20.700
Lisp-specific optimizations
17:20.800 --> 17:22.480
-- optimizations that take advantage of
17:22.580 --> 17:24.960
the specific Lisp semantics,
17:25.060 --> 17:27.760
something that GCC is not aware of.
17:27.860 --> 17:31.240
And while I was thinking about that,
17:31.340 --> 17:34.000
I thought that having a smarter compiler
17:34.100 --> 17:38.120
had also other advantages, like a smarter compiler
17:38.220 --> 17:40.120
that understands the semantics
17:40.220 --> 17:41.820
of the programming language being compiled
17:41.920 --> 17:43.680
would be also capable of
17:43.780 --> 17:45.620
giving feedback to the programmers,
17:45.720 --> 17:47.920
like better warnings and errors.
17:48.020 --> 17:51.360
So I was really fascinated about this idea,
17:51.460 --> 17:53.240
and I wanted to change my implementation
17:53.340 --> 17:55.920
because I was not really happy about it.
17:56.020 --> 17:58.320
I had a lot of C code in terms of
17:58.420 --> 18:02.100
lines that were not doing any smart job.
18:02.200 --> 18:07.380
And I wanted to write all the interesting logic
18:07.480 --> 18:09.940
[in Lisp].
18:10.040 --> 18:12.560
So optimizing outside GCC
18:12.660 --> 18:15.840
before jumping into GCC,
18:15.940 --> 18:20.500
as I mentioned, has two main targets:
18:20.600 --> 18:23.060
Either optimize the code before going into GCC,
18:23.160 --> 18:25.380
or present to GCC some code
18:25.480 --> 18:27.740
that we know GCC can optimize effectively.
18:27.840 --> 18:30.800
And also, this will give, as I mentioned,
18:30.900 --> 18:32.660
better options for the compiler
18:32.760 --> 18:34.420
to provide warnings, errors
18:34.520 --> 18:36.340
-- better diagnostics.
18:36.440 --> 18:38.200
So this is pretty much
18:38.300 --> 18:40.640
what the native compiler looks like nowadays,
18:40.740 --> 18:42.720
in terms of passes.
18:42.820 --> 18:44.560
We have a list of passes,
18:44.660 --> 18:46.620
each of which is taking an input
18:46.720 --> 18:48.120
and producing an output.
18:48.220 --> 18:51.040
So it's doing either analysis on the program
18:51.140 --> 18:52.640
that's being passed,
18:52.740 --> 18:54.760
or it's performing a transformation.
18:54.860 --> 18:57.900
All of these passes are implemented in Lisp,
18:58.000 --> 19:00.440
and only the last pass is implemented in C.
19:00.540 --> 19:05.060
That is the one that is talking to libgccjit.
19:05.160 --> 19:07.760
To do that, I have introduced
19:07.860 --> 19:10.640
a new intermediate representation
19:10.740 --> 19:13.960
that I call LIMPLE, as a tribute to GCC GIMPLE,
19:14.060 --> 19:17.220
that is the main internal representation of GCC,
19:17.320 --> 19:20.600
at least one of the main ones.
19:20.700 --> 19:25.080
Introducing a new intermediate representation
19:25.180 --> 19:27.720
-- a new way of representing my program --
19:27.820 --> 19:29.540
solved a bunch of problems.
19:29.640 --> 19:33.200
First, it allowed me to implement
19:33.300 --> 19:37.280
non-trivial analysis and transformations,
19:37.380 --> 19:40.000
the ones I needed in my compiler pipeline.
19:40.100 --> 19:42.160
But also, it solved the problem of
19:42.260 --> 19:43.840
what was the boundary between
19:43.940 --> 19:46.120
what I had to implement in Lisp,
19:46.220 --> 19:48.040
and what in C.
19:48.140 --> 19:49.040
Because once I had
19:49.140 --> 19:51.860
my intermediate representation defined,
19:51.960 --> 19:53.780
essentially the boundary between Lisp and C
19:53.880 --> 19:55.640
is just a function, that is,
19:55.740 --> 19:57.780
the one that is implementing the final pass.
19:57.880 --> 19:59.220
That is taking, as an input,
19:59.320 --> 20:01.620
all of my programs in LIMPLE representation
20:01.720 --> 20:03.880
and it's doing [his bit].
20:03.980 --> 20:07.980
So I was convinced this design at least had sense.
20:08.080 --> 20:10.120
When we go through some of these passes,
20:10.220 --> 20:12.600
just to give you an idea of what these are doing:
20:12.700 --> 20:14.560
the first pass is just responsible for
20:14.660 --> 20:18.100
spilling the LAP from the byte compiler
20:18.200 --> 20:20.160
that effectively here we are using as a front end
20:20.260 --> 20:21.780
for our compiler pipeline.
20:21.880 --> 20:24.040
The second pass, called 'limplify',
20:24.140 --> 20:27.920
will be in charge of converting LAP into LIMPLE.
20:28.020 --> 20:31.260
LIMPLE is an intermediate representation
20:31.360 --> 20:32.860
that is Control Flow Graph based,
20:32.960 --> 20:34.700
and it's capable of SSA.
20:34.800 --> 20:38.640
So we can have a look to what this means.
20:38.740 --> 20:41.300
Let's assume we have our LAP program,
20:41.400 --> 20:42.520
as any program,
20:42.620 --> 20:43.960
that's a simple list of instructions
20:44.060 --> 20:45.640
that we will execute one after the other.
20:45.740 --> 20:47.360
Some of these instructions
20:47.460 --> 20:49.200
are special instructions
20:49.300 --> 20:51.240
that we call conditional branches,
20:51.340 --> 20:52.800
where we check for a condition,
20:52.900 --> 20:54.320
and if this is verified,
20:54.420 --> 20:56.940
we jump to a different address within the program.
20:57.040 --> 20:59.580
(Addresses that here we are calling 'labels'.)
20:59.680 --> 21:03.440
So we can split our program in chunks,
21:03.540 --> 21:08.200
and those chunks we execute without interruption,
21:08.300 --> 21:10.460
so we always enter from the top of those,
21:10.560 --> 21:12.600
and we exit from the bottom.
21:12.700 --> 21:15.980
We can name those, and split them apart,
21:16.080 --> 21:18.980
and these are what we call basic blocks.
21:19.080 --> 21:22.360
And now we have a bunch of these basic blocks
21:22.460 --> 21:23.380
that are floating,
21:23.480 --> 21:25.020
and they are not any more sorted.
21:25.120 --> 21:25.920
This is what is called
21:26.020 --> 21:28.680
a Control Flow Graph based representation.
21:28.780 --> 21:31.400
Now we can get into the SSA topic.
21:31.500 --> 21:33.900
That stands for Static Single Assignment.
21:34.000 --> 21:35.860
I don't want to get into the details,
21:35.960 --> 21:36.720
but just give you a feeling.
21:36.820 --> 21:38.480
I added into our basic blocks
21:38.580 --> 21:41.400
in our Control Flow Graph a few assignments.
21:41.500 --> 21:43.840
We will transform this into SSA
21:43.940 --> 21:45.040
just for the variable 'x',
21:45.140 --> 21:47.360
just for the sake of demonstrating it.
21:47.460 --> 21:49.760
This is done through a number of phases
21:49.860 --> 21:51.760
that are essentially some analysis,
21:51.860 --> 21:52.600
mainly renaming.
21:52.700 --> 21:55.560
But the outcome, the one we see here,
21:55.660 --> 21:59.120
looks quite similar to the original one,
21:59.220 --> 22:01.120
but we can see that the variable 'x'
22:01.220 --> 22:01.960
has been renamed.
22:02.060 --> 22:03.400
And now we don't have anymore just one,
22:03.500 --> 22:06.140
but a number of these variables.
22:06.240 --> 22:08.000
The interesting property is that
22:08.100 --> 22:10.880
each of these variables is assigned just once.
22:10.980 --> 22:13.240
And this allows for the compiler
22:13.340 --> 22:16.760
to do prediction of the value of that variable,
22:16.860 --> 22:19.040
depending on the position
22:19.140 --> 22:19.840
within the Control Flow Graph.
22:19.940 --> 22:21.980
This is very important. For instance,
22:22.080 --> 22:23.440
a very simple case is 'x1'
22:23.540 --> 22:27.440
that we see is assigned once by definition,
22:27.540 --> 22:29.300
in particular here at the beginning.
22:29.400 --> 22:31.040
Here it's very simple to understand
22:31.140 --> 22:33.080
that x1 will have the value 3.
22:33.180 --> 22:35.380
While, for instance, it's more difficult to prove
22:35.480 --> 22:37.060
what is going to be the value of x5,
22:37.160 --> 22:38.620
because it's calling a function,
22:38.720 --> 22:41.940
or we don't know at the moment what x4 is.
22:42.040 --> 22:46.240
So the compiler will gain the capability
22:46.340 --> 22:48.460
to do prediction on all the variables,
22:48.560 --> 22:50.620
and the more we get information on one variable,
22:50.720 --> 22:54.980
the more we can prove about the others.
22:55.460 --> 22:57.280
Coming back to our passes, the next one
22:57.380 --> 22:59.320
is forward propagation.
22:59.420 --> 23:00.600
This pass is responsible for
23:00.700 --> 23:03.240
doing what I briefly mentioned just before:
23:03.340 --> 23:07.160
doing proof over all the different variables
23:07.260 --> 23:09.620
in different positions of the Control Flow Graph,
23:09.720 --> 23:12.700
about the values, types, or ranges.
23:12.800 --> 23:15.080
This pass is also responsible for
23:15.180 --> 23:16.920
executing functions
23:17.020 --> 23:18.640
when we know that the function has no side effect
23:18.740 --> 23:20.520
and the pass managed to
23:20.620 --> 23:22.440
prove all the values of its argument.
23:22.540 --> 23:24.800
So the function is then executed at compile time
23:24.900 --> 23:26.700
and it doesn't even exist anymore
23:26.800 --> 23:27.880
in the produced code.
23:27.980 --> 23:30.300
Then we have another pass, this is
23:30.400 --> 23:33.420
an example of a pass that is very specific:
23:33.520 --> 23:36.120
it's trying to remove the call to funcall
23:36.220 --> 23:38.040
when those are not necessary.
23:38.140 --> 23:39.760
There are a couple situations
23:39.860 --> 23:42.200
where this is very useful.
23:42.300 --> 23:45.240
And not only is this beneficial
23:45.340 --> 23:47.560
because we are generating better code,
23:47.660 --> 23:49.245
but when we manage to do that,
23:49.345 --> 23:52.000
we allow GCC better analysis over the code,
23:52.100 --> 23:54.440
because GCC knows nothing about funcall.
23:54.540 --> 23:57.400
So if we are calling, from 'foo', directly, 'bar',
23:57.500 --> 24:01.280
for GCC it's way easier to do its analysis
24:01.380 --> 24:03.360
on top of this code.
24:03.460 --> 24:06.240
Another interesting pass we can mention is 'tco'.
24:06.340 --> 24:08.800
This is performing Tail Recursion Elimination.
24:08.900 --> 24:11.880
It allows a more functional programming style,
24:11.980 --> 24:13.220
if you want.
24:13.320 --> 24:14.280
We can jump to the last pass
24:14.380 --> 24:16.200
that is called 'final', and as I mentioned,
24:16.300 --> 24:17.520
this one is responsible for
24:17.620 --> 24:19.880
taking our program in LIMPLE representation
24:19.980 --> 24:24.900
and describing it to libgccjit in the gccjit IR.
24:25.000 --> 24:27.480
That's the main task. It's also
24:27.580 --> 24:29.520
defining inline functions
24:29.620 --> 24:32.400
for accessing fundamental data types, and so on.
24:32.500 --> 24:34.460
This pass is also responsible for
24:34.560 --> 24:36.280
using some of the predictions
24:36.380 --> 24:39.560
done by previous passes to generate better code.
24:39.660 --> 24:41.320
Things we had to add
24:41.420 --> 24:43.880
to have all of this machinery work
24:43.980 --> 24:45.240
and to be controllable:
24:45.340 --> 24:47.480
The first one is an opt called 'native-comp-speed'
24:47.580 --> 24:49.920
and it's equivalent to Common Lisp's 'speed'.
24:50.020 --> 24:51.920
It represents the optimization level.
24:52.020 --> 24:53.400
The default is 2 and is
24:53.500 --> 24:55.400
the maximum optimization level
24:55.500 --> 24:58.600
that is meant to reflect
24:58.700 --> 25:00.860
all the original semantics of Emacs Lisp.
25:00.960 --> 25:02.480
So it's the one that should be used by default.
25:02.580 --> 25:04.640
The second one is 'compilation unit'
25:04.740 --> 25:05.960
and it's a kind of new object
25:06.060 --> 25:11.080
that has been added to Emacs.
25:11.180 --> 25:12.960
Let's have a look to
25:13.060 --> 25:14.360
how the Garbage Collector works in this case.
25:14.460 --> 25:15.840
The GNU Emacs Garbage Collector
25:15.940 --> 25:18.660
is a simple mark-and-sweep garbage collector.
25:18.760 --> 25:21.420
It does a tree walk through all the objects
25:21.520 --> 25:25.100
and follows references from one object to another.
25:25.200 --> 25:27.960
All the objects reachable during the mark phase
25:28.060 --> 25:31.240
will be kept in our Lisp universe.
25:31.340 --> 25:33.680
All the other ones will be freed.
25:33.780 --> 25:35.080
In this case we have a bunch of functions,
25:35.180 --> 25:38.760
'foo1', 'foo2', 'bar1', etc., that are defined.
25:38.860 --> 25:40.320
When a function is defined,
25:40.420 --> 25:42.400
it's accessible through its symbol,
25:42.500 --> 25:44.360
so we have the symbol referring to the function.
25:44.460 --> 25:47.720
The function, in this case a native-compiled one,
25:47.820 --> 25:50.040
is referring to the compilation unit.
25:50.140 --> 25:53.020
The compilation unit is essentially
25:53.120 --> 25:58.600
the ELF file that has been compiled,
25:58.700 --> 26:01.160
and contains all those functions
26:01.260 --> 26:03.240
that came from the original .el file,
26:03.340 --> 26:05.100
and that we have loaded into memory.
26:05.200 --> 26:10.000
If, for instance, 'bar1 and 'bar2 are undefined,
26:10.100 --> 26:14.200
functions [3] and 4 will be no longer reachable,
26:14.300 --> 26:16.040
and we will be able to free them
26:16.140 --> 26:18.160
and unload the compilation unit.
26:18.260 --> 26:21.200
We discussed quite a lot about Control Flow Graph,
26:21.300 --> 26:23.560
SSA, and a lot of boring stuff,
26:23.660 --> 26:25.400
and I promised you that we are doing
26:25.500 --> 26:27.320
a lot of interesting proofs over variables,
26:27.420 --> 26:30.220
So let's have some examples of them.
26:30.320 --> 26:31.840
Let's jump into a quick demo
26:31.940 --> 26:34.480
to see what all of this abstract theory
26:34.580 --> 26:37.680
and this esoteric propagation engine can do for us
26:37.780 --> 26:39.240
and how the user can interact with it.
26:39.340 --> 26:42.100
I've defined a bunch of functions,
26:42.200 --> 26:45.240
and I will native-compile and load it.
26:47.500 --> 26:48.840
Alright, Emacs Lisp native compiled and loaded.
26:48.940 --> 26:52.320
At this point, I can disassemble 'foo1'
26:52.420 --> 26:56.320
to make sure it's native code and I'm not lying.
26:56.420 --> 26:58.500
These are the instructions
26:58.600 --> 27:01.320
that will be executed directly by my CPU
27:01.420 --> 27:03.620
when I call this function.
27:03.720 --> 27:07.520
Alright, very cool.
27:07.620 --> 27:16.080
Now, [Lisp:] (symbol-function #'foo1)
27:16.180 --> 27:19.720
Interestingly, this is returning a subroutine,
27:19.820 --> 27:21.820
as it would be a primitive function.
27:21.920 --> 27:23.700
Because this is native code,
27:23.800 --> 27:24.840
even if it's written in Lisp,
27:24.940 --> 27:26.340
has been converted to native code
27:26.440 --> 27:29.200
as if it's a primitive function.
27:29.300 --> 27:31.560
But we can do also a new thing:
27:31.660 --> 27:34.440
asking for the type of the subroutine.
27:34.540 --> 27:38.360
Alright, very cool. It says this is a function,
27:38.460 --> 27:40.280
it's taking one argument of type 't'
27:40.380 --> 27:41.560
(that means anything
27:41.660 --> 27:42.960
because we don't have any information),
27:43.060 --> 27:45.200
and is returning a type 't',
27:45.300 --> 27:47.380
so also there we don't have much information.
27:47.480 --> 27:49.700
OK, very cool, but not very useful.
27:49.800 --> 27:53.680
Let's see #'foo2. #'foo2 is slightly different,
27:53.780 --> 27:55.840
it doesn't take any argument, but it's returning
27:55.940 --> 27:58.040
an integer included between 3 and 3.
27:58.140 --> 28:01.360
Wow, amazing!
28:01.460 --> 28:04.040
Let's get into something a little more complex:
28:04.140 --> 28:09.440
#'foo3 takes one argument we know nothing about,
28:09.540 --> 28:11.740
but it's returning a number.
28:11.840 --> 28:13.280
And why it's returning a number?
28:13.380 --> 28:16.320
Essentially because 1+ is returning a number,
28:16.420 --> 28:18.880
and in all the other cases,
28:18.980 --> 28:20.640
it would signal an error
28:20.740 --> 28:23.380
if it's not happy about its input argument.
28:23.480 --> 28:27.760
Let's have a look to #'foo4.
28:27.860 --> 28:32.920
#'foo4 is a little bit more complex.
28:33.020 --> 28:34.680
It will return nil
28:34.780 --> 28:37.400
if the 'when' condition is not satisfied,
28:37.500 --> 28:39.720
so it's type 'null' here.
28:39.820 --> 28:41.200
It can return a floating point;
28:41.300 --> 28:43.600
we don't do propagation of floating point so far,
28:43.700 --> 28:47.080
or it can return any integer between 4 and 9.
28:47.180 --> 28:52.840
Wow. Let's go on with #'foo5.
28:52.940 --> 28:55.760
#'foo5 is even more complex
28:55.860 --> 28:57.200
because other than
28:57.300 --> 28:59.180
having to satisfy this condition,
28:59.280 --> 29:02.280
we can see that the result of the propagation
29:02.380 --> 29:03.800
of this complex condition
29:03.900 --> 29:05.460
is propagated also across the 'plus'.
29:05.560 --> 29:08.240
So this foo5 can return nil,
29:08.340 --> 29:09.720
a floating point we know nothing about,
29:09.820 --> 29:13.560
or an integer included between 12 and 24.
29:13.660 --> 29:18.080
Let's go on with #'foo6.
29:18.180 --> 29:23.320
#'foo6 is returning anything but an integer.
29:23.420 --> 29:26.520
I think it should be pretty obvious why,
29:26.620 --> 29:28.120
because if it's not an integer we return it,
29:28.220 --> 29:30.000
otherwise we signal an error.
29:30.100 --> 29:32.880
Let's finish with #'foo7 very quickly.
29:32.980 --> 29:37.920
#'foo7 has another very complex condition,
29:38.020 --> 29:40.320
at least for me, but it's also interesting to see
29:40.420 --> 29:42.200
that we are also propagating values for symbols.
29:42.300 --> 29:45.160
So we can return the symbol 'big,
29:45.260 --> 29:46.980
the symbol 'small,
29:47.080 --> 29:51.200
or an integer included between -100 and 100.
29:51.300 --> 29:54.440
Now, the question is: why all of this is useful
29:54.540 --> 29:56.800
other than having Andrea very happy
29:56.900 --> 29:59.560
when he's playing with this all day?
29:59.660 --> 30:01.440
Well, we have to come back one second
30:01.540 --> 30:04.920
to how Lisp_Objects are represented within Emacs.
30:05.020 --> 30:09.480
Lisp_Objects are represented as machine words,
30:09.580 --> 30:12.580
where we reserve a few bits to indicate the type.
30:12.680 --> 30:15.560
And every time we access the object,
30:15.660 --> 30:17.120
when this is a Fixnum,
30:17.220 --> 30:19.920
or a regular object where this is a pointer,
30:20.020 --> 30:21.600
we always have to extract these bits,
30:21.700 --> 30:24.520
make sure that they satisfy a condition,
30:24.620 --> 30:27.120
so make sure that we are going to manipulate
30:27.220 --> 30:28.580
the object of the type we expect,
30:28.680 --> 30:31.040
and then we can extract the object
30:31.140 --> 30:32.540
and do the manipulation.
30:32.640 --> 30:34.420
If the compiler managed to prove
30:34.620 --> 30:37.400
that the contained object is of the right type,
30:37.500 --> 30:42.440
it will be able to not emit the type check,
30:42.540 --> 30:44.500
and save a lot of instructions.
30:44.600 --> 30:48.560
This is a very powerful optimization.
30:48.660 --> 30:50.760
Let's discuss some potential future development
30:50.860 --> 30:52.000
in this area.
30:52.100 --> 30:53.360
First I think it would be extremely nice
30:53.460 --> 30:54.920
to extend the propagation
30:55.020 --> 30:56.920
to types that are not built in.
30:57.020 --> 30:58.160
There are a lot of cases
30:58.260 --> 31:00.600
where we could optimize effectively.
31:00.700 --> 31:02.520
For instance when we do
31:02.620 --> 31:05.720
a lot of accesses to structures
31:05.820 --> 31:06.920
-- lots of stuff like that --
31:07.020 --> 31:08.880
where we keep on checking and checking
31:08.980 --> 31:10.640
the same object for the type
31:10.740 --> 31:13.080
where it's obvious, where it should be trivial
31:13.180 --> 31:14.720
to prove that it's the right type
31:14.820 --> 31:16.360
after the first access or things like that.
31:16.460 --> 31:18.920
So I believe this is a low-hanging fruit
31:19.020 --> 31:21.180
in terms of performance.
31:21.280 --> 31:23.080
Also I think it would be really nice
31:23.180 --> 31:24.720
to extend the declare mechanism
31:24.820 --> 31:27.600
to allow the user to declare argument types.
31:27.700 --> 31:30.480
(Optionally. Indeed, optionally.)
31:30.580 --> 31:32.880
Doing that would give the compiler
31:32.980 --> 31:35.120
a lot of information to propagate value types
31:35.220 --> 31:36.360
within the function.
31:36.460 --> 31:38.840
But those will allow the compiler
31:38.940 --> 31:43.040
to give the user really good diagnostics
31:43.140 --> 31:45.400
during compile time. Like the compiler could say:
31:45.500 --> 31:47.000
Hey, here you are calling a function
31:47.100 --> 31:49.200
that is expecting this argument of this type,
31:49.300 --> 31:52.000
but I'm proving that you are calling it
31:52.100 --> 31:55.200
with an argument that is of THIS type,
31:55.300 --> 31:57.840
and is not a subtype of the expected one.
31:57.940 --> 32:00.240
So you are doing something not coherent.
32:00.340 --> 32:02.800
This kind of interprocedural logic.
32:02.900 --> 32:05.000
And I think the compiler should also take advantage
32:05.100 --> 32:06.640
(under certain circumstances)
32:06.740 --> 32:08.760
of this interprocedural analysis
32:08.860 --> 32:12.520
in order to optimize even more, when possible.
32:12.620 --> 32:13.720
Also I think we should
32:13.820 --> 32:15.480
work on our [?] to improve the code generation
32:15.580 --> 32:17.100
depending on the prediction
32:17.200 --> 32:18.160
that the compiler is doing.
32:18.260 --> 32:20.120
We already take advantage of those predictions,
32:20.220 --> 32:22.300
but I think we could do better.
32:22.400 --> 32:25.120
A quick look at some performance results.
32:25.220 --> 32:28.720
These are from the elisp-benchmarks package
32:28.820 --> 32:30.760
within GNU ELPA.
32:30.860 --> 32:32.520
This is the performance uplift,
32:32.620 --> 32:38.480
and we can identify about 4 "classes" of results.
32:38.580 --> 32:41.440
The first one there is no performance uplift,
32:41.540 --> 32:42.880
because there is not much we can do,
32:42.980 --> 32:44.720
and the time is probably not spent
32:44.820 --> 32:46.280
within the execution engine.
32:46.380 --> 32:49.000
And the ones around 3x are the ones
32:49.100 --> 32:50.680
Where probably we are not triggering
32:50.780 --> 32:52.640
manually specific optimizations,
32:52.740 --> 32:53.600
but just the fact
32:53.700 --> 32:57.100
that we are converting into native code
32:57.200 --> 33:00.500
is giving us this performance uplift.
33:00.600 --> 33:03.280
Then there is a bunch of other benchmarks
33:03.380 --> 33:05.680
where the Lisp optimizations are triggering,
33:05.780 --> 33:09.620
and the uplift is way bigger,
33:09.720 --> 33:11.900
and then we have 3 benchmarks that at the time
33:12.000 --> 33:13.420
are completely optimized out.
33:13.520 --> 33:15.580
That means the compiler became "so smart"
33:15.680 --> 33:18.160
that it was able to compute the result
33:18.260 --> 33:20.160
in the compile time and just put the result
33:20.260 --> 33:21.400
in the generated binary.
33:21.500 --> 33:23.880
Let's discuss a little bit the compilation model.
33:23.980 --> 33:26.080
This is an Hybrid one;
33:26.180 --> 33:29.420
it's both JIT-like and Ahead-of-Time-like.
33:29.520 --> 33:33.400
Emacs is composed of what we call an Emacs image,
33:33.500 --> 33:36.180
essentially the Emacs binary that we start.
33:36.280 --> 33:37.720
It's including all the C code,
33:37.820 --> 33:41.760
plus all the Lisp code that we preload.
33:41.860 --> 33:46.480
Then we have the rest of the Emacs Lisp codebase
33:46.580 --> 33:49.440
that can be loaded just if it's required.
33:49.540 --> 33:52.760
Same for the external packages, if we have any.
33:52.860 --> 33:55.120
If we build an Emacs Lisp
33:55.220 --> 33:57.940
with native compilation enabled, by default,
33:58.040 --> 34:01.200
only the Emacs image will be native compiled.
34:01.300 --> 34:03.920
All the other code will be compiled
34:04.020 --> 34:06.720
on the fly when it's loaded and executed
34:06.820 --> 34:08.800
the first time, if it's necessary.
34:08.900 --> 34:10.880
Same for the packages, in a transparent way
34:10.980 --> 34:12.640
and asynchronous way.
34:12.740 --> 34:13.480
Also worth noting
34:13.580 --> 34:15.400
that the result of this compilation
34:15.500 --> 34:17.240
will be stored into a cache directory
34:17.340 --> 34:19.900
within the home directory of the user.
34:20.000 --> 34:23.600
So it will be reused in the following sessions
34:23.700 --> 34:25.440
if the same file is loaded,
34:25.540 --> 34:27.520
without having to recompile multiple times
34:27.620 --> 34:29.320
the same file in different sessions.
34:29.420 --> 34:31.520
It works a little bit like this:
34:31.620 --> 34:33.800
When we load the byte-code for the first time,
34:33.900 --> 34:35.900
we spawn a native compilation process.
34:36.000 --> 34:39.320
Meanwhile we keep using the byte-code available.
34:39.420 --> 34:41.180
When the native compilation is finished,
34:41.280 --> 34:43.960
we hot-swap the definition of the functions
34:44.060 --> 34:46.040
that are contained in the file
34:46.140 --> 34:47.960
and start using the native code transparently.
34:48.060 --> 34:49.880
We do this asynchronously,
34:49.980 --> 34:53.140
and for more compilation units at the same time,
34:53.240 --> 34:56.280
so it looks a little bit like this.
34:56.380 --> 34:58.560
Let's try a quick demo of all of this machinery.
34:58.660 --> 35:00.880
I've started a fresh Emacs
35:00.980 --> 35:03.280
with native compilation support,
35:03.380 --> 35:05.060
and at this moment nothing is going on.
35:05.160 --> 35:07.440
We will test the machinery with Tetris,
35:07.540 --> 35:10.460
because I can't imagine anything better
35:10.560 --> 35:12.840
to test this.
35:12.940 --> 35:15.080
What I do expect is that when I launch Tetris
35:15.180 --> 35:17.920
it will be loaded, it will immediately
35:18.020 --> 35:20.460
start execution of the byte-compiled version,
35:20.560 --> 35:23.000
so we won't see any delay in the user experience,
35:23.100 --> 35:25.160
and in the meanwhile, a parallel process
35:25.260 --> 35:28.160
will start to native-compile Tetris itself.
35:28.260 --> 35:30.200
When the native compilation will be finished,
35:30.300 --> 35:33.240
the functions of all Tetris will be hot-swapped.
35:33.340 --> 35:36.280
So we will not see any interruption.
35:36.380 --> 35:39.680
So Tetris started, and it's running,
35:39.780 --> 35:41.600
we have seen no delay, and in the meanwhile,
35:41.700 --> 35:43.520
the native compilation probably already finished,
35:43.620 --> 35:44.960
we can have a look.
35:45.060 --> 35:47.160
In this I see the native compilation log buffer.
35:47.260 --> 35:49.720
So we see that Tetris has been native compiled,
35:49.820 --> 35:51.760
and all of its dependencies.
35:51.860 --> 35:53.840
Now Tetris is still running,
35:53.940 --> 36:00.480
but I can do "C-h f tetris"
36:00.580 --> 36:02.540
and we can see that 'tetris'
36:02.640 --> 36:04.880
is an interactive native compiled
36:04.980 --> 36:07.940
Lisp function, so it has been native-compiled.
36:08.040 --> 36:13.500
I can even disassemble if I want.
36:13.600 --> 36:14.880
OK, so very cool.
36:14.980 --> 36:18.020
I guess we can say this mechanism is working.
36:18.120 --> 36:20.660
Also worth noting that if I go back
36:20.760 --> 36:24.120
to the *Async-native-compile-log* buffer,
36:24.220 --> 36:27.960
we see we have compiled another bunch of files.
36:28.060 --> 36:31.600
I think these are because of my 'C-h f',
36:31.700 --> 36:33.800
this help function command and disassemble,
36:33.900 --> 36:34.920
and so on.
36:35.020 --> 36:37.720
The first time you run Emacs, you will have,
36:37.820 --> 36:41.280
from time to time, these processes spawned.
36:41.380 --> 36:43.100
Emacs is "compiling itself",
36:43.200 --> 36:45.520
and it's replacing the byte-code definition
36:45.620 --> 36:47.640
with the native one. But after a few sessions,
36:47.740 --> 36:49.760
you will not see this anymore,
36:49.860 --> 36:51.360
because the output of this compilation,
36:51.460 --> 36:54.900
as I mentioned, are stored in the user directory.
36:55.000 --> 36:57.560
To conclude: Emacs with native compilation support
36:57.660 --> 36:59.080
is coming up in Emacs 28,
36:59.180 --> 37:01.040
that is gonna be the next major stable release
37:01.140 --> 37:02.080
that will be released.
37:02.180 --> 37:04.840
So we ought to celebrate with a big party,
37:04.940 --> 37:07.320
I believe. But before going to the party,
37:07.420 --> 37:09.080
I'd like to list a few points
37:09.180 --> 37:11.340
that I think have been success factors
37:11.440 --> 37:13.420
in upstreaming this work.
37:13.520 --> 37:15.420
It has been extremely important
37:15.520 --> 37:18.140
to get in touch with upstream as soon as possible,
37:18.240 --> 37:20.680
as soon as I had a proof of concept.
37:20.780 --> 37:22.600
It's been extremely important
37:22.700 --> 37:24.660
to involve the community as much as possible,
37:24.760 --> 37:28.480
and this included keeping a development blog,
37:28.580 --> 37:31.600
and posts about that on emacs-devel,
37:31.700 --> 37:33.720
and also producing material,
37:33.820 --> 37:36.020
participating in conferences,
37:36.120 --> 37:38.320
and giving presentations like the one I'm doing,
37:38.420 --> 37:40.680
to explain what I was doing and how it works.
37:40.780 --> 37:43.040
It has been extremely important, also,
37:43.140 --> 37:45.860
to be able to rely on the upstream infrastructure.
37:45.960 --> 37:47.540
So, to develop the software
37:47.640 --> 37:49.080
as a feature branch in the official git,
37:49.180 --> 37:49.960
but even more, I would say,
37:50.060 --> 37:51.660
to use the official bug tracker
37:51.760 --> 37:52.880
for solving bugs of this branch.
37:52.980 --> 37:54.680
This gave the opportunity
37:54.780 --> 37:58.160
to stay really in close touch with maintainers,
37:58.260 --> 37:59.920
and senior developers of Emacs.
38:00.020 --> 38:02.980
That helped me a lot. And at the same time
38:03.080 --> 38:04.820
they were informed about what I was doing
38:04.920 --> 38:07.360
and what was the status of this feature branch.
38:07.460 --> 38:08.800
Extremely important.
38:08.900 --> 38:11.160
And also I think it played a major role
38:11.260 --> 38:14.120
to try to design this enormous patch
38:14.220 --> 38:18.120
in a way that the impact on the current codebase
38:18.220 --> 38:21.120
was minimized (at least as much as possible).
38:21.220 --> 38:23.660
And also minimizing
38:23.760 --> 38:26.240
the impact on the user operation of the software,
38:26.340 --> 38:28.040
in this case Emacs.
38:28.140 --> 38:29.640
So yes, mandatory Special Thanks:
38:29.740 --> 38:33.360
Emacs developers, and especially maintainers
38:33.460 --> 38:36.680
and senior developers like Stefan Monnier,
38:36.780 --> 38:40.440
that helped me a lot across this long journey.
38:40.540 --> 38:42.800
And, well, all the community
38:42.900 --> 38:45.160
that really got so excited about this project
38:45.260 --> 38:46.240
and gave me the energy
38:46.340 --> 38:49.120
to go through all of this time and development
38:49.220 --> 38:51.980
and bugs and solving, etc. etc.
38:52.080 --> 38:54.920
So yes, it was a really exciting time,
38:55.020 --> 38:58.000
and I think we have to look forward
38:58.100 --> 39:01.400
and start thinking about how to improve all this
39:01.500 --> 39:02.920
for the following years.
39:03.020 --> 39:04.300
And that's it.
39:04.400 --> 39:06.040
I think I should be online for questions.
39:06.140 --> 39:07.480
Thank you very much.
39:07.580 --> 39:07.680
[captions by John Cummings]
|