1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750
|
#
# IPInt: the WASM in-place interpreter
# DISCLAIMER: not tested on x86 yet (as of 05 Jul 2023); IPInt may break *very* badly.
#
# docs by Daniel Liu <daniel_liu4@apple.com / danlliu@umich.edu>; 2023 intern project
#
# 0. OfflineASM:
# --------------
#
# For a crash course on OfflineASM, check out LowLevelInterpreter.asm.
#
# 1. Code Structure
# -----------------
#
# IPInt is designed to start up quickly and interpret WASM code efficiently. To optimize for speed, we utilize a jump
# table, using the opcode's first byte as an offset. This jump table is set up in _ipint_setup.
# For more complex opcodes (ex. SIMD), we define additional jump tables that utilize further bytes as indices.
#
# 2. Setting Up
# -------------
#
# Before we can execute WebAssembly, we have to handle the call frame that is given to us. This is handled in _ipint_entry.
# We start by saving registers to the stack as per the system calling convention. Then, we have IPInt specific logic:
#
# 2.1. Locals
# -----------
#
# To ensure that we are able to access local variables quickly, we allocate a section of the stack to store local variables.
# We allocate 8 bytes for each local variable on the stack.
#
# Additionally, we need to load the parameters to the function into local variables. As per the calling convention, arguments
# are passed via registers, and then on the stack if all argument registers have been exhausted. Thus, we need to handle those
# cases. We keep track of the number of arguments in IPIntCallee, allowing us to know exactly where to load arguments from.
#
# Finally, we set the value of the `PL` (pointer to locals) register to the position of the first local. This allows us to quickly
# index into locals.
#
# 2.2. Bytecode and Metadata
# --------------------------
#
# The final step before executing is to load the bytecode to execute, as well as the metadata. For an explanation of why we use
# metadata in IPInt, check out WasmIPIntGenerator.cpp. We load these into registers `PB` (pointer to bytecode) and `PM` (pointer
# to metadata). Additionally, registers `PC` (program counter) and `MC` (metadata counter) are set to 0.
#
# 3. Executing WebAssembly
# ------------------------
#
# WebAssembly execution revolves around a stack machine, which we run on the program stack. We work with the constraint
# that the stack must be 16B aligned by ensuring that pushes and pops are always 16B. This makes certain opcodes (ex. drop)
# much easier as well.
#
# For each instruction, we align its assembly to a 256B boundary. Thus, we can take (address of instruction 0) + opcode * 256
# to find the exact point where we need to jump for each opcode without any dependent loads.
#
# 4. Returning
# ------------
#
# To return values to the caller, IPInt uses the standard WebAssembly calling convention. Return values are passed in the
# system return registers, and on the stack if not possible. After this, we perform cleanup logic to reset the stack to its
# original state, and return to the caller.
#
#################################
# Register and Size Definitions #
#################################
# PC = t4
const MC = t5 # Metadata counter (index into metadata)
const PL = t6 # Pointer to locals (index into locals)
const PM = metadataTable
if ARM64 or ARM64E
const IB = t7 # instruction base
end
# TODO: SIMD support, since locals will need double the space. Can we do it only sometimes?
# May just need to write metadata that rewrites offsets. May be worth the space savings.
# Actually, what if we just use the same thing but have a SIMD section separately allocated that
# is "pointed" to by the 8B entries on the stack? Easier and we only need to allocate SIMD when we need
# instead of blowing up the stack. Argument copying a little trickier though.
const PtrSize = constexpr (sizeof(void*))
const MachineRegisterSize = constexpr (sizeof(CPURegister))
const SlotSize = constexpr (sizeof(Register))
const LocalSize = SlotSize
const StackValueSize = 16
if X86_64 or ARM64 or ARM64E or RISCV64
const wasmInstance = csr0
const memoryBase = csr3
const boundsCheckingSize = csr4
elsif ARMv7
const wasmInstance = csr0
const memoryBase = invalidGPR
const boundsCheckingSize = invalidGPR
else
end
const WasmCodeBlock = CallerFrame - constexpr Wasm::numberOfIPIntCalleeSaveRegisters * SlotSize - MachineRegisterSize
##########
# Macros #
##########
# Callee Save
macro saveIPIntRegisters()
subp 2*CalleeSaveSpaceStackAligned, sp
if ARM64 or ARM64E
storepairq wasmInstance, PB, -16[cfr]
storep PM, -24[cfr]
elsif X86_64 or RISCV64
storep PB, -0x8[cfr]
storep wasmInstance, -0x10[cfr]
storep PM, -0x18[cfr]
else
end
end
macro restoreIPIntRegisters()
if ARM64 or ARM64E
loadpairq -16[cfr], wasmInstance, PB
loadp -24[cfr], PM
elsif X86_64 or RISCV64
loadp -0x8[cfr], PB
loadp -0x10[cfr], wasmInstance
loadp -0x18[cfr], PM
else
end
addp 2*CalleeSaveSpaceStackAligned, sp
end
# Get IPIntCallee object at startup
macro getIPIntCallee()
loadp Callee[cfr], ws0
if JSVALUE64
andp ~(constexpr JSValue::WasmTag), ws0
end
leap WTFConfig + constexpr WTF::offsetOfWTFConfigLowestAccessibleAddress, ws1
loadp [ws1], ws1
addp ws1, ws0
storep ws0, WasmCodeBlock[cfr]
end
# Tail-call dispatch
macro advancePC(amount)
addq amount, PC
end
macro advancePCByReg(amount)
addq amount, PC
end
macro advanceMC(amount)
addq amount, MC
end
macro advanceMCByReg(amount)
addq amount, MC
end
macro nextIPIntInstruction()
# Consistency check
# move MC, t0
# andq 7, t0
# bqeq t0, 0, .fine
# break
# .fine:
loadb [PB, PC, 1], t0
if ARM64 or ARM64E
# x7 = IB
# x0 = opcode
emit "add x0, x7, x0, lsl #8"
emit "br x0"
elsif X86_64
lshiftq 8, t0
leap (_ipint_unreachable), t1
addq t1, t0
emit "jmp *(%eax)"
else
break
end
end
# Stack operations
# Every value on the stack is always 16 bytes! This makes life easy.
macro pushQuad(reg)
if ARM64 or ARM64E
push reg, reg
else
push reg
end
end
macro pushQuadPair(reg1, reg2)
push reg1, reg2
end
macro popQuad(reg, scratch)
if ARM64 or ARM64E
pop reg, scratch
else
pop reg
end
end
# Pushes ft0 because macros
macro pushFPR()
if ARM64 or ARM64E
emit "str q0, [sp, #-16]!"
else
emit "sub $16, %esp"
emit "movdqu %xmm0, (%esp)"
end
end
macro pushFPR1()
if ARM64 or ARM64E
emit "str q1, [sp, #-16]!"
else
emit "sub $16, %esp"
emit "movdqu %xmm1, (%esp)"
end
end
macro popFPR()
if ARM64 or ARM64E
# We'll just drop the entire q0 register in here
# to keep stack aligned to 16
# We'll never actually use q0 as a whole for FP,
# since we only work with f32 (s0) or f64 (d0)
emit "ldr q0, [sp], #16"
elsif X86_64
emit "movdqu (%esp), %xmm0"
emit "add $16, %esp"
end
end
macro popFPR1()
if ARM64 or ARM64E
emit "ldr q1, [sp], #16"
elsif X86_64
emit "movdqu (%esp), %xmm1"
emit "add $16, %esp"
end
end
# Typed push/pop to make code pretty
macro pushInt32(reg)
pushQuad(reg)
end
macro popInt32(reg, scratch)
popQuad(reg, scratch)
end
macro pushInt64(reg)
pushQuad(reg)
end
macro popInt64(reg, scratch)
popQuad(reg, scratch)
end
macro pushFloat32FT0()
pushFPR()
end
macro pushFloat32FT1()
pushFPR1()
end
macro popFloat32FT0()
popFPR()
end
macro popFloat32FT1()
popFPR1()
end
macro pushFloat64FT0()
pushFPR()
end
macro pushFloat64FT1()
pushFPR1()
end
macro popFloat64FT0()
popFPR()
end
macro popFloat64FT1()
popFPR1()
end
# Instruction labels
macro alignment()
if ARM64 or ARM64E
# fill with brk instructions
emit ".balignl 256, 0xd4388e20"
elsif X86_64
# fill with int 3 instructions
emit ".balign 256, 0xcc"
end
end
macro instructionLabel(instrname)
alignment()
unalignedglobal _ipint%instrname%_validate
_ipint%instrname%:
_ipint%instrname%_validate:
end
macro unimplementedInstruction(instrname)
alignment()
instructionLabel(instrname)
break
end
macro reservedOpcode(opcode)
alignment()
break
end
# Memory
macro ipintReloadMemory()
if ARM64 or ARM64E
loadpairq Wasm::Instance::m_cachedMemory[wasmInstance], memoryBase, boundsCheckingSize
else
loadp Wasm::Instance::m_cachedMemory[wasmInstance], memoryBase
loadp Wasm::Instance::m_cachedBoundsCheckingSize[wasmInstance], boundsCheckingSize
end
cagedPrimitiveMayBeNull(memoryBase, boundsCheckingSize, t2, t3)
end
# Operation Calls
macro operationCall(fn)
move wasmInstance, a0
push PC, MC
push PL, ws0
fn()
pop ws0, PL
pop MC, PC
if ARM64 or ARM64E
pcrtoaddr _ipint_unreachable, IB
end
end
macro operationCallMayThrow(fn)
move wasmInstance, a0
push PC, MC
push PL, ws0
fn()
bqneq r0, 1, .continuation
storei r1, ArgumentCountIncludingThis + PayloadOffset[cfr]
jmp _wasm_throw_from_slow_path_trampoline
.continuation:
pop ws0, PL
pop MC, PC
if ARM64 or ARM64E
pcrtoaddr _ipint_unreachable, IB
end
end
# Exception handling
macro ipintException(exception)
# move PL, sp
# loadi Wasm::IPIntCallee::m_localSizeToAlloc[ws0], PM
# mulq SlotSize, PM
# addq PM, sp
# restoreCallerPCAndCFR()
storei constexpr Wasm::ExceptionType::%exception%, ArgumentCountIncludingThis + PayloadOffset[cfr]
restoreIPIntRegisters()
jmp _wasm_throw_from_slow_path_trampoline
end
########################
# In-Place Interpreter #
########################
global _ipint_entry
_ipint_entry:
if WEBASSEMBLY and (ARM64 or ARM64E or X86_64)
preserveCallerPCAndCFR()
saveIPIntRegisters()
storep wasmInstance, CodeBlock[cfr]
getIPIntCallee()
# Allocate space for locals
loadi Wasm::IPIntCallee::m_localSizeToAlloc[ws0], csr0
mulq LocalSize, csr0
subq csr0, sp
if ARM64 or ARM64E
storepairq t0, t1, 0x00[sp]
storepairq t2, t3, 0x10[sp]
storepairq t4, t5, 0x20[sp]
storepairq t6, t7, 0x30[sp]
storepaird fa0, fa1, 0x40[sp]
storepaird fa2, fa3, 0x50[sp]
elsif JSVALUE64
storeq t0, 0x00[sp]
storeq t1, 0x08[sp]
storeq t2, 0x10[sp]
storeq t3, 0x18[sp]
storeq t4, 0x20[sp]
storeq t5, 0x28[sp]
stored fa0, 0x40[sp]
stored fa1, 0x48[sp]
stored fa2, 0x50[sp]
stored fa3, 0x58[sp]
else
storeq t0, 0x00[sp]
storeq t1, 0x08[sp]
storeq t2, 0x10[sp]
storeq t3, 0x18[sp]
stored fa0, 0x40[sp]
stored fa1, 0x48[sp]
end
move sp, PL
# Copy over arguments on stack
# csr0 = argument index
# csr1 = total arguments
# csr2 = tmp
# csr3 = stack index
# csr4 = first argument offset
move 0, csr0
loadi Wasm::IPIntCallee::m_numArgumentsOnStack[ws0], csr1
move 16, csr3
leap FirstArgumentOffset[cfr], csr4
.argloop:
bqeq csr0, csr1, .endargs
# Load from stack
loadq [csr4, csr0, LocalSize], csr2
storeq csr2, 0x80[PL, csr0, LocalSize]
addq 1, csr0
jmp .argloop
.endargs:
# Zero out everything else
loadi Wasm::IPIntCallee::m_numArgumentsOnStack[ws0], csr0
addq 16, csr0
loadi Wasm::IPIntCallee::m_localSizeToAlloc[ws0], csr1
.localLoop:
bieq csr0, csr1, .endlocals
storeq 0, [PL, csr0, LocalSize]
addq 1, csr0
jmp .localLoop
.endlocals:
loadp CodeBlock[cfr], wasmInstance
if ARM64 or ARM64E
pcrtoaddr _ipint_unreachable, IB
end
loadp Wasm::IPIntCallee::m_bytecode[ws0], PB
move 0, PC
loadp Wasm::IPIntCallee::m_metadata[ws0], PM
move 0, MC
# Load memory
ipintReloadMemory()
nextIPIntInstruction()
.ipint_exit:
# Clean up locals
# Don't overwrite the return registers
# Will use PM as a temp because we don't want to use the actual temps.
move PL, sp
loadi Wasm::IPIntCallee::m_localSizeToAlloc[ws0], PM
mulq SlotSize, PM
addq PM, sp
restoreIPIntRegisters()
restoreCallerPCAndCFR()
ret
else
ret
end
if WEBASSEMBLY and (ARM64 or ARM64E or X86_64)
# Put all instructions after this `if`, or 32 bit will fail to build.
#############################
# 0x00 - 0x11: control flow #
#############################
instructionLabel(_unreachable)
# unreachable
ipintException(Unreachable)
instructionLabel(_nop)
# nop
advancePC(1)
nextIPIntInstruction()
instructionLabel(_block)
# block
loadq [PM, MC], PC
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_loop)
# loop
loadq [PM, MC], PC
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_if)
# if
popInt32(t0, t1)
bqneq 0, t0, .ipint_if_taken
loadi [PM, MC], PC
loadi 4[PM, MC], MC
nextIPIntInstruction()
.ipint_if_taken:
# Skip LEB128
loadq 8[PM, MC], PC
advanceMC(16)
nextIPIntInstruction()
instructionLabel(_else)
# else
# Counterintuitively, we only run this instruction if the if
# clause is TAKEN. This is used to branch to the end of the
# block.
loadi [PM, MC], PC
loadi 4[PM, MC], MC
nextIPIntInstruction()
reservedOpcode(0x06)
reservedOpcode(0x07)
reservedOpcode(0x08)
reservedOpcode(0x09)
reservedOpcode(0x0a)
instructionLabel(_end)
loadi Wasm::IPIntCallee::m_bytecodeLength[ws0], t0
subq 1, t0
bqeq PC, t0, .ipint_end_ret
advancePC(1)
nextIPIntInstruction()
.ipint_end_ret:
# Get number of returns
loadh [PM, MC], t1
move MC, t0
addq 2, t0
addq MC, t1
.ipint_ret_loop:
bqeq t0, t1, .ipint_ret_loop_end
loadb [PM, t0], t2
bqeq t2, 0, .ipint_ret_loop_end
addq 1, t0
bqgteq t2, 6, .ipint_ret_stack
bqeq t2, 5, .ipint_ret_fpr
popQuad(r0, r1)
jmp .ipint_ret_loop
.ipint_ret_fpr:
popFPR()
jmp .ipint_ret_loop
.ipint_ret_stack:
# TODO
break
.ipint_ret_loop_end:
jmp .ipint_exit
instructionLabel(_br)
# br
# number to pop
loadh 8[PM, MC], t0
# number to keep
loadh 10[PM, MC], t1
# ex. pop 3 and keep 2
#
# +4 +3 +2 +1 sp
# a b c d e
# d e
#
# [sp + k + numToPop] = [sp + k] for k in numToKeep-1 -> 0
move t0, t2
lshiftq 4, t2
leap [sp, t2], t2
.ipint_br_poploop:
bqeq t1, 0, .ipint_br_popend
subq 1, t1
move t1, t3
lshiftq 4, t3
loadq [sp, t3], t0
storeq t0, [t2, t3]
loadq 8[sp, t3], t0
storeq t0, 8[t2, t3]
jmp .ipint_br_poploop
.ipint_br_popend:
loadh 8[PM, MC], t0
lshiftq 4, t0
leap [sp, t0], sp
loadi [PM, MC], PC
loadi 4[PM, MC], MC
nextIPIntInstruction()
instructionLabel(_br_if)
# pop i32
popInt32(t0, t2)
bineq t0, 0, _ipint_br
loadi 12[PM, MC], PC
advanceMC(16)
nextIPIntInstruction()
instructionLabel(_br_table)
# br_table
popInt32(t0, t2)
loadq [PM, MC], t1
advanceMC(8)
biaeq t0, t1, .ipint_br_table_maxout
lshiftq 4, t0
addq t0, MC
jmp _ipint_br
.ipint_br_table_maxout:
subq 1, t1
lshiftq 4, t1
addq t1, MC
jmp _ipint_br
instructionLabel(_return)
# ret
loadi Wasm::IPIntCallee::m_bytecodeLength[ws0], PC
loadi Wasm::IPIntCallee::m_returnMetadata[ws0], MC
subq 1, PC
# This is guaranteed going to an end instruction, so skip
# dispatch and end of program check for speed
jmp .ipint_end_ret
instructionLabel(_call)
# call
jmp _ipint_call_impl
instructionLabel(_call_indirect)
# Get ref
# Load pre-computed values from metadata
popInt32(t0, t1)
push PC, MC # a4
move t0, a2
leap [PM, MC], a3
move wasmInstance, a0
move cfr, a1
operationCall(macro() cCall4(_ipint_extern_call_indirect) end)
pop MC, PC
btpz r1, .ipint_call_indirect_throw
advanceMC(8)
jmp .ipint_call_common
.ipint_call_indirect_throw:
jmp _wasm_throw_from_slow_path_trampoline
reservedOpcode(0x12)
reservedOpcode(0x13)
reservedOpcode(0x14)
reservedOpcode(0x15)
reservedOpcode(0x16)
reservedOpcode(0x17)
reservedOpcode(0x18)
reservedOpcode(0x19)
instructionLabel(_drop)
addq StackValueSize, sp
advancePC(1)
nextIPIntInstruction()
instructionLabel(_select)
popInt32(t0, t2)
bieq t0, 0, .ipint_select_val2
addq 16, sp
advancePC(1)
advanceMC(8)
nextIPIntInstruction()
.ipint_select_val2:
popQuad(t1, t2)
popQuad(t0, t2)
pushQuad(t1)
advancePC(1)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_select_t)
popInt32(t0, t2)
bieq t0, 0, .ipint_select_t_val2
addq 16, sp
loadi [PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
.ipint_select_t_val2:
popQuad(t1, t2)
popQuad(t0, t3)
pushQuadPair(t2, t1)
loadi [PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
reservedOpcode(0x1d)
reservedOpcode(0x1e)
reservedOpcode(0x1f)
###################################
# 0x20 - 0x26: get and set values #
###################################
instructionLabel(_local_get)
# local.get
# Load pre-computed index from metadata
loadi [PM, MC], t0
# Index into locals
loadq [PL, t0, LocalSize],t0
# Push to stack
pushQuad(t0)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_local_set)
# local.set
# Load pre-computed index from metadata
loadi [PM, MC], t0
# Pop from stack
popQuad(t1, t2)
# Store to locals
storeq t1, [PL, t0, LocalSize]
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_local_tee)
# local.tee
loadi [PM, MC], t0
loadq [sp], t1
storeq t1, [PL, t0, LocalSize]
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(16)
nextIPIntInstruction()
instructionLabel(_global_get)
# Load pre-computed index from metadata
loadh 6[PM, MC], t2
loadi [PM, MC], t1
loadp Wasm::Instance::m_globals[wasmInstance], t0
lshiftp 1, t1
loadq [t0, t1, 8], t0
bieq t2, 0, .ipint_global_get_embedded
loadq [t0], t0
.ipint_global_get_embedded:
pushQuad(t0)
loadh 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_global_set)
# b7 = 1 => ref, use slowpath
loadb 7[PM, MC], t0
bineq t0, 0, .ipint_global_set_refpath
# b6 = 1 => portable
loadb 6[PM, MC], t2
# get global addr
loadp Wasm::Instance::m_globals[wasmInstance], t0
# get value to store
popQuad(t3, t1)
# get index
loadi [PM, MC], t1
lshiftp 1, t1
bieq t2, 0, .ipint_global_set_embedded
# portable: dereference then set
loadq [t0, t1, 8], t0
storeq t3, [t0]
loadh 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
.ipint_global_set_embedded:
# embedded: set directly
storeq t3, [t0, t1, 8]
loadh 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
.ipint_global_set_refpath:
loadi [PM, MC], a1
# Pop from stack
popQuad(a2, t3)
operationCall(macro() cCall3(_ipint_extern_set_global_64) end)
loadh 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_table_get)
# Load pre-computed index from metadata
loadi [PM, MC], a1
popInt32(a2, t3)
operationCallMayThrow(macro() cCall3(_ipint_extern_table_get) end)
pushQuad(t0)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_table_set)
# Load pre-computed index from metadata
loadi [PM, MC], a1
popQuad(a3, t0)
popInt32(a2, t0)
operationCallMayThrow(macro() cCall4(_ipint_extern_table_set) end)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
reservedOpcode(0x27)
macro ipintCheckMemoryBound(mem, size)
leap size - 1[mem], t2
bpb t2, boundsCheckingSize, .continuation
break
ipintException(OutOfBoundsMemoryAccess)
.continuation:
nop
end
instructionLabel(_i32_load_mem)
# i32.load
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 4)
# load memory location
loadi [memoryBase, t0], t1
pushInt32(t1)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i64_load_mem)
# i32.load
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 8)
# load memory location
loadq [memoryBase, t0], t1
pushInt64(t1)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_f32_load_mem)
# f32.load
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 4)
# load memory location
loadf [memoryBase, t0], ft0
pushFloat32FT0()
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_f64_load_mem)
# f64.load
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 8)
# load memory location
loadd [memoryBase, t0], ft0
pushFloat64FT0()
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i32_load8s_mem)
# i32.load8_s
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 1)
# load memory location
loadb [memoryBase, t0], t1
sxb2i t1, t1
pushInt32(t1)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i32_load8u_mem)
# i32.load8_u
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 1)
# load memory location
loadb [memoryBase, t0], t1
pushInt32(t1)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i32_load16s_mem)
# i32.load16_s
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 2)
# load memory location
loadh [memoryBase, t0], t1
sxh2i t1, t1
pushInt32(t1)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i32_load16u_mem)
# i32.load16_u
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 2)
# load memory location
loadh [memoryBase, t0], t1
pushInt32(t1)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i64_load8s_mem)
# i64.load8_s
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 1)
# load memory location
loadb [memoryBase, t0], t1
sxb2q t1, t1
pushInt64(t1)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i64_load8u_mem)
# i64.load8_u
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 1)
# load memory location
loadb [memoryBase, t0], t1
pushInt64(t1)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i64_load16s_mem)
# i64.load16_s
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 2)
# load memory location
loadh [memoryBase, t0], t1
sxh2q t1, t1
pushInt64(t1)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i64_load16u_mem)
# i64.load16_u
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 2)
# load memory location
loadh [memoryBase, t0], t1
pushInt64(t1)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i64_load32s_mem)
# i64.load32_s
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 4)
# load memory location
loadi [memoryBase, t0], t1
sxi2q t1, t1
pushInt64(t1)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i64_load32u_mem)
# i64.load8_s
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 4)
# load memory location
loadi [memoryBase, t0], t1
pushInt64(t1)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i32_store_mem)
# i32.store
# pop data
popInt32(t1, t2)
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 4)
# load memory location
storei t1, [memoryBase, t0]
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i64_store_mem)
# i64.store
# pop data
popInt64(t1, t2)
# pop index
popInt64(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 8)
# load memory location
storeq t1, [memoryBase, t0]
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_f32_store_mem)
# f32.store
# pop data
popFloat32FT0()
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 4)
# load memory location
storef ft0, [memoryBase, t0]
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_f64_store_mem)
# f64.store
# pop data
popFloat64FT0()
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 8)
# load memory location
stored ft0, [memoryBase, t0]
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i32_store8_mem)
# i32.store8
# pop data
popInt32(t1, t2)
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 1)
# load memory location
storeb t1, [memoryBase, t0]
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i32_store16_mem)
# i32.store16
# pop data
popInt32(t1, t2)
# pop index
popInt32(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 2)
# load memory location
storeh t1, [memoryBase, t0]
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i64_store8_mem)
# i64.store8
# pop data
popInt64(t1, t2)
# pop index
popInt64(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 1)
# load memory location
storeb t1, [memoryBase, t0]
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i64_store16_mem)
# i64.store16
# pop data
popInt64(t1, t2)
# pop index
popInt64(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 2)
# load memory location
storeh t1, [memoryBase, t0]
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i64_store32_mem)
# i64.store32
# pop data
popInt64(t1, t2)
# pop index
popInt64(t0, t2)
loadi [PM, MC], t2
addq t2, t0
ipintCheckMemoryBound(t0, 4)
# load memory location
storei t1, [memoryBase, t0]
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_memory_size)
operationCall(macro() cCall2(_ipint_extern_current_memory) end)
pushInt32(r0)
advancePC(2)
nextIPIntInstruction()
instructionLabel(_memory_grow)
popInt32(a1, t2)
operationCall(macro() cCall2(_ipint_extern_memory_grow) end)
pushInt32(r0)
ipintReloadMemory()
advancePC(2)
nextIPIntInstruction()
################################
# 0x41 - 0x44: constant values #
################################
instructionLabel(_i32_const)
# i32.const
# Load pre-computed value from metadata
loadi [PM, MC], t0
# Push to stack
pushInt32(t0)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_i64_const)
# i64.const
# Load pre-computed value from metadata
loadq [PM, MC], t0
# Push to stack
pushInt64(t0)
loadq 8[PM, MC], t0
advancePCByReg(t0)
advanceMC(16)
nextIPIntInstruction()
instructionLabel(_f32_const)
# f32.const
# Load pre-computed value from metadata
loadf 1[PB, PC], ft0
pushFloat32FT0()
advancePC(5)
nextIPIntInstruction()
instructionLabel(_f64_const)
# f64.const
# Load pre-computed value from metadata
loadd 1[PB, PC], ft0
pushFloat64FT0()
advancePC(9)
nextIPIntInstruction()
###############################
# 0x45 - 0x4f: i32 comparison #
###############################
instructionLabel(_i32_eqz)
# i32.eqz
popInt32(t0, t2)
cieq t0, 0, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_eq)
# i32.eq
popInt32(t1, t2)
popInt32(t0, t2)
cieq t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_ne)
# i32.ne
popInt32(t1, t2)
popInt32(t0, t2)
cineq t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_lt_s)
# i32.lt_s
popInt32(t1, t2)
popInt32(t0, t2)
cilt t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_lt_u)
# i32.lt_u
popInt32(t1, t2)
popInt32(t0, t2)
cib t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_gt_s)
# i32.gt_s
popInt32(t1, t2)
popInt32(t0, t2)
cigt t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_gt_u)
# i32.gt_u
popInt32(t1, t2)
popInt32(t0, t2)
cia t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_le_s)
# i32.le_s
popInt32(t1, t2)
popInt32(t0, t2)
cilteq t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_le_u)
# i32.le_u
popInt32(t1, t2)
popInt32(t0, t2)
cibeq t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_ge_s)
# i32.ge_s
popInt32(t1, t2)
popInt32(t0, t2)
cigteq t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_ge_u)
# i32.ge_u
popInt32(t1, t2)
popInt32(t0, t2)
ciaeq t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
###############################
# 0x50 - 0x5a: i64 comparison #
###############################
instructionLabel(_i64_eqz)
# i64.eqz
popInt64(t0, t2)
cqeq t0, 0, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_eq)
# i64.eq
popInt64(t1, t2)
popInt64(t0, t2)
cqeq t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_ne)
# i64.ne
popInt64(t1, t2)
popInt64(t0, t2)
cqneq t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_lt_s)
# i64.lt_s
popInt64(t1, t2)
popInt64(t0, t2)
cqlt t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_lt_u)
# i64.lt_u
popInt64(t1, t2)
popInt64(t0, t2)
cqb t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_gt_s)
# i64.gt_s
popInt64(t1, t2)
popInt64(t0, t2)
cqgt t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_gt_u)
# i64.gt_u
popInt64(t1, t2)
popInt64(t0, t2)
cqa t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_le_s)
# i64.le_s
popInt64(t1, t2)
popInt64(t0, t2)
cqlteq t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_le_u)
# i64.le_u
popInt64(t1, t2)
popInt64(t0, t2)
cqbeq t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_ge_s)
# i64.ge_s
popInt64(t1, t2)
popInt64(t0, t2)
cqgteq t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_ge_u)
# i64.ge_u
popInt64(t1, t2)
popInt64(t0, t2)
cqaeq t0, t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
###############################
# 0x5b - 0x60: f32 comparison #
###############################
instructionLabel(_f32_eq)
# f32.eq
popFloat32FT1()
popFloat32FT0()
cfeq ft0, ft1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_ne)
# f32.ne
popFloat32FT1()
popFloat32FT0()
cfnequn ft0, ft1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_lt)
# f32.lt
popFloat32FT1()
popFloat32FT0()
cflt ft0, ft1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_gt)
# f32.gt
popFloat32FT1()
popFloat32FT0()
cfgt ft0, ft1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_le)
# f32.le
popFloat32FT1()
popFloat32FT0()
cflteq ft0, ft1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_ge)
# f32.ge
popFloat32FT1()
popFloat32FT0()
cfgteq ft0, ft1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
###############################
# 0x61 - 0x66: f64 comparison #
###############################
instructionLabel(_f64_eq)
# f64.eq
popFloat64FT1()
popFloat64FT0()
cdeq ft0, ft1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_ne)
# f64.ne
popFloat64FT1()
popFloat64FT0()
cdnequn ft0, ft1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_lt)
# f64.lt
popFloat64FT1()
popFloat64FT0()
cdlt ft0, ft1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_gt)
# f64.gt
popFloat64FT1()
popFloat64FT0()
cdgt ft0, ft1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_le)
# f64.le
popFloat64FT1()
popFloat64FT0()
cdlteq ft0, ft1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_ge)
# f64.ge
popFloat64FT1()
popFloat64FT0()
cdgteq ft0, ft1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
###############################
# 0x67 - 0x78: i32 operations #
###############################
instructionLabel(_i32_clz)
# i32.clz
popInt32(t0, t2)
lzcnti t0, t1
pushInt32(t1)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_ctz)
# i32.ctz
popInt32(t0, t2)
tzcnti t0, t1
pushInt32(t1)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_popcnt)
# i32.popcnt
popInt32(t1, t2)
operationCall(macro() cCall2(_slow_path_wasm_popcount) end)
pushInt32(r1)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_add)
# i32.add
popInt32(t1, t2)
popInt32(t0, t2)
addi t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_sub)
# i32.sub
popInt32(t1, t2)
popInt32(t0, t2)
subi t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_mul)
# i32.mul
popInt32(t1, t2)
popInt32(t0, t2)
muli t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_div_s)
# i32.div_s
popInt32(t1, t2)
popInt32(t0, t2)
btiz t1, .ipint_i32_div_s_throwDivisionByZero
bineq t1, -1, .ipint_i32_div_s_safe
bieq t0, constexpr INT32_MIN, .ipint_i32_div_s_throwIntegerOverflow
.ipint_i32_div_s_safe:
if X86_64
# FIXME: Add a way to static_asset that t0 is rax and t2 is rdx
# https://bugs.webkit.org/show_bug.cgi?id=203692
cdqi
idivi t1
elsif ARM64 or ARM64E or RISCV64
divis t1, t0
else
error
end
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
.ipint_i32_div_s_throwDivisionByZero:
ipintException(DivisionByZero)
.ipint_i32_div_s_throwIntegerOverflow:
ipintException(IntegerOverflow)
instructionLabel(_i32_div_u)
# i32.div_u
popInt32(t1, t2)
popInt32(t0, t2)
btiz t1, .ipint_i32_div_u_throwDivisionByZero
if X86_64
xori t2, t2
udivi t1
elsif ARM64 or ARM64E or RISCV64
divi t1, t0
else
error
end
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
.ipint_i32_div_u_throwDivisionByZero:
ipintException(DivisionByZero)
instructionLabel(_i32_rem_s)
# i32.rem_s
popInt32(t1, t2)
popInt32(t0, t2)
btiz t1, .ipint_i32_rem_s_throwDivisionByZero
bineq t1, -1, .ipint_i32_rem_s_safe
bineq t0, constexpr INT32_MIN, .ipint_i32_rem_s_safe
move 0, t2
jmp .ipint_i32_rem_s_return
.ipint_i32_rem_s_safe:
if X86_64
# FIXME: Add a way to static_asset that t0 is rax and t2 is rdx
# https://bugs.webkit.org/show_bug.cgi?id=203692
cdqi
idivi t1
elsif ARM64 or ARM64E
divis t1, t0, t2
muli t1, t2
subi t0, t2, t2
elsif RISCV64
remis t0, t1, t2
else
error
end
.ipint_i32_rem_s_return:
pushInt32(t2)
advancePC(1)
nextIPIntInstruction()
.ipint_i32_rem_s_throwDivisionByZero:
ipintException(DivisionByZero)
instructionLabel(_i32_rem_u)
# i32.rem_u
popInt32(t1, t2)
popInt32(t0, t2)
btiz t1, .ipint_i32_rem_u_throwDivisionByZero
if X86_64
xori t2, t2
udivi t1
elsif ARM64 or ARM64E
divi t1, t0, t2
muli t1, t2
subi t0, t2, t2
elsif RISCV64
remi t0, t1, t2
else
error
end
pushInt32(t2)
advancePC(1)
nextIPIntInstruction()
.ipint_i32_rem_u_throwDivisionByZero:
ipintException(DivisionByZero)
instructionLabel(_i32_and)
# i32.and
popInt32(t1, t2)
popInt32(t0, t2)
andi t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_or)
# i32.or
popInt32(t1, t2)
popInt32(t0, t2)
ori t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_xor)
# i32.xor
popInt32(t1, t2)
popInt32(t0, t2)
xori t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_shl)
# i32.shl
popInt32(t1, t2)
popInt32(t0, t2)
lshifti t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_shr_s)
# i32.shr_s
popInt32(t1, t2)
popInt32(t0, t2)
rshifti t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_shr_u)
# i32.shr_u
popInt32(t1, t2)
popInt32(t0, t2)
urshifti t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_rotl)
# i32.rotl
popInt32(t1, t2)
popInt32(t0, t2)
lrotatei t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_rotr)
# i32.rotr
popInt32(t1, t2)
popInt32(t0, t2)
rrotatei t1, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
###############################
# 0x79 - 0x8a: i64 operations #
###############################
instructionLabel(_i64_clz)
# i64.clz
popInt64(t0, t2)
lzcntq t0, t1
pushInt64(t1)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_ctz)
# i64.ctz
popInt64(t0, t2)
tzcntq t0, t1
pushInt64(t1)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_popcnt)
# i64.popcnt
popInt64(t1, t2)
operationCall(macro() cCall2(_slow_path_wasm_popcountll) end)
pushInt64(r1)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_add)
# i64.add
popInt64(t1, t2)
popInt64(t0, t2)
addq t1, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_sub)
# i64.sub
popInt64(t1, t2)
popInt64(t0, t2)
subq t1, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_mul)
# i64.mul
popInt64(t1, t2)
popInt64(t0, t2)
mulq t1, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_div_s)
# i64.div_s
popInt64(t1, t2)
popInt64(t0, t2)
btqz t1, .ipint_i64_div_s_throwDivisionByZero
bqneq t1, -1, .ipint_i64_div_s_safe
bqeq t0, constexpr INT64_MIN, .ipint_i64_div_s_throwIntegerOverflow
.ipint_i64_div_s_safe:
if X86_64
# FIXME: Add a way to static_asset that t0 is rax and t2 is rdx
# https://bugs.webkit.org/show_bug.cgi?id=203692
cqoq
idivq t1
elsif ARM64 or ARM64E or RISCV64
divqs t1, t0
else
error
end
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
.ipint_i64_div_s_throwDivisionByZero:
ipintException(DivisionByZero)
.ipint_i64_div_s_throwIntegerOverflow:
ipintException(IntegerOverflow)
instructionLabel(_i64_div_u)
# i64.div_u
popInt64(t1, t2)
popInt64(t0, t2)
btqz t1, .ipint_i64_div_u_throwDivisionByZero
if X86_64
xorq t2, t2
udivq t1
elsif ARM64 or ARM64E or RISCV64
divq t1, t0
else
error
end
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
.ipint_i64_div_u_throwDivisionByZero:
ipintException(DivisionByZero)
instructionLabel(_i64_rem_s)
# i64.rem_s
popInt64(t1, t2)
popInt64(t0, t2)
btqz t1, .ipint_i64_rem_s_throwDivisionByZero
bqneq t1, -1, .ipint_i64_rem_s_safe
bqneq t0, constexpr INT64_MIN, .ipint_i64_rem_s_safe
move 0, t2
jmp .ipint_i64_rem_s_return
.ipint_i64_rem_s_safe:
if X86_64
# FIXME: Add a way to static_asset that t0 is rax and t2 is rdx
# https://bugs.webkit.org/show_bug.cgi?id=203692
cqoq
idivq t1
elsif ARM64 or ARM64E
divqs t1, t0, t2
mulq t1, t2
subq t0, t2, t2
elsif RISCV64
remqs t0, t1, t2
else
error
end
.ipint_i64_rem_s_return:
pushInt64(t2)
advancePC(1)
nextIPIntInstruction()
.ipint_i64_rem_s_throwDivisionByZero:
ipintException(DivisionByZero)
instructionLabel(_i64_rem_u)
# i64.rem_u
popInt64(t1, t2)
popInt64(t0, t2)
btqz t1, .ipint_i64_rem_u_throwDivisionByZero
if X86_64
xorq t2, t2
udivq t1
elsif ARM64 or ARM64E
divq t1, t0, t2
mulq t1, t2
subq t0, t2, t2
elsif RISCV64
remq t0, t1, t2
else
error
end
pushInt64(t2)
advancePC(1)
nextIPIntInstruction()
.ipint_i64_rem_u_throwDivisionByZero:
ipintException(DivisionByZero)
instructionLabel(_i64_and)
# i64.and
popInt64(t1, t2)
popInt64(t0, t2)
andq t1, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_or)
# i64.or
popInt64(t1, t2)
popInt64(t0, t2)
orq t1, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_xor)
# i64.xor
popInt64(t1, t2)
popInt64(t0, t2)
xorq t1, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_shl)
# i64.shl
popInt64(t1, t2)
popInt64(t0, t2)
lshiftq t1, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_shr_s)
# i64.shr_s
popInt64(t1, t2)
popInt64(t0, t2)
rshiftq t1, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_shr_u)
# i64.shr_u
popInt64(t1, t2)
popInt64(t0, t2)
urshiftq t1, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_rotl)
# i64.rotl
popInt64(t1, t2)
popInt64(t0, t2)
lrotateq t1, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_rotr)
# i64.rotr
popInt64(t1, t2)
popInt64(t0, t2)
rrotateq t1, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
###############################
# 0x8b - 0x98: f32 operations #
###############################
instructionLabel(_f32_abs)
# f32.abs
popFloat32FT0()
absf ft0, ft0
pushFloat32FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_neg)
# f32.neg
popFloat32FT0()
negf ft0, ft0
pushFloat32FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_ceil)
# f32.ceil
popFloat32FT0()
ceilf ft0, ft0
pushFloat32FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_floor)
# f32.floor
popFloat32FT0()
floorf ft0, ft0
pushFloat32FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_trunc)
# f32.trunc
popFloat32FT0()
truncatef ft0, ft0
pushFloat32FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_nearest)
# f32.nearest
popFloat32FT0()
roundf ft0, ft0
pushFloat32FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_sqrt)
# f32.sqrt
popFloat32FT0()
sqrtf ft0, ft0
pushFloat32FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_add)
# f32.add
popFloat32FT1()
popFloat32FT0()
addf ft1, ft0
pushFloat32FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_sub)
# f32.sub
popFloat32FT1()
popFloat32FT0()
subf ft1, ft0
pushFloat32FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_mul)
# f32.mul
popFloat32FT1()
popFloat32FT0()
mulf ft1, ft0
pushFloat32FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_div)
# f32.div
popFloat32FT1()
popFloat32FT0()
divf ft1, ft0
pushFloat32FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_min)
# f32.min
popFloat32FT1()
popFloat32FT0()
bfeq ft0, ft1, .ipint_f32_min_equal
bflt ft0, ft1, .ipint_f32_min_lt
bfgt ft0, ft1, .ipint_f32_min_return
.ipint_f32_min_NaN:
addf ft0, ft1
pushFloat32FT1()
advancePC(1)
nextIPIntInstruction()
.ipint_f32_min_equal:
orf ft0, ft1
pushFloat32FT1()
advancePC(1)
nextIPIntInstruction()
.ipint_f32_min_lt:
moved ft0, ft1
pushFloat32FT1()
advancePC(1)
nextIPIntInstruction()
.ipint_f32_min_return:
pushFloat32FT1()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_max)
# f32.max
popFloat32FT1()
popFloat32FT0()
bfeq ft1, ft0, .ipint_f32_max_equal
bflt ft1, ft0, .ipint_f32_max_lt
bfgt ft1, ft0, .ipint_f32_max_return
.ipint_f32_max_NaN:
addf ft0, ft1
pushFloat32FT1()
advancePC(1)
nextIPIntInstruction()
.ipint_f32_max_equal:
andf ft0, ft1
pushFloat32FT1()
advancePC(1)
nextIPIntInstruction()
.ipint_f32_max_lt:
moved ft0, ft1
pushFloat32FT1()
advancePC(1)
nextIPIntInstruction()
.ipint_f32_max_return:
pushFloat32FT1()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_copysign)
# f32.copysign
popFloat32FT1()
popFloat32FT0()
ff2i ft1, t1
move 0x80000000, t2
andi t2, t1
ff2i ft0, t0
move 0x7fffffff, t2
andi t2, t0
ori t1, t0
fi2f t0, ft0
pushFloat32FT0()
advancePC(1)
nextIPIntInstruction()
###############################
# 0x99 - 0xa6: f64 operations #
###############################
instructionLabel(_f64_abs)
# f64.abs
popFloat64FT0()
absd ft0, ft0
pushFloat64FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_neg)
# f64.neg
popFloat64FT0()
negd ft0, ft0
pushFloat64FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_ceil)
# f64.ceil
popFloat64FT0()
ceild ft0, ft0
pushFloat64FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_floor)
# f64.floor
popFloat64FT0()
floord ft0, ft0
pushFloat64FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_trunc)
# f64.trunc
popFloat64FT0()
truncated ft0, ft0
pushFloat64FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_nearest)
# f64.nearest
popFloat64FT0()
roundd ft0, ft0
pushFloat64FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_sqrt)
# f64.sqrt
popFloat64FT0()
sqrtd ft0, ft0
pushFloat64FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_add)
# f64.add
popFloat64FT1()
popFloat64FT0()
addd ft1, ft0
pushFloat64FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_sub)
# f64.sub
popFloat64FT1()
popFloat64FT0()
subd ft1, ft0
pushFloat64FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_mul)
# f64.mul
popFloat64FT1()
popFloat64FT0()
muld ft1, ft0
pushFloat64FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_div)
# f64.div
popFloat64FT1()
popFloat64FT0()
divd ft1, ft0
pushFloat64FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_min)
# f64.min
popFloat64FT1()
popFloat64FT0()
bdeq ft0, ft1, .ipint_f64_min_equal
bdlt ft0, ft1, .ipint_f64_min_lt
bdgt ft0, ft1, .ipint_f64_min_return
.ipint_f64_min_NaN:
addd ft0, ft1
pushFloat64FT1()
advancePC(1)
nextIPIntInstruction()
.ipint_f64_min_equal:
ord ft0, ft1
pushFloat64FT1()
advancePC(1)
nextIPIntInstruction()
.ipint_f64_min_lt:
moved ft0, ft1
pushFloat64FT1()
advancePC(1)
nextIPIntInstruction()
.ipint_f64_min_return:
pushFloat64FT1()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_max)
# f64.max
popFloat64FT1()
popFloat64FT0()
bdeq ft1, ft0, .ipint_f64_max_equal
bdlt ft1, ft0, .ipint_f64_max_lt
bdgt ft1, ft0, .ipint_f64_max_return
.ipint_f64_max_NaN:
addd ft0, ft1
pushFloat64FT1()
advancePC(1)
nextIPIntInstruction()
.ipint_f64_max_equal:
andd ft0, ft1
pushFloat64FT1()
advancePC(1)
nextIPIntInstruction()
.ipint_f64_max_lt:
moved ft0, ft1
pushFloat64FT1()
advancePC(1)
nextIPIntInstruction()
.ipint_f64_max_return:
pushFloat64FT1()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_copysign)
# f64.copysign
popFloat64FT1()
popFloat64FT0()
fd2q ft1, t1
move 0x8000000000000000, t2
andq t2, t1
fd2q ft0, t0
move 0x7fffffffffffffff, t2
andq t2, t0
orq t1, t0
fq2d t0, ft0
pushFloat64FT0()
advancePC(1)
nextIPIntInstruction()
############################
# 0xa7 - 0xc4: conversions #
############################
instructionLabel(_i32_wrap_i64)
# because of how we store values on stack, do nothing
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_trunc_f32_s)
popFloat32FT0()
move 0xcf000000, t0 # INT32_MIN (Note that INT32_MIN - 1.0 in float is the same as INT32_MIN in float).
fi2f t0, ft1
bfltun ft0, ft1, .ipint_trunc_i32_f32_s_outOfBoundsTrunc
move 0x4f000000, t0 # -INT32_MIN
fi2f t0, ft1
bfgtequn ft0, ft1, .ipint_trunc_i32_f32_s_outOfBoundsTrunc
truncatef2is ft0, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
.ipint_trunc_i32_f32_s_outOfBoundsTrunc:
ipintException(OutOfBoundsTrunc)
instructionLabel(_i32_trunc_f32_u)
popFloat32FT0()
move 0xbf800000, t0 # -1.0
fi2f t0, ft1
bfltequn ft0, ft1, .ipint_trunc_i32_f32_u_outOfBoundsTrunc
move 0x4f800000, t0 # INT32_MIN * -2.0
fi2f t0, ft1
bfgtequn ft0, ft1, .ipint_trunc_i32_f32_u_outOfBoundsTrunc
truncatef2i ft0, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
.ipint_trunc_i32_f32_u_outOfBoundsTrunc:
ipintException(OutOfBoundsTrunc)
instructionLabel(_i32_trunc_f64_s)
popFloat64FT0()
move 0xc1e0000000200000, t0 # INT32_MIN - 1.0
fq2d t0, ft1
bdltequn ft0, ft1, .ipint_trunc_i32_f64_s_outOfBoundsTrunc
move 0x41e0000000000000, t0 # -INT32_MIN
fq2d t0, ft1
bdgtequn ft0, ft1, .ipint_trunc_i32_f64_s_outOfBoundsTrunc
truncated2is ft0, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
.ipint_trunc_i32_f64_s_outOfBoundsTrunc:
ipintException(OutOfBoundsTrunc)
instructionLabel(_i32_trunc_f64_u)
popFloat64FT0()
move 0xbff0000000000000, t0 # -1.0
fq2d t0, ft1
bdltequn ft0, ft1, .ipint_trunc_i32_f64_u_outOfBoundsTrunc
move 0x41f0000000000000, t0 # INT32_MIN * -2.0
fq2d t0, ft1
bdgtequn ft0, ft1, .ipint_trunc_i32_f64_u_outOfBoundsTrunc
truncated2i ft0, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
.ipint_trunc_i32_f64_u_outOfBoundsTrunc:
ipintException(OutOfBoundsTrunc)
instructionLabel(_i64_extend_i32_s)
popInt32(t0, t1)
sxi2q t0, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_extend_i32_u)
popInt32(t0, t1)
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_trunc_f32_s)
popFloat32FT0()
move 0xdf000000, t0 # INT64_MIN
fi2f t0, ft1
bfltun ft0, ft1, .ipint_trunc_i64_f32_s_outOfBoundsTrunc
move 0x5f000000, t0 # -INT64_MIN
fi2f t0, ft1
bfgtequn ft0, ft1, .ipint_trunc_i64_f32_s_outOfBoundsTrunc
truncatef2qs ft0, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
.ipint_trunc_i64_f32_s_outOfBoundsTrunc:
ipintException(OutOfBoundsTrunc)
instructionLabel(_i64_trunc_f32_u)
popFloat32FT0()
move 0xbf800000, t0 # -1.0
fi2f t0, ft1
bfltequn ft0, ft1, .ipint_i64_f32_u_outOfBoundsTrunc
move 0x5f800000, t0 # INT64_MIN * -2.0
fi2f t0, ft1
bfgtequn ft0, ft1, .ipint_i64_f32_u_outOfBoundsTrunc
truncatef2q ft0, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
.ipint_i64_f32_u_outOfBoundsTrunc:
ipintException(OutOfBoundsTrunc)
instructionLabel(_i64_trunc_f64_s)
move 0xc3e0000000000000, t0 # INT64_MIN
fq2d t0, ft1
bdltun ft0, ft1, .ipint_i64_f64_s_outOfBoundsTrunc
move 0x43e0000000000000, t0 # -INT64_MIN
fq2d t0, ft1
bdgtequn ft0, ft1, .ipint_i64_f64_s_outOfBoundsTrunc
truncated2qs ft0, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
.ipint_i64_f64_s_outOfBoundsTrunc:
ipintException(OutOfBoundsTrunc)
instructionLabel(_i64_trunc_f64_u)
move 0xbff0000000000000, t0 # -1.0
fq2d t0, ft1
bdltequn ft0, ft1, .ipint_i64_f64_u_outOfBoundsTrunc
move 0x43f0000000000000, t0 # INT64_MIN * -2.0
fq2d t0, ft1
bdgtequn ft0, ft1, .ipint_i64_f64_u_outOfBoundsTrunc
truncated2q ft0, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
.ipint_i64_f64_u_outOfBoundsTrunc:
ipintException(OutOfBoundsTrunc)
instructionLabel(_f32_convert_i32_s)
popInt32(t0, t1)
ci2fs t0, ft0
pushFloat32FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_convert_i32_u)
popInt32(t0, t1)
ci2f t0, ft0
pushFloat32FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_convert_i64_s)
popInt64(t0, t1)
cq2fs t0, ft0
pushFloat32FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_convert_i64_u)
popInt64(t0, t1)
if X86_64
cq2f t0, t1, ft0
else
cq2f t0, ft0
end
pushFloat32FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_demote_f64)
popFloat64FT0()
cd2f ft0, ft0
pushFloat32FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_convert_i32_s)
popInt32(t0, t1)
ci2ds t0, ft0
pushFloat64FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_convert_i32_u)
popInt32(t0, t1)
ci2d t0, ft0
pushFloat64FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_convert_i64_s)
popInt64(t0, t1)
cq2ds t0, ft0
pushFloat64FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_convert_i64_u)
popInt64(t0, t1)
if X86_64
cq2d t0, t1, ft0
else
cq2d t0, ft0
end
pushFloat64FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_promote_f32)
popFloat32FT0()
cf2d ft0, ft0
pushFloat64FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_reinterpret_f32)
popFloat32FT0()
ff2i ft0, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_reinterpret_f64)
popFloat64FT0()
fd2q ft0, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f32_reinterpret_i32)
pushInt32(t0)
fi2f t0, ft0
popFloat32FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_f64_reinterpret_i64)
pushInt64(t0)
fq2d t0, ft0
popFloat64FT0()
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_extend8_s)
# i32.extend8_s
popInt32(t0, t1)
sxb2i t0, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i32_extend16_s)
# i32.extend8_s
popInt32(t0, t1)
sxh2i t0, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_extend8_s)
# i64.extend8_s
popInt64(t0, t1)
sxb2q t0, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_extend16_s)
# i64.extend8_s
popInt64(t0, t1)
sxh2q t0, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_i64_extend32_s)
# i64.extend8_s
popInt64(t0, t1)
sxi2q t0, t0
pushInt64(t0)
advancePC(1)
nextIPIntInstruction()
reservedOpcode(0xc5)
reservedOpcode(0xc6)
reservedOpcode(0xc7)
reservedOpcode(0xc8)
reservedOpcode(0xc9)
reservedOpcode(0xca)
reservedOpcode(0xcb)
reservedOpcode(0xcc)
reservedOpcode(0xcd)
reservedOpcode(0xce)
reservedOpcode(0xcf)
#####################
# 0xd0 - 0xd2: refs #
#####################
instructionLabel(_ref_null_t)
loadi [PM, MC], t0
pushQuad(t0)
loadi 4[PM, MC], t0
advancePC(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_ref_is_null)
popQuad(t0, t1)
cqeq t0, ValueNull, t0
pushInt32(t0)
advancePC(1)
nextIPIntInstruction()
instructionLabel(_ref_func)
move wasmInstance, a0
loadi [PM, MC], a1
operationCall(macro() cCall2(_ipint_extern_ref_func) end)
pushQuad(t0)
loadi 4[PM, MC], t0
advancePC(t0)
advanceMC(8)
nextIPIntInstruction()
reservedOpcode(0xd3)
reservedOpcode(0xd4)
reservedOpcode(0xd5)
reservedOpcode(0xd6)
reservedOpcode(0xd7)
reservedOpcode(0xd8)
reservedOpcode(0xd9)
reservedOpcode(0xda)
reservedOpcode(0xdb)
reservedOpcode(0xdc)
reservedOpcode(0xdd)
reservedOpcode(0xde)
reservedOpcode(0xdf)
reservedOpcode(0xe0)
reservedOpcode(0xe1)
reservedOpcode(0xe2)
reservedOpcode(0xe3)
reservedOpcode(0xe4)
reservedOpcode(0xe5)
reservedOpcode(0xe6)
reservedOpcode(0xe7)
reservedOpcode(0xe8)
reservedOpcode(0xe9)
reservedOpcode(0xea)
reservedOpcode(0xeb)
reservedOpcode(0xec)
reservedOpcode(0xed)
reservedOpcode(0xee)
reservedOpcode(0xef)
reservedOpcode(0xf0)
reservedOpcode(0xf1)
reservedOpcode(0xf2)
reservedOpcode(0xf3)
reservedOpcode(0xf4)
reservedOpcode(0xf5)
reservedOpcode(0xf6)
reservedOpcode(0xf7)
reservedOpcode(0xf8)
reservedOpcode(0xf9)
reservedOpcode(0xfa)
reservedOpcode(0xfb)
instructionLabel(_fc_block)
loadb 1[PB, PC], t0
biaeq t0, 18, .ipint_fc_nonexistent
# Security guarantee: always less than 18 (0x00 -> 0x11)
if ARM64 or ARM64E
pcrtoaddr _ipint_i32_trunc_sat_f32_s, t1
emit "add x0, x1, x0, lsl 8"
emit "br x0"
elsif X86_64
lshifti 4, t0
leap (_ipint_i32_trunc_sat_f32_s), t1
addq t1, t0
emit "jmp *(%eax)"
end
.ipint_fc_nonexistent:
ipintException(Unreachable)
unimplementedInstruction(_simd)
reservedOpcode(0xfe)
reservedOpcode(0xff)
#######################
## 0xFC instructions ##
#######################
instructionLabel(_i32_trunc_sat_f32_s)
popFloat32FT0()
move 0xcf000000, t0 # INT32_MIN (Note that INT32_MIN - 1.0 in float is the same as INT32_MIN in float).
fi2f t0, ft1
bfltun ft0, ft1, .ipint_i32_trunc_sat_f32_s_outOfBoundsTruncSatMinOrNaN
move 0x4f000000, t0 # -INT32_MIN
fi2f t0, ft1
bfgtequn ft0, ft1, .ipint_i32_trunc_sat_f32_s_outOfBoundsTruncSatMax
truncatef2is ft0, t0
pushInt32(t0)
advancePC(2)
nextIPIntInstruction()
.ipint_i32_trunc_sat_f32_s_outOfBoundsTruncSatMinOrNaN:
bfeq ft0, ft0, .outOfBoundsTruncSatMin
move 0, t0
pushInt32(t0)
advancePC(2)
nextIPIntInstruction()
.ipint_i32_trunc_sat_f32_s_outOfBoundsTruncSatMax:
move (constexpr INT32_MAX), t0
pushInt32(t0)
advancePC(2)
nextIPIntInstruction()
.ipint_i32_trunc_sat_f32_s_outOfBoundsTruncSatMin:
move (constexpr INT32_MIN), t0
pushInt32(t0)
advancePC(2)
nextIPIntInstruction()
instructionLabel(_i32_trunc_sat_f32_u)
popFloat32FT0()
move 0xbf800000, t0 # -1.0
fi2f t0, ft1
bfltequn ft0, ft1, .ipint_i32_trunc_sat_f32_u_outOfBoundsTruncSatMin
move 0x4f800000, t0 # INT32_MIN * -2.0
fi2f t0, ft1
bfgtequn ft0, ft1, .ipint_i32_trunc_sat_f32_u_outOfBoundsTruncSatMax
truncatef2i ft0, t0
pushInt32(t0)
advancePC(2)
nextIPIntInstruction()
.ipint_i32_trunc_sat_f32_u_outOfBoundsTruncSatMin:
move 0, t0
pushInt32(t0)
advancePC(2)
nextIPIntInstruction()
.ipint_i32_trunc_sat_f32_u_outOfBoundsTruncSatMax:
move (constexpr UINT32_MAX), t0
pushInt32(t0)
advancePC(2)
nextIPIntInstruction()
instructionLabel(_i32_trunc_sat_f64_s)
popFloat64FT0()
move 0xc1e0000000200000, t0 # INT32_MIN - 1.0
fq2d t0, ft1
bdltequn ft0, ft1, .ipint_i32_trunc_sat_f64_s_outOfBoundsTruncSatMinOrNaN
move 0x41e0000000000000, t0 # -INT32_MIN
fq2d t0, ft1
bdgtequn ft0, ft1, .ipint_i32_trunc_sat_f64_s_outOfBoundsTruncSatMax
truncated2is ft0, t0
pushInt32(t0)
advancePC(2)
nextIPIntInstruction()
.ipint_i32_trunc_sat_f64_s_outOfBoundsTruncSatMinOrNaN:
bdeq ft0, ft0, .ipint_i32_trunc_sat_f64_s_outOfBoundsTruncSatMin
move 0, t0
pushInt32(t0)
advancePC(2)
nextIPIntInstruction()
.ipint_i32_trunc_sat_f64_s_outOfBoundsTruncSatMax:
move (constexpr INT32_MAX), t0
pushInt32(t0)
advancePC(2)
nextIPIntInstruction()
.ipint_i32_trunc_sat_f64_s_outOfBoundsTruncSatMin:
move (constexpr INT32_MIN), t0
pushInt32(t0)
advancePC(2)
nextIPIntInstruction()
instructionLabel(_i32_trunc_sat_f64_u)
popFloat64FT0()
move 0xbff0000000000000, t0 # -1.0
fq2d t0, ft1
bdltequn ft0, ft1, .ipint_i32_trunc_sat_f64_u_outOfBoundsTruncSatMin
move 0x41f0000000000000, t0 # INT32_MIN * -2.0
fq2d t0, ft1
bdgtequn ft0, ft1, .ipint_i32_trunc_sat_f64_u_outOfBoundsTruncSatMax
truncated2i ft0, t0
pushInt32(t0)
advancePC(2)
nextIPIntInstruction()
.ipint_i32_trunc_sat_f64_u_outOfBoundsTruncSatMin:
move 0, t0
pushInt32(t0)
advancePC(2)
nextIPIntInstruction()
.ipint_i32_trunc_sat_f64_u_outOfBoundsTruncSatMax:
move (constexpr UINT32_MAX), t0
pushInt32(t0)
advancePC(2)
nextIPIntInstruction()
instructionLabel(_i64_trunc_sat_f32_s)
popFloat32FT0()
move 0xdf000000, t0 # INT64_MIN
fi2f t0, ft1
bfltun ft0, ft1, .ipint_i64_trunc_sat_f32_s_outOfBoundsTruncSatMinOrNaN
move 0x5f000000, t0 # -INT64_MIN
fi2f t0, ft1
bfgtequn ft0, ft1, .ipint_i64_trunc_sat_f32_s_outOfBoundsTruncSatMax
truncatef2qs ft0, t0
pushInt64(t0)
advancePC(2)
nextIPIntInstruction()
.ipint_i64_trunc_sat_f32_s_outOfBoundsTruncSatMinOrNaN:
bfeq ft0, ft0, .outOfBoundsTruncSatMin
move 0, t0
pushInt64(t0)
advancePC(2)
nextIPIntInstruction()
.ipint_i64_trunc_sat_f32_s_outOfBoundsTruncSatMax:
move (constexpr INT64_MAX), t0
pushInt64(t0)
advancePC(2)
nextIPIntInstruction()
instructionLabel(_i64_trunc_sat_f32_u)
popFloat32FT0()
move 0xbf800000, t0 # -1.0
fi2f t0, ft1
bfltequn ft0, ft1, .ipint_i64_trunc_sat_f32_u_outOfBoundsTruncSatMin
move 0x5f800000, t0 # INT64_MIN * -2.0
fi2f t0, ft1
bfgtequn ft0, ft1, .ipint_i64_trunc_sat_f32_u_outOfBoundsTruncSatMax
truncatef2q ft0, t0
pushInt64(t0)
advancePC(2)
nextIPIntInstruction()
.ipint_i64_trunc_sat_f32_u_outOfBoundsTruncSatMin:
move 0, t0
pushInt64(t0)
advancePC(2)
nextIPIntInstruction()
.ipint_i64_trunc_sat_f32_u_outOfBoundsTruncSatMax:
move (constexpr UINT64_MAX), t0
pushInt64(t0)
advancePC(2)
nextIPIntInstruction()
instructionLabel(_i64_trunc_sat_f64_s)
popFloat64FT0()
move 0xc3e0000000000000, t0 # INT64_MIN
fq2d t0, ft1
bdltun ft0, ft1, .outOfBoundsTruncSatMinOrNaN
move 0x43e0000000000000, t0 # -INT64_MIN
fq2d t0, ft1
bdgtequn ft0, ft1, .outOfBoundsTruncSatMax
truncated2qs ft0, t0
pushInt64(t0)
advancePC(2)
nextIPIntInstruction()
.outOfBoundsTruncSatMinOrNaN:
bdeq ft0, ft0, .outOfBoundsTruncSatMin
move 0, t0
pushInt64(t0)
advancePC(2)
nextIPIntInstruction()
.outOfBoundsTruncSatMax:
move (constexpr INT64_MAX), t0
pushInt64(t0)
advancePC(2)
nextIPIntInstruction()
.outOfBoundsTruncSatMin:
move (constexpr INT64_MIN), t0
pushInt64(t0)
advancePC(2)
nextIPIntInstruction()
instructionLabel(_i64_trunc_sat_f64_u)
popFloat64FT0()
move 0xbff0000000000000, t0 # -1.0
fq2d t0, ft1
bdltequn ft0, ft1, .ipint_i64_trunc_sat_f64_u_outOfBoundsTruncSatMin
move 0x43f0000000000000, t0 # INT64_MIN * -2.0
fq2d t0, ft1
bdgtequn ft0, ft1, .ipint_i64_trunc_sat_f64_u_outOfBoundsTruncSatMax
truncated2q ft0, t0
pushInt64(t0)
advancePC(2)
nextIPIntInstruction()
.ipint_i64_trunc_sat_f64_u_outOfBoundsTruncSatMin:
move 0, t0
pushInt64(t0)
advancePC(2)
nextIPIntInstruction()
.ipint_i64_trunc_sat_f64_u_outOfBoundsTruncSatMax:
move (constexpr UINT64_MAX), t0
pushInt64(t0)
advancePC(2)
nextIPIntInstruction()
instructionLabel(_memory_init)
# memory.init
popQuad(t0, t3) # n
popQuad(t1, t3) # s
popQuad(a2, t3) # d
lshiftq 32, t1
orq t1, t0
move t0, a3
loadi [PM, MC], a1
operationCallMayThrow(macro() cCall4(_ipint_extern_memory_init) end)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_data_drop)
# data.drop
loadi [PM, MC], a1
operationCall(macro() cCall2(_ipint_extern_data_drop) end)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_memory_copy)
# memory.copy
popQuad(a3, t0) # n
popQuad(a2, t0) # s
popQuad(a1, t0) # d
operationCallMayThrow(macro() cCall4(_ipint_extern_memory_copy) end)
advancePC(4)
nextIPIntInstruction()
instructionLabel(_memory_fill)
# memory.fill
popQuad(a3, t0) # n
popQuad(a2, t0) # val
popQuad(a1, t0) # d
operationCallMayThrow(macro() cCall4(_ipint_extern_memory_fill) end)
advancePC(3)
nextIPIntInstruction()
instructionLabel(_table_init)
# memory.init
popQuad(t0, t3) # n
popQuad(t1, t3) # s
popQuad(a2, t3) # d
lshiftq 32, t1
orq t1, t0
move t0, a3
leap [PM, MC], a1
operationCallMayThrow(macro() cCall4(_ipint_extern_table_init) end)
loadq 8[PM, MC], t0
advancePCByReg(t0)
advanceMC(16)
nextIPIntInstruction()
instructionLabel(_elem_drop)
# elem.drop
loadi [PM, MC], a1
operationCall(macro() cCall2(_ipint_extern_elem_drop) end)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_table_copy)
# table.copy
popQuad(t0, t3) # n
popQuad(t1, t3) # s
popQuad(a2, t3) # d
lshiftq 32, t1
orq t1, t0
move t0, a3
leap [PM, MC], a1
operationCallMayThrow(macro() cCall4(_ipint_extern_table_copy) end)
loadq 8[PM, MC], t0
advancePCByReg(t0)
advanceMC(16)
nextIPIntInstruction()
instructionLabel(_table_grow)
# table.grow
loadi [PM, MC], a1
popQuad(a3, t0) # n
popQuad(a2, t0) # fill
operationCall(macro() cCall4(_ipint_extern_table_grow) end)
pushQuad(t0)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_table_size)
# table.size
loadi [PM, MC], a1
operationCall(macro() cCall2(_ipint_extern_table_size) end)
pushQuad(t0)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
instructionLabel(_table_fill)
# table.fill
popQuad(t0, t3) # n
popQuad(a2, t3) # val
popQuad(t3, t1) # i
lshiftq 32, t3
orq t0, t3
loadi [PM, MC], a1
operationCallMayThrow(macro() cCall4(_ipint_extern_table_fill) end)
loadi 4[PM, MC], t0
advancePCByReg(t0)
advanceMC(8)
nextIPIntInstruction()
##################################
## "Out of line" logic for call ##
##################################
_ipint_call_impl:
# 0 - 3: function index
# 4 - 7: PC post call
# 8 - 23: offsets for GPR
# 24 - 39: offsets for FPR
# 40 - 42: length of stack data
# 42 - 44: number of arguments
# 44 - 46: number of stack arguments
# 46 - x: offsets
# function index
loadi [PM, MC], t0
# Get function data
move t0, a1
move wasmInstance, a0
cCall2(_ipint_extern_call)
.ipint_call_common:
move r0, ws0
move r1, wasmInstance
# Set up stack first
loadh 44[PM, MC], t2
move t2, t3
# 8B per argument on the stack
lshiftq 3, t2
# round up to nearest multiple of 16
# keep an extra 16 for saved PL
addq 24, t2
andq -16, t2
move sp, t1
subp t2, t1
leap 46[PM, MC], t2
move 0, t0
.ipint_call_stack_loop:
loadh [t2], t4
lshiftq 4, t4
bqeq t0, t3, .ipint_call_stack_end
loadq [sp, t4], t4
addp 2, t2
storeq t4, [t1]
addp 8, t1
addq 1, t0
jmp .ipint_call_stack_loop
.ipint_call_stack_end:
move MC, PB
pushQuad(PL)
# Set up arguments in registers
loadh 8[PM, PB], ws1
lshiftq 4, ws1
loadq 16[sp, ws1], a0
loadh 10[PM, PB], ws1
lshiftq 4, ws1
loadq 16[sp, ws1], a1
loadh 12[PM, PB], ws1
lshiftq 4, ws1
loadq 16[sp, ws1], a2
loadh 14[PM, PB], ws1
lshiftq 4, ws1
loadq 16[sp, ws1], a3
loadh 16[PM, PB], ws1
if ARM64 or ARM64E
lshiftq 4, ws1
loadq 16[sp, ws1], a4
loadh 18[PM, PB], ws1
lshiftq 4, ws1
loadq 16[sp, ws1], a5
loadh 20[PM, PB], ws1
lshiftq 4, ws1
loadq 16[sp, ws1], a6
loadh 22[PM, PB], ws1
lshiftq 4, ws1
loadq 16[sp, ws1], a7
end
loadh 24[PM, PB], ws1
lshiftq 4, ws1
loadd 16[sp, ws1], wfa0
loadh 26[PM, PB], ws1
lshiftq 4, ws1
loadd 16[sp, ws1], wfa1
loadh 28[PM, PB], ws1
lshiftq 4, ws1
loadd 16[sp, ws1], wfa2
loadh 30[PM, PB], ws1
lshiftq 4, ws1
loadd 16[sp, ws1], wfa3
loadh 32[PM, PB], ws1
lshiftq 4, ws1
loadd 16[sp, ws1], wfa4
loadh 34[PM, PB], ws1
lshiftq 4, ws1
loadd 16[sp, ws1], wfa5
if ARM64 or ARM64E
loadh 36[PM, PB], ws1
lshiftq 4, ws1
loadd 16[sp, ws1], wfa6
loadh 38[PM, PB], ws1
lshiftq 4, ws1
loadd 16[sp, ws1], wfa7
end
loadq [sp], ws1
addq 16, sp
# reset SP to top of params
loadh 44[PM, PB], ws1
# 8B per argument on the stack
lshiftq 3, ws1
# round up to nearest multiple of 16
# keep an extra 16 for saved PL
addq 24, ws1
andq -16, ws1
subp ws1, sp
# Space for caller frame
subp FirstArgumentOffset - 16, sp
# Make the call
move wasmInstance, PM
call ws0, JSEntrySlowPathPtrTag
addq FirstArgumentOffset - 16, sp
# Post-call: restore instance and MC
move PM, wasmInstance
getIPIntCallee()
# Saved MC
move PB, ws1
# Throw away PM value since it's already in wasmInstance
popQuad(PB, PM)
loadp Wasm::IPIntCallee::m_metadata[ws0], PM
# ws0 = limit
# csr3 = index
# csr4 = value
move ws1, csr3
addq 40, csr3
# Load size of parameter group
loadh [PM, csr3], ws0
loadh 2[PM, csr3], csr4
addq ws0, csr3
# Pop all arguments off stack
lshiftq 4, csr4
addp csr4, sp
# Load size of return group
loadh [PM, csr3], ws0
addq csr3, ws0
.ipint_call_ret_loop:
bqeq ws0, csr3, .ipint_call_ret_loop_end
loadb 2[PM, csr3], csr4
bqeq csr4, 0, .ipint_call_ret_loop_end
addq 1, csr3
bqgteq csr4, 6, .ipint_call_ret_stack
bqeq csr4, 5, .ipint_call_ret_fpr
pushQuad(t0)
jmp .ipint_call_ret_loop
.ipint_call_ret_fpr:
pushFPR()
jmp .ipint_call_ret_loop
.ipint_call_ret_stack:
# TODO
break
.ipint_call_ret_loop_end:
move ws0, MC
move PB, PL
# Restore PC
loadi 4[PM, ws1], PC
# Restore ws1
getIPIntCallee()
loadp Wasm::IPIntCallee::m_bytecode[ws0], PB
# Restore IB
if ARM64 or ARM64E
pcrtoaddr _ipint_unreachable, IB
end
ipintReloadMemory()
nextIPIntInstruction()
# Put all operations before this `else`, or else 32-bit architectures will fail to build.
else
# For 32-bit architectures: make sure that the assertions can still find the labels
unimplementedInstruction(_unreachable)
unimplementedInstruction(_nop)
unimplementedInstruction(_block)
unimplementedInstruction(_loop)
unimplementedInstruction(_if)
unimplementedInstruction(_else)
reservedOpcode(0x06)
reservedOpcode(0x07)
reservedOpcode(0x08)
reservedOpcode(0x09)
reservedOpcode(0x0a)
unimplementedInstruction(_end)
unimplementedInstruction(_br)
unimplementedInstruction(_br_if)
unimplementedInstruction(_br_table)
unimplementedInstruction(_return)
unimplementedInstruction(_call)
unimplementedInstruction(_call_indirect)
reservedOpcode(0x12)
reservedOpcode(0x13)
reservedOpcode(0x14)
reservedOpcode(0x15)
reservedOpcode(0x16)
reservedOpcode(0x17)
reservedOpcode(0x18)
reservedOpcode(0x19)
unimplementedInstruction(_drop)
unimplementedInstruction(_select)
unimplementedInstruction(_select_t)
reservedOpcode(0x1d)
reservedOpcode(0x1e)
reservedOpcode(0x1f)
unimplementedInstruction(_local_get)
unimplementedInstruction(_local_set)
unimplementedInstruction(_local_tee)
unimplementedInstruction(_global_get)
unimplementedInstruction(_global_set)
unimplementedInstruction(_table_get)
unimplementedInstruction(_table_set)
reservedOpcode(0x27)
unimplementedInstruction(_i32_load_mem)
unimplementedInstruction(_i64_load_mem)
unimplementedInstruction(_f32_load_mem)
unimplementedInstruction(_f64_load_mem)
unimplementedInstruction(_i32_load8s_mem)
unimplementedInstruction(_i32_load8u_mem)
unimplementedInstruction(_i32_load16s_mem)
unimplementedInstruction(_i32_load16u_mem)
unimplementedInstruction(_i64_load8s_mem)
unimplementedInstruction(_i64_load8u_mem)
unimplementedInstruction(_i64_load16s_mem)
unimplementedInstruction(_i64_load16u_mem)
unimplementedInstruction(_i64_load32s_mem)
unimplementedInstruction(_i64_load32u_mem)
unimplementedInstruction(_i32_store_mem)
unimplementedInstruction(_i64_store_mem)
unimplementedInstruction(_f32_store_mem)
unimplementedInstruction(_f64_store_mem)
unimplementedInstruction(_i32_store8_mem)
unimplementedInstruction(_i32_store16_mem)
unimplementedInstruction(_i64_store8_mem)
unimplementedInstruction(_i64_store16_mem)
unimplementedInstruction(_i64_store32_mem)
unimplementedInstruction(_memory_size)
unimplementedInstruction(_memory_grow)
unimplementedInstruction(_i32_const)
unimplementedInstruction(_i64_const)
unimplementedInstruction(_f32_const)
unimplementedInstruction(_f64_const)
unimplementedInstruction(_i32_eqz)
unimplementedInstruction(_i32_eq)
unimplementedInstruction(_i32_ne)
unimplementedInstruction(_i32_lt_s)
unimplementedInstruction(_i32_lt_u)
unimplementedInstruction(_i32_gt_s)
unimplementedInstruction(_i32_gt_u)
unimplementedInstruction(_i32_le_s)
unimplementedInstruction(_i32_le_u)
unimplementedInstruction(_i32_ge_s)
unimplementedInstruction(_i32_ge_u)
unimplementedInstruction(_i64_eqz)
unimplementedInstruction(_i64_eq)
unimplementedInstruction(_i64_ne)
unimplementedInstruction(_i64_lt_s)
unimplementedInstruction(_i64_lt_u)
unimplementedInstruction(_i64_gt_s)
unimplementedInstruction(_i64_gt_u)
unimplementedInstruction(_i64_le_s)
unimplementedInstruction(_i64_le_u)
unimplementedInstruction(_i64_ge_s)
unimplementedInstruction(_i64_ge_u)
unimplementedInstruction(_f32_eq)
unimplementedInstruction(_f32_ne)
unimplementedInstruction(_f32_lt)
unimplementedInstruction(_f32_gt)
unimplementedInstruction(_f32_le)
unimplementedInstruction(_f32_ge)
unimplementedInstruction(_f64_eq)
unimplementedInstruction(_f64_ne)
unimplementedInstruction(_f64_lt)
unimplementedInstruction(_f64_gt)
unimplementedInstruction(_f64_le)
unimplementedInstruction(_f64_ge)
unimplementedInstruction(_i32_clz)
unimplementedInstruction(_i32_ctz)
unimplementedInstruction(_i32_popcnt)
unimplementedInstruction(_i32_add)
unimplementedInstruction(_i32_sub)
unimplementedInstruction(_i32_mul)
unimplementedInstruction(_i32_div_s)
unimplementedInstruction(_i32_div_u)
unimplementedInstruction(_i32_rem_s)
unimplementedInstruction(_i32_rem_u)
unimplementedInstruction(_i32_and)
unimplementedInstruction(_i32_or)
unimplementedInstruction(_i32_xor)
unimplementedInstruction(_i32_shl)
unimplementedInstruction(_i32_shr_s)
unimplementedInstruction(_i32_shr_u)
unimplementedInstruction(_i32_rotl)
unimplementedInstruction(_i32_rotr)
unimplementedInstruction(_i64_clz)
unimplementedInstruction(_i64_ctz)
unimplementedInstruction(_i64_popcnt)
unimplementedInstruction(_i64_add)
unimplementedInstruction(_i64_sub)
unimplementedInstruction(_i64_mul)
unimplementedInstruction(_i64_div_s)
unimplementedInstruction(_i64_div_u)
unimplementedInstruction(_i64_rem_s)
unimplementedInstruction(_i64_rem_u)
unimplementedInstruction(_i64_and)
unimplementedInstruction(_i64_or)
unimplementedInstruction(_i64_xor)
unimplementedInstruction(_i64_shl)
unimplementedInstruction(_i64_shr_s)
unimplementedInstruction(_i64_shr_u)
unimplementedInstruction(_i64_rotl)
unimplementedInstruction(_i64_rotr)
unimplementedInstruction(_f32_abs)
unimplementedInstruction(_f32_neg)
unimplementedInstruction(_f32_ceil)
unimplementedInstruction(_f32_floor)
unimplementedInstruction(_f32_trunc)
unimplementedInstruction(_f32_nearest)
unimplementedInstruction(_f32_sqrt)
unimplementedInstruction(_f32_add)
unimplementedInstruction(_f32_sub)
unimplementedInstruction(_f32_mul)
unimplementedInstruction(_f32_div)
unimplementedInstruction(_f32_min)
unimplementedInstruction(_f32_max)
unimplementedInstruction(_f32_copysign)
unimplementedInstruction(_f64_abs)
unimplementedInstruction(_f64_neg)
unimplementedInstruction(_f64_ceil)
unimplementedInstruction(_f64_floor)
unimplementedInstruction(_f64_trunc)
unimplementedInstruction(_f64_nearest)
unimplementedInstruction(_f64_sqrt)
unimplementedInstruction(_f64_add)
unimplementedInstruction(_f64_sub)
unimplementedInstruction(_f64_mul)
unimplementedInstruction(_f64_div)
unimplementedInstruction(_f64_min)
unimplementedInstruction(_f64_max)
unimplementedInstruction(_f64_copysign)
unimplementedInstruction(_i32_wrap_i64)
unimplementedInstruction(_i32_trunc_f32_s)
unimplementedInstruction(_i32_trunc_f32_u)
unimplementedInstruction(_i32_trunc_f64_s)
unimplementedInstruction(_i32_trunc_f64_u)
unimplementedInstruction(_i64_extend_i32_s)
unimplementedInstruction(_i64_extend_i32_u)
unimplementedInstruction(_i64_trunc_f32_s)
unimplementedInstruction(_i64_trunc_f32_u)
unimplementedInstruction(_i64_trunc_f64_s)
unimplementedInstruction(_i64_trunc_f64_u)
unimplementedInstruction(_f32_convert_i32_s)
unimplementedInstruction(_f32_convert_i32_u)
unimplementedInstruction(_f32_convert_i64_s)
unimplementedInstruction(_f32_convert_i64_u)
unimplementedInstruction(_f32_demote_f64)
unimplementedInstruction(_f64_convert_i32_s)
unimplementedInstruction(_f64_convert_i32_u)
unimplementedInstruction(_f64_convert_i64_s)
unimplementedInstruction(_f64_convert_i64_u)
unimplementedInstruction(_f64_promote_f32)
unimplementedInstruction(_i32_reinterpret_f32)
unimplementedInstruction(_i64_reinterpret_f64)
unimplementedInstruction(_f32_reinterpret_i32)
unimplementedInstruction(_f64_reinterpret_i64)
unimplementedInstruction(_i32_extend8_s)
unimplementedInstruction(_i32_extend16_s)
unimplementedInstruction(_i64_extend8_s)
unimplementedInstruction(_i64_extend16_s)
unimplementedInstruction(_i64_extend32_s)
reservedOpcode(0xc5)
reservedOpcode(0xc6)
reservedOpcode(0xc7)
reservedOpcode(0xc8)
reservedOpcode(0xc9)
reservedOpcode(0xca)
reservedOpcode(0xcb)
reservedOpcode(0xcc)
reservedOpcode(0xcd)
reservedOpcode(0xce)
reservedOpcode(0xcf)
unimplementedInstruction(_ref_null_t)
unimplementedInstruction(_ref_is_null)
unimplementedInstruction(_ref_func)
reservedOpcode(0xd3)
reservedOpcode(0xd4)
reservedOpcode(0xd5)
reservedOpcode(0xd6)
reservedOpcode(0xd7)
reservedOpcode(0xd8)
reservedOpcode(0xd9)
reservedOpcode(0xda)
reservedOpcode(0xdb)
reservedOpcode(0xdc)
reservedOpcode(0xdd)
reservedOpcode(0xde)
reservedOpcode(0xdf)
reservedOpcode(0xe0)
reservedOpcode(0xe1)
reservedOpcode(0xe2)
reservedOpcode(0xe3)
reservedOpcode(0xe4)
reservedOpcode(0xe5)
reservedOpcode(0xe6)
reservedOpcode(0xe7)
reservedOpcode(0xe8)
reservedOpcode(0xe9)
reservedOpcode(0xea)
reservedOpcode(0xeb)
reservedOpcode(0xec)
reservedOpcode(0xed)
reservedOpcode(0xee)
reservedOpcode(0xef)
reservedOpcode(0xf0)
reservedOpcode(0xf1)
reservedOpcode(0xf2)
reservedOpcode(0xf3)
reservedOpcode(0xf4)
reservedOpcode(0xf5)
reservedOpcode(0xf6)
reservedOpcode(0xf7)
reservedOpcode(0xf8)
reservedOpcode(0xf9)
reservedOpcode(0xfa)
reservedOpcode(0xfb)
unimplementedInstruction(_fc_block)
unimplementedInstruction(_simd)
reservedOpcode(0xfe)
reservedOpcode(0xff)
end
|