aboutsummaryrefslogtreecommitdiff
path: root/src/buildvm_x64win.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildvm_x64win.h')
-rw-r--r--src/buildvm_x64win.h993
1 files changed, 557 insertions, 436 deletions
diff --git a/src/buildvm_x64win.h b/src/buildvm_x64win.h
index a3c8ed74..b051974c 100644
--- a/src/buildvm_x64win.h
+++ b/src/buildvm_x64win.h
@@ -12,7 +12,7 @@
12#define DASM_SECTION_CODE_OP 0 12#define DASM_SECTION_CODE_OP 0
13#define DASM_SECTION_CODE_SUB 1 13#define DASM_SECTION_CODE_SUB 1
14#define DASM_MAXSECTION 2 14#define DASM_MAXSECTION 2
15static const unsigned char build_actionlist[16019] = { 15static const unsigned char build_actionlist[16020] = {
16 254,1,248,10,252,247,198,237,15,132,244,11,131,230,252,248,41,252,242,72, 16 254,1,248,10,252,247,198,237,15,132,244,11,131,230,252,248,41,252,242,72,
17 141,76,49,252,248,139,114,252,252,199,68,10,4,237,248,12,131,192,1,137,68, 17 141,76,49,252,248,139,114,252,252,199,68,10,4,237,248,12,131,192,1,137,68,
18 36,84,252,247,198,237,15,132,244,13,248,14,129,252,246,239,252,247,198,237, 18 36,84,252,247,198,237,15,132,244,13,248,14,129,252,246,239,252,247,198,237,
@@ -490,18 +490,18 @@ static const unsigned char build_actionlist[16019] = {
490 252,233,218,209,221,217,195,255,221,225,223,224,252,246,196,1,15,132,244, 490 252,233,218,209,221,217,195,255,221,225,223,224,252,246,196,1,15,132,244,
491 248,217,201,248,2,221,216,195,248,1,221,225,223,224,252,246,196,1,15,133, 491 248,217,201,248,2,221,216,195,248,1,221,225,223,224,252,246,196,1,15,133,
492 244,248,217,201,248,2,221,216,195,255,248,163,137,200,86,72,137,214,83,15, 492 244,248,217,201,248,2,221,216,195,255,248,163,137,200,86,72,137,214,83,15,
493 162,137,6,137,94,4,137,78,8,137,86,12,91,94,195,248,164,255,85,72,137,229, 493 162,137,6,137,94,4,137,78,8,137,86,12,91,94,195,248,164,255,204,248,165,255,
494 83,72,137,203,139,131,233,72,41,196,255,15,182,139,233,131,252,233,1,15,136, 494 85,72,137,229,83,72,137,203,139,131,233,72,41,196,255,15,182,139,233,131,
495 244,248,248,1,72,139,132,253,203,233,72,137,132,253,204,233,131,252,233,1, 495 252,233,1,15,136,244,248,248,1,72,139,132,253,203,233,72,137,132,253,204,
496 15,137,244,1,248,2,15,182,131,233,72,139,139,233,72,139,147,233,76,139,131, 496 233,131,252,233,1,15,137,244,1,248,2,15,182,131,233,72,139,139,233,72,139,
497 233,76,139,139,233,133,192,15,132,244,251,15,40,131,233,15,40,139,233,15, 497 147,233,76,139,131,233,76,139,139,233,133,192,15,132,244,251,15,40,131,233,
498 40,147,233,15,40,155,233,248,5,255,252,255,147,233,72,137,131,233,15,41,131, 498 15,40,139,233,15,40,147,233,15,40,155,233,248,5,255,252,255,147,233,72,137,
499 233,255,72,139,93,252,248,201,195,255,248,165,255,249,255,129,124,253,202, 499 131,233,15,41,131,233,255,72,139,93,252,248,201,195,255,249,255,129,124,253,
500 4,239,15,133,244,253,129,124,253,194,4,239,15,133,244,254,139,44,202,131, 500 202,4,239,15,133,244,253,129,124,253,194,4,239,15,133,244,254,139,44,202,
501 198,4,59,44,194,255,15,141,244,255,255,15,140,244,255,255,15,143,244,255, 501 131,198,4,59,44,194,255,15,141,244,255,255,15,140,244,255,255,15,143,244,
502 255,15,142,244,255,255,248,6,15,183,70,252,254,141,180,253,134,233,248,9, 502 255,255,15,142,244,255,255,248,6,15,183,70,252,254,141,180,253,134,233,248,
503 139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,252,235,248,7, 503 9,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,252,235,248,
504 15,135,244,43,129,124,253,194,4,239,15,130,244,247,15,133,244,43,255,252, 504 7,15,135,244,43,129,124,253,194,4,239,15,130,244,247,15,133,244,43,255,252,
505 242,15,42,4,194,252,233,244,248,255,221,4,202,219,4,194,252,233,244,249,255, 505 242,15,42,4,194,252,233,244,248,255,221,4,202,219,4,194,252,233,244,249,255,
506 248,8,15,135,244,43,255,252,242,15,42,12,202,252,242,15,16,4,194,131,198, 506 248,8,15,135,244,43,255,252,242,15,42,12,202,252,242,15,16,4,194,131,198,
507 4,102,15,46,193,255,15,134,244,9,255,15,135,244,9,255,15,130,244,9,255,15, 507 4,102,15,46,193,255,15,134,244,9,255,15,135,244,9,255,15,130,244,9,255,15,
@@ -749,7 +749,7 @@ static const unsigned char build_actionlist[16019] = {
749 252,237,129,229,239,102,129,172,253,43,233,238,15,130,244,148,255,141,12, 749 252,237,129,229,239,102,129,172,253,43,233,238,15,130,244,148,255,141,12,
750 202,255,129,121,253,4,239,15,133,244,255,255,129,121,253,12,239,15,133,244, 750 202,255,129,121,253,4,239,15,133,244,255,255,129,121,253,12,239,15,133,244,
751 60,129,121,253,20,239,15,133,244,60,139,41,131,121,16,0,15,140,244,251,255, 751 60,129,121,253,20,239,15,133,244,60,139,41,131,121,16,0,15,140,244,251,255,
752 129,121,253,12,239,15,133,244,165,129,121,253,20,239,15,133,244,165,255,139, 752 129,121,253,12,239,15,133,244,164,129,121,253,20,239,15,133,244,164,255,139,
753 105,16,133,252,237,15,136,244,251,3,41,15,128,244,247,137,41,255,59,105,8, 753 105,16,133,252,237,15,136,244,251,3,41,15,128,244,247,137,41,255,59,105,8,
754 199,65,28,237,137,105,24,255,15,142,244,253,248,1,248,6,141,180,253,134,233, 754 199,65,28,237,137,105,24,255,15,142,244,253,248,1,248,6,141,180,253,134,233,
755 255,141,180,253,134,233,15,183,70,252,254,15,142,245,248,1,248,6,255,15,143, 755 255,141,180,253,134,233,15,183,70,252,254,15,142,245,248,1,248,6,255,15,143,
@@ -758,7 +758,7 @@ static const unsigned char build_actionlist[16019] = {
758 41,255,15,141,244,7,255,141,180,253,134,233,15,183,70,252,254,15,141,245, 758 41,255,15,141,244,7,255,141,180,253,134,233,15,183,70,252,254,15,141,245,
759 255,15,140,244,7,255,252,233,244,6,248,9,255,129,121,253,4,239,255,15,131, 759 255,15,140,244,7,255,252,233,244,6,248,9,255,129,121,253,4,239,255,15,131,
760 244,60,129,121,253,12,239,15,131,244,60,255,129,121,253,12,239,15,131,244, 760 244,60,129,121,253,12,239,15,131,244,60,255,129,121,253,12,239,15,131,244,
761 165,129,121,253,20,239,15,131,244,165,255,139,105,20,255,129,252,253,239, 761 164,129,121,253,20,239,15,131,244,164,255,139,105,20,255,129,252,253,239,
762 15,131,244,60,255,252,242,15,16,1,252,242,15,16,73,8,255,252,242,15,88,65, 762 15,131,244,60,255,252,242,15,16,1,252,242,15,16,73,8,255,252,242,15,88,65,
763 16,252,242,15,17,1,133,252,237,15,136,244,249,255,15,140,244,249,255,102, 763 16,252,242,15,17,1,133,252,237,15,136,244,249,255,15,140,244,249,255,102,
764 15,46,200,248,1,252,242,15,17,65,24,255,221,65,8,221,1,255,220,65,16,221, 764 15,46,200,248,1,252,242,15,17,65,24,255,221,65,8,221,1,255,220,65,16,221,
@@ -947,8 +947,8 @@ enum {
947 GLOB_vm_foldfpm, 947 GLOB_vm_foldfpm,
948 GLOB_vm_foldarith, 948 GLOB_vm_foldarith,
949 GLOB_vm_cpuid, 949 GLOB_vm_cpuid,
950 GLOB_vm_ffi_call,
951 GLOB_assert_bad_for_arg_type, 950 GLOB_assert_bad_for_arg_type,
951 GLOB_vm_ffi_call,
952 GLOB_BC_MODVN_Z, 952 GLOB_BC_MODVN_Z,
953 GLOB_BC_TGETS_Z, 953 GLOB_BC_TGETS_Z,
954 GLOB_BC_TSETS_Z, 954 GLOB_BC_TSETS_Z,
@@ -1109,8 +1109,8 @@ static const char *const globnames[] = {
1109 "vm_foldfpm", 1109 "vm_foldfpm",
1110 "vm_foldarith", 1110 "vm_foldarith",
1111 "vm_cpuid", 1111 "vm_cpuid",
1112 "vm_ffi_call@4",
1113 "assert_bad_for_arg_type", 1112 "assert_bad_for_arg_type",
1113 "vm_ffi_call@4",
1114 "BC_MODVN_Z", 1114 "BC_MODVN_Z",
1115 "BC_TGETS_Z", 1115 "BC_TGETS_Z",
1116 "BC_TSETS_Z", 1116 "BC_TSETS_Z",
@@ -1832,29 +1832,28 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
1832 dasm_put(Dst, 9398); 1832 dasm_put(Dst, 9398);
1833 } 1833 }
1834 dasm_put(Dst, 9816); 1834 dasm_put(Dst, 9816);
1835#ifdef LUA_USE_ASSERT
1836 dasm_put(Dst, 9400);
1837#endif
1838 dasm_put(Dst, 9844);
1835#if LJ_HASFFI 1839#if LJ_HASFFI
1836#define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V) 1840#define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
1837 dasm_put(Dst, 9844, DtE(->spadj)); 1841 dasm_put(Dst, 9848, DtE(->spadj));
1838#if LJ_TARGET_WINDOWS 1842#if LJ_TARGET_WINDOWS
1839#endif 1843#endif
1840 dasm_put(Dst, 9859, DtE(->nsp), offsetof(CCallState, stack), CCALL_SPS_EXTRA*8, DtE(->nfpr), DtE(->gpr[0]), DtE(->gpr[1]), DtE(->gpr[2]), DtE(->gpr[3]), DtE(->fpr[0]), DtE(->fpr[1]), DtE(->fpr[2]), DtE(->fpr[3])); 1844 dasm_put(Dst, 9863, DtE(->nsp), offsetof(CCallState, stack), CCALL_SPS_EXTRA*8, DtE(->nfpr), DtE(->gpr[0]), DtE(->gpr[1]), DtE(->gpr[2]), DtE(->gpr[3]), DtE(->fpr[0]), DtE(->fpr[1]), DtE(->fpr[2]), DtE(->fpr[3]));
1841 dasm_put(Dst, 9940, DtE(->func), DtE(->gpr[0]), DtE(->fpr[0])); 1845 dasm_put(Dst, 9944, DtE(->func), DtE(->gpr[0]), DtE(->fpr[0]));
1842#if LJ_TARGET_WINDOWS 1846#if LJ_TARGET_WINDOWS
1843#endif 1847#endif
1844 dasm_put(Dst, 9953); 1848 dasm_put(Dst, 9957);
1845#endif
1846 dasm_put(Dst, 9961);
1847#ifdef LUA_USE_ASSERT
1848 dasm_put(Dst, 9400);
1849#endif 1849#endif
1850 dasm_put(Dst, 9400);
1851} 1850}
1852 1851
1853/* Generate the code for a single instruction. */ 1852/* Generate the code for a single instruction. */
1854static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse) 1853static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
1855{ 1854{
1856 int vk = 0; 1855 int vk = 0;
1857 dasm_put(Dst, 9964, defop); 1856 dasm_put(Dst, 9965, defop);
1858 1857
1859 switch (op) { 1858 switch (op) {
1860 1859
@@ -1865,145 +1864,145 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
1865 1864
1866 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: 1865 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT:
1867 if (LJ_DUALNUM) { 1866 if (LJ_DUALNUM) {
1868 dasm_put(Dst, 9966, LJ_TISNUM, LJ_TISNUM); 1867 dasm_put(Dst, 9967, LJ_TISNUM, LJ_TISNUM);
1869 switch (op) { 1868 switch (op) {
1870 case BC_ISLT: 1869 case BC_ISLT:
1871 dasm_put(Dst, 9996); 1870 dasm_put(Dst, 9997);
1872 break; 1871 break;
1873 case BC_ISGE: 1872 case BC_ISGE:
1874 dasm_put(Dst, 10001); 1873 dasm_put(Dst, 10002);
1875 break; 1874 break;
1876 case BC_ISLE: 1875 case BC_ISLE:
1877 dasm_put(Dst, 10006); 1876 dasm_put(Dst, 10007);
1878 break; 1877 break;
1879 case BC_ISGT: 1878 case BC_ISGT:
1880 dasm_put(Dst, 10011); 1879 dasm_put(Dst, 10012);
1881 break; 1880 break;
1882 default: break; /* Shut up GCC. */ 1881 default: break; /* Shut up GCC. */
1883 } 1882 }
1884 dasm_put(Dst, 10016, -BCBIAS_J*4, LJ_TISNUM); 1883 dasm_put(Dst, 10017, -BCBIAS_J*4, LJ_TISNUM);
1885 if (sse) { 1884 if (sse) {
1886 dasm_put(Dst, 10070); 1885 dasm_put(Dst, 10071);
1887 } else { 1886 } else {
1888 dasm_put(Dst, 10081); 1887 dasm_put(Dst, 10082);
1889 } 1888 }
1890 dasm_put(Dst, 10092); 1889 dasm_put(Dst, 10093);
1891 if (sse) { 1890 if (sse) {
1892 dasm_put(Dst, 10099); 1891 dasm_put(Dst, 10100);
1893 switch (op) { 1892 switch (op) {
1894 case BC_ISLT: 1893 case BC_ISLT:
1895 dasm_put(Dst, 10119); 1894 dasm_put(Dst, 10120);
1896 break; 1895 break;
1897 case BC_ISGE: 1896 case BC_ISGE:
1898 dasm_put(Dst, 10124); 1897 dasm_put(Dst, 10125);
1899 break; 1898 break;
1900 case BC_ISLE: 1899 case BC_ISLE:
1901 dasm_put(Dst, 10129); 1900 dasm_put(Dst, 10130);
1902 break; 1901 break;
1903 case BC_ISGT: 1902 case BC_ISGT:
1904 dasm_put(Dst, 10134); 1903 dasm_put(Dst, 10135);
1905 break; 1904 break;
1906 default: break; /* Shut up GCC. */ 1905 default: break; /* Shut up GCC. */
1907 } 1906 }
1908 dasm_put(Dst, 10139); 1907 dasm_put(Dst, 10140);
1909 } else { 1908 } else {
1910 dasm_put(Dst, 10144); 1909 dasm_put(Dst, 10145);
1911 } 1910 }
1912 } else { 1911 } else {
1913 dasm_put(Dst, 10152, LJ_TISNUM, LJ_TISNUM); 1912 dasm_put(Dst, 10153, LJ_TISNUM, LJ_TISNUM);
1914 } 1913 }
1915 if (sse) { 1914 if (sse) {
1916 dasm_put(Dst, 10173); 1915 dasm_put(Dst, 10174);
1917 } else { 1916 } else {
1918 dasm_put(Dst, 10194); 1917 dasm_put(Dst, 10195);
1919 if (cmov) { 1918 if (cmov) {
1920 dasm_put(Dst, 10210); 1919 dasm_put(Dst, 10211);
1921 } else { 1920 } else {
1922 dasm_put(Dst, 10216); 1921 dasm_put(Dst, 10217);
1923 } 1922 }
1924 } 1923 }
1925 if (LJ_DUALNUM) { 1924 if (LJ_DUALNUM) {
1926 switch (op) { 1925 switch (op) {
1927 case BC_ISLT: 1926 case BC_ISLT:
1928 dasm_put(Dst, 10119); 1927 dasm_put(Dst, 10120);
1929 break; 1928 break;
1930 case BC_ISGE: 1929 case BC_ISGE:
1931 dasm_put(Dst, 10124); 1930 dasm_put(Dst, 10125);
1932 break; 1931 break;
1933 case BC_ISLE: 1932 case BC_ISLE:
1934 dasm_put(Dst, 10129); 1933 dasm_put(Dst, 10130);
1935 break; 1934 break;
1936 case BC_ISGT: 1935 case BC_ISGT:
1937 dasm_put(Dst, 10134); 1936 dasm_put(Dst, 10135);
1938 break; 1937 break;
1939 default: break; /* Shut up GCC. */ 1938 default: break; /* Shut up GCC. */
1940 } 1939 }
1941 dasm_put(Dst, 10139); 1940 dasm_put(Dst, 10140);
1942 } else { 1941 } else {
1943 switch (op) { 1942 switch (op) {
1944 case BC_ISLT: 1943 case BC_ISLT:
1945 dasm_put(Dst, 10223); 1944 dasm_put(Dst, 10224);
1946 break; 1945 break;
1947 case BC_ISGE: 1946 case BC_ISGE:
1948 dasm_put(Dst, 10228); 1947 dasm_put(Dst, 10229);
1949 break; 1948 break;
1950 case BC_ISLE: 1949 case BC_ISLE:
1951 dasm_put(Dst, 10233); 1950 dasm_put(Dst, 10234);
1952 break; 1951 break;
1953 case BC_ISGT: 1952 case BC_ISGT:
1954 dasm_put(Dst, 10238); 1953 dasm_put(Dst, 10239);
1955 break; 1954 break;
1956 default: break; /* Shut up GCC. */ 1955 default: break; /* Shut up GCC. */
1957 } 1956 }
1958 dasm_put(Dst, 10243, -BCBIAS_J*4); 1957 dasm_put(Dst, 10244, -BCBIAS_J*4);
1959 } 1958 }
1960 break; 1959 break;
1961 1960
1962 case BC_ISEQV: case BC_ISNEV: 1961 case BC_ISEQV: case BC_ISNEV:
1963 vk = op == BC_ISEQV; 1962 vk = op == BC_ISEQV;
1964 dasm_put(Dst, 10275); 1963 dasm_put(Dst, 10276);
1965 if (LJ_DUALNUM) { 1964 if (LJ_DUALNUM) {
1966 dasm_put(Dst, 10283, LJ_TISNUM, LJ_TISNUM); 1965 dasm_put(Dst, 10284, LJ_TISNUM, LJ_TISNUM);
1967 if (vk) { 1966 if (vk) {
1968 dasm_put(Dst, 10308); 1967 dasm_put(Dst, 10309);
1969 } else { 1968 } else {
1970 dasm_put(Dst, 10313); 1969 dasm_put(Dst, 10314);
1971 } 1970 }
1972 dasm_put(Dst, 10318, -BCBIAS_J*4, LJ_TISNUM); 1971 dasm_put(Dst, 10319, -BCBIAS_J*4, LJ_TISNUM);
1973 if (sse) { 1972 if (sse) {
1974 dasm_put(Dst, 10370); 1973 dasm_put(Dst, 10371);
1975 } else { 1974 } else {
1976 dasm_put(Dst, 10377); 1975 dasm_put(Dst, 10378);
1977 } 1976 }
1978 dasm_put(Dst, 10381); 1977 dasm_put(Dst, 10382);
1979 if (sse) { 1978 if (sse) {
1980 dasm_put(Dst, 10392); 1979 dasm_put(Dst, 10393);
1981 } else { 1980 } else {
1982 dasm_put(Dst, 10404); 1981 dasm_put(Dst, 10405);
1983 } 1982 }
1984 dasm_put(Dst, 10411); 1983 dasm_put(Dst, 10412);
1985 } else { 1984 } else {
1986 dasm_put(Dst, 10416, LJ_TISNUM, LJ_TISNUM); 1985 dasm_put(Dst, 10417, LJ_TISNUM, LJ_TISNUM);
1987 } 1986 }
1988 if (sse) { 1987 if (sse) {
1989 dasm_put(Dst, 10435); 1988 dasm_put(Dst, 10436);
1990 } else { 1989 } else {
1991 dasm_put(Dst, 10453); 1990 dasm_put(Dst, 10454);
1992 if (cmov) { 1991 if (cmov) {
1993 dasm_put(Dst, 10210); 1992 dasm_put(Dst, 10211);
1994 } else { 1993 } else {
1995 dasm_put(Dst, 10216); 1994 dasm_put(Dst, 10217);
1996 } 1995 }
1997 } 1996 }
1998 iseqne_fp: 1997 iseqne_fp:
1999 if (vk) { 1998 if (vk) {
2000 dasm_put(Dst, 10466); 1999 dasm_put(Dst, 10467);
2001 } else { 2000 } else {
2002 dasm_put(Dst, 10475); 2001 dasm_put(Dst, 10476);
2003 } 2002 }
2004 iseqne_end: 2003 iseqne_end:
2005 if (vk) { 2004 if (vk) {
2006 dasm_put(Dst, 10484, -BCBIAS_J*4); 2005 dasm_put(Dst, 10485, -BCBIAS_J*4);
2007 if (!LJ_HASFFI) { 2006 if (!LJ_HASFFI) {
2008 dasm_put(Dst, 4629); 2007 dasm_put(Dst, 4629);
2009 } 2008 }
@@ -2011,156 +2010,156 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2011 if (!LJ_HASFFI) { 2010 if (!LJ_HASFFI) {
2012 dasm_put(Dst, 4629); 2011 dasm_put(Dst, 4629);
2013 } 2012 }
2014 dasm_put(Dst, 10499, -BCBIAS_J*4); 2013 dasm_put(Dst, 10500, -BCBIAS_J*4);
2015 } 2014 }
2016 if (LJ_DUALNUM && (op == BC_ISEQV || op == BC_ISNEV || 2015 if (LJ_DUALNUM && (op == BC_ISEQV || op == BC_ISNEV ||
2017 op == BC_ISEQN || op == BC_ISNEN)) { 2016 op == BC_ISEQN || op == BC_ISNEN)) {
2018 dasm_put(Dst, 10514); 2017 dasm_put(Dst, 10515);
2019 } else { 2018 } else {
2020 dasm_put(Dst, 10255); 2019 dasm_put(Dst, 10256);
2021 } 2020 }
2022 if (op == BC_ISEQV || op == BC_ISNEV) { 2021 if (op == BC_ISEQV || op == BC_ISNEV) {
2023 dasm_put(Dst, 9937); 2022 dasm_put(Dst, 9941);
2024 if (LJ_HASFFI) { 2023 if (LJ_HASFFI) {
2025 dasm_put(Dst, 10519, LJ_TCDATA, LJ_TCDATA); 2024 dasm_put(Dst, 10520, LJ_TCDATA, LJ_TCDATA);
2026 } 2025 }
2027 dasm_put(Dst, 10538, LJ_TISPRI, LJ_TISTABUD, LJ_TUDATA, Dt6(->metatable), Dt6(->nomm), 1<<MM_eq); 2026 dasm_put(Dst, 10539, LJ_TISPRI, LJ_TISTABUD, LJ_TUDATA, Dt6(->metatable), Dt6(->nomm), 1<<MM_eq);
2028 if (vk) { 2027 if (vk) {
2029 dasm_put(Dst, 10602); 2028 dasm_put(Dst, 10603);
2030 } else { 2029 } else {
2031 dasm_put(Dst, 10606); 2030 dasm_put(Dst, 10607);
2032 } 2031 }
2033 dasm_put(Dst, 10612); 2032 dasm_put(Dst, 10613);
2034 } else if (LJ_HASFFI) { 2033 } else if (LJ_HASFFI) {
2035 dasm_put(Dst, 10617, LJ_TCDATA); 2034 dasm_put(Dst, 10618, LJ_TCDATA);
2036 if (LJ_DUALNUM && vk) { 2035 if (LJ_DUALNUM && vk) {
2037 dasm_put(Dst, 10624); 2036 dasm_put(Dst, 10625);
2038 } else { 2037 } else {
2039 dasm_put(Dst, 10597); 2038 dasm_put(Dst, 10598);
2040 } 2039 }
2041 dasm_put(Dst, 10629); 2040 dasm_put(Dst, 10630);
2042 } 2041 }
2043 break; 2042 break;
2044 case BC_ISEQS: case BC_ISNES: 2043 case BC_ISEQS: case BC_ISNES:
2045 vk = op == BC_ISEQS; 2044 vk = op == BC_ISEQS;
2046 dasm_put(Dst, 10634, LJ_TSTR); 2045 dasm_put(Dst, 10635, LJ_TSTR);
2047 iseqne_test: 2046 iseqne_test:
2048 if (vk) { 2047 if (vk) {
2049 dasm_put(Dst, 10470); 2048 dasm_put(Dst, 10471);
2050 } else { 2049 } else {
2051 dasm_put(Dst, 765); 2050 dasm_put(Dst, 765);
2052 } 2051 }
2053 goto iseqne_end; 2052 goto iseqne_end;
2054 case BC_ISEQN: case BC_ISNEN: 2053 case BC_ISEQN: case BC_ISNEN:
2055 vk = op == BC_ISEQN; 2054 vk = op == BC_ISEQN;
2056 dasm_put(Dst, 10660); 2055 dasm_put(Dst, 10661);
2057 if (LJ_DUALNUM) { 2056 if (LJ_DUALNUM) {
2058 dasm_put(Dst, 10668, LJ_TISNUM, LJ_TISNUM); 2057 dasm_put(Dst, 10669, LJ_TISNUM, LJ_TISNUM);
2059 if (vk) { 2058 if (vk) {
2060 dasm_put(Dst, 10308); 2059 dasm_put(Dst, 10309);
2061 } else { 2060 } else {
2062 dasm_put(Dst, 10313); 2061 dasm_put(Dst, 10314);
2063 } 2062 }
2064 dasm_put(Dst, 10693, -BCBIAS_J*4, LJ_TISNUM); 2063 dasm_put(Dst, 10694, -BCBIAS_J*4, LJ_TISNUM);
2065 if (sse) { 2064 if (sse) {
2066 dasm_put(Dst, 10741); 2065 dasm_put(Dst, 10742);
2067 } else { 2066 } else {
2068 dasm_put(Dst, 10748); 2067 dasm_put(Dst, 10749);
2069 } 2068 }
2070 dasm_put(Dst, 10752); 2069 dasm_put(Dst, 10753);
2071 if (sse) { 2070 if (sse) {
2072 dasm_put(Dst, 10759); 2071 dasm_put(Dst, 10760);
2073 } else { 2072 } else {
2074 dasm_put(Dst, 10771); 2073 dasm_put(Dst, 10772);
2075 } 2074 }
2076 dasm_put(Dst, 10411); 2075 dasm_put(Dst, 10412);
2077 } else { 2076 } else {
2078 dasm_put(Dst, 10778, LJ_TISNUM); 2077 dasm_put(Dst, 10779, LJ_TISNUM);
2079 } 2078 }
2080 if (sse) { 2079 if (sse) {
2081 dasm_put(Dst, 10787); 2080 dasm_put(Dst, 10788);
2082 } else { 2081 } else {
2083 dasm_put(Dst, 10805); 2082 dasm_put(Dst, 10806);
2084 if (cmov) { 2083 if (cmov) {
2085 dasm_put(Dst, 10210); 2084 dasm_put(Dst, 10211);
2086 } else { 2085 } else {
2087 dasm_put(Dst, 10216); 2086 dasm_put(Dst, 10217);
2088 } 2087 }
2089 } 2088 }
2090 goto iseqne_fp; 2089 goto iseqne_fp;
2091 case BC_ISEQP: case BC_ISNEP: 2090 case BC_ISEQP: case BC_ISNEP:
2092 vk = op == BC_ISEQP; 2091 vk = op == BC_ISEQP;
2093 dasm_put(Dst, 10818); 2092 dasm_put(Dst, 10819);
2094 if (!LJ_HASFFI) goto iseqne_test; 2093 if (!LJ_HASFFI) goto iseqne_test;
2095 if (vk) { 2094 if (vk) {
2096 dasm_put(Dst, 10832, -BCBIAS_J*4, LJ_TCDATA); 2095 dasm_put(Dst, 10833, -BCBIAS_J*4, LJ_TCDATA);
2097 } else { 2096 } else {
2098 dasm_put(Dst, 10882, LJ_TCDATA, -BCBIAS_J*4); 2097 dasm_put(Dst, 10883, LJ_TCDATA, -BCBIAS_J*4);
2099 } 2098 }
2100 break; 2099 break;
2101 2100
2102 /* -- Unary test and copy ops ------------------------------------------- */ 2101 /* -- Unary test and copy ops ------------------------------------------- */
2103 2102
2104 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: 2103 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF:
2105 dasm_put(Dst, 10926, LJ_TISTRUECOND); 2104 dasm_put(Dst, 10927, LJ_TISTRUECOND);
2106 if (op == BC_IST || op == BC_ISTC) { 2105 if (op == BC_IST || op == BC_ISTC) {
2107 dasm_put(Dst, 10238); 2106 dasm_put(Dst, 10239);
2108 } else { 2107 } else {
2109 dasm_put(Dst, 10233); 2108 dasm_put(Dst, 10234);
2110 } 2109 }
2111 if (op == BC_ISTC || op == BC_ISFC) { 2110 if (op == BC_ISTC || op == BC_ISFC) {
2112 dasm_put(Dst, 10938); 2111 dasm_put(Dst, 10939);
2113 } 2112 }
2114 dasm_put(Dst, 10243, -BCBIAS_J*4); 2113 dasm_put(Dst, 10244, -BCBIAS_J*4);
2115 break; 2114 break;
2116 2115
2117 /* -- Unary ops --------------------------------------------------------- */ 2116 /* -- Unary ops --------------------------------------------------------- */
2118 2117
2119 case BC_MOV: 2118 case BC_MOV:
2120 dasm_put(Dst, 10949); 2119 dasm_put(Dst, 10950);
2121 break; 2120 break;
2122 case BC_NOT: 2121 case BC_NOT:
2123 dasm_put(Dst, 10977, LJ_TISTRUECOND, LJ_TTRUE); 2122 dasm_put(Dst, 10978, LJ_TISTRUECOND, LJ_TTRUE);
2124 break; 2123 break;
2125 case BC_UNM: 2124 case BC_UNM:
2126 if (LJ_DUALNUM) { 2125 if (LJ_DUALNUM) {
2127 dasm_put(Dst, 11013, LJ_TISNUM, LJ_TISNUM); 2126 dasm_put(Dst, 11014, LJ_TISNUM, LJ_TISNUM);
2128 } else { 2127 } else {
2129 dasm_put(Dst, 11090, LJ_TISNUM); 2128 dasm_put(Dst, 11091, LJ_TISNUM);
2130 } 2129 }
2131 if (sse) { 2130 if (sse) {
2132 dasm_put(Dst, 11101, (unsigned int)(U64x(80000000,00000000)), (unsigned int)((U64x(80000000,00000000))>>32)); 2131 dasm_put(Dst, 11102, (unsigned int)(U64x(80000000,00000000)), (unsigned int)((U64x(80000000,00000000))>>32));
2133 } else { 2132 } else {
2134 dasm_put(Dst, 11126); 2133 dasm_put(Dst, 11127);
2135 } 2134 }
2136 if (LJ_DUALNUM) { 2135 if (LJ_DUALNUM) {
2137 dasm_put(Dst, 10514); 2136 dasm_put(Dst, 10515);
2138 } else { 2137 } else {
2139 dasm_put(Dst, 10255); 2138 dasm_put(Dst, 10256);
2140 } 2139 }
2141 break; 2140 break;
2142 case BC_LEN: 2141 case BC_LEN:
2143 dasm_put(Dst, 11135, LJ_TSTR); 2142 dasm_put(Dst, 11136, LJ_TSTR);
2144 if (LJ_DUALNUM) { 2143 if (LJ_DUALNUM) {
2145 dasm_put(Dst, 11149, Dt5(->len), LJ_TISNUM); 2144 dasm_put(Dst, 11150, Dt5(->len), LJ_TISNUM);
2146 } else if (sse) { 2145 } else if (sse) {
2147 dasm_put(Dst, 11163, Dt5(->len)); 2146 dasm_put(Dst, 11164, Dt5(->len));
2148 } else { 2147 } else {
2149 dasm_put(Dst, 11181, Dt5(->len)); 2148 dasm_put(Dst, 11182, Dt5(->len));
2150 } 2149 }
2151 dasm_put(Dst, 11190, LJ_TTAB); 2150 dasm_put(Dst, 11191, LJ_TTAB);
2152#ifdef LUAJIT_ENABLE_LUA52COMPAT 2151#ifdef LUAJIT_ENABLE_LUA52COMPAT
2153 dasm_put(Dst, 11225, Dt6(->metatable)); 2152 dasm_put(Dst, 11226, Dt6(->metatable));
2154#endif 2153#endif
2155 dasm_put(Dst, 11239); 2154 dasm_put(Dst, 11240);
2156 if (LJ_DUALNUM) { 2155 if (LJ_DUALNUM) {
2157 } else if (sse) { 2156 } else if (sse) {
2158 dasm_put(Dst, 11248); 2157 dasm_put(Dst, 11249);
2159 } else { 2158 } else {
2160 } 2159 }
2161 dasm_put(Dst, 11254); 2160 dasm_put(Dst, 11255);
2162#ifdef LUAJIT_ENABLE_LUA52COMPAT 2161#ifdef LUAJIT_ENABLE_LUA52COMPAT
2163 dasm_put(Dst, 11267, Dt6(->nomm), 1<<MM_len); 2162 dasm_put(Dst, 11268, Dt6(->nomm), 1<<MM_len);
2164#endif 2163#endif
2165 break; 2164 break;
2166 2165
@@ -2169,603 +2168,603 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2169 2168
2170 case BC_ADDVN: case BC_ADDNV: case BC_ADDVV: 2169 case BC_ADDVN: case BC_ADDNV: case BC_ADDVV:
2171 if (LJ_DUALNUM) { 2170 if (LJ_DUALNUM) {
2172 dasm_put(Dst, 11283); 2171 dasm_put(Dst, 11284);
2173 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2172 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2174 switch (vk) { 2173 switch (vk) {
2175 case 0: 2174 case 0:
2176 dasm_put(Dst, 11291, LJ_TISNUM, LJ_TISNUM); 2175 dasm_put(Dst, 11292, LJ_TISNUM, LJ_TISNUM);
2177 break; 2176 break;
2178 case 1: 2177 case 1:
2179 dasm_put(Dst, 11324, LJ_TISNUM, LJ_TISNUM); 2178 dasm_put(Dst, 11325, LJ_TISNUM, LJ_TISNUM);
2180 break; 2179 break;
2181 default: 2180 default:
2182 dasm_put(Dst, 11357, LJ_TISNUM, LJ_TISNUM); 2181 dasm_put(Dst, 11358, LJ_TISNUM, LJ_TISNUM);
2183 break; 2182 break;
2184 } 2183 }
2185 dasm_put(Dst, 11390, LJ_TISNUM); 2184 dasm_put(Dst, 11391, LJ_TISNUM);
2186 if (vk == 1) { 2185 if (vk == 1) {
2187 dasm_put(Dst, 11159); 2186 dasm_put(Dst, 11160);
2188 } else { 2187 } else {
2189 dasm_put(Dst, 10945); 2188 dasm_put(Dst, 10946);
2190 } 2189 }
2191 dasm_put(Dst, 10255); 2190 dasm_put(Dst, 10256);
2192 } else { 2191 } else {
2193 dasm_put(Dst, 11283); 2192 dasm_put(Dst, 11284);
2194 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2193 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2195 switch (vk) { 2194 switch (vk) {
2196 case 0: 2195 case 0:
2197 dasm_put(Dst, 11396, LJ_TISNUM); 2196 dasm_put(Dst, 11397, LJ_TISNUM);
2198 if (LJ_DUALNUM) { 2197 if (LJ_DUALNUM) {
2199 dasm_put(Dst, 11408, LJ_TISNUM); 2198 dasm_put(Dst, 11409, LJ_TISNUM);
2200 } 2199 }
2201 if (sse) { 2200 if (sse) {
2202 dasm_put(Dst, 11419); 2201 dasm_put(Dst, 11420);
2203 } else { 2202 } else {
2204 dasm_put(Dst, 11433); 2203 dasm_put(Dst, 11434);
2205 } 2204 }
2206 break; 2205 break;
2207 case 1: 2206 case 1:
2208 dasm_put(Dst, 11441, LJ_TISNUM); 2207 dasm_put(Dst, 11442, LJ_TISNUM);
2209 if (LJ_DUALNUM) { 2208 if (LJ_DUALNUM) {
2210 dasm_put(Dst, 11453, LJ_TISNUM); 2209 dasm_put(Dst, 11454, LJ_TISNUM);
2211 } 2210 }
2212 if (sse) { 2211 if (sse) {
2213 dasm_put(Dst, 11464); 2212 dasm_put(Dst, 11465);
2214 } else { 2213 } else {
2215 dasm_put(Dst, 11478); 2214 dasm_put(Dst, 11479);
2216 } 2215 }
2217 break; 2216 break;
2218 default: 2217 default:
2219 dasm_put(Dst, 11486, LJ_TISNUM, LJ_TISNUM); 2218 dasm_put(Dst, 11487, LJ_TISNUM, LJ_TISNUM);
2220 if (sse) { 2219 if (sse) {
2221 dasm_put(Dst, 11508); 2220 dasm_put(Dst, 11509);
2222 } else { 2221 } else {
2223 dasm_put(Dst, 11522); 2222 dasm_put(Dst, 11523);
2224 } 2223 }
2225 break; 2224 break;
2226 } 2225 }
2227 if (sse) { 2226 if (sse) {
2228 dasm_put(Dst, 11119); 2227 dasm_put(Dst, 11120);
2229 } else { 2228 } else {
2230 dasm_put(Dst, 11131); 2229 dasm_put(Dst, 11132);
2231 } 2230 }
2232 dasm_put(Dst, 10255); 2231 dasm_put(Dst, 10256);
2233 } 2232 }
2234 break; 2233 break;
2235 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: 2234 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV:
2236 if (LJ_DUALNUM) { 2235 if (LJ_DUALNUM) {
2237 dasm_put(Dst, 11283); 2236 dasm_put(Dst, 11284);
2238 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2237 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2239 switch (vk) { 2238 switch (vk) {
2240 case 0: 2239 case 0:
2241 dasm_put(Dst, 11530, LJ_TISNUM, LJ_TISNUM); 2240 dasm_put(Dst, 11531, LJ_TISNUM, LJ_TISNUM);
2242 break; 2241 break;
2243 case 1: 2242 case 1:
2244 dasm_put(Dst, 11563, LJ_TISNUM, LJ_TISNUM); 2243 dasm_put(Dst, 11564, LJ_TISNUM, LJ_TISNUM);
2245 break; 2244 break;
2246 default: 2245 default:
2247 dasm_put(Dst, 11596, LJ_TISNUM, LJ_TISNUM); 2246 dasm_put(Dst, 11597, LJ_TISNUM, LJ_TISNUM);
2248 break; 2247 break;
2249 } 2248 }
2250 dasm_put(Dst, 11390, LJ_TISNUM); 2249 dasm_put(Dst, 11391, LJ_TISNUM);
2251 if (vk == 1) { 2250 if (vk == 1) {
2252 dasm_put(Dst, 11159); 2251 dasm_put(Dst, 11160);
2253 } else { 2252 } else {
2254 dasm_put(Dst, 10945); 2253 dasm_put(Dst, 10946);
2255 } 2254 }
2256 dasm_put(Dst, 10255); 2255 dasm_put(Dst, 10256);
2257 } else { 2256 } else {
2258 dasm_put(Dst, 11283); 2257 dasm_put(Dst, 11284);
2259 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2258 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2260 switch (vk) { 2259 switch (vk) {
2261 case 0: 2260 case 0:
2262 dasm_put(Dst, 11396, LJ_TISNUM); 2261 dasm_put(Dst, 11397, LJ_TISNUM);
2263 if (LJ_DUALNUM) { 2262 if (LJ_DUALNUM) {
2264 dasm_put(Dst, 11408, LJ_TISNUM); 2263 dasm_put(Dst, 11409, LJ_TISNUM);
2265 } 2264 }
2266 if (sse) { 2265 if (sse) {
2267 dasm_put(Dst, 11629); 2266 dasm_put(Dst, 11630);
2268 } else { 2267 } else {
2269 dasm_put(Dst, 11643); 2268 dasm_put(Dst, 11644);
2270 } 2269 }
2271 break; 2270 break;
2272 case 1: 2271 case 1:
2273 dasm_put(Dst, 11441, LJ_TISNUM); 2272 dasm_put(Dst, 11442, LJ_TISNUM);
2274 if (LJ_DUALNUM) { 2273 if (LJ_DUALNUM) {
2275 dasm_put(Dst, 11453, LJ_TISNUM); 2274 dasm_put(Dst, 11454, LJ_TISNUM);
2276 } 2275 }
2277 if (sse) { 2276 if (sse) {
2278 dasm_put(Dst, 11651); 2277 dasm_put(Dst, 11652);
2279 } else { 2278 } else {
2280 dasm_put(Dst, 11665); 2279 dasm_put(Dst, 11666);
2281 } 2280 }
2282 break; 2281 break;
2283 default: 2282 default:
2284 dasm_put(Dst, 11486, LJ_TISNUM, LJ_TISNUM); 2283 dasm_put(Dst, 11487, LJ_TISNUM, LJ_TISNUM);
2285 if (sse) { 2284 if (sse) {
2286 dasm_put(Dst, 11673); 2285 dasm_put(Dst, 11674);
2287 } else { 2286 } else {
2288 dasm_put(Dst, 11687); 2287 dasm_put(Dst, 11688);
2289 } 2288 }
2290 break; 2289 break;
2291 } 2290 }
2292 if (sse) { 2291 if (sse) {
2293 dasm_put(Dst, 11119); 2292 dasm_put(Dst, 11120);
2294 } else { 2293 } else {
2295 dasm_put(Dst, 11131); 2294 dasm_put(Dst, 11132);
2296 } 2295 }
2297 dasm_put(Dst, 10255); 2296 dasm_put(Dst, 10256);
2298 } 2297 }
2299 break; 2298 break;
2300 case BC_MULVN: case BC_MULNV: case BC_MULVV: 2299 case BC_MULVN: case BC_MULNV: case BC_MULVV:
2301 if (LJ_DUALNUM) { 2300 if (LJ_DUALNUM) {
2302 dasm_put(Dst, 11283); 2301 dasm_put(Dst, 11284);
2303 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2302 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2304 switch (vk) { 2303 switch (vk) {
2305 case 0: 2304 case 0:
2306 dasm_put(Dst, 11695, LJ_TISNUM, LJ_TISNUM); 2305 dasm_put(Dst, 11696, LJ_TISNUM, LJ_TISNUM);
2307 break; 2306 break;
2308 case 1: 2307 case 1:
2309 dasm_put(Dst, 11729, LJ_TISNUM, LJ_TISNUM); 2308 dasm_put(Dst, 11730, LJ_TISNUM, LJ_TISNUM);
2310 break; 2309 break;
2311 default: 2310 default:
2312 dasm_put(Dst, 11763, LJ_TISNUM, LJ_TISNUM); 2311 dasm_put(Dst, 11764, LJ_TISNUM, LJ_TISNUM);
2313 break; 2312 break;
2314 } 2313 }
2315 dasm_put(Dst, 11390, LJ_TISNUM); 2314 dasm_put(Dst, 11391, LJ_TISNUM);
2316 if (vk == 1) { 2315 if (vk == 1) {
2317 dasm_put(Dst, 11159); 2316 dasm_put(Dst, 11160);
2318 } else { 2317 } else {
2319 dasm_put(Dst, 10945); 2318 dasm_put(Dst, 10946);
2320 } 2319 }
2321 dasm_put(Dst, 10255); 2320 dasm_put(Dst, 10256);
2322 } else { 2321 } else {
2323 dasm_put(Dst, 11283); 2322 dasm_put(Dst, 11284);
2324 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2323 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2325 switch (vk) { 2324 switch (vk) {
2326 case 0: 2325 case 0:
2327 dasm_put(Dst, 11396, LJ_TISNUM); 2326 dasm_put(Dst, 11397, LJ_TISNUM);
2328 if (LJ_DUALNUM) { 2327 if (LJ_DUALNUM) {
2329 dasm_put(Dst, 11408, LJ_TISNUM); 2328 dasm_put(Dst, 11409, LJ_TISNUM);
2330 } 2329 }
2331 if (sse) { 2330 if (sse) {
2332 dasm_put(Dst, 11797); 2331 dasm_put(Dst, 11798);
2333 } else { 2332 } else {
2334 dasm_put(Dst, 11811); 2333 dasm_put(Dst, 11812);
2335 } 2334 }
2336 break; 2335 break;
2337 case 1: 2336 case 1:
2338 dasm_put(Dst, 11441, LJ_TISNUM); 2337 dasm_put(Dst, 11442, LJ_TISNUM);
2339 if (LJ_DUALNUM) { 2338 if (LJ_DUALNUM) {
2340 dasm_put(Dst, 11453, LJ_TISNUM); 2339 dasm_put(Dst, 11454, LJ_TISNUM);
2341 } 2340 }
2342 if (sse) { 2341 if (sse) {
2343 dasm_put(Dst, 11819); 2342 dasm_put(Dst, 11820);
2344 } else { 2343 } else {
2345 dasm_put(Dst, 11833); 2344 dasm_put(Dst, 11834);
2346 } 2345 }
2347 break; 2346 break;
2348 default: 2347 default:
2349 dasm_put(Dst, 11486, LJ_TISNUM, LJ_TISNUM); 2348 dasm_put(Dst, 11487, LJ_TISNUM, LJ_TISNUM);
2350 if (sse) { 2349 if (sse) {
2351 dasm_put(Dst, 11841); 2350 dasm_put(Dst, 11842);
2352 } else { 2351 } else {
2353 dasm_put(Dst, 11855); 2352 dasm_put(Dst, 11856);
2354 } 2353 }
2355 break; 2354 break;
2356 } 2355 }
2357 if (sse) { 2356 if (sse) {
2358 dasm_put(Dst, 11119); 2357 dasm_put(Dst, 11120);
2359 } else { 2358 } else {
2360 dasm_put(Dst, 11131); 2359 dasm_put(Dst, 11132);
2361 } 2360 }
2362 dasm_put(Dst, 10255); 2361 dasm_put(Dst, 10256);
2363 } 2362 }
2364 break; 2363 break;
2365 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: 2364 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV:
2366 dasm_put(Dst, 11283); 2365 dasm_put(Dst, 11284);
2367 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2366 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2368 switch (vk) { 2367 switch (vk) {
2369 case 0: 2368 case 0:
2370 dasm_put(Dst, 11396, LJ_TISNUM); 2369 dasm_put(Dst, 11397, LJ_TISNUM);
2371 if (LJ_DUALNUM) { 2370 if (LJ_DUALNUM) {
2372 dasm_put(Dst, 11408, LJ_TISNUM); 2371 dasm_put(Dst, 11409, LJ_TISNUM);
2373 } 2372 }
2374 if (sse) { 2373 if (sse) {
2375 dasm_put(Dst, 11863); 2374 dasm_put(Dst, 11864);
2376 } else { 2375 } else {
2377 dasm_put(Dst, 11877); 2376 dasm_put(Dst, 11878);
2378 } 2377 }
2379 break; 2378 break;
2380 case 1: 2379 case 1:
2381 dasm_put(Dst, 11441, LJ_TISNUM); 2380 dasm_put(Dst, 11442, LJ_TISNUM);
2382 if (LJ_DUALNUM) { 2381 if (LJ_DUALNUM) {
2383 dasm_put(Dst, 11453, LJ_TISNUM); 2382 dasm_put(Dst, 11454, LJ_TISNUM);
2384 } 2383 }
2385 if (sse) { 2384 if (sse) {
2386 dasm_put(Dst, 11885); 2385 dasm_put(Dst, 11886);
2387 } else { 2386 } else {
2388 dasm_put(Dst, 11899); 2387 dasm_put(Dst, 11900);
2389 } 2388 }
2390 break; 2389 break;
2391 default: 2390 default:
2392 dasm_put(Dst, 11486, LJ_TISNUM, LJ_TISNUM); 2391 dasm_put(Dst, 11487, LJ_TISNUM, LJ_TISNUM);
2393 if (sse) { 2392 if (sse) {
2394 dasm_put(Dst, 11907); 2393 dasm_put(Dst, 11908);
2395 } else { 2394 } else {
2396 dasm_put(Dst, 11921); 2395 dasm_put(Dst, 11922);
2397 } 2396 }
2398 break; 2397 break;
2399 } 2398 }
2400 if (sse) { 2399 if (sse) {
2401 dasm_put(Dst, 11119); 2400 dasm_put(Dst, 11120);
2402 } else { 2401 } else {
2403 dasm_put(Dst, 11131); 2402 dasm_put(Dst, 11132);
2404 } 2403 }
2405 dasm_put(Dst, 10255); 2404 dasm_put(Dst, 10256);
2406 break; 2405 break;
2407 case BC_MODVN: 2406 case BC_MODVN:
2408 dasm_put(Dst, 11283); 2407 dasm_put(Dst, 11284);
2409 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2408 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2410 switch (vk) { 2409 switch (vk) {
2411 case 0: 2410 case 0:
2412 dasm_put(Dst, 11396, LJ_TISNUM); 2411 dasm_put(Dst, 11397, LJ_TISNUM);
2413 if (LJ_DUALNUM) { 2412 if (LJ_DUALNUM) {
2414 dasm_put(Dst, 11408, LJ_TISNUM); 2413 dasm_put(Dst, 11409, LJ_TISNUM);
2415 } 2414 }
2416 if (sse) { 2415 if (sse) {
2417 dasm_put(Dst, 11929); 2416 dasm_put(Dst, 11930);
2418 } else { 2417 } else {
2419 dasm_put(Dst, 11943); 2418 dasm_put(Dst, 11944);
2420 } 2419 }
2421 break; 2420 break;
2422 case 1: 2421 case 1:
2423 dasm_put(Dst, 11441, LJ_TISNUM); 2422 dasm_put(Dst, 11442, LJ_TISNUM);
2424 if (LJ_DUALNUM) { 2423 if (LJ_DUALNUM) {
2425 dasm_put(Dst, 11453, LJ_TISNUM); 2424 dasm_put(Dst, 11454, LJ_TISNUM);
2426 } 2425 }
2427 if (sse) { 2426 if (sse) {
2428 dasm_put(Dst, 11951); 2427 dasm_put(Dst, 11952);
2429 } else { 2428 } else {
2430 dasm_put(Dst, 11965); 2429 dasm_put(Dst, 11966);
2431 } 2430 }
2432 break; 2431 break;
2433 default: 2432 default:
2434 dasm_put(Dst, 11486, LJ_TISNUM, LJ_TISNUM); 2433 dasm_put(Dst, 11487, LJ_TISNUM, LJ_TISNUM);
2435 if (sse) { 2434 if (sse) {
2436 dasm_put(Dst, 11973); 2435 dasm_put(Dst, 11974);
2437 } else { 2436 } else {
2438 dasm_put(Dst, 11987); 2437 dasm_put(Dst, 11988);
2439 } 2438 }
2440 break; 2439 break;
2441 } 2440 }
2442 dasm_put(Dst, 11995); 2441 dasm_put(Dst, 11996);
2443 if (sse) { 2442 if (sse) {
2444 dasm_put(Dst, 11119); 2443 dasm_put(Dst, 11120);
2445 } else { 2444 } else {
2446 dasm_put(Dst, 11131); 2445 dasm_put(Dst, 11132);
2447 } 2446 }
2448 dasm_put(Dst, 10255); 2447 dasm_put(Dst, 10256);
2449 break; 2448 break;
2450 case BC_MODNV: case BC_MODVV: 2449 case BC_MODNV: case BC_MODVV:
2451 dasm_put(Dst, 11283); 2450 dasm_put(Dst, 11284);
2452 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2451 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2453 switch (vk) { 2452 switch (vk) {
2454 case 0: 2453 case 0:
2455 dasm_put(Dst, 11396, LJ_TISNUM); 2454 dasm_put(Dst, 11397, LJ_TISNUM);
2456 if (LJ_DUALNUM) { 2455 if (LJ_DUALNUM) {
2457 dasm_put(Dst, 11408, LJ_TISNUM); 2456 dasm_put(Dst, 11409, LJ_TISNUM);
2458 } 2457 }
2459 if (sse) { 2458 if (sse) {
2460 dasm_put(Dst, 11929); 2459 dasm_put(Dst, 11930);
2461 } else { 2460 } else {
2462 dasm_put(Dst, 11943); 2461 dasm_put(Dst, 11944);
2463 } 2462 }
2464 break; 2463 break;
2465 case 1: 2464 case 1:
2466 dasm_put(Dst, 11441, LJ_TISNUM); 2465 dasm_put(Dst, 11442, LJ_TISNUM);
2467 if (LJ_DUALNUM) { 2466 if (LJ_DUALNUM) {
2468 dasm_put(Dst, 11453, LJ_TISNUM); 2467 dasm_put(Dst, 11454, LJ_TISNUM);
2469 } 2468 }
2470 if (sse) { 2469 if (sse) {
2471 dasm_put(Dst, 11951); 2470 dasm_put(Dst, 11952);
2472 } else { 2471 } else {
2473 dasm_put(Dst, 11965); 2472 dasm_put(Dst, 11966);
2474 } 2473 }
2475 break; 2474 break;
2476 default: 2475 default:
2477 dasm_put(Dst, 11486, LJ_TISNUM, LJ_TISNUM); 2476 dasm_put(Dst, 11487, LJ_TISNUM, LJ_TISNUM);
2478 if (sse) { 2477 if (sse) {
2479 dasm_put(Dst, 11973); 2478 dasm_put(Dst, 11974);
2480 } else { 2479 } else {
2481 dasm_put(Dst, 11987); 2480 dasm_put(Dst, 11988);
2482 } 2481 }
2483 break; 2482 break;
2484 } 2483 }
2485 dasm_put(Dst, 12001); 2484 dasm_put(Dst, 12002);
2486 break; 2485 break;
2487 case BC_POW: 2486 case BC_POW:
2488 dasm_put(Dst, 11283); 2487 dasm_put(Dst, 11284);
2489 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2488 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2490 switch (vk) { 2489 switch (vk) {
2491 case 0: 2490 case 0:
2492 dasm_put(Dst, 11396, LJ_TISNUM); 2491 dasm_put(Dst, 11397, LJ_TISNUM);
2493 if (LJ_DUALNUM) { 2492 if (LJ_DUALNUM) {
2494 dasm_put(Dst, 11408, LJ_TISNUM); 2493 dasm_put(Dst, 11409, LJ_TISNUM);
2495 } 2494 }
2496 if (sse) { 2495 if (sse) {
2497 dasm_put(Dst, 11929); 2496 dasm_put(Dst, 11930);
2498 } else { 2497 } else {
2499 dasm_put(Dst, 11943); 2498 dasm_put(Dst, 11944);
2500 } 2499 }
2501 break; 2500 break;
2502 case 1: 2501 case 1:
2503 dasm_put(Dst, 11441, LJ_TISNUM); 2502 dasm_put(Dst, 11442, LJ_TISNUM);
2504 if (LJ_DUALNUM) { 2503 if (LJ_DUALNUM) {
2505 dasm_put(Dst, 11453, LJ_TISNUM); 2504 dasm_put(Dst, 11454, LJ_TISNUM);
2506 } 2505 }
2507 if (sse) { 2506 if (sse) {
2508 dasm_put(Dst, 11951); 2507 dasm_put(Dst, 11952);
2509 } else { 2508 } else {
2510 dasm_put(Dst, 11965); 2509 dasm_put(Dst, 11966);
2511 } 2510 }
2512 break; 2511 break;
2513 default: 2512 default:
2514 dasm_put(Dst, 11486, LJ_TISNUM, LJ_TISNUM); 2513 dasm_put(Dst, 11487, LJ_TISNUM, LJ_TISNUM);
2515 if (sse) { 2514 if (sse) {
2516 dasm_put(Dst, 11973); 2515 dasm_put(Dst, 11974);
2517 } else { 2516 } else {
2518 dasm_put(Dst, 11987); 2517 dasm_put(Dst, 11988);
2519 } 2518 }
2520 break; 2519 break;
2521 } 2520 }
2522 dasm_put(Dst, 12006); 2521 dasm_put(Dst, 12007);
2523 if (sse) { 2522 if (sse) {
2524 dasm_put(Dst, 11119); 2523 dasm_put(Dst, 11120);
2525 } else { 2524 } else {
2526 dasm_put(Dst, 11131); 2525 dasm_put(Dst, 11132);
2527 } 2526 }
2528 dasm_put(Dst, 10255); 2527 dasm_put(Dst, 10256);
2529 break; 2528 break;
2530 2529
2531 case BC_CAT: 2530 case BC_CAT:
2532 dasm_put(Dst, 12010, Dt1(->base), Dt1(->base)); 2531 dasm_put(Dst, 12011, Dt1(->base), Dt1(->base));
2533 break; 2532 break;
2534 2533
2535 /* -- Constant ops ------------------------------------------------------ */ 2534 /* -- Constant ops ------------------------------------------------------ */
2536 2535
2537 case BC_KSTR: 2536 case BC_KSTR:
2538 dasm_put(Dst, 12093, LJ_TSTR); 2537 dasm_put(Dst, 12094, LJ_TSTR);
2539 break; 2538 break;
2540 case BC_KCDATA: 2539 case BC_KCDATA:
2541#if LJ_HASFFI 2540#if LJ_HASFFI
2542 dasm_put(Dst, 12093, LJ_TCDATA); 2541 dasm_put(Dst, 12094, LJ_TCDATA);
2543#endif 2542#endif
2544 break; 2543 break;
2545 case BC_KSHORT: 2544 case BC_KSHORT:
2546 if (LJ_DUALNUM) { 2545 if (LJ_DUALNUM) {
2547 dasm_put(Dst, 12128, LJ_TISNUM); 2546 dasm_put(Dst, 12129, LJ_TISNUM);
2548 } else if (sse) { 2547 } else if (sse) {
2549 dasm_put(Dst, 12140); 2548 dasm_put(Dst, 12141);
2550 } else { 2549 } else {
2551 dasm_put(Dst, 12155); 2550 dasm_put(Dst, 12156);
2552 } 2551 }
2553 dasm_put(Dst, 10255); 2552 dasm_put(Dst, 10256);
2554 break; 2553 break;
2555 case BC_KNUM: 2554 case BC_KNUM:
2556 if (sse) { 2555 if (sse) {
2557 dasm_put(Dst, 12163); 2556 dasm_put(Dst, 12164);
2558 } else { 2557 } else {
2559 dasm_put(Dst, 12176); 2558 dasm_put(Dst, 12177);
2560 } 2559 }
2561 dasm_put(Dst, 10255); 2560 dasm_put(Dst, 10256);
2562 break; 2561 break;
2563 case BC_KPRI: 2562 case BC_KPRI:
2564 dasm_put(Dst, 12183); 2563 dasm_put(Dst, 12184);
2565 break; 2564 break;
2566 case BC_KNIL: 2565 case BC_KNIL:
2567 dasm_put(Dst, 12211, LJ_TNIL); 2566 dasm_put(Dst, 12212, LJ_TNIL);
2568 break; 2567 break;
2569 2568
2570 /* -- Upvalue and function ops ------------------------------------------ */ 2569 /* -- Upvalue and function ops ------------------------------------------ */
2571 2570
2572 case BC_UGET: 2571 case BC_UGET:
2573 dasm_put(Dst, 12258, offsetof(GCfuncL, uvptr), DtA(->v)); 2572 dasm_put(Dst, 12259, offsetof(GCfuncL, uvptr), DtA(->v));
2574 break; 2573 break;
2575 case BC_USETV: 2574 case BC_USETV:
2576#define TV2MARKOFS \ 2575#define TV2MARKOFS \
2577 ((int32_t)offsetof(GCupval, marked)-(int32_t)offsetof(GCupval, tv)) 2576 ((int32_t)offsetof(GCupval, marked)-(int32_t)offsetof(GCupval, tv))
2578 dasm_put(Dst, 12298, offsetof(GCfuncL, uvptr), DtA(->closed), DtA(->v), TV2MARKOFS, LJ_GC_BLACK, LJ_TISGCV, LJ_TISNUM - LJ_TISGCV, Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G); 2577 dasm_put(Dst, 12299, offsetof(GCfuncL, uvptr), DtA(->closed), DtA(->v), TV2MARKOFS, LJ_GC_BLACK, LJ_TISGCV, LJ_TISNUM - LJ_TISGCV, Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G);
2579 dasm_put(Dst, 12389); 2578 dasm_put(Dst, 12390);
2580 break; 2579 break;
2581#undef TV2MARKOFS 2580#undef TV2MARKOFS
2582 case BC_USETS: 2581 case BC_USETS:
2583 dasm_put(Dst, 12401, offsetof(GCfuncL, uvptr), DtA(->v), LJ_TSTR, DtA(->marked), LJ_GC_BLACK, Dt4(->gch.marked), LJ_GC_WHITES, DtA(->closed), GG_DISP2G); 2582 dasm_put(Dst, 12402, offsetof(GCfuncL, uvptr), DtA(->v), LJ_TSTR, DtA(->marked), LJ_GC_BLACK, Dt4(->gch.marked), LJ_GC_WHITES, DtA(->closed), GG_DISP2G);
2584 break; 2583 break;
2585 case BC_USETN: 2584 case BC_USETN:
2586 dasm_put(Dst, 12494); 2585 dasm_put(Dst, 12495);
2587 if (sse) { 2586 if (sse) {
2588 dasm_put(Dst, 12499); 2587 dasm_put(Dst, 12500);
2589 } else { 2588 } else {
2590 dasm_put(Dst, 10774); 2589 dasm_put(Dst, 10775);
2591 } 2590 }
2592 dasm_put(Dst, 12506, offsetof(GCfuncL, uvptr), DtA(->v)); 2591 dasm_put(Dst, 12507, offsetof(GCfuncL, uvptr), DtA(->v));
2593 if (sse) { 2592 if (sse) {
2594 dasm_put(Dst, 12515); 2593 dasm_put(Dst, 12516);
2595 } else { 2594 } else {
2596 dasm_put(Dst, 12521); 2595 dasm_put(Dst, 12522);
2597 } 2596 }
2598 dasm_put(Dst, 10255); 2597 dasm_put(Dst, 10256);
2599 break; 2598 break;
2600 case BC_USETP: 2599 case BC_USETP:
2601 dasm_put(Dst, 12524, offsetof(GCfuncL, uvptr), DtA(->v)); 2600 dasm_put(Dst, 12525, offsetof(GCfuncL, uvptr), DtA(->v));
2602 break; 2601 break;
2603 case BC_UCLO: 2602 case BC_UCLO:
2604 dasm_put(Dst, 12563, -BCBIAS_J*4, Dt1(->openupval), Dt1(->base), Dt1(->base)); 2603 dasm_put(Dst, 12564, -BCBIAS_J*4, Dt1(->openupval), Dt1(->base), Dt1(->base));
2605 break; 2604 break;
2606 2605
2607 case BC_FNEW: 2606 case BC_FNEW:
2608 dasm_put(Dst, 12618, Dt1(->base), Dt1(->base), LJ_TFUNC); 2607 dasm_put(Dst, 12619, Dt1(->base), Dt1(->base), LJ_TFUNC);
2609 break; 2608 break;
2610 2609
2611 /* -- Table ops --------------------------------------------------------- */ 2610 /* -- Table ops --------------------------------------------------------- */
2612 2611
2613 case BC_TNEW: 2612 case BC_TNEW:
2614 dasm_put(Dst, 12684, Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), LJ_TTAB); 2613 dasm_put(Dst, 12685, Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), LJ_TTAB);
2615 break; 2614 break;
2616 case BC_TDUP: 2615 case BC_TDUP:
2617 dasm_put(Dst, 12806, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB); 2616 dasm_put(Dst, 12807, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB);
2618 break; 2617 break;
2619 2618
2620 case BC_GGET: 2619 case BC_GGET:
2621 dasm_put(Dst, 12901, Dt7(->env)); 2620 dasm_put(Dst, 12902, Dt7(->env));
2622 break; 2621 break;
2623 case BC_GSET: 2622 case BC_GSET:
2624 dasm_put(Dst, 12920, Dt7(->env)); 2623 dasm_put(Dst, 12921, Dt7(->env));
2625 break; 2624 break;
2626 2625
2627 case BC_TGETV: 2626 case BC_TGETV:
2628 dasm_put(Dst, 12939, LJ_TTAB); 2627 dasm_put(Dst, 12940, LJ_TTAB);
2629 if (LJ_DUALNUM) { 2628 if (LJ_DUALNUM) {
2630 dasm_put(Dst, 12962, LJ_TISNUM); 2629 dasm_put(Dst, 12963, LJ_TISNUM);
2631 } else { 2630 } else {
2632 dasm_put(Dst, 12976, LJ_TISNUM); 2631 dasm_put(Dst, 12977, LJ_TISNUM);
2633 if (sse) { 2632 if (sse) {
2634 dasm_put(Dst, 12987); 2633 dasm_put(Dst, 12988);
2635 } else { 2634 } else {
2636 } 2635 }
2637 dasm_put(Dst, 13008); 2636 dasm_put(Dst, 13009);
2638 } 2637 }
2639 dasm_put(Dst, 13013, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index, LJ_TNIL); 2638 dasm_put(Dst, 13014, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index, LJ_TNIL);
2640 dasm_put(Dst, 13104, LJ_TSTR); 2639 dasm_put(Dst, 13105, LJ_TSTR);
2641 break; 2640 break;
2642 case BC_TGETS: 2641 case BC_TGETS:
2643 dasm_put(Dst, 13122, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL); 2642 dasm_put(Dst, 13123, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL);
2644 dasm_put(Dst, 13206, LJ_TNIL, DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 2643 dasm_put(Dst, 13207, LJ_TNIL, DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
2645 break; 2644 break;
2646 case BC_TGETB: 2645 case BC_TGETB:
2647 dasm_put(Dst, 13277, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 2646 dasm_put(Dst, 13278, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
2648 dasm_put(Dst, 13372, LJ_TNIL); 2647 dasm_put(Dst, 13373, LJ_TNIL);
2649 break; 2648 break;
2650 2649
2651 case BC_TSETV: 2650 case BC_TSETV:
2652 dasm_put(Dst, 13389, LJ_TTAB); 2651 dasm_put(Dst, 13390, LJ_TTAB);
2653 if (LJ_DUALNUM) { 2652 if (LJ_DUALNUM) {
2654 dasm_put(Dst, 12962, LJ_TISNUM); 2653 dasm_put(Dst, 12963, LJ_TISNUM);
2655 } else { 2654 } else {
2656 dasm_put(Dst, 12976, LJ_TISNUM); 2655 dasm_put(Dst, 12977, LJ_TISNUM);
2657 if (sse) { 2656 if (sse) {
2658 dasm_put(Dst, 12987); 2657 dasm_put(Dst, 12988);
2659 } else { 2658 } else {
2660 } 2659 }
2661 dasm_put(Dst, 13412); 2660 dasm_put(Dst, 13413);
2662 } 2661 }
2663 dasm_put(Dst, 13417, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); 2662 dasm_put(Dst, 13418, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex);
2664 dasm_put(Dst, 13497, LJ_TSTR, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); 2663 dasm_put(Dst, 13498, LJ_TSTR, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
2665 break; 2664 break;
2666 case BC_TSETS: 2665 case BC_TSETS:
2667 dasm_put(Dst, 13554, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->nomm), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL); 2666 dasm_put(Dst, 13555, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->nomm), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL);
2668 dasm_put(Dst, 13630, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next)); 2667 dasm_put(Dst, 13631, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next));
2669 dasm_put(Dst, 13718, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, Dt1(->base), Dt1(->base), Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); 2668 dasm_put(Dst, 13719, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, Dt1(->base), Dt1(->base), Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
2670 break; 2669 break;
2671 case BC_TSETB: 2670 case BC_TSETB:
2672 dasm_put(Dst, 13809, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable)); 2671 dasm_put(Dst, 13810, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable));
2673 dasm_put(Dst, 13903, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); 2672 dasm_put(Dst, 13904, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
2674 break; 2673 break;
2675 2674
2676 case BC_TSETM: 2675 case BC_TSETM:
2677 dasm_put(Dst, 13949, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base)); 2676 dasm_put(Dst, 13950, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
2678 dasm_put(Dst, 14092, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); 2677 dasm_put(Dst, 14093, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
2679 break; 2678 break;
2680 2679
2681 /* -- Calls and vararg handling ----------------------------------------- */ 2680 /* -- Calls and vararg handling ----------------------------------------- */
2682 2681
2683 case BC_CALL: case BC_CALLM: 2682 case BC_CALL: case BC_CALLM:
2684 dasm_put(Dst, 11287); 2683 dasm_put(Dst, 11288);
2685 if (op == BC_CALLM) { 2684 if (op == BC_CALLM) {
2686 dasm_put(Dst, 14110); 2685 dasm_put(Dst, 14111);
2687 } 2686 }
2688 dasm_put(Dst, 14115, LJ_TFUNC, Dt7(->pc)); 2687 dasm_put(Dst, 14116, LJ_TFUNC, Dt7(->pc));
2689 break; 2688 break;
2690 2689
2691 case BC_CALLMT: 2690 case BC_CALLMT:
2692 dasm_put(Dst, 14110); 2691 dasm_put(Dst, 14111);
2693 break; 2692 break;
2694 case BC_CALLT: 2693 case BC_CALLT:
2695 dasm_put(Dst, 14157, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc)); 2694 dasm_put(Dst, 14158, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc));
2696 dasm_put(Dst, 14272, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG); 2695 dasm_put(Dst, 14273, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG);
2697 break; 2696 break;
2698 2697
2699 case BC_ITERC: 2698 case BC_ITERC:
2700 dasm_put(Dst, 14343, LJ_TFUNC, 2+1, Dt7(->pc)); 2699 dasm_put(Dst, 14344, LJ_TFUNC, 2+1, Dt7(->pc));
2701 break; 2700 break;
2702 2701
2703 case BC_ITERN: 2702 case BC_ITERN:
2704#if LJ_HASJIT 2703#if LJ_HASJIT
2705#endif 2704#endif
2706 dasm_put(Dst, 14414, Dt6(->asize), Dt6(->array), LJ_TNIL); 2705 dasm_put(Dst, 14415, Dt6(->asize), Dt6(->array), LJ_TNIL);
2707 if (LJ_DUALNUM) { 2706 if (LJ_DUALNUM) {
2708 dasm_put(Dst, 11154, LJ_TISNUM); 2707 dasm_put(Dst, 11155, LJ_TISNUM);
2709 } else if (sse) { 2708 } else if (sse) {
2710 dasm_put(Dst, 11248); 2709 dasm_put(Dst, 11249);
2711 } else { 2710 } else {
2712 dasm_put(Dst, 14460); 2711 dasm_put(Dst, 14461);
2713 } 2712 }
2714 dasm_put(Dst, 14466); 2713 dasm_put(Dst, 14467);
2715 if (LJ_DUALNUM) { 2714 if (LJ_DUALNUM) {
2716 } else if (sse) { 2715 } else if (sse) {
2717 dasm_put(Dst, 11119); 2716 dasm_put(Dst, 11120);
2718 } else { 2717 } else {
2719 dasm_put(Dst, 11131); 2718 dasm_put(Dst, 11132);
2720 } 2719 }
2721 dasm_put(Dst, 14479, -BCBIAS_J*4); 2720 dasm_put(Dst, 14480, -BCBIAS_J*4);
2722 if (!LJ_DUALNUM && !sse) { 2721 if (!LJ_DUALNUM && !sse) {
2723 dasm_put(Dst, 14531); 2722 dasm_put(Dst, 14532);
2724 } 2723 }
2725 dasm_put(Dst, 14537, Dt6(->hmask), sizeof(Node), Dt6(->node), DtB(->val.it), LJ_TNIL, DtB(->key), DtB(->val)); 2724 dasm_put(Dst, 14538, Dt6(->hmask), sizeof(Node), Dt6(->node), DtB(->val.it), LJ_TNIL, DtB(->key), DtB(->val));
2726 break; 2725 break;
2727 2726
2728 case BC_ISNEXT: 2727 case BC_ISNEXT:
2729 dasm_put(Dst, 14609, LJ_TFUNC, LJ_TTAB, LJ_TNIL, Dt8(->ffid), FF_next_N, -BCBIAS_J*4, BC_JMP, -BCBIAS_J*4, BC_ITERC); 2728 dasm_put(Dst, 14610, LJ_TFUNC, LJ_TTAB, LJ_TNIL, Dt8(->ffid), FF_next_N, -BCBIAS_J*4, BC_JMP, -BCBIAS_J*4, BC_ITERC);
2730 break; 2729 break;
2731 2730
2732 case BC_VARG: 2731 case BC_VARG:
2733 dasm_put(Dst, 14709, (8+FRAME_VARG), LJ_TNIL, Dt1(->maxstack)); 2732 dasm_put(Dst, 14710, (8+FRAME_VARG), LJ_TNIL, Dt1(->maxstack));
2734 dasm_put(Dst, 14869, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); 2733 dasm_put(Dst, 14870, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
2735 break; 2734 break;
2736 2735
2737 /* -- Returns ----------------------------------------------------------- */ 2736 /* -- Returns ----------------------------------------------------------- */
2738 2737
2739 case BC_RETM: 2738 case BC_RETM:
2740 dasm_put(Dst, 14110); 2739 dasm_put(Dst, 14111);
2741 break; 2740 break;
2742 2741
2743 case BC_RET: case BC_RET0: case BC_RET1: 2742 case BC_RET: case BC_RET0: case BC_RET1:
2744 if (op != BC_RET0) { 2743 if (op != BC_RET0) {
2745 dasm_put(Dst, 14935); 2744 dasm_put(Dst, 14936);
2746 } 2745 }
2747 dasm_put(Dst, 14939, FRAME_TYPE); 2746 dasm_put(Dst, 14940, FRAME_TYPE);
2748 switch (op) { 2747 switch (op) {
2749 case BC_RET: 2748 case BC_RET:
2750 dasm_put(Dst, 14958); 2749 dasm_put(Dst, 14959);
2751 break; 2750 break;
2752 case BC_RET1: 2751 case BC_RET1:
2753 dasm_put(Dst, 15010); 2752 dasm_put(Dst, 15011);
2754 /* fallthrough */ 2753 /* fallthrough */
2755 case BC_RET0: 2754 case BC_RET0:
2756 dasm_put(Dst, 15020); 2755 dasm_put(Dst, 15021);
2757 default: 2756 default:
2758 break; 2757 break;
2759 } 2758 }
2760 dasm_put(Dst, 15031, Dt7(->pc), PC2PROTO(k)); 2759 dasm_put(Dst, 15032, Dt7(->pc), PC2PROTO(k));
2761 if (op == BC_RET) { 2760 if (op == BC_RET) {
2762 dasm_put(Dst, 15075, LJ_TNIL); 2761 dasm_put(Dst, 15076, LJ_TNIL);
2763 } else { 2762 } else {
2764 dasm_put(Dst, 15084, LJ_TNIL); 2763 dasm_put(Dst, 15085, LJ_TNIL);
2765 } 2764 }
2766 dasm_put(Dst, 15091, -FRAME_VARG, FRAME_TYPEP); 2765 dasm_put(Dst, 15092, -FRAME_VARG, FRAME_TYPEP);
2767 if (op != BC_RET0) { 2766 if (op != BC_RET0) {
2768 dasm_put(Dst, 15115); 2767 dasm_put(Dst, 15116);
2769 } 2768 }
2770 dasm_put(Dst, 4708); 2769 dasm_put(Dst, 4708);
2771 break; 2770 break;
@@ -2775,7 +2774,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2775 2774
2776 case BC_FORL: 2775 case BC_FORL:
2777#if LJ_HASJIT 2776#if LJ_HASJIT
2778 dasm_put(Dst, 15119, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP); 2777 dasm_put(Dst, 15120, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
2779#endif 2778#endif
2780 break; 2779 break;
2781 2780
@@ -2787,111 +2786,111 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2787 case BC_FORI: 2786 case BC_FORI:
2788 case BC_IFORL: 2787 case BC_IFORL:
2789 vk = (op == BC_IFORL || op == BC_JFORL); 2788 vk = (op == BC_IFORL || op == BC_JFORL);
2790 dasm_put(Dst, 15140); 2789 dasm_put(Dst, 15141);
2791 if (LJ_DUALNUM) { 2790 if (LJ_DUALNUM) {
2792 dasm_put(Dst, 15144, LJ_TISNUM); 2791 dasm_put(Dst, 15145, LJ_TISNUM);
2793 if (!vk) { 2792 if (!vk) {
2794 dasm_put(Dst, 15154, LJ_TISNUM, LJ_TISNUM); 2793 dasm_put(Dst, 15155, LJ_TISNUM, LJ_TISNUM);
2795 } else { 2794 } else {
2796#ifdef LUA_USE_ASSERT 2795#ifdef LUA_USE_ASSERT
2797 dasm_put(Dst, 15183, LJ_TISNUM, LJ_TISNUM); 2796 dasm_put(Dst, 15184, LJ_TISNUM, LJ_TISNUM);
2798#endif 2797#endif
2799 dasm_put(Dst, 15202); 2798 dasm_put(Dst, 15203);
2800 } 2799 }
2801 dasm_put(Dst, 15221, LJ_TISNUM); 2800 dasm_put(Dst, 15222, LJ_TISNUM);
2802 if (op == BC_FORI) { 2801 if (op == BC_FORI) {
2803 dasm_put(Dst, 15232, -BCBIAS_J*4); 2802 dasm_put(Dst, 15233, -BCBIAS_J*4);
2804 } else if (op == BC_JFORI) { 2803 } else if (op == BC_JFORI) {
2805 dasm_put(Dst, 15246, -BCBIAS_J*4, BC_JLOOP); 2804 dasm_put(Dst, 15247, -BCBIAS_J*4, BC_JLOOP);
2806 } else if (op == BC_IFORL) { 2805 } else if (op == BC_IFORL) {
2807 dasm_put(Dst, 15264, -BCBIAS_J*4); 2806 dasm_put(Dst, 15265, -BCBIAS_J*4);
2808 } else { 2807 } else {
2809 dasm_put(Dst, 15256, BC_JLOOP); 2808 dasm_put(Dst, 15257, BC_JLOOP);
2810 } 2809 }
2811 dasm_put(Dst, 15278); 2810 dasm_put(Dst, 15279);
2812 if (vk) { 2811 if (vk) {
2813 dasm_put(Dst, 15302); 2812 dasm_put(Dst, 15303);
2814 } 2813 }
2815 dasm_put(Dst, 15221, LJ_TISNUM); 2814 dasm_put(Dst, 15222, LJ_TISNUM);
2816 if (op == BC_FORI) { 2815 if (op == BC_FORI) {
2817 dasm_put(Dst, 15311); 2816 dasm_put(Dst, 15312);
2818 } else if (op == BC_JFORI) { 2817 } else if (op == BC_JFORI) {
2819 dasm_put(Dst, 15316, -BCBIAS_J*4, BC_JLOOP); 2818 dasm_put(Dst, 15317, -BCBIAS_J*4, BC_JLOOP);
2820 } else if (op == BC_IFORL) { 2819 } else if (op == BC_IFORL) {
2821 dasm_put(Dst, 15330); 2820 dasm_put(Dst, 15331);
2822 } else { 2821 } else {
2823 dasm_put(Dst, 15326, BC_JLOOP); 2822 dasm_put(Dst, 15327, BC_JLOOP);
2824 } 2823 }
2825 dasm_put(Dst, 15335); 2824 dasm_put(Dst, 15336);
2826 } else if (!vk) { 2825 } else if (!vk) {
2827 dasm_put(Dst, 15342, LJ_TISNUM); 2826 dasm_put(Dst, 15343, LJ_TISNUM);
2828 } 2827 }
2829 if (!vk) { 2828 if (!vk) {
2830 dasm_put(Dst, 15348, LJ_TISNUM); 2829 dasm_put(Dst, 15349, LJ_TISNUM);
2831 } else { 2830 } else {
2832#ifdef LUA_USE_ASSERT 2831#ifdef LUA_USE_ASSERT
2833 dasm_put(Dst, 15362, LJ_TISNUM, LJ_TISNUM); 2832 dasm_put(Dst, 15363, LJ_TISNUM, LJ_TISNUM);
2834#endif 2833#endif
2835 } 2834 }
2836 dasm_put(Dst, 15381); 2835 dasm_put(Dst, 15382);
2837 if (!vk) { 2836 if (!vk) {
2838 dasm_put(Dst, 15385, LJ_TISNUM); 2837 dasm_put(Dst, 15386, LJ_TISNUM);
2839 } 2838 }
2840 if (sse) { 2839 if (sse) {
2841 dasm_put(Dst, 15394); 2840 dasm_put(Dst, 15395);
2842 if (vk) { 2841 if (vk) {
2843 dasm_put(Dst, 15406); 2842 dasm_put(Dst, 15407);
2844 } else { 2843 } else {
2845 dasm_put(Dst, 15425); 2844 dasm_put(Dst, 15426);
2846 } 2845 }
2847 dasm_put(Dst, 15430); 2846 dasm_put(Dst, 15431);
2848 } else { 2847 } else {
2849 dasm_put(Dst, 15443); 2848 dasm_put(Dst, 15444);
2850 if (vk) { 2849 if (vk) {
2851 dasm_put(Dst, 15449); 2850 dasm_put(Dst, 15450);
2852 } else { 2851 } else {
2853 dasm_put(Dst, 15465); 2852 dasm_put(Dst, 15466);
2854 } 2853 }
2855 dasm_put(Dst, 15473); 2854 dasm_put(Dst, 15474);
2856 if (cmov) { 2855 if (cmov) {
2857 dasm_put(Dst, 10210); 2856 dasm_put(Dst, 10211);
2858 } else { 2857 } else {
2859 dasm_put(Dst, 10216); 2858 dasm_put(Dst, 10217);
2860 } 2859 }
2861 if (!cmov) { 2860 if (!cmov) {
2862 dasm_put(Dst, 15478); 2861 dasm_put(Dst, 15479);
2863 } 2862 }
2864 } 2863 }
2865 if (op == BC_FORI) { 2864 if (op == BC_FORI) {
2866 if (LJ_DUALNUM) { 2865 if (LJ_DUALNUM) {
2867 dasm_put(Dst, 15484); 2866 dasm_put(Dst, 15485);
2868 } else { 2867 } else {
2869 dasm_put(Dst, 15489, -BCBIAS_J*4); 2868 dasm_put(Dst, 15490, -BCBIAS_J*4);
2870 } 2869 }
2871 } else if (op == BC_JFORI) { 2870 } else if (op == BC_JFORI) {
2872 dasm_put(Dst, 15499, -BCBIAS_J*4, BC_JLOOP); 2871 dasm_put(Dst, 15500, -BCBIAS_J*4, BC_JLOOP);
2873 } else if (op == BC_IFORL) { 2872 } else if (op == BC_IFORL) {
2874 if (LJ_DUALNUM) { 2873 if (LJ_DUALNUM) {
2875 dasm_put(Dst, 15513); 2874 dasm_put(Dst, 15514);
2876 } else { 2875 } else {
2877 dasm_put(Dst, 15518, -BCBIAS_J*4); 2876 dasm_put(Dst, 15519, -BCBIAS_J*4);
2878 } 2877 }
2879 } else { 2878 } else {
2880 dasm_put(Dst, 15509, BC_JLOOP); 2879 dasm_put(Dst, 15510, BC_JLOOP);
2881 } 2880 }
2882 if (LJ_DUALNUM) { 2881 if (LJ_DUALNUM) {
2883 dasm_put(Dst, 10139); 2882 dasm_put(Dst, 10140);
2884 } else { 2883 } else {
2885 dasm_put(Dst, 10904); 2884 dasm_put(Dst, 10905);
2886 } 2885 }
2887 if (sse) { 2886 if (sse) {
2888 dasm_put(Dst, 15528); 2887 dasm_put(Dst, 15529);
2889 } 2888 }
2890 break; 2889 break;
2891 2890
2892 case BC_ITERL: 2891 case BC_ITERL:
2893#if LJ_HASJIT 2892#if LJ_HASJIT
2894 dasm_put(Dst, 15119, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP); 2893 dasm_put(Dst, 15120, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
2895#endif 2894#endif
2896 break; 2895 break;
2897 2896
@@ -2900,33 +2899,33 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2900 break; 2899 break;
2901#endif 2900#endif
2902 case BC_IITERL: 2901 case BC_IITERL:
2903 dasm_put(Dst, 15539, LJ_TNIL); 2902 dasm_put(Dst, 15540, LJ_TNIL);
2904 if (op == BC_JITERL) { 2903 if (op == BC_JITERL) {
2905 dasm_put(Dst, 15554, BC_JLOOP); 2904 dasm_put(Dst, 15555, BC_JLOOP);
2906 } else { 2905 } else {
2907 dasm_put(Dst, 15568, -BCBIAS_J*4); 2906 dasm_put(Dst, 15569, -BCBIAS_J*4);
2908 } 2907 }
2909 dasm_put(Dst, 10253); 2908 dasm_put(Dst, 10254);
2910 break; 2909 break;
2911 2910
2912 case BC_LOOP: 2911 case BC_LOOP:
2913#if LJ_HASJIT 2912#if LJ_HASJIT
2914 dasm_put(Dst, 15119, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP); 2913 dasm_put(Dst, 15120, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
2915#endif 2914#endif
2916 break; 2915 break;
2917 2916
2918 case BC_ILOOP: 2917 case BC_ILOOP:
2919 dasm_put(Dst, 10255); 2918 dasm_put(Dst, 10256);
2920 break; 2919 break;
2921 2920
2922 case BC_JLOOP: 2921 case BC_JLOOP:
2923#if LJ_HASJIT 2922#if LJ_HASJIT
2924 dasm_put(Dst, 15584, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L), 9*16+4*8, -1*16, -2*16, -3*16, -4*16, -5*16, -6*16, -7*16, -8*16, -9*16); 2923 dasm_put(Dst, 15585, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L), 9*16+4*8, -1*16, -2*16, -3*16, -4*16, -5*16, -6*16, -7*16, -8*16, -9*16);
2925#endif 2924#endif
2926 break; 2925 break;
2927 2926
2928 case BC_JMP: 2927 case BC_JMP:
2929 dasm_put(Dst, 15693, -BCBIAS_J*4); 2928 dasm_put(Dst, 15694, -BCBIAS_J*4);
2930 break; 2929 break;
2931 2930
2932 /* -- Function headers -------------------------------------------------- */ 2931 /* -- Function headers -------------------------------------------------- */
@@ -2940,7 +2939,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2940 2939
2941 case BC_FUNCF: 2940 case BC_FUNCF:
2942#if LJ_HASJIT 2941#if LJ_HASJIT
2943 dasm_put(Dst, 15718, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_CALL); 2942 dasm_put(Dst, 15719, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_CALL);
2944#endif 2943#endif
2945 case BC_FUNCV: /* NYI: compiled vararg functions. */ 2944 case BC_FUNCV: /* NYI: compiled vararg functions. */
2946 break; 2945 break;
@@ -2950,13 +2949,13 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2950 break; 2949 break;
2951#endif 2950#endif
2952 case BC_IFUNCF: 2951 case BC_IFUNCF:
2953 dasm_put(Dst, 15739, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams)); 2952 dasm_put(Dst, 15740, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams));
2954 if (op == BC_JFUNCF) { 2953 if (op == BC_JFUNCF) {
2955 dasm_put(Dst, 15769, BC_JLOOP); 2954 dasm_put(Dst, 15770, BC_JLOOP);
2956 } else { 2955 } else {
2957 dasm_put(Dst, 10255); 2956 dasm_put(Dst, 10256);
2958 } 2957 }
2959 dasm_put(Dst, 15778, LJ_TNIL); 2958 dasm_put(Dst, 15779, LJ_TNIL);
2960 break; 2959 break;
2961 2960
2962 case BC_JFUNCV: 2961 case BC_JFUNCV:
@@ -2967,30 +2966,30 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2967 break; /* NYI: compiled vararg functions. */ 2966 break; /* NYI: compiled vararg functions. */
2968 2967
2969 case BC_IFUNCV: 2968 case BC_IFUNCV:
2970 dasm_put(Dst, 15800, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL); 2969 dasm_put(Dst, 15801, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL);
2971 if (op == BC_JFUNCV) { 2970 if (op == BC_JFUNCV) {
2972 dasm_put(Dst, 15769, BC_JLOOP); 2971 dasm_put(Dst, 15770, BC_JLOOP);
2973 } else { 2972 } else {
2974 dasm_put(Dst, 15891, -4+PC2PROTO(k)); 2973 dasm_put(Dst, 15892, -4+PC2PROTO(k));
2975 } 2974 }
2976 dasm_put(Dst, 15914, LJ_TNIL); 2975 dasm_put(Dst, 15915, LJ_TNIL);
2977 break; 2976 break;
2978 2977
2979 case BC_FUNCC: 2978 case BC_FUNCC:
2980 case BC_FUNCCW: 2979 case BC_FUNCCW:
2981 dasm_put(Dst, 15936, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top)); 2980 dasm_put(Dst, 15937, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top));
2982 if (op == BC_FUNCC) { 2981 if (op == BC_FUNCC) {
2983 dasm_put(Dst, 2372); 2982 dasm_put(Dst, 2372);
2984 } else { 2983 } else {
2985 dasm_put(Dst, 15966); 2984 dasm_put(Dst, 15967);
2986 } 2985 }
2987 dasm_put(Dst, 15974, DISPATCH_GL(vmstate), ~LJ_VMST_C); 2986 dasm_put(Dst, 15975, DISPATCH_GL(vmstate), ~LJ_VMST_C);
2988 if (op == BC_FUNCC) { 2987 if (op == BC_FUNCC) {
2989 dasm_put(Dst, 15983); 2988 dasm_put(Dst, 15984);
2990 } else { 2989 } else {
2991 dasm_put(Dst, 15987, DISPATCH_GL(wrapf)); 2990 dasm_put(Dst, 15988, DISPATCH_GL(wrapf));
2992 } 2991 }
2993 dasm_put(Dst, 15992, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top)); 2992 dasm_put(Dst, 15993, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top));
2994 break; 2993 break;
2995 2994
2996 /* ---------------------------------------------------------------------- */ 2995 /* ---------------------------------------------------------------------- */
@@ -3018,7 +3017,7 @@ static int build_backend(BuildCtx *ctx)
3018 3017
3019 build_subroutines(ctx, cmov, sse); 3018 build_subroutines(ctx, cmov, sse);
3020 3019
3021 dasm_put(Dst, 16017); 3020 dasm_put(Dst, 16018);
3022 for (op = 0; op < BC__MAX; op++) 3021 for (op = 0; op < BC__MAX; op++)
3023 build_ins(ctx, (BCOp)op, op, cmov, sse); 3022 build_ins(ctx, (BCOp)op, op, cmov, sse);
3024 3023
@@ -3028,6 +3027,7 @@ static int build_backend(BuildCtx *ctx)
3028/* Emit pseudo frame-info for all assembler functions. */ 3027/* Emit pseudo frame-info for all assembler functions. */
3029static void emit_asm_debug(BuildCtx *ctx) 3028static void emit_asm_debug(BuildCtx *ctx)
3030{ 3029{
3030 int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
3031#if LJ_64 3031#if LJ_64
3032#define SZPTR "8" 3032#define SZPTR "8"
3033#define BSZPTR "3" 3033#define BSZPTR "3"
@@ -3061,22 +3061,49 @@ static void emit_asm_debug(BuildCtx *ctx)
3061 "\t.long .LEFDE0-.LASFDE0\n" 3061 "\t.long .LEFDE0-.LASFDE0\n"
3062 ".LASFDE0:\n" 3062 ".LASFDE0:\n"
3063 "\t.long .Lframe0\n" 3063 "\t.long .Lframe0\n"
3064 "\t.long .Lbegin\n"
3065 "\t.long %d\n"
3066 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
3067#if LJ_64 3064#if LJ_64
3065 "\t.quad .Lbegin\n"
3066 "\t.quad %d\n"
3067 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
3068 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */ 3068 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
3069 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */ 3069 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
3070 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */ 3070 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
3071 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */ 3071 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
3072#else 3072#else
3073 "\t.long .Lbegin\n"
3074 "\t.long %d\n"
3075 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
3073 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */ 3076 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
3074 "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */ 3077 "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */
3075 "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */ 3078 "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */
3076 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ 3079 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
3077#endif 3080#endif
3078 "\t.align " SZPTR "\n" 3081 "\t.align " SZPTR "\n"
3079 ".LEFDE0:\n\n", (int)ctx->codesz, CFRAME_SIZE); 3082 ".LEFDE0:\n\n", fcofs, CFRAME_SIZE);
3083#if LJ_HASFFI
3084 fprintf(ctx->fp,
3085 ".LSFDE1:\n"
3086 "\t.long .LEFDE1-.LASFDE1\n"
3087 ".LASFDE1:\n"
3088 "\t.long .Lframe0\n"
3089#if LJ_64
3090 "\t.quad lj_vm_ffi_call\n"
3091 "\t.quad %d\n"
3092 "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
3093 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
3094 "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
3095 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
3096#else
3097 "\t.long lj_vm_ffi_call\n"
3098 "\t.long %d\n"
3099 "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
3100 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
3101 "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
3102 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
3103#endif
3104 "\t.align " SZPTR "\n"
3105 ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
3106#endif
3080#if (defined(__sun__) && defined(__svr4__)) || defined(__solaris_) 3107#if (defined(__sun__) && defined(__svr4__)) || defined(__solaris_)
3081 fprintf(ctx->fp, "\t.section .eh_frame,\"aw\",@progbits\n"); 3108 fprintf(ctx->fp, "\t.section .eh_frame,\"aw\",@progbits\n");
3082#else 3109#else
@@ -3101,10 +3128,10 @@ static void emit_asm_debug(BuildCtx *ctx)
3101 "\t.align " SZPTR "\n" 3128 "\t.align " SZPTR "\n"
3102 ".LECIE1:\n\n"); 3129 ".LECIE1:\n\n");
3103 fprintf(ctx->fp, 3130 fprintf(ctx->fp,
3104 ".LSFDE1:\n" 3131 ".LSFDE2:\n"
3105 "\t.long .LEFDE1-.LASFDE1\n" 3132 "\t.long .LEFDE2-.LASFDE2\n"
3106 ".LASFDE1:\n" 3133 ".LASFDE2:\n"
3107 "\t.long .LASFDE1-.Lframe1\n" 3134 "\t.long .LASFDE2-.Lframe1\n"
3108 "\t.long .Lbegin-.\n" 3135 "\t.long .Lbegin-.\n"
3109 "\t.long %d\n" 3136 "\t.long %d\n"
3110 "\t.uleb128 0\n" /* augmentation length */ 3137 "\t.uleb128 0\n" /* augmentation length */
@@ -3121,7 +3148,46 @@ static void emit_asm_debug(BuildCtx *ctx)
3121 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ 3148 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
3122#endif 3149#endif
3123 "\t.align " SZPTR "\n" 3150 "\t.align " SZPTR "\n"
3124 ".LEFDE1:\n\n", (int)ctx->codesz, CFRAME_SIZE); 3151 ".LEFDE2:\n\n", fcofs, CFRAME_SIZE);
3152#if LJ_HASFFI
3153 fprintf(ctx->fp,
3154 ".Lframe2:\n"
3155 "\t.long .LECIE2-.LSCIE2\n"
3156 ".LSCIE2:\n"
3157 "\t.long 0\n"
3158 "\t.byte 0x1\n"
3159 "\t.string \"zR\"\n"
3160 "\t.uleb128 0x1\n"
3161 "\t.sleb128 -" SZPTR "\n"
3162 "\t.byte " REG_RA "\n"
3163 "\t.uleb128 1\n" /* augmentation length */
3164 "\t.byte 0x1b\n" /* pcrel|sdata4 */
3165 "\t.byte 0xc\n\t.uleb128 " REG_SP "\n\t.uleb128 " SZPTR "\n"
3166 "\t.byte 0x80+" REG_RA "\n\t.uleb128 0x1\n"
3167 "\t.align " SZPTR "\n"
3168 ".LECIE2:\n\n");
3169 fprintf(ctx->fp,
3170 ".LSFDE3:\n"
3171 "\t.long .LEFDE3-.LASFDE3\n"
3172 ".LASFDE3:\n"
3173 "\t.long .LASFDE3-.Lframe2\n"
3174 "\t.long lj_vm_ffi_call-.\n"
3175 "\t.long %d\n"
3176 "\t.uleb128 0\n" /* augmentation length */
3177#if LJ_64
3178 "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
3179 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
3180 "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
3181 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
3182#else
3183 "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
3184 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
3185 "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
3186 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
3187#endif
3188 "\t.align " SZPTR "\n"
3189 ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
3190#endif
3125 break; 3191 break;
3126 case BUILD_coffasm: 3192 case BUILD_coffasm:
3127 fprintf(ctx->fp, "\t.section .eh_frame,\"dr\"\n"); 3193 fprintf(ctx->fp, "\t.section .eh_frame,\"dr\"\n");
@@ -3172,6 +3238,9 @@ static void emit_asm_debug(BuildCtx *ctx)
3172 ** Or a linker. Or a plastic case. But I digress. 3238 ** Or a linker. Or a plastic case. But I digress.
3173 */ 3239 */
3174 case BUILD_machasm: { 3240 case BUILD_machasm: {
3241#if LJ_HASFFI
3242 int fcsize = 0;
3243#endif
3175 int i; 3244 int i;
3176 fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n"); 3245 fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n");
3177 fprintf(ctx->fp, 3246 fprintf(ctx->fp,
@@ -3203,6 +3272,9 @@ static void emit_asm_debug(BuildCtx *ctx)
3203 const char *name = ctx->sym[i].name; 3272 const char *name = ctx->sym[i].name;
3204 int32_t size = ctx->sym[i+1].ofs - ctx->sym[i].ofs; 3273 int32_t size = ctx->sym[i+1].ofs - ctx->sym[i].ofs;
3205 if (size == 0) continue; 3274 if (size == 0) continue;
3275#if LJ_HASFFI
3276 if (!strcmp(name, "_lj_vm_ffi_call")) { fcsize = size; continue; }
3277#endif
3206 fprintf(ctx->fp, 3278 fprintf(ctx->fp,
3207 "%s.eh:\n" 3279 "%s.eh:\n"
3208 "LSFDE%d:\n" 3280 "LSFDE%d:\n"
@@ -3212,23 +3284,72 @@ static void emit_asm_debug(BuildCtx *ctx)
3212 "\t.long LASFDE%d-EH_frame1\n" 3284 "\t.long LASFDE%d-EH_frame1\n"
3213 "\t.long %s-.\n" 3285 "\t.long %s-.\n"
3214 "\t.long %d\n" 3286 "\t.long %d\n"
3215 "\t.byte 0\n" /* augmentation length */ 3287 "\t.byte 0\n" /* augmentation length */
3216 "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */ 3288 "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */
3217#if LJ_64 3289#if LJ_64
3218 "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */ 3290 "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
3219 "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */ 3291 "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
3220 "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */ 3292 "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */
3221 "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */ 3293 "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */
3222#else 3294#else
3223 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/ 3295 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
3224 "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */ 3296 "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */
3225 "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */ 3297 "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */
3226 "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */ 3298 "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */
3227#endif 3299#endif
3228 "\t.align " BSZPTR "\n" 3300 "\t.align " BSZPTR "\n"
3229 "LEFDE%d:\n\n", 3301 "LEFDE%d:\n\n",
3230 name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i); 3302 name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i);
3231 } 3303 }
3304#if LJ_HASFFI
3305 if (fcsize) {
3306 fprintf(ctx->fp,
3307 "EH_frame2:\n"
3308 "\t.set L$set$y,LECIEY-LSCIEY\n"
3309 "\t.long L$set$y\n"
3310 "LSCIEY:\n"
3311 "\t.long 0\n"
3312 "\t.byte 0x1\n"
3313 "\t.ascii \"zR\\0\"\n"
3314 "\t.byte 0x1\n"
3315 "\t.byte 128-" SZPTR "\n"
3316 "\t.byte " REG_RA "\n"
3317 "\t.byte 1\n" /* augmentation length */
3318#if LJ_64
3319 "\t.byte 0x1b\n" /* pcrel|sdata4 */
3320 "\t.byte 0xc\n\t.byte " REG_SP "\n\t.byte " SZPTR "\n"
3321#else
3322 "\t.byte 0x1b\n" /* pcrel|sdata4 */
3323 "\t.byte 0xc\n\t.byte 0x5\n\t.byte 0x4\n" /* esp=5 on 32 bit MACH. */
3324#endif
3325 "\t.byte 0x80+" REG_RA "\n\t.byte 0x1\n"
3326 "\t.align " BSZPTR "\n"
3327 "LECIEY:\n\n");
3328 fprintf(ctx->fp,
3329 "_lj_vm_ffi_call.eh:\n"
3330 "LSFDEY:\n"
3331 "\t.set L$set$yy,LEFDEY-LASFDEY\n"
3332 "\t.long L$set$yy\n"
3333 "LASFDEY:\n"
3334 "\t.long LASFDEY-EH_frame2\n"
3335 "\t.long _lj_vm_ffi_call-.\n"
3336 "\t.long %d\n"
3337 "\t.byte 0\n" /* augmentation length */
3338#if LJ_64
3339 "\t.byte 0xe\n\t.byte 16\n" /* def_cfa_offset */
3340 "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
3341 "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
3342 "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
3343#else
3344 "\t.byte 0xe\n\t.byte 8\n" /* def_cfa_offset */
3345 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
3346 "\t.byte 0xd\n\t.uleb128 0x4\n" /* def_cfa_register ebp */
3347 "\t.byte 0x83\n\t.byte 0x3\n" /* offset ebx */
3348#endif
3349 "\t.align " BSZPTR "\n"
3350 "LEFDEY:\n\n", fcsize);
3351 }
3352#endif
3232#if LJ_64 3353#if LJ_64
3233 fprintf(ctx->fp, "\t.subsections_via_symbols\n"); 3354 fprintf(ctx->fp, "\t.subsections_via_symbols\n");
3234#else 3355#else