diff options
| author | Andrea Corallo | 2019-06-22 18:04:16 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2020-01-01 11:33:43 +0100 |
| commit | 1d46302e725fabf7ccb2cfbe76c2b175039ac0f0 (patch) | |
| tree | c9a0e9667bf7c0cd29e531d88aaeb9244a0eef60 /src/comp.c | |
| parent | 11ca831f996e1a0a732f811de75008b714f3836a (diff) | |
| download | emacs-1d46302e725fabf7ccb2cfbe76c2b175039ac0f0.tar.gz emacs-1d46302e725fabf7ccb2cfbe76c2b175039ac0f0.zip | |
dump all ops as comments
Diffstat (limited to 'src/comp.c')
| -rw-r--r-- | src/comp.c | 288 |
1 files changed, 168 insertions, 120 deletions
diff --git a/src/comp.c b/src/comp.c index 8563ff0b8f0..e0688b626ae 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -122,6 +122,13 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 122 | /* With most of the ops we need to do the same stuff so this macros are meant | 122 | /* With most of the ops we need to do the same stuff so this macros are meant |
| 123 | to save some typing. */ | 123 | to save some typing. */ |
| 124 | 124 | ||
| 125 | #define CASE(op) \ | ||
| 126 | case op : \ | ||
| 127 | if (COMP_DEBUG) \ | ||
| 128 | gcc_jit_block_add_comment (comp.bblock->gcc_bb, \ | ||
| 129 | NULL, \ | ||
| 130 | "Opcode " STR(op)); | ||
| 131 | |||
| 125 | /* Pop from the meta-stack, emit the call and push the result */ | 132 | /* Pop from the meta-stack, emit the call and push the result */ |
| 126 | 133 | ||
| 127 | #define EMIT_CALL_N(name, nargs) \ | 134 | #define EMIT_CALL_N(name, nargs) \ |
| @@ -134,7 +141,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 134 | /* Generate appropriate case and emit call to function. */ | 141 | /* Generate appropriate case and emit call to function. */ |
| 135 | 142 | ||
| 136 | #define CASE_CALL_NARGS(name, nargs) \ | 143 | #define CASE_CALL_NARGS(name, nargs) \ |
| 137 | case B##name: \ | 144 | CASE (B##name) \ |
| 138 | EMIT_CALL_N (STR(F##name), nargs); \ | 145 | EMIT_CALL_N (STR(F##name), nargs); \ |
| 139 | break | 146 | break |
| 140 | 147 | ||
| @@ -1386,36 +1393,47 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1386 | 1393 | ||
| 1387 | switch (op) | 1394 | switch (op) |
| 1388 | { | 1395 | { |
| 1389 | case Bstack_ref1: | 1396 | CASE (Bstack_ref1) |
| 1390 | case Bstack_ref2: | 1397 | goto stack_ref; |
| 1391 | case Bstack_ref3: | 1398 | CASE (Bstack_ref2) |
| 1392 | case Bstack_ref4: | 1399 | goto stack_ref; |
| 1393 | case Bstack_ref5: | 1400 | CASE (Bstack_ref3) |
| 1401 | goto stack_ref; | ||
| 1402 | CASE (Bstack_ref4) | ||
| 1403 | goto stack_ref; | ||
| 1404 | CASE (Bstack_ref5) | ||
| 1405 | stack_ref: | ||
| 1394 | PUSH_LVAL (stack_base[(stack - stack_base) - (op - Bstack_ref) - 1]); | 1406 | PUSH_LVAL (stack_base[(stack - stack_base) - (op - Bstack_ref) - 1]); |
| 1395 | break; | 1407 | break; |
| 1396 | 1408 | ||
| 1397 | case Bstack_ref6: | 1409 | CASE (Bstack_ref6) |
| 1398 | PUSH_LVAL (stack_base[(stack - stack_base) - FETCH - 1]); | 1410 | PUSH_LVAL (stack_base[(stack - stack_base) - FETCH - 1]); |
| 1399 | break; | 1411 | break; |
| 1400 | 1412 | ||
| 1401 | case Bstack_ref7: | 1413 | CASE (Bstack_ref7) |
| 1402 | PUSH_LVAL (stack_base[(stack - stack_base) - FETCH2 - 1]); | 1414 | PUSH_LVAL (stack_base[(stack - stack_base) - FETCH2 - 1]); |
| 1403 | break; | 1415 | break; |
| 1404 | 1416 | ||
| 1405 | case Bvarref7: | 1417 | CASE (Bvarref7) |
| 1406 | op = FETCH2; | 1418 | op = FETCH2; |
| 1407 | goto varref; | 1419 | goto varref; |
| 1408 | 1420 | ||
| 1409 | case Bvarref: | 1421 | CASE (Bvarref) |
| 1410 | case Bvarref1: | 1422 | goto varref_count; |
| 1411 | case Bvarref2: | 1423 | CASE (Bvarref1) |
| 1412 | case Bvarref3: | 1424 | goto varref_count; |
| 1413 | case Bvarref4: | 1425 | CASE (Bvarref2) |
| 1414 | case Bvarref5: | 1426 | goto varref_count; |
| 1427 | CASE (Bvarref3) | ||
| 1428 | goto varref_count; | ||
| 1429 | CASE (Bvarref4) | ||
| 1430 | goto varref_count; | ||
| 1431 | CASE (Bvarref5) | ||
| 1432 | varref_count: | ||
| 1415 | op -= Bvarref; | 1433 | op -= Bvarref; |
| 1416 | goto varref; | 1434 | goto varref; |
| 1417 | 1435 | ||
| 1418 | case Bvarref6: | 1436 | CASE (Bvarref6) |
| 1419 | op = FETCH; | 1437 | op = FETCH; |
| 1420 | varref: | 1438 | varref: |
| 1421 | { | 1439 | { |
| @@ -1425,20 +1443,26 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1425 | break; | 1443 | break; |
| 1426 | } | 1444 | } |
| 1427 | 1445 | ||
| 1428 | case Bvarset: | 1446 | CASE (Bvarset) |
| 1429 | case Bvarset1: | 1447 | goto varset_count; |
| 1430 | case Bvarset2: | 1448 | CASE (Bvarset1) |
| 1431 | case Bvarset3: | 1449 | goto varset_count; |
| 1432 | case Bvarset4: | 1450 | CASE (Bvarset2) |
| 1433 | case Bvarset5: | 1451 | goto varset_count; |
| 1452 | CASE (Bvarset3) | ||
| 1453 | goto varset_count; | ||
| 1454 | CASE (Bvarset4) | ||
| 1455 | goto varset_count; | ||
| 1456 | CASE (Bvarset5) | ||
| 1457 | varset_count: | ||
| 1434 | op -= Bvarset; | 1458 | op -= Bvarset; |
| 1435 | goto varset; | 1459 | goto varset; |
| 1436 | 1460 | ||
| 1437 | case Bvarset7: | 1461 | CASE (Bvarset7) |
| 1438 | op = FETCH2; | 1462 | op = FETCH2; |
| 1439 | goto varset; | 1463 | goto varset; |
| 1440 | 1464 | ||
| 1441 | case Bvarset6: | 1465 | CASE (Bvarset6) |
| 1442 | op = FETCH; | 1466 | op = FETCH; |
| 1443 | varset: | 1467 | varset: |
| 1444 | { | 1468 | { |
| @@ -1454,20 +1478,26 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1454 | } | 1478 | } |
| 1455 | break; | 1479 | break; |
| 1456 | 1480 | ||
| 1457 | case Bvarbind6: | 1481 | CASE (Bvarbind6) |
| 1458 | op = FETCH; | 1482 | op = FETCH; |
| 1459 | goto varbind; | 1483 | goto varbind; |
| 1460 | 1484 | ||
| 1461 | case Bvarbind7: | 1485 | CASE (Bvarbind7) |
| 1462 | op = FETCH2; | 1486 | op = FETCH2; |
| 1463 | goto varbind; | 1487 | goto varbind; |
| 1464 | 1488 | ||
| 1465 | case Bvarbind: | 1489 | CASE (Bvarbind) |
| 1466 | case Bvarbind1: | 1490 | goto varbind_count; |
| 1467 | case Bvarbind2: | 1491 | CASE (Bvarbind1) |
| 1468 | case Bvarbind3: | 1492 | goto varbind_count; |
| 1469 | case Bvarbind4: | 1493 | CASE (Bvarbind2) |
| 1470 | case Bvarbind5: | 1494 | goto varbind_count; |
| 1495 | CASE (Bvarbind3) | ||
| 1496 | goto varbind_count; | ||
| 1497 | CASE (Bvarbind4) | ||
| 1498 | goto varbind_count; | ||
| 1499 | CASE (Bvarbind5) | ||
| 1500 | varbind_count: | ||
| 1471 | op -= Bvarbind; | 1501 | op -= Bvarbind; |
| 1472 | varbind: | 1502 | varbind: |
| 1473 | { | 1503 | { |
| @@ -1478,20 +1508,26 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1478 | break; | 1508 | break; |
| 1479 | } | 1509 | } |
| 1480 | 1510 | ||
| 1481 | case Bcall6: | 1511 | CASE (Bcall6) |
| 1482 | op = FETCH; | 1512 | op = FETCH; |
| 1483 | goto docall; | 1513 | goto docall; |
| 1484 | 1514 | ||
| 1485 | case Bcall7: | 1515 | CASE (Bcall7) |
| 1486 | op = FETCH2; | 1516 | op = FETCH2; |
| 1487 | goto docall; | 1517 | goto docall; |
| 1488 | 1518 | ||
| 1489 | case Bcall: | 1519 | CASE (Bcall) |
| 1490 | case Bcall1: | 1520 | goto docall_count; |
| 1491 | case Bcall2: | 1521 | CASE (Bcall1) |
| 1492 | case Bcall3: | 1522 | goto docall_count; |
| 1493 | case Bcall4: | 1523 | CASE (Bcall2) |
| 1494 | case Bcall5: | 1524 | goto docall_count; |
| 1525 | CASE (Bcall3) | ||
| 1526 | goto docall_count; | ||
| 1527 | CASE (Bcall4) | ||
| 1528 | goto docall_count; | ||
| 1529 | CASE (Bcall5) | ||
| 1530 | docall_count: | ||
| 1495 | op -= Bcall; | 1531 | op -= Bcall; |
| 1496 | docall: | 1532 | docall: |
| 1497 | { | 1533 | { |
| @@ -1502,20 +1538,26 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1502 | break; | 1538 | break; |
| 1503 | } | 1539 | } |
| 1504 | 1540 | ||
| 1505 | case Bunbind6: | 1541 | CASE (Bunbind6) |
| 1506 | op = FETCH; | 1542 | op = FETCH; |
| 1507 | goto dounbind; | 1543 | goto dounbind; |
| 1508 | 1544 | ||
| 1509 | case Bunbind7: | 1545 | CASE (Bunbind7) |
| 1510 | op = FETCH2; | 1546 | op = FETCH2; |
| 1511 | goto dounbind; | 1547 | goto dounbind; |
| 1512 | 1548 | ||
| 1513 | case Bunbind: | 1549 | CASE (Bunbind) |
| 1514 | case Bunbind1: | 1550 | goto dounbind_count; |
| 1515 | case Bunbind2: | 1551 | CASE (Bunbind1) |
| 1516 | case Bunbind3: | 1552 | goto dounbind_count; |
| 1517 | case Bunbind4: | 1553 | CASE (Bunbind2) |
| 1518 | case Bunbind5: | 1554 | goto dounbind_count; |
| 1555 | CASE (Bunbind3) | ||
| 1556 | goto dounbind_count; | ||
| 1557 | CASE (Bunbind4) | ||
| 1558 | goto dounbind_count; | ||
| 1559 | CASE (Bunbind5) | ||
| 1560 | dounbind_count: | ||
| 1519 | op -= Bunbind; | 1561 | op -= Bunbind; |
| 1520 | dounbind: | 1562 | dounbind: |
| 1521 | { | 1563 | { |
| @@ -1527,7 +1569,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1527 | } | 1569 | } |
| 1528 | break; | 1570 | break; |
| 1529 | 1571 | ||
| 1530 | case Bpophandler: | 1572 | CASE (Bpophandler) |
| 1531 | { | 1573 | { |
| 1532 | /* current_thread->m_handlerlist = | 1574 | /* current_thread->m_handlerlist = |
| 1533 | current_thread->m_handlerlist->next; */ | 1575 | current_thread->m_handlerlist->next; */ |
| @@ -1548,11 +1590,11 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1548 | break; | 1590 | break; |
| 1549 | } | 1591 | } |
| 1550 | 1592 | ||
| 1551 | case Bpushconditioncase: /* New in 24.4. */ | 1593 | CASE (Bpushconditioncase) /* New in 24.4. */ |
| 1552 | type = CATCHER; | 1594 | type = CATCHER; |
| 1553 | goto pushhandler; | 1595 | goto pushhandler; |
| 1554 | 1596 | ||
| 1555 | case Bpushcatch: /* New in 24.4. */ | 1597 | CASE (Bpushcatch) /* New in 24.4. */ |
| 1556 | type = CONDITION_CASE;; | 1598 | type = CONDITION_CASE;; |
| 1557 | pushhandler: | 1599 | pushhandler: |
| 1558 | { | 1600 | { |
| @@ -1632,7 +1674,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1632 | CASE_CALL_NARGS (nth, 2); | 1674 | CASE_CALL_NARGS (nth, 2); |
| 1633 | CASE_CALL_NARGS (symbolp, 1); | 1675 | CASE_CALL_NARGS (symbolp, 1); |
| 1634 | 1676 | ||
| 1635 | case Bconsp: | 1677 | CASE (Bconsp) |
| 1636 | POP1; | 1678 | POP1; |
| 1637 | res = emit_cast (comp.bool_type, | 1679 | res = emit_cast (comp.bool_type, |
| 1638 | emit_CONSP (args[0])); | 1680 | emit_CONSP (args[0])); |
| @@ -1652,14 +1694,18 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1652 | CASE_CALL_NARGS (cdr, 1); | 1694 | CASE_CALL_NARGS (cdr, 1); |
| 1653 | CASE_CALL_NARGS (cons, 2); | 1695 | CASE_CALL_NARGS (cons, 2); |
| 1654 | 1696 | ||
| 1655 | case BlistN: | 1697 | CASE (BlistN) |
| 1656 | op = FETCH; | 1698 | op = FETCH; |
| 1657 | goto make_list; | 1699 | goto make_list; |
| 1658 | 1700 | ||
| 1659 | case Blist1: | 1701 | CASE (Blist1) |
| 1660 | case Blist2: | 1702 | goto make_list_count; |
| 1661 | case Blist3: | 1703 | CASE (Blist2) |
| 1662 | case Blist4: | 1704 | goto make_list_count; |
| 1705 | CASE (Blist3) | ||
| 1706 | goto make_list_count; | ||
| 1707 | CASE (Blist4) | ||
| 1708 | make_list_count: | ||
| 1663 | op = op - Blist1; | 1709 | op = op - Blist1; |
| 1664 | make_list: | 1710 | make_list: |
| 1665 | { | 1711 | { |
| @@ -1686,21 +1732,21 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1686 | CASE_CALL_NARGS (get, 2); | 1732 | CASE_CALL_NARGS (get, 2); |
| 1687 | CASE_CALL_NARGS (substring, 3); | 1733 | CASE_CALL_NARGS (substring, 3); |
| 1688 | 1734 | ||
| 1689 | case Bconcat2: | 1735 | CASE (Bconcat2) |
| 1690 | EMIT_SCRATCH_CALL_N ("Fconcat", 2); | 1736 | EMIT_SCRATCH_CALL_N ("Fconcat", 2); |
| 1691 | break; | 1737 | break; |
| 1692 | case Bconcat3: | 1738 | CASE (Bconcat3) |
| 1693 | EMIT_SCRATCH_CALL_N ("Fconcat", 3); | 1739 | EMIT_SCRATCH_CALL_N ("Fconcat", 3); |
| 1694 | break; | 1740 | break; |
| 1695 | case Bconcat4: | 1741 | CASE (Bconcat4) |
| 1696 | EMIT_SCRATCH_CALL_N ("Fconcat", 4); | 1742 | EMIT_SCRATCH_CALL_N ("Fconcat", 4); |
| 1697 | break; | 1743 | break; |
| 1698 | case BconcatN: | 1744 | CASE (BconcatN) |
| 1699 | op = FETCH; | 1745 | op = FETCH; |
| 1700 | EMIT_SCRATCH_CALL_N ("Fconcat", op); | 1746 | EMIT_SCRATCH_CALL_N ("Fconcat", op); |
| 1701 | break; | 1747 | break; |
| 1702 | 1748 | ||
| 1703 | case Bsub1: | 1749 | CASE (Bsub1) |
| 1704 | { | 1750 | { |
| 1705 | 1751 | ||
| 1706 | /* (FIXNUMP (TOP) && XFIXNUM (TOP) != MOST_NEGATIVE_FIXNUM | 1752 | /* (FIXNUMP (TOP) && XFIXNUM (TOP) != MOST_NEGATIVE_FIXNUM |
| @@ -1760,7 +1806,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1760 | } | 1806 | } |
| 1761 | 1807 | ||
| 1762 | break; | 1808 | break; |
| 1763 | case Badd1: | 1809 | CASE (Badd1) |
| 1764 | { | 1810 | { |
| 1765 | 1811 | ||
| 1766 | /* (FIXNUMP (TOP) && XFIXNUM (TOP) != MOST_POSITIVE_FIXNUM | 1812 | /* (FIXNUMP (TOP) && XFIXNUM (TOP) != MOST_POSITIVE_FIXNUM |
| @@ -1820,31 +1866,31 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1820 | } | 1866 | } |
| 1821 | break; | 1867 | break; |
| 1822 | 1868 | ||
| 1823 | case Beqlsign: | 1869 | CASE (Beqlsign) |
| 1824 | EMIT_ARITHCOMPARE (ARITH_EQUAL); | 1870 | EMIT_ARITHCOMPARE (ARITH_EQUAL); |
| 1825 | break; | 1871 | break; |
| 1826 | 1872 | ||
| 1827 | case Bgtr: | 1873 | CASE (Bgtr) |
| 1828 | EMIT_ARITHCOMPARE (ARITH_GRTR); | 1874 | EMIT_ARITHCOMPARE (ARITH_GRTR); |
| 1829 | break; | 1875 | break; |
| 1830 | 1876 | ||
| 1831 | case Blss: | 1877 | CASE (Blss) |
| 1832 | EMIT_ARITHCOMPARE (ARITH_LESS); | 1878 | EMIT_ARITHCOMPARE (ARITH_LESS); |
| 1833 | break; | 1879 | break; |
| 1834 | 1880 | ||
| 1835 | case Bleq: | 1881 | CASE (Bleq) |
| 1836 | EMIT_ARITHCOMPARE (ARITH_LESS_OR_EQUAL); | 1882 | EMIT_ARITHCOMPARE (ARITH_LESS_OR_EQUAL); |
| 1837 | break; | 1883 | break; |
| 1838 | 1884 | ||
| 1839 | case Bgeq: | 1885 | CASE (Bgeq) |
| 1840 | EMIT_ARITHCOMPARE (ARITH_GRTR_OR_EQUAL); | 1886 | EMIT_ARITHCOMPARE (ARITH_GRTR_OR_EQUAL); |
| 1841 | break; | 1887 | break; |
| 1842 | 1888 | ||
| 1843 | case Bdiff: | 1889 | CASE (Bdiff) |
| 1844 | EMIT_SCRATCH_CALL_N ("Fminus", 2); | 1890 | EMIT_SCRATCH_CALL_N ("Fminus", 2); |
| 1845 | break; | 1891 | break; |
| 1846 | 1892 | ||
| 1847 | case Bnegate: | 1893 | CASE (Bnegate) |
| 1848 | { | 1894 | { |
| 1849 | 1895 | ||
| 1850 | /* (FIXNUMP (TOP) && XFIXNUM (TOP) != MOST_NEGATIVE_FIXNUM | 1896 | /* (FIXNUMP (TOP) && XFIXNUM (TOP) != MOST_NEGATIVE_FIXNUM |
| @@ -1899,19 +1945,19 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1899 | bb_map[pc].gcc_bb); | 1945 | bb_map[pc].gcc_bb); |
| 1900 | } | 1946 | } |
| 1901 | break; | 1947 | break; |
| 1902 | case Bplus: | 1948 | CASE (Bplus) |
| 1903 | EMIT_SCRATCH_CALL_N ("Fplus", 2); | 1949 | EMIT_SCRATCH_CALL_N ("Fplus", 2); |
| 1904 | break; | 1950 | break; |
| 1905 | case Bmax: | 1951 | CASE (Bmax) |
| 1906 | EMIT_SCRATCH_CALL_N ("Fmax", 2); | 1952 | EMIT_SCRATCH_CALL_N ("Fmax", 2); |
| 1907 | break; | 1953 | break; |
| 1908 | case Bmin: | 1954 | CASE (Bmin) |
| 1909 | EMIT_SCRATCH_CALL_N ("Fmin", 2); | 1955 | EMIT_SCRATCH_CALL_N ("Fmin", 2); |
| 1910 | break; | 1956 | break; |
| 1911 | case Bmult: | 1957 | CASE (Bmult) |
| 1912 | EMIT_SCRATCH_CALL_N ("Ftimes", 2); | 1958 | EMIT_SCRATCH_CALL_N ("Ftimes", 2); |
| 1913 | break; | 1959 | break; |
| 1914 | case Bpoint: | 1960 | CASE (Bpoint) |
| 1915 | args[0] = | 1961 | args[0] = |
| 1916 | gcc_jit_context_new_rvalue_from_int (comp.ctxt, | 1962 | gcc_jit_context_new_rvalue_from_int (comp.ctxt, |
| 1917 | comp.ptrdiff_type, | 1963 | comp.ptrdiff_type, |
| @@ -1925,11 +1971,11 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1925 | 1971 | ||
| 1926 | CASE_CALL_NARGS (goto_char, 1); | 1972 | CASE_CALL_NARGS (goto_char, 1); |
| 1927 | 1973 | ||
| 1928 | case Binsert: | 1974 | CASE (Binsert) |
| 1929 | EMIT_SCRATCH_CALL_N ("Finsert", 1); | 1975 | EMIT_SCRATCH_CALL_N ("Finsert", 1); |
| 1930 | break; | 1976 | break; |
| 1931 | 1977 | ||
| 1932 | case Bpoint_max: | 1978 | CASE (Bpoint_max) |
| 1933 | args[0] = | 1979 | args[0] = |
| 1934 | gcc_jit_context_new_rvalue_from_int (comp.ctxt, | 1980 | gcc_jit_context_new_rvalue_from_int (comp.ctxt, |
| 1935 | comp.ptrdiff_type, | 1981 | comp.ptrdiff_type, |
| @@ -1941,7 +1987,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1941 | PUSH_RVAL (res); | 1987 | PUSH_RVAL (res); |
| 1942 | break; | 1988 | break; |
| 1943 | 1989 | ||
| 1944 | case Bpoint_min: | 1990 | CASE (Bpoint_min) |
| 1945 | args[0] = | 1991 | args[0] = |
| 1946 | gcc_jit_context_new_rvalue_from_int (comp.ctxt, | 1992 | gcc_jit_context_new_rvalue_from_int (comp.ctxt, |
| 1947 | comp.ptrdiff_type, | 1993 | comp.ptrdiff_type, |
| @@ -1956,14 +2002,14 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1956 | CASE_CALL_NARGS (char_after, 1); | 2002 | CASE_CALL_NARGS (char_after, 1); |
| 1957 | CASE_CALL_NARGS (following_char, 0); | 2003 | CASE_CALL_NARGS (following_char, 0); |
| 1958 | 2004 | ||
| 1959 | case Bpreceding_char: | 2005 | CASE (Bpreceding_char) |
| 1960 | res = emit_call ("Fprevious_char", comp.lisp_obj_type, 0, args); | 2006 | res = emit_call ("Fprevious_char", comp.lisp_obj_type, 0, args); |
| 1961 | PUSH_RVAL (res); | 2007 | PUSH_RVAL (res); |
| 1962 | break; | 2008 | break; |
| 1963 | 2009 | ||
| 1964 | CASE_CALL_NARGS (current_column, 0); | 2010 | CASE_CALL_NARGS (current_column, 0); |
| 1965 | 2011 | ||
| 1966 | case Bindent_to: | 2012 | CASE (Bindent_to) |
| 1967 | POP1; | 2013 | POP1; |
| 1968 | args[1] = nil; | 2014 | args[1] = nil; |
| 1969 | res = emit_call ("Findent_to", comp.lisp_obj_type, 2, args); | 2015 | res = emit_call ("Findent_to", comp.lisp_obj_type, 2, args); |
| @@ -1977,13 +2023,15 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 1977 | CASE_CALL_NARGS (current_buffer, 0); | 2023 | CASE_CALL_NARGS (current_buffer, 0); |
| 1978 | CASE_CALL_NARGS (set_buffer, 1); | 2024 | CASE_CALL_NARGS (set_buffer, 1); |
| 1979 | 2025 | ||
| 1980 | case Bsave_current_buffer: /* Obsolete since ??. */ | 2026 | CASE (Bsave_current_buffer) /* Obsolete since ??. */ |
| 1981 | case Bsave_current_buffer_1: | 2027 | goto save_current; |
| 2028 | CASE (Bsave_current_buffer_1) | ||
| 2029 | save_current: | ||
| 1982 | emit_call ("record_unwind_current_buffer", | 2030 | emit_call ("record_unwind_current_buffer", |
| 1983 | comp.void_type, 0, NULL); | 2031 | comp.void_type, 0, NULL); |
| 1984 | break; | 2032 | break; |
| 1985 | 2033 | ||
| 1986 | case Binteractive_p: /* Obsolete since 24.1. */ | 2034 | CASE (Binteractive_p) /* Obsolete since 24.1. */ |
| 1987 | PUSH_RVAL (emit_lisp_obj_from_ptr (comp.bblock, | 2035 | PUSH_RVAL (emit_lisp_obj_from_ptr (comp.bblock, |
| 1988 | intern ("interactive-p"))); | 2036 | intern ("interactive-p"))); |
| 1989 | res = emit_call ("call0", comp.lisp_obj_type, 1, args); | 2037 | res = emit_call ("call0", comp.lisp_obj_type, 1, args); |
| @@ -2002,11 +2050,11 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2002 | CASE_CALL_NARGS (widen, 0); | 2050 | CASE_CALL_NARGS (widen, 0); |
| 2003 | CASE_CALL_NARGS (end_of_line, 1); | 2051 | CASE_CALL_NARGS (end_of_line, 1); |
| 2004 | 2052 | ||
| 2005 | case Bconstant2: | 2053 | CASE (Bconstant2) |
| 2006 | goto do_constant; | 2054 | goto do_constant; |
| 2007 | break; | 2055 | break; |
| 2008 | 2056 | ||
| 2009 | case Bgoto: | 2057 | CASE (Bgoto) |
| 2010 | op = FETCH2; | 2058 | op = FETCH2; |
| 2011 | gcc_jit_block_end_with_jump (comp.bblock->gcc_bb, | 2059 | gcc_jit_block_end_with_jump (comp.bblock->gcc_bb, |
| 2012 | NULL, | 2060 | NULL, |
| @@ -2014,21 +2062,21 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2014 | comp.bblock->terminated = true; | 2062 | comp.bblock->terminated = true; |
| 2015 | break; | 2063 | break; |
| 2016 | 2064 | ||
| 2017 | case Bgotoifnil: | 2065 | CASE (Bgotoifnil) |
| 2018 | op = FETCH2; | 2066 | op = FETCH2; |
| 2019 | POP1; | 2067 | POP1; |
| 2020 | emit_comparison_jump (GCC_JIT_COMPARISON_EQ, args[0], nil, | 2068 | emit_comparison_jump (GCC_JIT_COMPARISON_EQ, args[0], nil, |
| 2021 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); | 2069 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); |
| 2022 | break; | 2070 | break; |
| 2023 | 2071 | ||
| 2024 | case Bgotoifnonnil: | 2072 | CASE (Bgotoifnonnil) |
| 2025 | op = FETCH2; | 2073 | op = FETCH2; |
| 2026 | POP1; | 2074 | POP1; |
| 2027 | emit_comparison_jump (GCC_JIT_COMPARISON_NE, args[0], nil, | 2075 | emit_comparison_jump (GCC_JIT_COMPARISON_NE, args[0], nil, |
| 2028 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); | 2076 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); |
| 2029 | break; | 2077 | break; |
| 2030 | 2078 | ||
| 2031 | case Bgotoifnilelsepop: | 2079 | CASE (Bgotoifnilelsepop) |
| 2032 | op = FETCH2; | 2080 | op = FETCH2; |
| 2033 | emit_comparison_jump (GCC_JIT_COMPARISON_EQ, | 2081 | emit_comparison_jump (GCC_JIT_COMPARISON_EQ, |
| 2034 | gcc_jit_lvalue_as_rvalue (TOS), | 2082 | gcc_jit_lvalue_as_rvalue (TOS), |
| @@ -2037,7 +2085,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2037 | POP1; | 2085 | POP1; |
| 2038 | break; | 2086 | break; |
| 2039 | 2087 | ||
| 2040 | case Bgotoifnonnilelsepop: | 2088 | CASE (Bgotoifnonnilelsepop) |
| 2041 | op = FETCH2; | 2089 | op = FETCH2; |
| 2042 | emit_comparison_jump (GCC_JIT_COMPARISON_NE, | 2090 | emit_comparison_jump (GCC_JIT_COMPARISON_NE, |
| 2043 | gcc_jit_lvalue_as_rvalue (TOS), | 2091 | gcc_jit_lvalue_as_rvalue (TOS), |
| @@ -2046,7 +2094,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2046 | POP1; | 2094 | POP1; |
| 2047 | break; | 2095 | break; |
| 2048 | 2096 | ||
| 2049 | case Breturn: | 2097 | CASE (Breturn) |
| 2050 | POP1; | 2098 | POP1; |
| 2051 | gcc_jit_block_end_with_return(comp.bblock->gcc_bb, | 2099 | gcc_jit_block_end_with_return(comp.bblock->gcc_bb, |
| 2052 | NULL, | 2100 | NULL, |
| @@ -2054,24 +2102,24 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2054 | comp.bblock->terminated = true; | 2102 | comp.bblock->terminated = true; |
| 2055 | break; | 2103 | break; |
| 2056 | 2104 | ||
| 2057 | case Bdiscard: | 2105 | CASE (Bdiscard) |
| 2058 | POP1; | 2106 | POP1; |
| 2059 | break; | 2107 | break; |
| 2060 | 2108 | ||
| 2061 | case Bdup: | 2109 | CASE (Bdup) |
| 2062 | PUSH_LVAL (TOS); | 2110 | PUSH_LVAL (TOS); |
| 2063 | break; | 2111 | break; |
| 2064 | 2112 | ||
| 2065 | case Bsave_excursion: | 2113 | CASE (Bsave_excursion) |
| 2066 | res = emit_call ("record_unwind_protect_excursion", | 2114 | res = emit_call ("record_unwind_protect_excursion", |
| 2067 | comp.void_type, 0, args); | 2115 | comp.void_type, 0, args); |
| 2068 | break; | 2116 | break; |
| 2069 | 2117 | ||
| 2070 | case Bsave_window_excursion: /* Obsolete since 24.1. */ | 2118 | CASE (Bsave_window_excursion) /* Obsolete since 24.1. */ |
| 2071 | EMIT_CALL_N ("helper_save_window_excursion", 1); | 2119 | EMIT_CALL_N ("helper_save_window_excursion", 1); |
| 2072 | break; | 2120 | break; |
| 2073 | 2121 | ||
| 2074 | case Bsave_restriction: | 2122 | CASE (Bsave_restriction) |
| 2075 | args[0] = emit_lisp_obj_from_ptr (comp.bblock, | 2123 | args[0] = emit_lisp_obj_from_ptr (comp.bblock, |
| 2076 | save_restriction_restore); | 2124 | save_restriction_restore); |
| 2077 | args[1] = emit_call ("save_restriction_save", | 2125 | args[1] = emit_call ("save_restriction_save", |
| @@ -2081,29 +2129,29 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2081 | emit_call ("record_unwind_protect", comp.void_ptr_type, 2, args); | 2129 | emit_call ("record_unwind_protect", comp.void_ptr_type, 2, args); |
| 2082 | break; | 2130 | break; |
| 2083 | 2131 | ||
| 2084 | case Bcatch: /* Obsolete since 24.4. */ | 2132 | CASE (Bcatch) /* Obsolete since 24.4. */ |
| 2085 | POP2; | 2133 | POP2; |
| 2086 | args[2] = args[1]; | 2134 | args[2] = args[1]; |
| 2087 | args[1] = emit_lisp_obj_from_ptr (comp.bblock, eval_sub); | 2135 | args[1] = emit_lisp_obj_from_ptr (comp.bblock, eval_sub); |
| 2088 | emit_call ("internal_catch", comp.void_ptr_type, 3, args); | 2136 | emit_call ("internal_catch", comp.void_ptr_type, 3, args); |
| 2089 | break; | 2137 | break; |
| 2090 | 2138 | ||
| 2091 | case Bunwind_protect: /* FIXME: avoid closure for lexbind. */ | 2139 | CASE (Bunwind_protect) /* FIXME: avoid closure for lexbind. */ |
| 2092 | POP1; | 2140 | POP1; |
| 2093 | emit_call ("helper_unwind_protect", comp.void_type, 1, args); | 2141 | emit_call ("helper_unwind_protect", comp.void_type, 1, args); |
| 2094 | break; | 2142 | break; |
| 2095 | 2143 | ||
| 2096 | case Bcondition_case: /* Obsolete since 24.4. */ | 2144 | CASE (Bcondition_case) /* Obsolete since 24.4. */ |
| 2097 | POP3; | 2145 | POP3; |
| 2098 | emit_call ("internal_lisp_condition_case", | 2146 | emit_call ("internal_lisp_condition_case", |
| 2099 | comp.lisp_obj_type, 3, args); | 2147 | comp.lisp_obj_type, 3, args); |
| 2100 | break; | 2148 | break; |
| 2101 | 2149 | ||
| 2102 | case Btemp_output_buffer_setup: /* Obsolete since 24.1. */ | 2150 | CASE (Btemp_output_buffer_setup) /* Obsolete since 24.1. */ |
| 2103 | EMIT_CALL_N ("helper_temp_output_buffer_setup", 1); | 2151 | EMIT_CALL_N ("helper_temp_output_buffer_setup", 1); |
| 2104 | break; | 2152 | break; |
| 2105 | 2153 | ||
| 2106 | case Btemp_output_buffer_show: /* Obsolete since 24.1. */ | 2154 | CASE (Btemp_output_buffer_show) /* Obsolete since 24.1. */ |
| 2107 | POP2; | 2155 | POP2; |
| 2108 | emit_call ("temp_output_buffer_show", comp.void_type, 1, | 2156 | emit_call ("temp_output_buffer_show", comp.void_type, 1, |
| 2109 | &args[1]); | 2157 | &args[1]); |
| @@ -2111,7 +2159,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2111 | emit_call ("helper_unbind_n", comp.lisp_obj_type, 1, args); | 2159 | emit_call ("helper_unbind_n", comp.lisp_obj_type, 1, args); |
| 2112 | 2160 | ||
| 2113 | break; | 2161 | break; |
| 2114 | case Bunbind_all: /* Obsolete. Never used. */ | 2162 | CASE (Bunbind_all) /* Obsolete. Never used. */ |
| 2115 | /* To unbind back to the beginning of this frame. Not used yet, | 2163 | /* To unbind back to the beginning of this frame. Not used yet, |
| 2116 | but will be needed for tail-recursion elimination. */ | 2164 | but will be needed for tail-recursion elimination. */ |
| 2117 | error ("Bunbind_all not supported"); | 2165 | error ("Bunbind_all not supported"); |
| @@ -2123,11 +2171,11 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2123 | CASE_CALL_NARGS (upcase, 1); | 2171 | CASE_CALL_NARGS (upcase, 1); |
| 2124 | CASE_CALL_NARGS (downcase, 1); | 2172 | CASE_CALL_NARGS (downcase, 1); |
| 2125 | 2173 | ||
| 2126 | case Bstringeqlsign: | 2174 | CASE (Bstringeqlsign) |
| 2127 | EMIT_CALL_N ("Fstring_equal", 2); | 2175 | EMIT_CALL_N ("Fstring_equal", 2); |
| 2128 | break; | 2176 | break; |
| 2129 | 2177 | ||
| 2130 | case Bstringlss: | 2178 | CASE (Bstringlss) |
| 2131 | EMIT_CALL_N ("Fstring_lessp", 2); | 2179 | EMIT_CALL_N ("Fstring_lessp", 2); |
| 2132 | break; | 2180 | break; |
| 2133 | 2181 | ||
| @@ -2139,25 +2187,25 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2139 | CASE_CALL_NARGS (setcar, 2); | 2187 | CASE_CALL_NARGS (setcar, 2); |
| 2140 | CASE_CALL_NARGS (setcdr, 2); | 2188 | CASE_CALL_NARGS (setcdr, 2); |
| 2141 | 2189 | ||
| 2142 | case Bcar_safe: | 2190 | CASE (Bcar_safe) |
| 2143 | EMIT_CALL_N ("CAR_SAFE", 1); | 2191 | EMIT_CALL_N ("CAR_SAFE", 1); |
| 2144 | break; | 2192 | break; |
| 2145 | 2193 | ||
| 2146 | case Bcdr_safe: | 2194 | CASE (Bcdr_safe) |
| 2147 | EMIT_CALL_N ("CDR_SAFE", 1); | 2195 | EMIT_CALL_N ("CDR_SAFE", 1); |
| 2148 | break; | 2196 | break; |
| 2149 | 2197 | ||
| 2150 | case Bnconc: | 2198 | CASE (Bnconc) |
| 2151 | EMIT_SCRATCH_CALL_N ("Fnconc", 2); | 2199 | EMIT_SCRATCH_CALL_N ("Fnconc", 2); |
| 2152 | break; | 2200 | break; |
| 2153 | 2201 | ||
| 2154 | case Bquo: | 2202 | CASE (Bquo) |
| 2155 | EMIT_SCRATCH_CALL_N ("Fquo", 2); | 2203 | EMIT_SCRATCH_CALL_N ("Fquo", 2); |
| 2156 | break; | 2204 | break; |
| 2157 | 2205 | ||
| 2158 | CASE_CALL_NARGS (rem, 2); | 2206 | CASE_CALL_NARGS (rem, 2); |
| 2159 | 2207 | ||
| 2160 | case Bnumberp: | 2208 | CASE (Bnumberp) |
| 2161 | POP1; | 2209 | POP1; |
| 2162 | res = emit_NUMBERP (args[0]); | 2210 | res = emit_NUMBERP (args[0]); |
| 2163 | res = gcc_jit_context_new_call (comp.ctxt, | 2211 | res = gcc_jit_context_new_call (comp.ctxt, |
| @@ -2167,7 +2215,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2167 | PUSH_RVAL (res); | 2215 | PUSH_RVAL (res); |
| 2168 | break; | 2216 | break; |
| 2169 | 2217 | ||
| 2170 | case Bintegerp: | 2218 | CASE (Bintegerp) |
| 2171 | POP1; | 2219 | POP1; |
| 2172 | res = emit_INTEGERP(args[0]); | 2220 | res = emit_INTEGERP(args[0]); |
| 2173 | res = gcc_jit_context_new_call (comp.ctxt, | 2221 | res = gcc_jit_context_new_call (comp.ctxt, |
| @@ -2177,7 +2225,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2177 | PUSH_RVAL (res); | 2225 | PUSH_RVAL (res); |
| 2178 | break; | 2226 | break; |
| 2179 | 2227 | ||
| 2180 | case BRgoto: | 2228 | CASE (BRgoto) |
| 2181 | op = FETCH - 128; | 2229 | op = FETCH - 128; |
| 2182 | op += pc; | 2230 | op += pc; |
| 2183 | gcc_jit_block_end_with_jump (comp.bblock->gcc_bb, | 2231 | gcc_jit_block_end_with_jump (comp.bblock->gcc_bb, |
| @@ -2186,7 +2234,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2186 | comp.bblock->terminated = true; | 2234 | comp.bblock->terminated = true; |
| 2187 | break; | 2235 | break; |
| 2188 | 2236 | ||
| 2189 | case BRgotoifnil: | 2237 | CASE (BRgotoifnil) |
| 2190 | op = FETCH - 128; | 2238 | op = FETCH - 128; |
| 2191 | op += pc; | 2239 | op += pc; |
| 2192 | POP1; | 2240 | POP1; |
| @@ -2194,7 +2242,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2194 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); | 2242 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); |
| 2195 | break; | 2243 | break; |
| 2196 | 2244 | ||
| 2197 | case BRgotoifnonnil: | 2245 | CASE (BRgotoifnonnil) |
| 2198 | op = FETCH - 128; | 2246 | op = FETCH - 128; |
| 2199 | op += pc; | 2247 | op += pc; |
| 2200 | POP1; | 2248 | POP1; |
| @@ -2202,7 +2250,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2202 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); | 2250 | bb_map[op].gcc_bb, bb_map[pc].gcc_bb); |
| 2203 | break; | 2251 | break; |
| 2204 | 2252 | ||
| 2205 | case BRgotoifnilelsepop: | 2253 | CASE (BRgotoifnilelsepop) |
| 2206 | op = FETCH - 128; | 2254 | op = FETCH - 128; |
| 2207 | op += pc; | 2255 | op += pc; |
| 2208 | emit_comparison_jump (GCC_JIT_COMPARISON_EQ, | 2256 | emit_comparison_jump (GCC_JIT_COMPARISON_EQ, |
| @@ -2212,7 +2260,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2212 | POP1; | 2260 | POP1; |
| 2213 | break; | 2261 | break; |
| 2214 | 2262 | ||
| 2215 | case BRgotoifnonnilelsepop: | 2263 | CASE (BRgotoifnonnilelsepop) |
| 2216 | op = FETCH - 128; | 2264 | op = FETCH - 128; |
| 2217 | op += pc; | 2265 | op += pc; |
| 2218 | emit_comparison_jump (GCC_JIT_COMPARISON_NE, | 2266 | emit_comparison_jump (GCC_JIT_COMPARISON_NE, |
| @@ -2222,12 +2270,12 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2222 | POP1; | 2270 | POP1; |
| 2223 | break; | 2271 | break; |
| 2224 | 2272 | ||
| 2225 | case BinsertN: | 2273 | CASE (BinsertN) |
| 2226 | op = FETCH; | 2274 | op = FETCH; |
| 2227 | EMIT_SCRATCH_CALL_N ("Finsert", op); | 2275 | EMIT_SCRATCH_CALL_N ("Finsert", op); |
| 2228 | break; | 2276 | break; |
| 2229 | 2277 | ||
| 2230 | case Bstack_set: | 2278 | CASE (Bstack_set) |
| 2231 | /* stack-set-0 = discard; stack-set-1 = discard-1-preserve-tos. */ | 2279 | /* stack-set-0 = discard; stack-set-1 = discard-1-preserve-tos. */ |
| 2232 | op = FETCH; | 2280 | op = FETCH; |
| 2233 | POP1; | 2281 | POP1; |
| @@ -2238,7 +2286,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2238 | args[0]); | 2286 | args[0]); |
| 2239 | break; | 2287 | break; |
| 2240 | 2288 | ||
| 2241 | case Bstack_set2: | 2289 | CASE (Bstack_set2) |
| 2242 | op = FETCH2; | 2290 | op = FETCH2; |
| 2243 | POP1; | 2291 | POP1; |
| 2244 | gcc_jit_block_add_assignment (comp.bblock->gcc_bb, | 2292 | gcc_jit_block_add_assignment (comp.bblock->gcc_bb, |
| @@ -2247,7 +2295,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2247 | args[0]); | 2295 | args[0]); |
| 2248 | break; | 2296 | break; |
| 2249 | 2297 | ||
| 2250 | case BdiscardN: | 2298 | CASE (BdiscardN) |
| 2251 | op = FETCH; | 2299 | op = FETCH; |
| 2252 | if (op & 0x80) | 2300 | if (op & 0x80) |
| 2253 | { | 2301 | { |
| @@ -2261,7 +2309,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2261 | 2309 | ||
| 2262 | stack -= op; | 2310 | stack -= op; |
| 2263 | break; | 2311 | break; |
| 2264 | case Bswitch: | 2312 | CASE (Bswitch) |
| 2265 | error ("Bswitch not supported"); | 2313 | error ("Bswitch not supported"); |
| 2266 | /* The cases of Bswitch that we handle (which in theory is | 2314 | /* The cases of Bswitch that we handle (which in theory is |
| 2267 | all of them) are done in Bconstant, below. This is done | 2315 | all of them) are done in Bconstant, below. This is done |
| @@ -2272,7 +2320,7 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, | |||
| 2272 | break; | 2320 | break; |
| 2273 | 2321 | ||
| 2274 | default: | 2322 | default: |
| 2275 | case Bconstant: | 2323 | CASE (Bconstant) |
| 2276 | { | 2324 | { |
| 2277 | if (op < Bconstant || op > Bconstant + vector_size) | 2325 | if (op < Bconstant || op > Bconstant + vector_size) |
| 2278 | goto fail; | 2326 | goto fail; |