aboutsummaryrefslogtreecommitdiff
path: root/src/buildvm_x86.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildvm_x86.h')
-rw-r--r--src/buildvm_x86.h1009
1 files changed, 565 insertions, 444 deletions
diff --git a/src/buildvm_x86.h b/src/buildvm_x86.h
index a9b74642..8add07c5 100644
--- a/src/buildvm_x86.h
+++ b/src/buildvm_x86.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[17111] = { 15static const unsigned char build_actionlist[17112] = {
16 254,1,248,10,252,247,198,237,15,132,244,11,131,230,252,248,41,252,242,141, 16 254,1,248,10,252,247,198,237,15,132,244,11,131,230,252,248,41,252,242,141,
17 76,49,252,248,139,114,252,252,199,68,10,4,237,248,12,131,192,1,137,68,36, 17 76,49,252,248,139,114,252,252,199,68,10,4,237,248,12,131,192,1,137,68,36,
18 20,252,247,198,237,15,132,244,13,248,14,129,252,246,239,252,247,198,237,15, 18 20,252,247,198,237,15,132,244,13,248,14,129,252,246,239,252,247,198,237,15,
@@ -540,26 +540,26 @@ static const unsigned char build_actionlist[17111] = {
540 223,224,252,246,196,1,15,133,244,248,217,201,248,2,221,216,195,255,248,163, 540 223,224,252,246,196,1,15,133,244,248,217,201,248,2,221,216,195,255,248,163,
541 156,90,137,209,129,252,242,0,0,32,0,82,157,156,90,49,192,57,209,15,132,244, 541 156,90,137,209,129,252,242,0,0,32,0,82,157,156,90,49,192,57,209,15,132,244,
542 247,139,68,36,4,87,83,15,162,139,124,36,16,137,7,137,95,4,137,79,8,137,87, 542 247,139,68,36,4,87,83,15,162,139,124,36,16,137,7,137,95,4,137,79,8,137,87,
543 12,91,95,248,1,195,248,164,255,85,137,229,83,137,203,43,163,233,255,137,163, 543 12,91,95,248,1,195,248,164,255,204,248,165,255,85,137,229,83,137,203,43,163,
544 233,255,15,182,139,233,131,252,233,1,15,136,244,248,248,1,139,132,253,139, 544 233,255,137,163,233,255,15,182,139,233,131,252,233,1,15,136,244,248,248,1,
545 233,137,4,140,131,252,233,1,15,137,244,1,248,2,139,139,233,139,147,233,252, 545 139,132,253,139,233,137,4,140,131,252,233,1,15,137,244,1,248,2,139,139,233,
546 255,147,233,137,131,233,137,147,233,128,187,233,1,15,130,244,253,15,132,244, 546 139,147,233,252,255,147,233,137,131,233,137,147,233,128,187,233,1,15,130,
547 252,221,155,233,252,233,244,253,248,6,255,217,155,233,248,7,255,41,163,233, 547 244,253,15,132,244,252,221,155,233,252,233,244,253,248,6,255,217,155,233,
548 255,139,93,252,252,201,195,255,248,165,255,249,255,129,124,253,202,4,239, 548 248,7,255,41,163,233,255,139,93,252,252,201,195,255,249,255,129,124,253,202,
549 15,133,244,253,129,124,253,194,4,239,15,133,244,254,139,44,202,131,198,4, 549 4,239,15,133,244,253,129,124,253,194,4,239,15,133,244,254,139,44,202,131,
550 59,44,194,255,15,141,244,255,255,15,140,244,255,255,15,143,244,255,255,15, 550 198,4,59,44,194,255,15,141,244,255,255,15,140,244,255,255,15,143,244,255,
551 142,244,255,255,248,6,15,183,70,252,254,141,180,253,134,233,248,9,139,6,15, 551 255,15,142,244,255,255,248,6,15,183,70,252,254,141,180,253,134,233,248,9,
552 182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,7,15,135,244,43, 552 139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,7,15,
553 129,124,253,194,4,239,15,130,244,247,15,133,244,43,255,252,242,15,42,4,194, 553 135,244,43,129,124,253,194,4,239,15,130,244,247,15,133,244,43,255,252,242,
554 252,233,244,248,255,221,4,202,219,4,194,252,233,244,249,255,248,8,15,135, 554 15,42,4,194,252,233,244,248,255,221,4,202,219,4,194,252,233,244,249,255,248,
555 244,43,255,252,242,15,42,12,202,252,242,15,16,4,194,131,198,4,102,15,46,193, 555 8,15,135,244,43,255,252,242,15,42,12,202,252,242,15,16,4,194,131,198,4,102,
556 255,15,134,244,9,255,15,135,244,9,255,15,130,244,9,255,15,131,244,9,255,252, 556 15,46,193,255,15,134,244,9,255,15,135,244,9,255,15,130,244,9,255,15,131,244,
557 233,244,6,255,219,4,202,252,233,244,248,255,129,124,253,202,4,239,15,131, 557 9,255,252,233,244,6,255,219,4,202,252,233,244,248,255,129,124,253,202,4,239,
558 244,43,129,124,253,194,4,239,15,131,244,43,255,248,1,252,242,15,16,4,194, 558 15,131,244,43,129,124,253,194,4,239,15,131,244,43,255,248,1,252,242,15,16,
559 248,2,131,198,4,102,15,46,4,202,248,3,255,248,1,221,4,202,248,2,221,4,194, 559 4,194,248,2,131,198,4,102,15,46,4,202,248,3,255,248,1,221,4,202,248,2,221,
560 248,3,131,198,4,255,15,134,244,247,255,15,135,244,247,255,15,130,244,247, 560 4,194,248,3,131,198,4,255,15,134,244,247,255,15,135,244,247,255,15,130,244,
561 255,15,131,244,247,255,15,183,70,252,254,141,180,253,134,233,248,1,139,6, 561 247,255,15,131,244,247,255,15,183,70,252,254,141,180,253,134,233,248,1,139,
562 15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,139,108,194, 562 6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,139,108,194,
563 4,131,198,4,255,129,252,253,239,15,133,244,253,129,124,253,202,4,239,15,133, 563 4,131,198,4,255,129,252,253,239,15,133,244,253,129,124,253,202,4,239,15,133,
564 244,254,139,44,194,59,44,202,255,15,133,244,255,255,15,132,244,255,255,15, 564 244,254,139,44,194,59,44,202,255,15,133,244,255,255,15,132,244,255,255,15,
565 183,70,252,254,141,180,253,134,233,248,9,139,6,15,182,204,15,182,232,131, 565 183,70,252,254,141,180,253,134,233,248,9,139,6,15,182,204,15,182,232,131,
@@ -801,8 +801,8 @@ static const unsigned char build_actionlist[17111] = {
801 137,252,245,209,252,237,129,229,239,102,129,172,253,43,233,238,15,130,244, 801 137,252,245,209,252,237,129,229,239,102,129,172,253,43,233,238,15,130,244,
802 148,255,141,12,202,255,129,121,253,4,239,15,133,244,255,255,129,121,253,12, 802 148,255,141,12,202,255,129,121,253,4,239,15,133,244,255,255,129,121,253,12,
803 239,15,133,244,60,129,121,253,20,239,15,133,244,60,139,41,131,121,16,0,15, 803 239,15,133,244,60,129,121,253,20,239,15,133,244,60,139,41,131,121,16,0,15,
804 140,244,251,255,129,121,253,12,239,15,133,244,165,129,121,253,20,239,15,133, 804 140,244,251,255,129,121,253,12,239,15,133,244,164,129,121,253,20,239,15,133,
805 244,165,255,139,105,16,133,252,237,15,136,244,251,3,41,15,128,244,247,137, 805 244,164,255,139,105,16,133,252,237,15,136,244,251,3,41,15,128,244,247,137,
806 41,255,59,105,8,199,65,28,237,137,105,24,255,15,142,244,253,248,1,248,6,141, 806 41,255,59,105,8,199,65,28,237,137,105,24,255,15,142,244,253,248,1,248,6,141,
807 180,253,134,233,255,141,180,253,134,233,15,183,70,252,254,15,142,245,248, 807 180,253,134,233,255,141,180,253,134,233,15,183,70,252,254,15,142,245,248,
808 1,248,6,255,15,143,244,253,248,6,141,180,253,134,233,248,1,255,248,7,139, 808 1,248,6,255,15,143,244,253,248,6,141,180,253,134,233,248,1,255,248,7,139,
@@ -810,7 +810,7 @@ static const unsigned char build_actionlist[17111] = {
810 15,128,244,1,137,41,255,15,141,244,7,255,141,180,253,134,233,15,183,70,252, 810 15,128,244,1,137,41,255,15,141,244,7,255,141,180,253,134,233,15,183,70,252,
811 254,15,141,245,255,15,140,244,7,255,252,233,244,6,248,9,255,129,121,253,4, 811 254,15,141,245,255,15,140,244,7,255,252,233,244,6,248,9,255,129,121,253,4,
812 239,255,15,131,244,60,129,121,253,12,239,15,131,244,60,255,129,121,253,12, 812 239,255,15,131,244,60,129,121,253,12,239,15,131,244,60,255,129,121,253,12,
813 239,15,131,244,165,129,121,253,20,239,15,131,244,165,255,139,105,20,255,129, 813 239,15,131,244,164,129,121,253,20,239,15,131,244,164,255,139,105,20,255,129,
814 252,253,239,15,131,244,60,255,252,242,15,16,1,252,242,15,16,73,8,255,252, 814 252,253,239,15,131,244,60,255,252,242,15,16,1,252,242,15,16,73,8,255,252,
815 242,15,88,65,16,252,242,15,17,1,133,252,237,15,136,244,249,255,15,140,244, 815 242,15,88,65,16,252,242,15,17,1,133,252,237,15,136,244,249,255,15,140,244,
816 249,255,102,15,46,200,248,1,252,242,15,17,65,24,255,221,65,8,221,1,255,220, 816 249,255,102,15,46,200,248,1,252,242,15,17,65,24,255,221,65,8,221,1,255,220,
@@ -995,8 +995,8 @@ enum {
995 GLOB_vm_foldfpm, 995 GLOB_vm_foldfpm,
996 GLOB_vm_foldarith, 996 GLOB_vm_foldarith,
997 GLOB_vm_cpuid, 997 GLOB_vm_cpuid,
998 GLOB_vm_ffi_call,
999 GLOB_assert_bad_for_arg_type, 998 GLOB_assert_bad_for_arg_type,
999 GLOB_vm_ffi_call,
1000 GLOB_BC_MODVN_Z, 1000 GLOB_BC_MODVN_Z,
1001 GLOB_BC_TGETS_Z, 1001 GLOB_BC_TGETS_Z,
1002 GLOB_BC_TSETS_Z, 1002 GLOB_BC_TSETS_Z,
@@ -1157,8 +1157,8 @@ static const char *const globnames[] = {
1157 "vm_foldfpm", 1157 "vm_foldfpm",
1158 "vm_foldarith", 1158 "vm_foldarith",
1159 "vm_cpuid", 1159 "vm_cpuid",
1160 "vm_ffi_call@4",
1161 "assert_bad_for_arg_type", 1160 "assert_bad_for_arg_type",
1161 "vm_ffi_call@4",
1162 "BC_MODVN_Z", 1162 "BC_MODVN_Z",
1163 "BC_TGETS_Z", 1163 "BC_TGETS_Z",
1164 "BC_TSETS_Z", 1164 "BC_TSETS_Z",
@@ -1972,31 +1972,30 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
1972 dasm_put(Dst, 10434); 1972 dasm_put(Dst, 10434);
1973 } 1973 }
1974 dasm_put(Dst, 10899); 1974 dasm_put(Dst, 10899);
1975#ifdef LUA_USE_ASSERT
1976 dasm_put(Dst, 10436);
1977#endif
1978 dasm_put(Dst, 10955);
1975#if LJ_HASFFI 1979#if LJ_HASFFI
1976#define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V) 1980#define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
1977 dasm_put(Dst, 10955, DtE(->spadj)); 1981 dasm_put(Dst, 10959, DtE(->spadj));
1978#if LJ_TARGET_WINDOWS 1982#if LJ_TARGET_WINDOWS
1979 dasm_put(Dst, 10965, DtE(->spadj)); 1983 dasm_put(Dst, 10969, DtE(->spadj));
1980#endif 1984#endif
1981 dasm_put(Dst, 10969, DtE(->nsp), offsetof(CCallState, stack), DtE(->gpr[0]), DtE(->gpr[1]), DtE(->func), DtE(->gpr[0]), DtE(->gpr[1]), DtE(->resx87), DtE(->fpr[0].d[0])); 1985 dasm_put(Dst, 10973, DtE(->nsp), offsetof(CCallState, stack), DtE(->gpr[0]), DtE(->gpr[1]), DtE(->func), DtE(->gpr[0]), DtE(->gpr[1]), DtE(->resx87), DtE(->fpr[0].d[0]));
1982 dasm_put(Dst, 11039, DtE(->fpr[0].f[0])); 1986 dasm_put(Dst, 11043, DtE(->fpr[0].f[0]));
1983#if LJ_TARGET_WINDOWS 1987#if LJ_TARGET_WINDOWS
1984 dasm_put(Dst, 11045, DtE(->spadj)); 1988 dasm_put(Dst, 11049, DtE(->spadj));
1985#endif
1986 dasm_put(Dst, 11049);
1987#endif 1989#endif
1988 dasm_put(Dst, 11056); 1990 dasm_put(Dst, 11053);
1989#ifdef LUA_USE_ASSERT
1990 dasm_put(Dst, 10436);
1991#endif 1991#endif
1992 dasm_put(Dst, 10436);
1993} 1992}
1994 1993
1995/* Generate the code for a single instruction. */ 1994/* Generate the code for a single instruction. */
1996static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse) 1995static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
1997{ 1996{
1998 int vk = 0; 1997 int vk = 0;
1999 dasm_put(Dst, 11059, defop); 1998 dasm_put(Dst, 11060, defop);
2000 1999
2001 switch (op) { 2000 switch (op) {
2002 2001
@@ -2007,57 +2006,57 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2007 2006
2008 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: 2007 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT:
2009 if (LJ_DUALNUM) { 2008 if (LJ_DUALNUM) {
2010 dasm_put(Dst, 11061, LJ_TISNUM, LJ_TISNUM); 2009 dasm_put(Dst, 11062, LJ_TISNUM, LJ_TISNUM);
2011 switch (op) { 2010 switch (op) {
2012 case BC_ISLT: 2011 case BC_ISLT:
2013 dasm_put(Dst, 11091); 2012 dasm_put(Dst, 11092);
2014 break; 2013 break;
2015 case BC_ISGE: 2014 case BC_ISGE:
2016 dasm_put(Dst, 11096); 2015 dasm_put(Dst, 11097);
2017 break; 2016 break;
2018 case BC_ISLE: 2017 case BC_ISLE:
2019 dasm_put(Dst, 11101); 2018 dasm_put(Dst, 11102);
2020 break; 2019 break;
2021 case BC_ISGT: 2020 case BC_ISGT:
2022 dasm_put(Dst, 11106); 2021 dasm_put(Dst, 11107);
2023 break; 2022 break;
2024 default: break; /* Shut up GCC. */ 2023 default: break; /* Shut up GCC. */
2025 } 2024 }
2026 dasm_put(Dst, 11111, -BCBIAS_J*4, LJ_TISNUM); 2025 dasm_put(Dst, 11112, -BCBIAS_J*4, LJ_TISNUM);
2027 if (sse) { 2026 if (sse) {
2028 dasm_put(Dst, 11164); 2027 dasm_put(Dst, 11165);
2029 } else { 2028 } else {
2030 dasm_put(Dst, 11175); 2029 dasm_put(Dst, 11176);
2031 } 2030 }
2032 dasm_put(Dst, 11186); 2031 dasm_put(Dst, 11187);
2033 if (sse) { 2032 if (sse) {
2034 dasm_put(Dst, 11193); 2033 dasm_put(Dst, 11194);
2035 switch (op) { 2034 switch (op) {
2036 case BC_ISLT: 2035 case BC_ISLT:
2037 dasm_put(Dst, 11213); 2036 dasm_put(Dst, 11214);
2038 break; 2037 break;
2039 case BC_ISGE: 2038 case BC_ISGE:
2040 dasm_put(Dst, 11218); 2039 dasm_put(Dst, 11219);
2041 break; 2040 break;
2042 case BC_ISLE: 2041 case BC_ISLE:
2043 dasm_put(Dst, 11223); 2042 dasm_put(Dst, 11224);
2044 break; 2043 break;
2045 case BC_ISGT: 2044 case BC_ISGT:
2046 dasm_put(Dst, 11228); 2045 dasm_put(Dst, 11229);
2047 break; 2046 break;
2048 default: break; /* Shut up GCC. */ 2047 default: break; /* Shut up GCC. */
2049 } 2048 }
2050 dasm_put(Dst, 11233); 2049 dasm_put(Dst, 11234);
2051 } else { 2050 } else {
2052 dasm_put(Dst, 11238); 2051 dasm_put(Dst, 11239);
2053 } 2052 }
2054 } else { 2053 } else {
2055 dasm_put(Dst, 11246, LJ_TISNUM, LJ_TISNUM); 2054 dasm_put(Dst, 11247, LJ_TISNUM, LJ_TISNUM);
2056 } 2055 }
2057 if (sse) { 2056 if (sse) {
2058 dasm_put(Dst, 11267); 2057 dasm_put(Dst, 11268);
2059 } else { 2058 } else {
2060 dasm_put(Dst, 11288); 2059 dasm_put(Dst, 11289);
2061 if (cmov) { 2060 if (cmov) {
2062 dasm_put(Dst, 3944); 2061 dasm_put(Dst, 3944);
2063 } else { 2062 } else {
@@ -2067,70 +2066,70 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2067 if (LJ_DUALNUM) { 2066 if (LJ_DUALNUM) {
2068 switch (op) { 2067 switch (op) {
2069 case BC_ISLT: 2068 case BC_ISLT:
2070 dasm_put(Dst, 11213); 2069 dasm_put(Dst, 11214);
2071 break; 2070 break;
2072 case BC_ISGE: 2071 case BC_ISGE:
2073 dasm_put(Dst, 11218); 2072 dasm_put(Dst, 11219);
2074 break; 2073 break;
2075 case BC_ISLE: 2074 case BC_ISLE:
2076 dasm_put(Dst, 11223); 2075 dasm_put(Dst, 11224);
2077 break; 2076 break;
2078 case BC_ISGT: 2077 case BC_ISGT:
2079 dasm_put(Dst, 11228); 2078 dasm_put(Dst, 11229);
2080 break; 2079 break;
2081 default: break; /* Shut up GCC. */ 2080 default: break; /* Shut up GCC. */
2082 } 2081 }
2083 dasm_put(Dst, 11233); 2082 dasm_put(Dst, 11234);
2084 } else { 2083 } else {
2085 switch (op) { 2084 switch (op) {
2086 case BC_ISLT: 2085 case BC_ISLT:
2087 dasm_put(Dst, 11304); 2086 dasm_put(Dst, 11305);
2088 break; 2087 break;
2089 case BC_ISGE: 2088 case BC_ISGE:
2090 dasm_put(Dst, 11309); 2089 dasm_put(Dst, 11310);
2091 break; 2090 break;
2092 case BC_ISLE: 2091 case BC_ISLE:
2093 dasm_put(Dst, 11314); 2092 dasm_put(Dst, 11315);
2094 break; 2093 break;
2095 case BC_ISGT: 2094 case BC_ISGT:
2096 dasm_put(Dst, 11319); 2095 dasm_put(Dst, 11320);
2097 break; 2096 break;
2098 default: break; /* Shut up GCC. */ 2097 default: break; /* Shut up GCC. */
2099 } 2098 }
2100 dasm_put(Dst, 11324, -BCBIAS_J*4); 2099 dasm_put(Dst, 11325, -BCBIAS_J*4);
2101 } 2100 }
2102 break; 2101 break;
2103 2102
2104 case BC_ISEQV: case BC_ISNEV: 2103 case BC_ISEQV: case BC_ISNEV:
2105 vk = op == BC_ISEQV; 2104 vk = op == BC_ISEQV;
2106 dasm_put(Dst, 11355); 2105 dasm_put(Dst, 11356);
2107 if (LJ_DUALNUM) { 2106 if (LJ_DUALNUM) {
2108 dasm_put(Dst, 11363, LJ_TISNUM, LJ_TISNUM); 2107 dasm_put(Dst, 11364, LJ_TISNUM, LJ_TISNUM);
2109 if (vk) { 2108 if (vk) {
2110 dasm_put(Dst, 11388); 2109 dasm_put(Dst, 11389);
2111 } else { 2110 } else {
2112 dasm_put(Dst, 11393); 2111 dasm_put(Dst, 11394);
2113 } 2112 }
2114 dasm_put(Dst, 11398, -BCBIAS_J*4, LJ_TISNUM); 2113 dasm_put(Dst, 11399, -BCBIAS_J*4, LJ_TISNUM);
2115 if (sse) { 2114 if (sse) {
2116 dasm_put(Dst, 11449); 2115 dasm_put(Dst, 11450);
2117 } else { 2116 } else {
2118 dasm_put(Dst, 11456); 2117 dasm_put(Dst, 11457);
2119 } 2118 }
2120 dasm_put(Dst, 11460); 2119 dasm_put(Dst, 11461);
2121 if (sse) { 2120 if (sse) {
2122 dasm_put(Dst, 11471); 2121 dasm_put(Dst, 11472);
2123 } else { 2122 } else {
2124 dasm_put(Dst, 11483); 2123 dasm_put(Dst, 11484);
2125 } 2124 }
2126 dasm_put(Dst, 11490); 2125 dasm_put(Dst, 11491);
2127 } else { 2126 } else {
2128 dasm_put(Dst, 11495, LJ_TISNUM, LJ_TISNUM); 2127 dasm_put(Dst, 11496, LJ_TISNUM, LJ_TISNUM);
2129 } 2128 }
2130 if (sse) { 2129 if (sse) {
2131 dasm_put(Dst, 11514); 2130 dasm_put(Dst, 11515);
2132 } else { 2131 } else {
2133 dasm_put(Dst, 11532); 2132 dasm_put(Dst, 11533);
2134 if (cmov) { 2133 if (cmov) {
2135 dasm_put(Dst, 3944); 2134 dasm_put(Dst, 3944);
2136 } else { 2135 } else {
@@ -2139,13 +2138,13 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2139 } 2138 }
2140 iseqne_fp: 2139 iseqne_fp:
2141 if (vk) { 2140 if (vk) {
2142 dasm_put(Dst, 11545); 2141 dasm_put(Dst, 11546);
2143 } else { 2142 } else {
2144 dasm_put(Dst, 11554); 2143 dasm_put(Dst, 11555);
2145 } 2144 }
2146 iseqne_end: 2145 iseqne_end:
2147 if (vk) { 2146 if (vk) {
2148 dasm_put(Dst, 11563, -BCBIAS_J*4); 2147 dasm_put(Dst, 11564, -BCBIAS_J*4);
2149 if (!LJ_HASFFI) { 2148 if (!LJ_HASFFI) {
2150 dasm_put(Dst, 4844); 2149 dasm_put(Dst, 4844);
2151 } 2150 }
@@ -2153,76 +2152,76 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2153 if (!LJ_HASFFI) { 2152 if (!LJ_HASFFI) {
2154 dasm_put(Dst, 4844); 2153 dasm_put(Dst, 4844);
2155 } 2154 }
2156 dasm_put(Dst, 11578, -BCBIAS_J*4); 2155 dasm_put(Dst, 11579, -BCBIAS_J*4);
2157 } 2156 }
2158 if (LJ_DUALNUM && (op == BC_ISEQV || op == BC_ISNEV || 2157 if (LJ_DUALNUM && (op == BC_ISEQV || op == BC_ISNEV ||
2159 op == BC_ISEQN || op == BC_ISNEN)) { 2158 op == BC_ISEQN || op == BC_ISNEN)) {
2160 dasm_put(Dst, 11593); 2159 dasm_put(Dst, 11594);
2161 } else { 2160 } else {
2162 dasm_put(Dst, 11336); 2161 dasm_put(Dst, 11337);
2163 } 2162 }
2164 if (op == BC_ISEQV || op == BC_ISNEV) { 2163 if (op == BC_ISEQV || op == BC_ISNEV) {
2165 dasm_put(Dst, 11598); 2164 dasm_put(Dst, 11599);
2166 if (LJ_HASFFI) { 2165 if (LJ_HASFFI) {
2167 dasm_put(Dst, 11601, LJ_TCDATA, LJ_TCDATA); 2166 dasm_put(Dst, 11602, LJ_TCDATA, LJ_TCDATA);
2168 } 2167 }
2169 dasm_put(Dst, 11620, LJ_TISPRI, LJ_TISTABUD, Dt6(->metatable), Dt6(->nomm), 1<<MM_eq); 2168 dasm_put(Dst, 11621, LJ_TISPRI, LJ_TISTABUD, Dt6(->metatable), Dt6(->nomm), 1<<MM_eq);
2170 if (vk) { 2169 if (vk) {
2171 dasm_put(Dst, 11676); 2170 dasm_put(Dst, 11677);
2172 } else { 2171 } else {
2173 dasm_put(Dst, 11680); 2172 dasm_put(Dst, 11681);
2174 } 2173 }
2175 dasm_put(Dst, 11686); 2174 dasm_put(Dst, 11687);
2176 } else if (LJ_HASFFI) { 2175 } else if (LJ_HASFFI) {
2177 dasm_put(Dst, 11691, LJ_TCDATA); 2176 dasm_put(Dst, 11692, LJ_TCDATA);
2178 if (LJ_DUALNUM && vk) { 2177 if (LJ_DUALNUM && vk) {
2179 dasm_put(Dst, 11698); 2178 dasm_put(Dst, 11699);
2180 } else { 2179 } else {
2181 dasm_put(Dst, 11671); 2180 dasm_put(Dst, 11672);
2182 } 2181 }
2183 dasm_put(Dst, 11703); 2182 dasm_put(Dst, 11704);
2184 } 2183 }
2185 break; 2184 break;
2186 case BC_ISEQS: case BC_ISNES: 2185 case BC_ISEQS: case BC_ISNES:
2187 vk = op == BC_ISEQS; 2186 vk = op == BC_ISEQS;
2188 dasm_put(Dst, 11708, LJ_TSTR); 2187 dasm_put(Dst, 11709, LJ_TSTR);
2189 iseqne_test: 2188 iseqne_test:
2190 if (vk) { 2189 if (vk) {
2191 dasm_put(Dst, 11549); 2190 dasm_put(Dst, 11550);
2192 } else { 2191 } else {
2193 dasm_put(Dst, 748); 2192 dasm_put(Dst, 748);
2194 } 2193 }
2195 goto iseqne_end; 2194 goto iseqne_end;
2196 case BC_ISEQN: case BC_ISNEN: 2195 case BC_ISEQN: case BC_ISNEN:
2197 vk = op == BC_ISEQN; 2196 vk = op == BC_ISEQN;
2198 dasm_put(Dst, 11733); 2197 dasm_put(Dst, 11734);
2199 if (LJ_DUALNUM) { 2198 if (LJ_DUALNUM) {
2200 dasm_put(Dst, 11741, LJ_TISNUM, LJ_TISNUM); 2199 dasm_put(Dst, 11742, LJ_TISNUM, LJ_TISNUM);
2201 if (vk) { 2200 if (vk) {
2202 dasm_put(Dst, 11388); 2201 dasm_put(Dst, 11389);
2203 } else { 2202 } else {
2204 dasm_put(Dst, 11393); 2203 dasm_put(Dst, 11394);
2205 } 2204 }
2206 dasm_put(Dst, 11766, -BCBIAS_J*4, LJ_TISNUM); 2205 dasm_put(Dst, 11767, -BCBIAS_J*4, LJ_TISNUM);
2207 if (sse) { 2206 if (sse) {
2208 dasm_put(Dst, 11813); 2207 dasm_put(Dst, 11814);
2209 } else { 2208 } else {
2210 dasm_put(Dst, 11820); 2209 dasm_put(Dst, 11821);
2211 } 2210 }
2212 dasm_put(Dst, 11824); 2211 dasm_put(Dst, 11825);
2213 if (sse) { 2212 if (sse) {
2214 dasm_put(Dst, 11831); 2213 dasm_put(Dst, 11832);
2215 } else { 2214 } else {
2216 dasm_put(Dst, 11843); 2215 dasm_put(Dst, 11844);
2217 } 2216 }
2218 dasm_put(Dst, 11490); 2217 dasm_put(Dst, 11491);
2219 } else { 2218 } else {
2220 dasm_put(Dst, 11850, LJ_TISNUM); 2219 dasm_put(Dst, 11851, LJ_TISNUM);
2221 } 2220 }
2222 if (sse) { 2221 if (sse) {
2223 dasm_put(Dst, 11859); 2222 dasm_put(Dst, 11860);
2224 } else { 2223 } else {
2225 dasm_put(Dst, 11877); 2224 dasm_put(Dst, 11878);
2226 if (cmov) { 2225 if (cmov) {
2227 dasm_put(Dst, 3944); 2226 dasm_put(Dst, 3944);
2228 } else { 2227 } else {
@@ -2232,78 +2231,78 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2232 goto iseqne_fp; 2231 goto iseqne_fp;
2233 case BC_ISEQP: case BC_ISNEP: 2232 case BC_ISEQP: case BC_ISNEP:
2234 vk = op == BC_ISEQP; 2233 vk = op == BC_ISEQP;
2235 dasm_put(Dst, 11890); 2234 dasm_put(Dst, 11891);
2236 if (!LJ_HASFFI) goto iseqne_test; 2235 if (!LJ_HASFFI) goto iseqne_test;
2237 if (vk) { 2236 if (vk) {
2238 dasm_put(Dst, 11903, -BCBIAS_J*4, LJ_TCDATA); 2237 dasm_put(Dst, 11904, -BCBIAS_J*4, LJ_TCDATA);
2239 } else { 2238 } else {
2240 dasm_put(Dst, 11952, LJ_TCDATA, -BCBIAS_J*4); 2239 dasm_put(Dst, 11953, LJ_TCDATA, -BCBIAS_J*4);
2241 } 2240 }
2242 break; 2241 break;
2243 2242
2244 /* -- Unary test and copy ops ------------------------------------------- */ 2243 /* -- Unary test and copy ops ------------------------------------------- */
2245 2244
2246 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: 2245 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF:
2247 dasm_put(Dst, 11995, LJ_TISTRUECOND); 2246 dasm_put(Dst, 11996, LJ_TISTRUECOND);
2248 if (op == BC_IST || op == BC_ISTC) { 2247 if (op == BC_IST || op == BC_ISTC) {
2249 dasm_put(Dst, 11319); 2248 dasm_put(Dst, 11320);
2250 } else { 2249 } else {
2251 dasm_put(Dst, 11314); 2250 dasm_put(Dst, 11315);
2252 } 2251 }
2253 if (op == BC_ISTC || op == BC_ISFC) { 2252 if (op == BC_ISTC || op == BC_ISFC) {
2254 dasm_put(Dst, 12007); 2253 dasm_put(Dst, 12008);
2255 } 2254 }
2256 dasm_put(Dst, 11324, -BCBIAS_J*4); 2255 dasm_put(Dst, 11325, -BCBIAS_J*4);
2257 break; 2256 break;
2258 2257
2259 /* -- Unary ops --------------------------------------------------------- */ 2258 /* -- Unary ops --------------------------------------------------------- */
2260 2259
2261 case BC_MOV: 2260 case BC_MOV:
2262 dasm_put(Dst, 12018); 2261 dasm_put(Dst, 12019);
2263 break; 2262 break;
2264 case BC_NOT: 2263 case BC_NOT:
2265 dasm_put(Dst, 12051, LJ_TISTRUECOND, LJ_TTRUE); 2264 dasm_put(Dst, 12052, LJ_TISTRUECOND, LJ_TTRUE);
2266 break; 2265 break;
2267 case BC_UNM: 2266 case BC_UNM:
2268 if (LJ_DUALNUM) { 2267 if (LJ_DUALNUM) {
2269 dasm_put(Dst, 12086, LJ_TISNUM, LJ_TISNUM); 2268 dasm_put(Dst, 12087, LJ_TISNUM, LJ_TISNUM);
2270 } else { 2269 } else {
2271 dasm_put(Dst, 12162, LJ_TISNUM); 2270 dasm_put(Dst, 12163, LJ_TISNUM);
2272 } 2271 }
2273 if (sse) { 2272 if (sse) {
2274 dasm_put(Dst, 12173); 2273 dasm_put(Dst, 12174);
2275 } else { 2274 } else {
2276 dasm_put(Dst, 12203); 2275 dasm_put(Dst, 12204);
2277 } 2276 }
2278 if (LJ_DUALNUM) { 2277 if (LJ_DUALNUM) {
2279 dasm_put(Dst, 11593); 2278 dasm_put(Dst, 11594);
2280 } else { 2279 } else {
2281 dasm_put(Dst, 11336); 2280 dasm_put(Dst, 11337);
2282 } 2281 }
2283 break; 2282 break;
2284 case BC_LEN: 2283 case BC_LEN:
2285 dasm_put(Dst, 12212, LJ_TSTR); 2284 dasm_put(Dst, 12213, LJ_TSTR);
2286 if (LJ_DUALNUM) { 2285 if (LJ_DUALNUM) {
2287 dasm_put(Dst, 12226, Dt5(->len), LJ_TISNUM); 2286 dasm_put(Dst, 12227, Dt5(->len), LJ_TISNUM);
2288 } else if (sse) { 2287 } else if (sse) {
2289 dasm_put(Dst, 12240, Dt5(->len)); 2288 dasm_put(Dst, 12241, Dt5(->len));
2290 } else { 2289 } else {
2291 dasm_put(Dst, 12258, Dt5(->len)); 2290 dasm_put(Dst, 12259, Dt5(->len));
2292 } 2291 }
2293 dasm_put(Dst, 12267, LJ_TTAB); 2292 dasm_put(Dst, 12268, LJ_TTAB);
2294#ifdef LUAJIT_ENABLE_LUA52COMPAT 2293#ifdef LUAJIT_ENABLE_LUA52COMPAT
2295 dasm_put(Dst, 12301, Dt6(->metatable)); 2294 dasm_put(Dst, 12302, Dt6(->metatable));
2296#endif 2295#endif
2297 dasm_put(Dst, 12315); 2296 dasm_put(Dst, 12316);
2298 if (LJ_DUALNUM) { 2297 if (LJ_DUALNUM) {
2299 } else if (sse) { 2298 } else if (sse) {
2300 dasm_put(Dst, 12324); 2299 dasm_put(Dst, 12325);
2301 } else { 2300 } else {
2302 dasm_put(Dst, 12330); 2301 dasm_put(Dst, 12331);
2303 } 2302 }
2304 dasm_put(Dst, 12337); 2303 dasm_put(Dst, 12338);
2305#ifdef LUAJIT_ENABLE_LUA52COMPAT 2304#ifdef LUAJIT_ENABLE_LUA52COMPAT
2306 dasm_put(Dst, 12350, Dt6(->nomm), 1<<MM_len); 2305 dasm_put(Dst, 12351, Dt6(->nomm), 1<<MM_len);
2307#endif 2306#endif
2308 break; 2307 break;
2309 2308
@@ -2312,471 +2311,471 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2312 2311
2313 case BC_ADDVN: case BC_ADDNV: case BC_ADDVV: 2312 case BC_ADDVN: case BC_ADDNV: case BC_ADDVV:
2314 if (LJ_DUALNUM) { 2313 if (LJ_DUALNUM) {
2315 dasm_put(Dst, 12366); 2314 dasm_put(Dst, 12367);
2316 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2315 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2317 switch (vk) { 2316 switch (vk) {
2318 case 0: 2317 case 0:
2319 dasm_put(Dst, 12374, LJ_TISNUM, LJ_TISNUM); 2318 dasm_put(Dst, 12375, LJ_TISNUM, LJ_TISNUM);
2320 break; 2319 break;
2321 case 1: 2320 case 1:
2322 dasm_put(Dst, 12407, LJ_TISNUM, LJ_TISNUM); 2321 dasm_put(Dst, 12408, LJ_TISNUM, LJ_TISNUM);
2323 break; 2322 break;
2324 default: 2323 default:
2325 dasm_put(Dst, 12440, LJ_TISNUM, LJ_TISNUM); 2324 dasm_put(Dst, 12441, LJ_TISNUM, LJ_TISNUM);
2326 break; 2325 break;
2327 } 2326 }
2328 dasm_put(Dst, 12473, LJ_TISNUM); 2327 dasm_put(Dst, 12474, LJ_TISNUM);
2329 if (vk == 1) { 2328 if (vk == 1) {
2330 dasm_put(Dst, 12236); 2329 dasm_put(Dst, 12237);
2331 } else { 2330 } else {
2332 dasm_put(Dst, 12014); 2331 dasm_put(Dst, 12015);
2333 } 2332 }
2334 dasm_put(Dst, 11336); 2333 dasm_put(Dst, 11337);
2335 } else { 2334 } else {
2336 dasm_put(Dst, 12366); 2335 dasm_put(Dst, 12367);
2337 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2336 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2338 switch (vk) { 2337 switch (vk) {
2339 case 0: 2338 case 0:
2340 dasm_put(Dst, 12479, LJ_TISNUM); 2339 dasm_put(Dst, 12480, LJ_TISNUM);
2341 if (LJ_DUALNUM) { 2340 if (LJ_DUALNUM) {
2342 dasm_put(Dst, 12491, LJ_TISNUM); 2341 dasm_put(Dst, 12492, LJ_TISNUM);
2343 } 2342 }
2344 if (sse) { 2343 if (sse) {
2345 dasm_put(Dst, 12502); 2344 dasm_put(Dst, 12503);
2346 } else { 2345 } else {
2347 dasm_put(Dst, 12516); 2346 dasm_put(Dst, 12517);
2348 } 2347 }
2349 break; 2348 break;
2350 case 1: 2349 case 1:
2351 dasm_put(Dst, 12524, LJ_TISNUM); 2350 dasm_put(Dst, 12525, LJ_TISNUM);
2352 if (LJ_DUALNUM) { 2351 if (LJ_DUALNUM) {
2353 dasm_put(Dst, 12536, LJ_TISNUM); 2352 dasm_put(Dst, 12537, LJ_TISNUM);
2354 } 2353 }
2355 if (sse) { 2354 if (sse) {
2356 dasm_put(Dst, 12547); 2355 dasm_put(Dst, 12548);
2357 } else { 2356 } else {
2358 dasm_put(Dst, 12561); 2357 dasm_put(Dst, 12562);
2359 } 2358 }
2360 break; 2359 break;
2361 default: 2360 default:
2362 dasm_put(Dst, 12569, LJ_TISNUM, LJ_TISNUM); 2361 dasm_put(Dst, 12570, LJ_TISNUM, LJ_TISNUM);
2363 if (sse) { 2362 if (sse) {
2364 dasm_put(Dst, 12591); 2363 dasm_put(Dst, 12592);
2365 } else { 2364 } else {
2366 dasm_put(Dst, 12605); 2365 dasm_put(Dst, 12606);
2367 } 2366 }
2368 break; 2367 break;
2369 } 2368 }
2370 if (sse) { 2369 if (sse) {
2371 dasm_put(Dst, 12196); 2370 dasm_put(Dst, 12197);
2372 } else { 2371 } else {
2373 dasm_put(Dst, 12208); 2372 dasm_put(Dst, 12209);
2374 } 2373 }
2375 dasm_put(Dst, 11336); 2374 dasm_put(Dst, 11337);
2376 } 2375 }
2377 break; 2376 break;
2378 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: 2377 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV:
2379 if (LJ_DUALNUM) { 2378 if (LJ_DUALNUM) {
2380 dasm_put(Dst, 12366); 2379 dasm_put(Dst, 12367);
2381 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2380 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2382 switch (vk) { 2381 switch (vk) {
2383 case 0: 2382 case 0:
2384 dasm_put(Dst, 12613, LJ_TISNUM, LJ_TISNUM); 2383 dasm_put(Dst, 12614, LJ_TISNUM, LJ_TISNUM);
2385 break; 2384 break;
2386 case 1: 2385 case 1:
2387 dasm_put(Dst, 12646, LJ_TISNUM, LJ_TISNUM); 2386 dasm_put(Dst, 12647, LJ_TISNUM, LJ_TISNUM);
2388 break; 2387 break;
2389 default: 2388 default:
2390 dasm_put(Dst, 12679, LJ_TISNUM, LJ_TISNUM); 2389 dasm_put(Dst, 12680, LJ_TISNUM, LJ_TISNUM);
2391 break; 2390 break;
2392 } 2391 }
2393 dasm_put(Dst, 12473, LJ_TISNUM); 2392 dasm_put(Dst, 12474, LJ_TISNUM);
2394 if (vk == 1) { 2393 if (vk == 1) {
2395 dasm_put(Dst, 12236); 2394 dasm_put(Dst, 12237);
2396 } else { 2395 } else {
2397 dasm_put(Dst, 12014); 2396 dasm_put(Dst, 12015);
2398 } 2397 }
2399 dasm_put(Dst, 11336); 2398 dasm_put(Dst, 11337);
2400 } else { 2399 } else {
2401 dasm_put(Dst, 12366); 2400 dasm_put(Dst, 12367);
2402 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2401 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2403 switch (vk) { 2402 switch (vk) {
2404 case 0: 2403 case 0:
2405 dasm_put(Dst, 12479, LJ_TISNUM); 2404 dasm_put(Dst, 12480, LJ_TISNUM);
2406 if (LJ_DUALNUM) { 2405 if (LJ_DUALNUM) {
2407 dasm_put(Dst, 12491, LJ_TISNUM); 2406 dasm_put(Dst, 12492, LJ_TISNUM);
2408 } 2407 }
2409 if (sse) { 2408 if (sse) {
2410 dasm_put(Dst, 12712); 2409 dasm_put(Dst, 12713);
2411 } else { 2410 } else {
2412 dasm_put(Dst, 12726); 2411 dasm_put(Dst, 12727);
2413 } 2412 }
2414 break; 2413 break;
2415 case 1: 2414 case 1:
2416 dasm_put(Dst, 12524, LJ_TISNUM); 2415 dasm_put(Dst, 12525, LJ_TISNUM);
2417 if (LJ_DUALNUM) { 2416 if (LJ_DUALNUM) {
2418 dasm_put(Dst, 12536, LJ_TISNUM); 2417 dasm_put(Dst, 12537, LJ_TISNUM);
2419 } 2418 }
2420 if (sse) { 2419 if (sse) {
2421 dasm_put(Dst, 12734); 2420 dasm_put(Dst, 12735);
2422 } else { 2421 } else {
2423 dasm_put(Dst, 12748); 2422 dasm_put(Dst, 12749);
2424 } 2423 }
2425 break; 2424 break;
2426 default: 2425 default:
2427 dasm_put(Dst, 12569, LJ_TISNUM, LJ_TISNUM); 2426 dasm_put(Dst, 12570, LJ_TISNUM, LJ_TISNUM);
2428 if (sse) { 2427 if (sse) {
2429 dasm_put(Dst, 12756); 2428 dasm_put(Dst, 12757);
2430 } else { 2429 } else {
2431 dasm_put(Dst, 12770); 2430 dasm_put(Dst, 12771);
2432 } 2431 }
2433 break; 2432 break;
2434 } 2433 }
2435 if (sse) { 2434 if (sse) {
2436 dasm_put(Dst, 12196); 2435 dasm_put(Dst, 12197);
2437 } else { 2436 } else {
2438 dasm_put(Dst, 12208); 2437 dasm_put(Dst, 12209);
2439 } 2438 }
2440 dasm_put(Dst, 11336); 2439 dasm_put(Dst, 11337);
2441 } 2440 }
2442 break; 2441 break;
2443 case BC_MULVN: case BC_MULNV: case BC_MULVV: 2442 case BC_MULVN: case BC_MULNV: case BC_MULVV:
2444 if (LJ_DUALNUM) { 2443 if (LJ_DUALNUM) {
2445 dasm_put(Dst, 12366); 2444 dasm_put(Dst, 12367);
2446 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2445 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2447 switch (vk) { 2446 switch (vk) {
2448 case 0: 2447 case 0:
2449 dasm_put(Dst, 12778, LJ_TISNUM, LJ_TISNUM); 2448 dasm_put(Dst, 12779, LJ_TISNUM, LJ_TISNUM);
2450 break; 2449 break;
2451 case 1: 2450 case 1:
2452 dasm_put(Dst, 12812, LJ_TISNUM, LJ_TISNUM); 2451 dasm_put(Dst, 12813, LJ_TISNUM, LJ_TISNUM);
2453 break; 2452 break;
2454 default: 2453 default:
2455 dasm_put(Dst, 12846, LJ_TISNUM, LJ_TISNUM); 2454 dasm_put(Dst, 12847, LJ_TISNUM, LJ_TISNUM);
2456 break; 2455 break;
2457 } 2456 }
2458 dasm_put(Dst, 12473, LJ_TISNUM); 2457 dasm_put(Dst, 12474, LJ_TISNUM);
2459 if (vk == 1) { 2458 if (vk == 1) {
2460 dasm_put(Dst, 12236); 2459 dasm_put(Dst, 12237);
2461 } else { 2460 } else {
2462 dasm_put(Dst, 12014); 2461 dasm_put(Dst, 12015);
2463 } 2462 }
2464 dasm_put(Dst, 11336); 2463 dasm_put(Dst, 11337);
2465 } else { 2464 } else {
2466 dasm_put(Dst, 12366); 2465 dasm_put(Dst, 12367);
2467 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2466 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2468 switch (vk) { 2467 switch (vk) {
2469 case 0: 2468 case 0:
2470 dasm_put(Dst, 12479, LJ_TISNUM); 2469 dasm_put(Dst, 12480, LJ_TISNUM);
2471 if (LJ_DUALNUM) { 2470 if (LJ_DUALNUM) {
2472 dasm_put(Dst, 12491, LJ_TISNUM); 2471 dasm_put(Dst, 12492, LJ_TISNUM);
2473 } 2472 }
2474 if (sse) { 2473 if (sse) {
2475 dasm_put(Dst, 12880); 2474 dasm_put(Dst, 12881);
2476 } else { 2475 } else {
2477 dasm_put(Dst, 12894); 2476 dasm_put(Dst, 12895);
2478 } 2477 }
2479 break; 2478 break;
2480 case 1: 2479 case 1:
2481 dasm_put(Dst, 12524, LJ_TISNUM); 2480 dasm_put(Dst, 12525, LJ_TISNUM);
2482 if (LJ_DUALNUM) { 2481 if (LJ_DUALNUM) {
2483 dasm_put(Dst, 12536, LJ_TISNUM); 2482 dasm_put(Dst, 12537, LJ_TISNUM);
2484 } 2483 }
2485 if (sse) { 2484 if (sse) {
2486 dasm_put(Dst, 12902); 2485 dasm_put(Dst, 12903);
2487 } else { 2486 } else {
2488 dasm_put(Dst, 12916); 2487 dasm_put(Dst, 12917);
2489 } 2488 }
2490 break; 2489 break;
2491 default: 2490 default:
2492 dasm_put(Dst, 12569, LJ_TISNUM, LJ_TISNUM); 2491 dasm_put(Dst, 12570, LJ_TISNUM, LJ_TISNUM);
2493 if (sse) { 2492 if (sse) {
2494 dasm_put(Dst, 12924); 2493 dasm_put(Dst, 12925);
2495 } else { 2494 } else {
2496 dasm_put(Dst, 12938); 2495 dasm_put(Dst, 12939);
2497 } 2496 }
2498 break; 2497 break;
2499 } 2498 }
2500 if (sse) { 2499 if (sse) {
2501 dasm_put(Dst, 12196); 2500 dasm_put(Dst, 12197);
2502 } else { 2501 } else {
2503 dasm_put(Dst, 12208); 2502 dasm_put(Dst, 12209);
2504 } 2503 }
2505 dasm_put(Dst, 11336); 2504 dasm_put(Dst, 11337);
2506 } 2505 }
2507 break; 2506 break;
2508 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: 2507 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV:
2509 dasm_put(Dst, 12366); 2508 dasm_put(Dst, 12367);
2510 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2509 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2511 switch (vk) { 2510 switch (vk) {
2512 case 0: 2511 case 0:
2513 dasm_put(Dst, 12479, LJ_TISNUM); 2512 dasm_put(Dst, 12480, LJ_TISNUM);
2514 if (LJ_DUALNUM) { 2513 if (LJ_DUALNUM) {
2515 dasm_put(Dst, 12491, LJ_TISNUM); 2514 dasm_put(Dst, 12492, LJ_TISNUM);
2516 } 2515 }
2517 if (sse) { 2516 if (sse) {
2518 dasm_put(Dst, 12946); 2517 dasm_put(Dst, 12947);
2519 } else { 2518 } else {
2520 dasm_put(Dst, 12960); 2519 dasm_put(Dst, 12961);
2521 } 2520 }
2522 break; 2521 break;
2523 case 1: 2522 case 1:
2524 dasm_put(Dst, 12524, LJ_TISNUM); 2523 dasm_put(Dst, 12525, LJ_TISNUM);
2525 if (LJ_DUALNUM) { 2524 if (LJ_DUALNUM) {
2526 dasm_put(Dst, 12536, LJ_TISNUM); 2525 dasm_put(Dst, 12537, LJ_TISNUM);
2527 } 2526 }
2528 if (sse) { 2527 if (sse) {
2529 dasm_put(Dst, 12968); 2528 dasm_put(Dst, 12969);
2530 } else { 2529 } else {
2531 dasm_put(Dst, 12982); 2530 dasm_put(Dst, 12983);
2532 } 2531 }
2533 break; 2532 break;
2534 default: 2533 default:
2535 dasm_put(Dst, 12569, LJ_TISNUM, LJ_TISNUM); 2534 dasm_put(Dst, 12570, LJ_TISNUM, LJ_TISNUM);
2536 if (sse) { 2535 if (sse) {
2537 dasm_put(Dst, 12990); 2536 dasm_put(Dst, 12991);
2538 } else { 2537 } else {
2539 dasm_put(Dst, 13004); 2538 dasm_put(Dst, 13005);
2540 } 2539 }
2541 break; 2540 break;
2542 } 2541 }
2543 if (sse) { 2542 if (sse) {
2544 dasm_put(Dst, 12196); 2543 dasm_put(Dst, 12197);
2545 } else { 2544 } else {
2546 dasm_put(Dst, 12208); 2545 dasm_put(Dst, 12209);
2547 } 2546 }
2548 dasm_put(Dst, 11336); 2547 dasm_put(Dst, 11337);
2549 break; 2548 break;
2550 case BC_MODVN: 2549 case BC_MODVN:
2551 dasm_put(Dst, 12366); 2550 dasm_put(Dst, 12367);
2552 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2551 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2553 switch (vk) { 2552 switch (vk) {
2554 case 0: 2553 case 0:
2555 dasm_put(Dst, 12479, LJ_TISNUM); 2554 dasm_put(Dst, 12480, LJ_TISNUM);
2556 if (LJ_DUALNUM) { 2555 if (LJ_DUALNUM) {
2557 dasm_put(Dst, 12491, LJ_TISNUM); 2556 dasm_put(Dst, 12492, LJ_TISNUM);
2558 } 2557 }
2559 if (sse) { 2558 if (sse) {
2560 dasm_put(Dst, 13012); 2559 dasm_put(Dst, 13013);
2561 } else { 2560 } else {
2562 dasm_put(Dst, 13026); 2561 dasm_put(Dst, 13027);
2563 } 2562 }
2564 break; 2563 break;
2565 case 1: 2564 case 1:
2566 dasm_put(Dst, 12524, LJ_TISNUM); 2565 dasm_put(Dst, 12525, LJ_TISNUM);
2567 if (LJ_DUALNUM) { 2566 if (LJ_DUALNUM) {
2568 dasm_put(Dst, 12536, LJ_TISNUM); 2567 dasm_put(Dst, 12537, LJ_TISNUM);
2569 } 2568 }
2570 if (sse) { 2569 if (sse) {
2571 dasm_put(Dst, 13034); 2570 dasm_put(Dst, 13035);
2572 } else { 2571 } else {
2573 dasm_put(Dst, 13048); 2572 dasm_put(Dst, 13049);
2574 } 2573 }
2575 break; 2574 break;
2576 default: 2575 default:
2577 dasm_put(Dst, 12569, LJ_TISNUM, LJ_TISNUM); 2576 dasm_put(Dst, 12570, LJ_TISNUM, LJ_TISNUM);
2578 if (sse) { 2577 if (sse) {
2579 dasm_put(Dst, 13056); 2578 dasm_put(Dst, 13057);
2580 } else { 2579 } else {
2581 dasm_put(Dst, 13070); 2580 dasm_put(Dst, 13071);
2582 } 2581 }
2583 break; 2582 break;
2584 } 2583 }
2585 dasm_put(Dst, 13078); 2584 dasm_put(Dst, 13079);
2586 if (sse) { 2585 if (sse) {
2587 dasm_put(Dst, 12196); 2586 dasm_put(Dst, 12197);
2588 } else { 2587 } else {
2589 dasm_put(Dst, 12208); 2588 dasm_put(Dst, 12209);
2590 } 2589 }
2591 dasm_put(Dst, 11336); 2590 dasm_put(Dst, 11337);
2592 break; 2591 break;
2593 case BC_MODNV: case BC_MODVV: 2592 case BC_MODNV: case BC_MODVV:
2594 dasm_put(Dst, 12366); 2593 dasm_put(Dst, 12367);
2595 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2594 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2596 switch (vk) { 2595 switch (vk) {
2597 case 0: 2596 case 0:
2598 dasm_put(Dst, 12479, LJ_TISNUM); 2597 dasm_put(Dst, 12480, LJ_TISNUM);
2599 if (LJ_DUALNUM) { 2598 if (LJ_DUALNUM) {
2600 dasm_put(Dst, 12491, LJ_TISNUM); 2599 dasm_put(Dst, 12492, LJ_TISNUM);
2601 } 2600 }
2602 if (sse) { 2601 if (sse) {
2603 dasm_put(Dst, 13012); 2602 dasm_put(Dst, 13013);
2604 } else { 2603 } else {
2605 dasm_put(Dst, 13026); 2604 dasm_put(Dst, 13027);
2606 } 2605 }
2607 break; 2606 break;
2608 case 1: 2607 case 1:
2609 dasm_put(Dst, 12524, LJ_TISNUM); 2608 dasm_put(Dst, 12525, LJ_TISNUM);
2610 if (LJ_DUALNUM) { 2609 if (LJ_DUALNUM) {
2611 dasm_put(Dst, 12536, LJ_TISNUM); 2610 dasm_put(Dst, 12537, LJ_TISNUM);
2612 } 2611 }
2613 if (sse) { 2612 if (sse) {
2614 dasm_put(Dst, 13034); 2613 dasm_put(Dst, 13035);
2615 } else { 2614 } else {
2616 dasm_put(Dst, 13048); 2615 dasm_put(Dst, 13049);
2617 } 2616 }
2618 break; 2617 break;
2619 default: 2618 default:
2620 dasm_put(Dst, 12569, LJ_TISNUM, LJ_TISNUM); 2619 dasm_put(Dst, 12570, LJ_TISNUM, LJ_TISNUM);
2621 if (sse) { 2620 if (sse) {
2622 dasm_put(Dst, 13056); 2621 dasm_put(Dst, 13057);
2623 } else { 2622 } else {
2624 dasm_put(Dst, 13070); 2623 dasm_put(Dst, 13071);
2625 } 2624 }
2626 break; 2625 break;
2627 } 2626 }
2628 dasm_put(Dst, 13084); 2627 dasm_put(Dst, 13085);
2629 break; 2628 break;
2630 case BC_POW: 2629 case BC_POW:
2631 dasm_put(Dst, 12366); 2630 dasm_put(Dst, 12367);
2632 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2631 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2633 switch (vk) { 2632 switch (vk) {
2634 case 0: 2633 case 0:
2635 dasm_put(Dst, 12479, LJ_TISNUM); 2634 dasm_put(Dst, 12480, LJ_TISNUM);
2636 if (LJ_DUALNUM) { 2635 if (LJ_DUALNUM) {
2637 dasm_put(Dst, 12491, LJ_TISNUM); 2636 dasm_put(Dst, 12492, LJ_TISNUM);
2638 } 2637 }
2639 if (sse) { 2638 if (sse) {
2640 dasm_put(Dst, 13012); 2639 dasm_put(Dst, 13013);
2641 } else { 2640 } else {
2642 dasm_put(Dst, 13026); 2641 dasm_put(Dst, 13027);
2643 } 2642 }
2644 break; 2643 break;
2645 case 1: 2644 case 1:
2646 dasm_put(Dst, 12524, LJ_TISNUM); 2645 dasm_put(Dst, 12525, LJ_TISNUM);
2647 if (LJ_DUALNUM) { 2646 if (LJ_DUALNUM) {
2648 dasm_put(Dst, 12536, LJ_TISNUM); 2647 dasm_put(Dst, 12537, LJ_TISNUM);
2649 } 2648 }
2650 if (sse) { 2649 if (sse) {
2651 dasm_put(Dst, 13034); 2650 dasm_put(Dst, 13035);
2652 } else { 2651 } else {
2653 dasm_put(Dst, 13048); 2652 dasm_put(Dst, 13049);
2654 } 2653 }
2655 break; 2654 break;
2656 default: 2655 default:
2657 dasm_put(Dst, 12569, LJ_TISNUM, LJ_TISNUM); 2656 dasm_put(Dst, 12570, LJ_TISNUM, LJ_TISNUM);
2658 if (sse) { 2657 if (sse) {
2659 dasm_put(Dst, 13056); 2658 dasm_put(Dst, 13057);
2660 } else { 2659 } else {
2661 dasm_put(Dst, 13070); 2660 dasm_put(Dst, 13071);
2662 } 2661 }
2663 break; 2662 break;
2664 } 2663 }
2665 dasm_put(Dst, 13089); 2664 dasm_put(Dst, 13090);
2666 if (sse) { 2665 if (sse) {
2667 dasm_put(Dst, 12196); 2666 dasm_put(Dst, 12197);
2668 } else { 2667 } else {
2669 dasm_put(Dst, 12208); 2668 dasm_put(Dst, 12209);
2670 } 2669 }
2671 dasm_put(Dst, 11336); 2670 dasm_put(Dst, 11337);
2672 break; 2671 break;
2673 2672
2674 case BC_CAT: 2673 case BC_CAT:
2675 dasm_put(Dst, 13093, Dt1(->base), Dt1(->base)); 2674 dasm_put(Dst, 13094, Dt1(->base), Dt1(->base));
2676 break; 2675 break;
2677 2676
2678 /* -- Constant ops ------------------------------------------------------ */ 2677 /* -- Constant ops ------------------------------------------------------ */
2679 2678
2680 case BC_KSTR: 2679 case BC_KSTR:
2681 dasm_put(Dst, 13187, LJ_TSTR); 2680 dasm_put(Dst, 13188, LJ_TSTR);
2682 break; 2681 break;
2683 case BC_KCDATA: 2682 case BC_KCDATA:
2684#if LJ_HASFFI 2683#if LJ_HASFFI
2685 dasm_put(Dst, 13187, LJ_TCDATA); 2684 dasm_put(Dst, 13188, LJ_TCDATA);
2686#endif 2685#endif
2687 break; 2686 break;
2688 case BC_KSHORT: 2687 case BC_KSHORT:
2689 if (LJ_DUALNUM) { 2688 if (LJ_DUALNUM) {
2690 dasm_put(Dst, 13220, LJ_TISNUM); 2689 dasm_put(Dst, 13221, LJ_TISNUM);
2691 } else if (sse) { 2690 } else if (sse) {
2692 dasm_put(Dst, 13232); 2691 dasm_put(Dst, 13233);
2693 } else { 2692 } else {
2694 dasm_put(Dst, 13247); 2693 dasm_put(Dst, 13248);
2695 } 2694 }
2696 dasm_put(Dst, 11336); 2695 dasm_put(Dst, 11337);
2697 break; 2696 break;
2698 case BC_KNUM: 2697 case BC_KNUM:
2699 if (sse) { 2698 if (sse) {
2700 dasm_put(Dst, 13255); 2699 dasm_put(Dst, 13256);
2701 } else { 2700 } else {
2702 dasm_put(Dst, 13268); 2701 dasm_put(Dst, 13269);
2703 } 2702 }
2704 dasm_put(Dst, 11336); 2703 dasm_put(Dst, 11337);
2705 break; 2704 break;
2706 case BC_KPRI: 2705 case BC_KPRI:
2707 dasm_put(Dst, 13275); 2706 dasm_put(Dst, 13276);
2708 break; 2707 break;
2709 case BC_KNIL: 2708 case BC_KNIL:
2710 dasm_put(Dst, 13301, LJ_TNIL); 2709 dasm_put(Dst, 13302, LJ_TNIL);
2711 break; 2710 break;
2712 2711
2713 /* -- Upvalue and function ops ------------------------------------------ */ 2712 /* -- Upvalue and function ops ------------------------------------------ */
2714 2713
2715 case BC_UGET: 2714 case BC_UGET:
2716 dasm_put(Dst, 13347, offsetof(GCfuncL, uvptr), DtA(->v)); 2715 dasm_put(Dst, 13348, offsetof(GCfuncL, uvptr), DtA(->v));
2717 break; 2716 break;
2718 case BC_USETV: 2717 case BC_USETV:
2719#define TV2MARKOFS \ 2718#define TV2MARKOFS \
2720 ((int32_t)offsetof(GCupval, marked)-(int32_t)offsetof(GCupval, tv)) 2719 ((int32_t)offsetof(GCupval, marked)-(int32_t)offsetof(GCupval, tv))
2721 dasm_put(Dst, 13391, 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); 2720 dasm_put(Dst, 13392, 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);
2722 dasm_put(Dst, 13481); 2721 dasm_put(Dst, 13482);
2723 break; 2722 break;
2724#undef TV2MARKOFS 2723#undef TV2MARKOFS
2725 case BC_USETS: 2724 case BC_USETS:
2726 dasm_put(Dst, 13493, offsetof(GCfuncL, uvptr), DtA(->v), LJ_TSTR, DtA(->marked), LJ_GC_BLACK, Dt4(->gch.marked), LJ_GC_WHITES, DtA(->closed), GG_DISP2G); 2725 dasm_put(Dst, 13494, offsetof(GCfuncL, uvptr), DtA(->v), LJ_TSTR, DtA(->marked), LJ_GC_BLACK, Dt4(->gch.marked), LJ_GC_WHITES, DtA(->closed), GG_DISP2G);
2727 break; 2726 break;
2728 case BC_USETN: 2727 case BC_USETN:
2729 dasm_put(Dst, 13584); 2728 dasm_put(Dst, 13585);
2730 if (sse) { 2729 if (sse) {
2731 dasm_put(Dst, 13589); 2730 dasm_put(Dst, 13590);
2732 } else { 2731 } else {
2733 dasm_put(Dst, 11846); 2732 dasm_put(Dst, 11847);
2734 } 2733 }
2735 dasm_put(Dst, 13596, offsetof(GCfuncL, uvptr), DtA(->v)); 2734 dasm_put(Dst, 13597, offsetof(GCfuncL, uvptr), DtA(->v));
2736 if (sse) { 2735 if (sse) {
2737 dasm_put(Dst, 13605); 2736 dasm_put(Dst, 13606);
2738 } else { 2737 } else {
2739 dasm_put(Dst, 13611); 2738 dasm_put(Dst, 13612);
2740 } 2739 }
2741 dasm_put(Dst, 11336); 2740 dasm_put(Dst, 11337);
2742 break; 2741 break;
2743 case BC_USETP: 2742 case BC_USETP:
2744 dasm_put(Dst, 13614, offsetof(GCfuncL, uvptr), DtA(->v)); 2743 dasm_put(Dst, 13615, offsetof(GCfuncL, uvptr), DtA(->v));
2745 break; 2744 break;
2746 case BC_UCLO: 2745 case BC_UCLO:
2747 dasm_put(Dst, 13651, -BCBIAS_J*4, Dt1(->openupval), Dt1(->base), Dt1(->base)); 2746 dasm_put(Dst, 13652, -BCBIAS_J*4, Dt1(->openupval), Dt1(->base), Dt1(->base));
2748 break; 2747 break;
2749 2748
2750 case BC_FNEW: 2749 case BC_FNEW:
2751 dasm_put(Dst, 13705, Dt1(->base), Dt1(->base), LJ_TFUNC); 2750 dasm_put(Dst, 13706, Dt1(->base), Dt1(->base), LJ_TFUNC);
2752 break; 2751 break;
2753 2752
2754 /* -- Table ops --------------------------------------------------------- */ 2753 /* -- Table ops --------------------------------------------------------- */
2755 2754
2756 case BC_TNEW: 2755 case BC_TNEW:
2757 dasm_put(Dst, 13776, Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), LJ_TTAB); 2756 dasm_put(Dst, 13777, Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), LJ_TTAB);
2758 break; 2757 break;
2759 case BC_TDUP: 2758 case BC_TDUP:
2760 dasm_put(Dst, 13902, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB); 2759 dasm_put(Dst, 13903, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB);
2761 break; 2760 break;
2762 2761
2763 case BC_GGET: 2762 case BC_GGET:
2764 dasm_put(Dst, 13994, Dt7(->env)); 2763 dasm_put(Dst, 13995, Dt7(->env));
2765 break; 2764 break;
2766 case BC_GSET: 2765 case BC_GSET:
2767 dasm_put(Dst, 14012, Dt7(->env)); 2766 dasm_put(Dst, 14013, Dt7(->env));
2768 break; 2767 break;
2769 2768
2770 case BC_TGETV: 2769 case BC_TGETV:
2771 dasm_put(Dst, 14030, LJ_TTAB); 2770 dasm_put(Dst, 14031, LJ_TTAB);
2772 if (LJ_DUALNUM) { 2771 if (LJ_DUALNUM) {
2773 dasm_put(Dst, 14053, LJ_TISNUM); 2772 dasm_put(Dst, 14054, LJ_TISNUM);
2774 } else { 2773 } else {
2775 dasm_put(Dst, 14067, LJ_TISNUM); 2774 dasm_put(Dst, 14068, LJ_TISNUM);
2776 if (sse) { 2775 if (sse) {
2777 dasm_put(Dst, 14078); 2776 dasm_put(Dst, 14079);
2778 } else { 2777 } else {
2779 dasm_put(Dst, 14099); 2778 dasm_put(Dst, 14100);
2780 if (cmov) { 2779 if (cmov) {
2781 dasm_put(Dst, 3944); 2780 dasm_put(Dst, 3944);
2782 } else { 2781 } else {
@@ -2784,30 +2783,30 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2784 } 2783 }
2785 dasm_put(Dst, 2680); 2784 dasm_put(Dst, 2680);
2786 } 2785 }
2787 dasm_put(Dst, 14109); 2786 dasm_put(Dst, 14110);
2788 } 2787 }
2789 dasm_put(Dst, 14114, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index, LJ_TNIL); 2788 dasm_put(Dst, 14115, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index, LJ_TNIL);
2790 dasm_put(Dst, 14209, LJ_TSTR); 2789 dasm_put(Dst, 14210, LJ_TSTR);
2791 break; 2790 break;
2792 case BC_TGETS: 2791 case BC_TGETS:
2793 dasm_put(Dst, 14227, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL); 2792 dasm_put(Dst, 14228, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL);
2794 dasm_put(Dst, 14315, LJ_TNIL, DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 2793 dasm_put(Dst, 14316, LJ_TNIL, DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
2795 break; 2794 break;
2796 case BC_TGETB: 2795 case BC_TGETB:
2797 dasm_put(Dst, 14385, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 2796 dasm_put(Dst, 14386, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
2798 dasm_put(Dst, 14484, LJ_TNIL); 2797 dasm_put(Dst, 14485, LJ_TNIL);
2799 break; 2798 break;
2800 2799
2801 case BC_TSETV: 2800 case BC_TSETV:
2802 dasm_put(Dst, 14501, LJ_TTAB); 2801 dasm_put(Dst, 14502, LJ_TTAB);
2803 if (LJ_DUALNUM) { 2802 if (LJ_DUALNUM) {
2804 dasm_put(Dst, 14053, LJ_TISNUM); 2803 dasm_put(Dst, 14054, LJ_TISNUM);
2805 } else { 2804 } else {
2806 dasm_put(Dst, 14067, LJ_TISNUM); 2805 dasm_put(Dst, 14068, LJ_TISNUM);
2807 if (sse) { 2806 if (sse) {
2808 dasm_put(Dst, 14078); 2807 dasm_put(Dst, 14079);
2809 } else { 2808 } else {
2810 dasm_put(Dst, 14099); 2809 dasm_put(Dst, 14100);
2811 if (cmov) { 2810 if (cmov) {
2812 dasm_put(Dst, 3944); 2811 dasm_put(Dst, 3944);
2813 } else { 2812 } else {
@@ -2815,115 +2814,115 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2815 } 2814 }
2816 dasm_put(Dst, 2680); 2815 dasm_put(Dst, 2680);
2817 } 2816 }
2818 dasm_put(Dst, 14524); 2817 dasm_put(Dst, 14525);
2819 } 2818 }
2820 dasm_put(Dst, 14529, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); 2819 dasm_put(Dst, 14530, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex);
2821 dasm_put(Dst, 14613, LJ_TSTR, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); 2820 dasm_put(Dst, 14614, LJ_TSTR, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
2822 break; 2821 break;
2823 case BC_TSETS: 2822 case BC_TSETS:
2824 dasm_put(Dst, 14670, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->nomm), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL); 2823 dasm_put(Dst, 14671, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->nomm), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL);
2825 dasm_put(Dst, 14745, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next)); 2824 dasm_put(Dst, 14746, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next));
2826 dasm_put(Dst, 14837, 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)); 2825 dasm_put(Dst, 14838, 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));
2827 break; 2826 break;
2828 case BC_TSETB: 2827 case BC_TSETB:
2829 dasm_put(Dst, 14933, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable)); 2828 dasm_put(Dst, 14934, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable));
2830 dasm_put(Dst, 15031, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); 2829 dasm_put(Dst, 15032, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
2831 break; 2830 break;
2832 2831
2833 case BC_TSETM: 2832 case BC_TSETM:
2834 dasm_put(Dst, 15077, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base)); 2833 dasm_put(Dst, 15078, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
2835 dasm_put(Dst, 15226, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); 2834 dasm_put(Dst, 15227, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
2836 break; 2835 break;
2837 2836
2838 /* -- Calls and vararg handling ----------------------------------------- */ 2837 /* -- Calls and vararg handling ----------------------------------------- */
2839 2838
2840 case BC_CALL: case BC_CALLM: 2839 case BC_CALL: case BC_CALLM:
2841 dasm_put(Dst, 12370); 2840 dasm_put(Dst, 12371);
2842 if (op == BC_CALLM) { 2841 if (op == BC_CALLM) {
2843 dasm_put(Dst, 15244); 2842 dasm_put(Dst, 15245);
2844 } 2843 }
2845 dasm_put(Dst, 15249, LJ_TFUNC, Dt7(->pc)); 2844 dasm_put(Dst, 15250, LJ_TFUNC, Dt7(->pc));
2846 break; 2845 break;
2847 2846
2848 case BC_CALLMT: 2847 case BC_CALLMT:
2849 dasm_put(Dst, 15244); 2848 dasm_put(Dst, 15245);
2850 break; 2849 break;
2851 case BC_CALLT: 2850 case BC_CALLT:
2852 dasm_put(Dst, 15290, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc)); 2851 dasm_put(Dst, 15291, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc));
2853 dasm_put(Dst, 15408, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG); 2852 dasm_put(Dst, 15409, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG);
2854 break; 2853 break;
2855 2854
2856 case BC_ITERC: 2855 case BC_ITERC:
2857 dasm_put(Dst, 15478, LJ_TFUNC, 2+1, Dt7(->pc)); 2856 dasm_put(Dst, 15479, LJ_TFUNC, 2+1, Dt7(->pc));
2858 break; 2857 break;
2859 2858
2860 case BC_ITERN: 2859 case BC_ITERN:
2861#if LJ_HASJIT 2860#if LJ_HASJIT
2862#endif 2861#endif
2863 dasm_put(Dst, 15558, Dt6(->asize), Dt6(->array), LJ_TNIL); 2862 dasm_put(Dst, 15559, Dt6(->asize), Dt6(->array), LJ_TNIL);
2864 if (LJ_DUALNUM) { 2863 if (LJ_DUALNUM) {
2865 dasm_put(Dst, 12231, LJ_TISNUM); 2864 dasm_put(Dst, 12232, LJ_TISNUM);
2866 } else if (sse) { 2865 } else if (sse) {
2867 dasm_put(Dst, 12324); 2866 dasm_put(Dst, 12325);
2868 } else { 2867 } else {
2869 dasm_put(Dst, 15604); 2868 dasm_put(Dst, 15605);
2870 } 2869 }
2871 dasm_put(Dst, 15610); 2870 dasm_put(Dst, 15611);
2872 if (LJ_DUALNUM) { 2871 if (LJ_DUALNUM) {
2873 } else if (sse) { 2872 } else if (sse) {
2874 dasm_put(Dst, 12196); 2873 dasm_put(Dst, 12197);
2875 } else { 2874 } else {
2876 dasm_put(Dst, 12208); 2875 dasm_put(Dst, 12209);
2877 } 2876 }
2878 dasm_put(Dst, 15629, -BCBIAS_J*4); 2877 dasm_put(Dst, 15630, -BCBIAS_J*4);
2879 if (!LJ_DUALNUM && !sse) { 2878 if (!LJ_DUALNUM && !sse) {
2880 dasm_put(Dst, 15680); 2879 dasm_put(Dst, 15681);
2881 } 2880 }
2882 dasm_put(Dst, 15686, Dt6(->hmask), sizeof(Node), Dt6(->node), DtB(->val.it), LJ_TNIL, DtB(->key.gcr), DtB(->key.it), DtB(->val.gcr), DtB(->val.it)); 2881 dasm_put(Dst, 15687, Dt6(->hmask), sizeof(Node), Dt6(->node), DtB(->val.it), LJ_TNIL, DtB(->key.gcr), DtB(->key.it), DtB(->val.gcr), DtB(->val.it));
2883 dasm_put(Dst, 15761); 2882 dasm_put(Dst, 15762);
2884 break; 2883 break;
2885 2884
2886 case BC_ISNEXT: 2885 case BC_ISNEXT:
2887 dasm_put(Dst, 15769, LJ_TFUNC, LJ_TTAB, LJ_TNIL, Dt8(->ffid), FF_next_N, -BCBIAS_J*4, BC_JMP, -BCBIAS_J*4, BC_ITERC); 2886 dasm_put(Dst, 15770, LJ_TFUNC, LJ_TTAB, LJ_TNIL, Dt8(->ffid), FF_next_N, -BCBIAS_J*4, BC_JMP, -BCBIAS_J*4, BC_ITERC);
2888 break; 2887 break;
2889 2888
2890 case BC_VARG: 2889 case BC_VARG:
2891 dasm_put(Dst, 15868, (8+FRAME_VARG), LJ_TNIL, Dt1(->maxstack)); 2890 dasm_put(Dst, 15869, (8+FRAME_VARG), LJ_TNIL, Dt1(->maxstack));
2892 dasm_put(Dst, 16032, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); 2891 dasm_put(Dst, 16033, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
2893 break; 2892 break;
2894 2893
2895 /* -- Returns ----------------------------------------------------------- */ 2894 /* -- Returns ----------------------------------------------------------- */
2896 2895
2897 case BC_RETM: 2896 case BC_RETM:
2898 dasm_put(Dst, 15244); 2897 dasm_put(Dst, 15245);
2899 break; 2898 break;
2900 2899
2901 case BC_RET: case BC_RET0: case BC_RET1: 2900 case BC_RET: case BC_RET0: case BC_RET1:
2902 if (op != BC_RET0) { 2901 if (op != BC_RET0) {
2903 dasm_put(Dst, 16103); 2902 dasm_put(Dst, 16104);
2904 } 2903 }
2905 dasm_put(Dst, 16107, FRAME_TYPE); 2904 dasm_put(Dst, 16108, FRAME_TYPE);
2906 switch (op) { 2905 switch (op) {
2907 case BC_RET: 2906 case BC_RET:
2908 dasm_put(Dst, 16126); 2907 dasm_put(Dst, 16127);
2909 break; 2908 break;
2910 case BC_RET1: 2909 case BC_RET1:
2911 dasm_put(Dst, 16184); 2910 dasm_put(Dst, 16185);
2912 /* fallthrough */ 2911 /* fallthrough */
2913 case BC_RET0: 2912 case BC_RET0:
2914 dasm_put(Dst, 16200); 2913 dasm_put(Dst, 16201);
2915 default: 2914 default:
2916 break; 2915 break;
2917 } 2916 }
2918 dasm_put(Dst, 16211, Dt7(->pc), PC2PROTO(k)); 2917 dasm_put(Dst, 16212, Dt7(->pc), PC2PROTO(k));
2919 if (op == BC_RET) { 2918 if (op == BC_RET) {
2920 dasm_put(Dst, 16253, LJ_TNIL); 2919 dasm_put(Dst, 16254, LJ_TNIL);
2921 } else { 2920 } else {
2922 dasm_put(Dst, 16262, LJ_TNIL); 2921 dasm_put(Dst, 16263, LJ_TNIL);
2923 } 2922 }
2924 dasm_put(Dst, 16269, -FRAME_VARG, FRAME_TYPEP); 2923 dasm_put(Dst, 16270, -FRAME_VARG, FRAME_TYPEP);
2925 if (op != BC_RET0) { 2924 if (op != BC_RET0) {
2926 dasm_put(Dst, 16293); 2925 dasm_put(Dst, 16294);
2927 } 2926 }
2928 dasm_put(Dst, 4928); 2927 dasm_put(Dst, 4928);
2929 break; 2928 break;
@@ -2933,7 +2932,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2933 2932
2934 case BC_FORL: 2933 case BC_FORL:
2935#if LJ_HASJIT 2934#if LJ_HASJIT
2936 dasm_put(Dst, 16297, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP); 2935 dasm_put(Dst, 16298, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
2937#endif 2936#endif
2938 break; 2937 break;
2939 2938
@@ -2945,111 +2944,111 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2945 case BC_FORI: 2944 case BC_FORI:
2946 case BC_IFORL: 2945 case BC_IFORL:
2947 vk = (op == BC_IFORL || op == BC_JFORL); 2946 vk = (op == BC_IFORL || op == BC_JFORL);
2948 dasm_put(Dst, 16318); 2947 dasm_put(Dst, 16319);
2949 if (LJ_DUALNUM) { 2948 if (LJ_DUALNUM) {
2950 dasm_put(Dst, 16322, LJ_TISNUM); 2949 dasm_put(Dst, 16323, LJ_TISNUM);
2951 if (!vk) { 2950 if (!vk) {
2952 dasm_put(Dst, 16332, LJ_TISNUM, LJ_TISNUM); 2951 dasm_put(Dst, 16333, LJ_TISNUM, LJ_TISNUM);
2953 } else { 2952 } else {
2954#ifdef LUA_USE_ASSERT 2953#ifdef LUA_USE_ASSERT
2955 dasm_put(Dst, 16361, LJ_TISNUM, LJ_TISNUM); 2954 dasm_put(Dst, 16362, LJ_TISNUM, LJ_TISNUM);
2956#endif 2955#endif
2957 dasm_put(Dst, 16380); 2956 dasm_put(Dst, 16381);
2958 } 2957 }
2959 dasm_put(Dst, 16399, LJ_TISNUM); 2958 dasm_put(Dst, 16400, LJ_TISNUM);
2960 if (op == BC_FORI) { 2959 if (op == BC_FORI) {
2961 dasm_put(Dst, 16410, -BCBIAS_J*4); 2960 dasm_put(Dst, 16411, -BCBIAS_J*4);
2962 } else if (op == BC_JFORI) { 2961 } else if (op == BC_JFORI) {
2963 dasm_put(Dst, 16424, -BCBIAS_J*4, BC_JLOOP); 2962 dasm_put(Dst, 16425, -BCBIAS_J*4, BC_JLOOP);
2964 } else if (op == BC_IFORL) { 2963 } else if (op == BC_IFORL) {
2965 dasm_put(Dst, 16442, -BCBIAS_J*4); 2964 dasm_put(Dst, 16443, -BCBIAS_J*4);
2966 } else { 2965 } else {
2967 dasm_put(Dst, 16434, BC_JLOOP); 2966 dasm_put(Dst, 16435, BC_JLOOP);
2968 } 2967 }
2969 dasm_put(Dst, 16456); 2968 dasm_put(Dst, 16457);
2970 if (vk) { 2969 if (vk) {
2971 dasm_put(Dst, 16479); 2970 dasm_put(Dst, 16480);
2972 } 2971 }
2973 dasm_put(Dst, 16399, LJ_TISNUM); 2972 dasm_put(Dst, 16400, LJ_TISNUM);
2974 if (op == BC_FORI) { 2973 if (op == BC_FORI) {
2975 dasm_put(Dst, 16488); 2974 dasm_put(Dst, 16489);
2976 } else if (op == BC_JFORI) { 2975 } else if (op == BC_JFORI) {
2977 dasm_put(Dst, 16493, -BCBIAS_J*4, BC_JLOOP); 2976 dasm_put(Dst, 16494, -BCBIAS_J*4, BC_JLOOP);
2978 } else if (op == BC_IFORL) { 2977 } else if (op == BC_IFORL) {
2979 dasm_put(Dst, 16507); 2978 dasm_put(Dst, 16508);
2980 } else { 2979 } else {
2981 dasm_put(Dst, 16503, BC_JLOOP); 2980 dasm_put(Dst, 16504, BC_JLOOP);
2982 } 2981 }
2983 dasm_put(Dst, 16512); 2982 dasm_put(Dst, 16513);
2984 } else if (!vk) { 2983 } else if (!vk) {
2985 dasm_put(Dst, 16519, LJ_TISNUM); 2984 dasm_put(Dst, 16520, LJ_TISNUM);
2986 } 2985 }
2987 if (!vk) { 2986 if (!vk) {
2988 dasm_put(Dst, 16525, LJ_TISNUM); 2987 dasm_put(Dst, 16526, LJ_TISNUM);
2989 } else { 2988 } else {
2990#ifdef LUA_USE_ASSERT 2989#ifdef LUA_USE_ASSERT
2991 dasm_put(Dst, 16539, LJ_TISNUM, LJ_TISNUM); 2990 dasm_put(Dst, 16540, LJ_TISNUM, LJ_TISNUM);
2992#endif 2991#endif
2993 } 2992 }
2994 dasm_put(Dst, 16558); 2993 dasm_put(Dst, 16559);
2995 if (!vk) { 2994 if (!vk) {
2996 dasm_put(Dst, 16562, LJ_TISNUM); 2995 dasm_put(Dst, 16563, LJ_TISNUM);
2997 } 2996 }
2998 if (sse) { 2997 if (sse) {
2999 dasm_put(Dst, 16571); 2998 dasm_put(Dst, 16572);
3000 if (vk) { 2999 if (vk) {
3001 dasm_put(Dst, 16583); 3000 dasm_put(Dst, 16584);
3002 } else { 3001 } else {
3003 dasm_put(Dst, 16602); 3002 dasm_put(Dst, 16603);
3004 } 3003 }
3005 dasm_put(Dst, 16607); 3004 dasm_put(Dst, 16608);
3006 } else { 3005 } else {
3007 dasm_put(Dst, 16620); 3006 dasm_put(Dst, 16621);
3008 if (vk) { 3007 if (vk) {
3009 dasm_put(Dst, 16626); 3008 dasm_put(Dst, 16627);
3010 } else { 3009 } else {
3011 dasm_put(Dst, 16642); 3010 dasm_put(Dst, 16643);
3012 } 3011 }
3013 dasm_put(Dst, 16650); 3012 dasm_put(Dst, 16651);
3014 if (cmov) { 3013 if (cmov) {
3015 dasm_put(Dst, 3944); 3014 dasm_put(Dst, 3944);
3016 } else { 3015 } else {
3017 dasm_put(Dst, 3950); 3016 dasm_put(Dst, 3950);
3018 } 3017 }
3019 if (!cmov) { 3018 if (!cmov) {
3020 dasm_put(Dst, 16655); 3019 dasm_put(Dst, 16656);
3021 } 3020 }
3022 } 3021 }
3023 if (op == BC_FORI) { 3022 if (op == BC_FORI) {
3024 if (LJ_DUALNUM) { 3023 if (LJ_DUALNUM) {
3025 dasm_put(Dst, 16661); 3024 dasm_put(Dst, 16662);
3026 } else { 3025 } else {
3027 dasm_put(Dst, 16666, -BCBIAS_J*4); 3026 dasm_put(Dst, 16667, -BCBIAS_J*4);
3028 } 3027 }
3029 } else if (op == BC_JFORI) { 3028 } else if (op == BC_JFORI) {
3030 dasm_put(Dst, 16676, -BCBIAS_J*4, BC_JLOOP); 3029 dasm_put(Dst, 16677, -BCBIAS_J*4, BC_JLOOP);
3031 } else if (op == BC_IFORL) { 3030 } else if (op == BC_IFORL) {
3032 if (LJ_DUALNUM) { 3031 if (LJ_DUALNUM) {
3033 dasm_put(Dst, 16690); 3032 dasm_put(Dst, 16691);
3034 } else { 3033 } else {
3035 dasm_put(Dst, 16695, -BCBIAS_J*4); 3034 dasm_put(Dst, 16696, -BCBIAS_J*4);
3036 } 3035 }
3037 } else { 3036 } else {
3038 dasm_put(Dst, 16686, BC_JLOOP); 3037 dasm_put(Dst, 16687, BC_JLOOP);
3039 } 3038 }
3040 if (LJ_DUALNUM) { 3039 if (LJ_DUALNUM) {
3041 dasm_put(Dst, 11233); 3040 dasm_put(Dst, 11234);
3042 } else { 3041 } else {
3043 dasm_put(Dst, 11974); 3042 dasm_put(Dst, 11975);
3044 } 3043 }
3045 if (sse) { 3044 if (sse) {
3046 dasm_put(Dst, 16705); 3045 dasm_put(Dst, 16706);
3047 } 3046 }
3048 break; 3047 break;
3049 3048
3050 case BC_ITERL: 3049 case BC_ITERL:
3051#if LJ_HASJIT 3050#if LJ_HASJIT
3052 dasm_put(Dst, 16297, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP); 3051 dasm_put(Dst, 16298, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
3053#endif 3052#endif
3054 break; 3053 break;
3055 3054
@@ -3058,33 +3057,33 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
3058 break; 3057 break;
3059#endif 3058#endif
3060 case BC_IITERL: 3059 case BC_IITERL:
3061 dasm_put(Dst, 16716, LJ_TNIL); 3060 dasm_put(Dst, 16717, LJ_TNIL);
3062 if (op == BC_JITERL) { 3061 if (op == BC_JITERL) {
3063 dasm_put(Dst, 16731, BC_JLOOP); 3062 dasm_put(Dst, 16732, BC_JLOOP);
3064 } else { 3063 } else {
3065 dasm_put(Dst, 16745, -BCBIAS_J*4); 3064 dasm_put(Dst, 16746, -BCBIAS_J*4);
3066 } 3065 }
3067 dasm_put(Dst, 11334); 3066 dasm_put(Dst, 11335);
3068 break; 3067 break;
3069 3068
3070 case BC_LOOP: 3069 case BC_LOOP:
3071#if LJ_HASJIT 3070#if LJ_HASJIT
3072 dasm_put(Dst, 16297, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP); 3071 dasm_put(Dst, 16298, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
3073#endif 3072#endif
3074 break; 3073 break;
3075 3074
3076 case BC_ILOOP: 3075 case BC_ILOOP:
3077 dasm_put(Dst, 11336); 3076 dasm_put(Dst, 11337);
3078 break; 3077 break;
3079 3078
3080 case BC_JLOOP: 3079 case BC_JLOOP:
3081#if LJ_HASJIT 3080#if LJ_HASJIT
3082 dasm_put(Dst, 16761, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L)); 3081 dasm_put(Dst, 16762, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L));
3083#endif 3082#endif
3084 break; 3083 break;
3085 3084
3086 case BC_JMP: 3085 case BC_JMP:
3087 dasm_put(Dst, 16784, -BCBIAS_J*4); 3086 dasm_put(Dst, 16785, -BCBIAS_J*4);
3088 break; 3087 break;
3089 3088
3090 /* -- Function headers -------------------------------------------------- */ 3089 /* -- Function headers -------------------------------------------------- */
@@ -3098,7 +3097,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
3098 3097
3099 case BC_FUNCF: 3098 case BC_FUNCF:
3100#if LJ_HASJIT 3099#if LJ_HASJIT
3101 dasm_put(Dst, 16808, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_CALL); 3100 dasm_put(Dst, 16809, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_CALL);
3102#endif 3101#endif
3103 case BC_FUNCV: /* NYI: compiled vararg functions. */ 3102 case BC_FUNCV: /* NYI: compiled vararg functions. */
3104 break; 3103 break;
@@ -3108,13 +3107,13 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
3108 break; 3107 break;
3109#endif 3108#endif
3110 case BC_IFUNCF: 3109 case BC_IFUNCF:
3111 dasm_put(Dst, 16829, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams)); 3110 dasm_put(Dst, 16830, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams));
3112 if (op == BC_JFUNCF) { 3111 if (op == BC_JFUNCF) {
3113 dasm_put(Dst, 16859, BC_JLOOP); 3112 dasm_put(Dst, 16860, BC_JLOOP);
3114 } else { 3113 } else {
3115 dasm_put(Dst, 11336); 3114 dasm_put(Dst, 11337);
3116 } 3115 }
3117 dasm_put(Dst, 16868, LJ_TNIL); 3116 dasm_put(Dst, 16869, LJ_TNIL);
3118 break; 3117 break;
3119 3118
3120 case BC_JFUNCV: 3119 case BC_JFUNCV:
@@ -3125,30 +3124,30 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
3125 break; /* NYI: compiled vararg functions. */ 3124 break; /* NYI: compiled vararg functions. */
3126 3125
3127 case BC_IFUNCV: 3126 case BC_IFUNCV:
3128 dasm_put(Dst, 16890, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL); 3127 dasm_put(Dst, 16891, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL);
3129 if (op == BC_JFUNCV) { 3128 if (op == BC_JFUNCV) {
3130 dasm_put(Dst, 16859, BC_JLOOP); 3129 dasm_put(Dst, 16860, BC_JLOOP);
3131 } else { 3130 } else {
3132 dasm_put(Dst, 16981, -4+PC2PROTO(k)); 3131 dasm_put(Dst, 16982, -4+PC2PROTO(k));
3133 } 3132 }
3134 dasm_put(Dst, 17003, LJ_TNIL); 3133 dasm_put(Dst, 17004, LJ_TNIL);
3135 break; 3134 break;
3136 3135
3137 case BC_FUNCC: 3136 case BC_FUNCC:
3138 case BC_FUNCCW: 3137 case BC_FUNCCW:
3139 dasm_put(Dst, 17025, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top)); 3138 dasm_put(Dst, 17026, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top));
3140 if (op == BC_FUNCC) { 3139 if (op == BC_FUNCC) {
3141 dasm_put(Dst, 17054); 3140 dasm_put(Dst, 17055);
3142 } else { 3141 } else {
3143 dasm_put(Dst, 17058); 3142 dasm_put(Dst, 17059);
3144 } 3143 }
3145 dasm_put(Dst, 17066, DISPATCH_GL(vmstate), ~LJ_VMST_C); 3144 dasm_put(Dst, 17067, DISPATCH_GL(vmstate), ~LJ_VMST_C);
3146 if (op == BC_FUNCC) { 3145 if (op == BC_FUNCC) {
3147 dasm_put(Dst, 17075); 3146 dasm_put(Dst, 17076);
3148 } else { 3147 } else {
3149 dasm_put(Dst, 17079, DISPATCH_GL(wrapf)); 3148 dasm_put(Dst, 17080, DISPATCH_GL(wrapf));
3150 } 3149 }
3151 dasm_put(Dst, 17084, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top)); 3150 dasm_put(Dst, 17085, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top));
3152 break; 3151 break;
3153 3152
3154 /* ---------------------------------------------------------------------- */ 3153 /* ---------------------------------------------------------------------- */
@@ -3176,7 +3175,7 @@ static int build_backend(BuildCtx *ctx)
3176 3175
3177 build_subroutines(ctx, cmov, sse); 3176 build_subroutines(ctx, cmov, sse);
3178 3177
3179 dasm_put(Dst, 17109); 3178 dasm_put(Dst, 17110);
3180 for (op = 0; op < BC__MAX; op++) 3179 for (op = 0; op < BC__MAX; op++)
3181 build_ins(ctx, (BCOp)op, op, cmov, sse); 3180 build_ins(ctx, (BCOp)op, op, cmov, sse);
3182 3181
@@ -3186,6 +3185,7 @@ static int build_backend(BuildCtx *ctx)
3186/* Emit pseudo frame-info for all assembler functions. */ 3185/* Emit pseudo frame-info for all assembler functions. */
3187static void emit_asm_debug(BuildCtx *ctx) 3186static void emit_asm_debug(BuildCtx *ctx)
3188{ 3187{
3188 int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
3189#if LJ_64 3189#if LJ_64
3190#define SZPTR "8" 3190#define SZPTR "8"
3191#define BSZPTR "3" 3191#define BSZPTR "3"
@@ -3219,22 +3219,49 @@ static void emit_asm_debug(BuildCtx *ctx)
3219 "\t.long .LEFDE0-.LASFDE0\n" 3219 "\t.long .LEFDE0-.LASFDE0\n"
3220 ".LASFDE0:\n" 3220 ".LASFDE0:\n"
3221 "\t.long .Lframe0\n" 3221 "\t.long .Lframe0\n"
3222 "\t.long .Lbegin\n"
3223 "\t.long %d\n"
3224 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
3225#if LJ_64 3222#if LJ_64
3223 "\t.quad .Lbegin\n"
3224 "\t.quad %d\n"
3225 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
3226 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */ 3226 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
3227 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */ 3227 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
3228 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */ 3228 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
3229 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */ 3229 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
3230#else 3230#else
3231 "\t.long .Lbegin\n"
3232 "\t.long %d\n"
3233 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
3231 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */ 3234 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
3232 "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */ 3235 "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */
3233 "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */ 3236 "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */
3234 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ 3237 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
3235#endif 3238#endif
3236 "\t.align " SZPTR "\n" 3239 "\t.align " SZPTR "\n"
3237 ".LEFDE0:\n\n", (int)ctx->codesz, CFRAME_SIZE); 3240 ".LEFDE0:\n\n", fcofs, CFRAME_SIZE);
3241#if LJ_HASFFI
3242 fprintf(ctx->fp,
3243 ".LSFDE1:\n"
3244 "\t.long .LEFDE1-.LASFDE1\n"
3245 ".LASFDE1:\n"
3246 "\t.long .Lframe0\n"
3247#if LJ_64
3248 "\t.quad lj_vm_ffi_call\n"
3249 "\t.quad %d\n"
3250 "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
3251 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
3252 "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
3253 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
3254#else
3255 "\t.long lj_vm_ffi_call\n"
3256 "\t.long %d\n"
3257 "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
3258 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
3259 "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
3260 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
3261#endif
3262 "\t.align " SZPTR "\n"
3263 ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
3264#endif
3238#if (defined(__sun__) && defined(__svr4__)) || defined(__solaris_) 3265#if (defined(__sun__) && defined(__svr4__)) || defined(__solaris_)
3239 fprintf(ctx->fp, "\t.section .eh_frame,\"aw\",@progbits\n"); 3266 fprintf(ctx->fp, "\t.section .eh_frame,\"aw\",@progbits\n");
3240#else 3267#else
@@ -3259,10 +3286,10 @@ static void emit_asm_debug(BuildCtx *ctx)
3259 "\t.align " SZPTR "\n" 3286 "\t.align " SZPTR "\n"
3260 ".LECIE1:\n\n"); 3287 ".LECIE1:\n\n");
3261 fprintf(ctx->fp, 3288 fprintf(ctx->fp,
3262 ".LSFDE1:\n" 3289 ".LSFDE2:\n"
3263 "\t.long .LEFDE1-.LASFDE1\n" 3290 "\t.long .LEFDE2-.LASFDE2\n"
3264 ".LASFDE1:\n" 3291 ".LASFDE2:\n"
3265 "\t.long .LASFDE1-.Lframe1\n" 3292 "\t.long .LASFDE2-.Lframe1\n"
3266 "\t.long .Lbegin-.\n" 3293 "\t.long .Lbegin-.\n"
3267 "\t.long %d\n" 3294 "\t.long %d\n"
3268 "\t.uleb128 0\n" /* augmentation length */ 3295 "\t.uleb128 0\n" /* augmentation length */
@@ -3279,7 +3306,46 @@ static void emit_asm_debug(BuildCtx *ctx)
3279 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ 3306 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
3280#endif 3307#endif
3281 "\t.align " SZPTR "\n" 3308 "\t.align " SZPTR "\n"
3282 ".LEFDE1:\n\n", (int)ctx->codesz, CFRAME_SIZE); 3309 ".LEFDE2:\n\n", fcofs, CFRAME_SIZE);
3310#if LJ_HASFFI
3311 fprintf(ctx->fp,
3312 ".Lframe2:\n"
3313 "\t.long .LECIE2-.LSCIE2\n"
3314 ".LSCIE2:\n"
3315 "\t.long 0\n"
3316 "\t.byte 0x1\n"
3317 "\t.string \"zR\"\n"
3318 "\t.uleb128 0x1\n"
3319 "\t.sleb128 -" SZPTR "\n"
3320 "\t.byte " REG_RA "\n"
3321 "\t.uleb128 1\n" /* augmentation length */
3322 "\t.byte 0x1b\n" /* pcrel|sdata4 */
3323 "\t.byte 0xc\n\t.uleb128 " REG_SP "\n\t.uleb128 " SZPTR "\n"
3324 "\t.byte 0x80+" REG_RA "\n\t.uleb128 0x1\n"
3325 "\t.align " SZPTR "\n"
3326 ".LECIE2:\n\n");
3327 fprintf(ctx->fp,
3328 ".LSFDE3:\n"
3329 "\t.long .LEFDE3-.LASFDE3\n"
3330 ".LASFDE3:\n"
3331 "\t.long .LASFDE3-.Lframe2\n"
3332 "\t.long lj_vm_ffi_call-.\n"
3333 "\t.long %d\n"
3334 "\t.uleb128 0\n" /* augmentation length */
3335#if LJ_64
3336 "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
3337 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
3338 "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
3339 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
3340#else
3341 "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
3342 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
3343 "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
3344 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
3345#endif
3346 "\t.align " SZPTR "\n"
3347 ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
3348#endif
3283 break; 3349 break;
3284 case BUILD_coffasm: 3350 case BUILD_coffasm:
3285 fprintf(ctx->fp, "\t.section .eh_frame,\"dr\"\n"); 3351 fprintf(ctx->fp, "\t.section .eh_frame,\"dr\"\n");
@@ -3330,6 +3396,9 @@ static void emit_asm_debug(BuildCtx *ctx)
3330 ** Or a linker. Or a plastic case. But I digress. 3396 ** Or a linker. Or a plastic case. But I digress.
3331 */ 3397 */
3332 case BUILD_machasm: { 3398 case BUILD_machasm: {
3399#if LJ_HASFFI
3400 int fcsize = 0;
3401#endif
3333 int i; 3402 int i;
3334 fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n"); 3403 fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n");
3335 fprintf(ctx->fp, 3404 fprintf(ctx->fp,
@@ -3361,6 +3430,9 @@ static void emit_asm_debug(BuildCtx *ctx)
3361 const char *name = ctx->sym[i].name; 3430 const char *name = ctx->sym[i].name;
3362 int32_t size = ctx->sym[i+1].ofs - ctx->sym[i].ofs; 3431 int32_t size = ctx->sym[i+1].ofs - ctx->sym[i].ofs;
3363 if (size == 0) continue; 3432 if (size == 0) continue;
3433#if LJ_HASFFI
3434 if (!strcmp(name, "_lj_vm_ffi_call")) { fcsize = size; continue; }
3435#endif
3364 fprintf(ctx->fp, 3436 fprintf(ctx->fp,
3365 "%s.eh:\n" 3437 "%s.eh:\n"
3366 "LSFDE%d:\n" 3438 "LSFDE%d:\n"
@@ -3370,23 +3442,72 @@ static void emit_asm_debug(BuildCtx *ctx)
3370 "\t.long LASFDE%d-EH_frame1\n" 3442 "\t.long LASFDE%d-EH_frame1\n"
3371 "\t.long %s-.\n" 3443 "\t.long %s-.\n"
3372 "\t.long %d\n" 3444 "\t.long %d\n"
3373 "\t.byte 0\n" /* augmentation length */ 3445 "\t.byte 0\n" /* augmentation length */
3374 "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */ 3446 "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */
3375#if LJ_64 3447#if LJ_64
3376 "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */ 3448 "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
3377 "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */ 3449 "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
3378 "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */ 3450 "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */
3379 "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */ 3451 "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */
3380#else 3452#else
3381 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/ 3453 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
3382 "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */ 3454 "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */
3383 "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */ 3455 "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */
3384 "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */ 3456 "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */
3385#endif 3457#endif
3386 "\t.align " BSZPTR "\n" 3458 "\t.align " BSZPTR "\n"
3387 "LEFDE%d:\n\n", 3459 "LEFDE%d:\n\n",
3388 name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i); 3460 name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i);
3389 } 3461 }
3462#if LJ_HASFFI
3463 if (fcsize) {
3464 fprintf(ctx->fp,
3465 "EH_frame2:\n"
3466 "\t.set L$set$y,LECIEY-LSCIEY\n"
3467 "\t.long L$set$y\n"
3468 "LSCIEY:\n"
3469 "\t.long 0\n"
3470 "\t.byte 0x1\n"
3471 "\t.ascii \"zR\\0\"\n"
3472 "\t.byte 0x1\n"
3473 "\t.byte 128-" SZPTR "\n"
3474 "\t.byte " REG_RA "\n"
3475 "\t.byte 1\n" /* augmentation length */
3476#if LJ_64
3477 "\t.byte 0x1b\n" /* pcrel|sdata4 */
3478 "\t.byte 0xc\n\t.byte " REG_SP "\n\t.byte " SZPTR "\n"
3479#else
3480 "\t.byte 0x1b\n" /* pcrel|sdata4 */
3481 "\t.byte 0xc\n\t.byte 0x5\n\t.byte 0x4\n" /* esp=5 on 32 bit MACH. */
3482#endif
3483 "\t.byte 0x80+" REG_RA "\n\t.byte 0x1\n"
3484 "\t.align " BSZPTR "\n"
3485 "LECIEY:\n\n");
3486 fprintf(ctx->fp,
3487 "_lj_vm_ffi_call.eh:\n"
3488 "LSFDEY:\n"
3489 "\t.set L$set$yy,LEFDEY-LASFDEY\n"
3490 "\t.long L$set$yy\n"
3491 "LASFDEY:\n"
3492 "\t.long LASFDEY-EH_frame2\n"
3493 "\t.long _lj_vm_ffi_call-.\n"
3494 "\t.long %d\n"
3495 "\t.byte 0\n" /* augmentation length */
3496#if LJ_64
3497 "\t.byte 0xe\n\t.byte 16\n" /* def_cfa_offset */
3498 "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
3499 "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
3500 "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
3501#else
3502 "\t.byte 0xe\n\t.byte 8\n" /* def_cfa_offset */
3503 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
3504 "\t.byte 0xd\n\t.uleb128 0x4\n" /* def_cfa_register ebp */
3505 "\t.byte 0x83\n\t.byte 0x3\n" /* offset ebx */
3506#endif
3507 "\t.align " BSZPTR "\n"
3508 "LEFDEY:\n\n", fcsize);
3509 }
3510#endif
3390#if LJ_64 3511#if LJ_64
3391 fprintf(ctx->fp, "\t.subsections_via_symbols\n"); 3512 fprintf(ctx->fp, "\t.subsections_via_symbols\n");
3392#else 3513#else