aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2011-11-11 22:10:31 +0100
committerMike Pall <mike>2011-11-12 01:16:10 +0100
commit635371c212a2d344df2aff80506ea51afdd065ef (patch)
treea26a06fb3384366b8e6a036c4e6cdcd11ebd36ec
parent0123e4fc895f4a52422dff05a29596e389b4749c (diff)
downloadluajit-635371c212a2d344df2aff80506ea51afdd065ef.tar.gz
luajit-635371c212a2d344df2aff80506ea51afdd065ef.tar.bz2
luajit-635371c212a2d344df2aff80506ea51afdd065ef.zip
FFI: Add unwind definitions for lj_vm_ffi_call.
Adds exception interoperability for C/C++ functions called via FFI from the interpreter.
-rw-r--r--doc/ext_ffi_semantics.html3
-rw-r--r--src/buildvm_arm.dasc28
-rw-r--r--src/buildvm_arm.h24
-rw-r--r--src/buildvm_asm.c13
-rw-r--r--src/buildvm_peobj.c34
-rw-r--r--src/buildvm_ppc.dasc76
-rw-r--r--src/buildvm_ppc.h826
-rw-r--r--src/buildvm_x64.h1109
-rw-r--r--src/buildvm_x64win.h993
-rw-r--r--src/buildvm_x86.dasc182
-rw-r--r--src/buildvm_x86.h1009
-rw-r--r--src/lj_ccall.h4
12 files changed, 2478 insertions, 1823 deletions
diff --git a/doc/ext_ffi_semantics.html b/doc/ext_ffi_semantics.html
index b8c839c2..79f25510 100644
--- a/doc/ext_ffi_semantics.html
+++ b/doc/ext_ffi_semantics.html
@@ -1005,7 +1005,8 @@ Other missing features:
1005<li>Callbacks from C&nbsp;code to Lua functions.</li> 1005<li>Callbacks from C&nbsp;code to Lua functions.</li>
1006<li>Passing structs by value to vararg C&nbsp;functions.</li> 1006<li>Passing structs by value to vararg C&nbsp;functions.</li>
1007<li><a href="extensions.html#exceptions">C++ exception interoperability</a> 1007<li><a href="extensions.html#exceptions">C++ exception interoperability</a>
1008does not extend to C&nbsp;functions called via the FFI.</li> 1008does not extend to C&nbsp;functions called via the FFI, if the call is
1009compiled.</li>
1009</ul> 1010</ul>
1010<br class="flush"> 1011<br class="flush">
1011</div> 1012</div>
diff --git a/src/buildvm_arm.dasc b/src/buildvm_arm.dasc
index 9b40ad18..29c616e0 100644
--- a/src/buildvm_arm.dasc
+++ b/src/buildvm_arm.dasc
@@ -2178,7 +2178,8 @@ static void build_subroutines(BuildCtx *ctx)
2178 |//-- FFI helper functions ----------------------------------------------- 2178 |//-- FFI helper functions -----------------------------------------------
2179 |//----------------------------------------------------------------------- 2179 |//-----------------------------------------------------------------------
2180 | 2180 |
2181 |->vm_ffi_call: 2181 |->vm_ffi_call: // Call C function via FFI.
2182 | // Caveat: needs special frame unwinding, see below.
2182#if LJ_HASFFI 2183#if LJ_HASFFI
2183 | .type CCSTATE, CCallState, r4 2184 | .type CCSTATE, CCallState, r4
2184 | push {CCSTATE, r5, r11, lr} 2185 | push {CCSTATE, r5, r11, lr}
@@ -2207,6 +2208,7 @@ static void build_subroutines(BuildCtx *ctx)
2207 | str CRET2, CCSTATE->gpr[1] 2208 | str CRET2, CCSTATE->gpr[1]
2208 | pop {CCSTATE, r5, r11, pc} 2209 | pop {CCSTATE, r5, r11, pc}
2209#endif 2210#endif
2211 |// Note: vm_ffi_call must be the last function in this object file!
2210 | 2212 |
2211 |//----------------------------------------------------------------------- 2213 |//-----------------------------------------------------------------------
2212} 2214}
@@ -4003,6 +4005,7 @@ static int build_backend(BuildCtx *ctx)
4003/* Emit pseudo frame-info for all assembler functions. */ 4005/* Emit pseudo frame-info for all assembler functions. */
4004static void emit_asm_debug(BuildCtx *ctx) 4006static void emit_asm_debug(BuildCtx *ctx)
4005{ 4007{
4008 int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
4006 int i; 4009 int i;
4007 switch (ctx->mode) { 4010 switch (ctx->mode) {
4008 case BUILD_elfasm: 4011 case BUILD_elfasm:
@@ -4028,13 +4031,30 @@ static void emit_asm_debug(BuildCtx *ctx)
4028 "\t.long .Lbegin\n" 4031 "\t.long .Lbegin\n"
4029 "\t.long %d\n" 4032 "\t.long %d\n"
4030 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */ 4033 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
4031 "\t.byte 0x8e\n\t.uleb128 1\n", /* Restore lr. */ 4034 "\t.byte 0x8e\n\t.uleb128 1\n", /* offset lr */
4032 (int)ctx->codesz, CFRAME_SIZE); 4035 fcofs, CFRAME_SIZE);
4033 for (i = 11; i >= 4; i--) /* Restore r4-r11. */ 4036 for (i = 11; i >= 4; i--) /* offset r4-r11 */
4034 fprintf(ctx->fp, "\t.byte %d\n\t.uleb128 %d\n", 0x80+i, 2+(11-i)); 4037 fprintf(ctx->fp, "\t.byte %d\n\t.uleb128 %d\n", 0x80+i, 2+(11-i));
4035 fprintf(ctx->fp, 4038 fprintf(ctx->fp,
4036 "\t.align 2\n" 4039 "\t.align 2\n"
4037 ".LEFDE0:\n\n"); 4040 ".LEFDE0:\n\n");
4041#if LJ_HASFFI
4042 fprintf(ctx->fp,
4043 ".LSFDE1:\n"
4044 "\t.long .LEFDE1-.LASFDE1\n"
4045 ".LASFDE1:\n"
4046 "\t.long .Lframe0\n"
4047 "\t.long lj_vm_ffi_call\n"
4048 "\t.long %d\n"
4049 "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
4050 "\t.byte 0x8e\n\t.uleb128 1\n" /* offset lr */
4051 "\t.byte 0x8b\n\t.uleb128 2\n" /* offset r11 */
4052 "\t.byte 0x85\n\t.uleb128 3\n" /* offset r5 */
4053 "\t.byte 0x84\n\t.uleb128 4\n" /* offset r4 */
4054 "\t.byte 0xd\n\t.uleb128 0xb\n" /* def_cfa_register r11 */
4055 "\t.align 2\n"
4056 ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
4057#endif
4038 break; 4058 break;
4039 default: 4059 default:
4040 break; 4060 break;
diff --git a/src/buildvm_arm.h b/src/buildvm_arm.h
index 0c2d9f39..bdb0038b 100644
--- a/src/buildvm_arm.h
+++ b/src/buildvm_arm.h
@@ -7332,6 +7332,7 @@ static int build_backend(BuildCtx *ctx)
7332/* Emit pseudo frame-info for all assembler functions. */ 7332/* Emit pseudo frame-info for all assembler functions. */
7333static void emit_asm_debug(BuildCtx *ctx) 7333static void emit_asm_debug(BuildCtx *ctx)
7334{ 7334{
7335 int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
7335 int i; 7336 int i;
7336 switch (ctx->mode) { 7337 switch (ctx->mode) {
7337 case BUILD_elfasm: 7338 case BUILD_elfasm:
@@ -7357,13 +7358,30 @@ static void emit_asm_debug(BuildCtx *ctx)
7357 "\t.long .Lbegin\n" 7358 "\t.long .Lbegin\n"
7358 "\t.long %d\n" 7359 "\t.long %d\n"
7359 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */ 7360 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
7360 "\t.byte 0x8e\n\t.uleb128 1\n", /* Restore lr. */ 7361 "\t.byte 0x8e\n\t.uleb128 1\n", /* offset lr */
7361 (int)ctx->codesz, CFRAME_SIZE); 7362 fcofs, CFRAME_SIZE);
7362 for (i = 11; i >= 4; i--) /* Restore r4-r11. */ 7363 for (i = 11; i >= 4; i--) /* offset r4-r11 */
7363 fprintf(ctx->fp, "\t.byte %d\n\t.uleb128 %d\n", 0x80+i, 2+(11-i)); 7364 fprintf(ctx->fp, "\t.byte %d\n\t.uleb128 %d\n", 0x80+i, 2+(11-i));
7364 fprintf(ctx->fp, 7365 fprintf(ctx->fp,
7365 "\t.align 2\n" 7366 "\t.align 2\n"
7366 ".LEFDE0:\n\n"); 7367 ".LEFDE0:\n\n");
7368#if LJ_HASFFI
7369 fprintf(ctx->fp,
7370 ".LSFDE1:\n"
7371 "\t.long .LEFDE1-.LASFDE1\n"
7372 ".LASFDE1:\n"
7373 "\t.long .Lframe0\n"
7374 "\t.long lj_vm_ffi_call\n"
7375 "\t.long %d\n"
7376 "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
7377 "\t.byte 0x8e\n\t.uleb128 1\n" /* offset lr */
7378 "\t.byte 0x8b\n\t.uleb128 2\n" /* offset r11 */
7379 "\t.byte 0x85\n\t.uleb128 3\n" /* offset r5 */
7380 "\t.byte 0x84\n\t.uleb128 4\n" /* offset r4 */
7381 "\t.byte 0xd\n\t.uleb128 0xb\n" /* def_cfa_register r11 */
7382 "\t.align 2\n"
7383 ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
7384#endif
7367 break; 7385 break;
7368 default: 7386 default:
7369 break; 7387 break;
diff --git a/src/buildvm_asm.c b/src/buildvm_asm.c
index 6a860c9f..01330456 100644
--- a/src/buildvm_asm.c
+++ b/src/buildvm_asm.c
@@ -202,6 +202,17 @@ void emit_asm(BuildCtx *ctx)
202 for (i = rel = 0; i < ctx->nsym; i++) { 202 for (i = rel = 0; i < ctx->nsym; i++) {
203 int32_t ofs = ctx->sym[i].ofs; 203 int32_t ofs = ctx->sym[i].ofs;
204 int32_t next = ctx->sym[i+1].ofs; 204 int32_t next = ctx->sym[i+1].ofs;
205#if LJ_TARGET_ARM && defined(__GNUC__) && !defined(LUAJIT_NO_UNWIND) && \
206 LJ_HASFFI
207 if (!strcmp(ctx->sym[i].name, "lj_vm_ffi_call"))
208 fprintf(ctx->fp,
209 ".globl lj_err_unwind_arm\n"
210 ".personality lj_err_unwind_arm\n"
211 ".fnend\n"
212 ".fnstart\n"
213 ".save {r4, r5, r11, lr}\n"
214 ".setfp r11, sp\n");
215#endif
205 emit_asm_label(ctx, ctx->sym[i].name, next - ofs, 1); 216 emit_asm_label(ctx, ctx->sym[i].name, next - ofs, 1);
206 while (rel < ctx->nreloc && ctx->reloc[rel].ofs <= next) { 217 while (rel < ctx->nreloc && ctx->reloc[rel].ofs <= next) {
207 BuildReloc *r = &ctx->reloc[rel]; 218 BuildReloc *r = &ctx->reloc[rel];
@@ -229,8 +240,10 @@ void emit_asm(BuildCtx *ctx)
229 240
230#if LJ_TARGET_ARM && defined(__GNUC__) && !defined(LUAJIT_NO_UNWIND) 241#if LJ_TARGET_ARM && defined(__GNUC__) && !defined(LUAJIT_NO_UNWIND)
231 fprintf(ctx->fp, 242 fprintf(ctx->fp,
243#if !LJ_HASFFI
232 ".globl lj_err_unwind_arm\n" 244 ".globl lj_err_unwind_arm\n"
233 ".personality lj_err_unwind_arm\n" 245 ".personality lj_err_unwind_arm\n"
246#endif
234 ".fnend\n"); 247 ".fnend\n");
235#endif 248#endif
236 249
diff --git a/src/buildvm_peobj.c b/src/buildvm_peobj.c
index b97a5b03..eb1d345f 100644
--- a/src/buildvm_peobj.c
+++ b/src/buildvm_peobj.c
@@ -191,15 +191,15 @@ void emit_peobj(BuildCtx *ctx)
191#if LJ_TARGET_X64 191#if LJ_TARGET_X64
192 memcpy(pesect[PEOBJ_SECT_PDATA].name, ".pdata", sizeof(".pdata")-1); 192 memcpy(pesect[PEOBJ_SECT_PDATA].name, ".pdata", sizeof(".pdata")-1);
193 pesect[PEOBJ_SECT_PDATA].ofs = sofs; 193 pesect[PEOBJ_SECT_PDATA].ofs = sofs;
194 sofs += (pesect[PEOBJ_SECT_PDATA].size = 3*4); 194 sofs += (pesect[PEOBJ_SECT_PDATA].size = 6*4);
195 pesect[PEOBJ_SECT_PDATA].relocofs = sofs; 195 pesect[PEOBJ_SECT_PDATA].relocofs = sofs;
196 sofs += (pesect[PEOBJ_SECT_PDATA].nreloc = 3) * PEOBJ_RELOC_SIZE; 196 sofs += (pesect[PEOBJ_SECT_PDATA].nreloc = 6) * PEOBJ_RELOC_SIZE;
197 /* Flags: 40 = read, 30 = align4, 40 = initialized data. */ 197 /* Flags: 40 = read, 30 = align4, 40 = initialized data. */
198 pesect[PEOBJ_SECT_PDATA].flags = 0x40300040; 198 pesect[PEOBJ_SECT_PDATA].flags = 0x40300040;
199 199
200 memcpy(pesect[PEOBJ_SECT_XDATA].name, ".xdata", sizeof(".xdata")-1); 200 memcpy(pesect[PEOBJ_SECT_XDATA].name, ".xdata", sizeof(".xdata")-1);
201 pesect[PEOBJ_SECT_XDATA].ofs = sofs; 201 pesect[PEOBJ_SECT_XDATA].ofs = sofs;
202 sofs += (pesect[PEOBJ_SECT_XDATA].size = 8*2+4); /* See below. */ 202 sofs += (pesect[PEOBJ_SECT_XDATA].size = 8*2+4+6*2); /* See below. */
203 pesect[PEOBJ_SECT_XDATA].relocofs = sofs; 203 pesect[PEOBJ_SECT_XDATA].relocofs = sofs;
204 sofs += (pesect[PEOBJ_SECT_XDATA].nreloc = 1) * PEOBJ_RELOC_SIZE; 204 sofs += (pesect[PEOBJ_SECT_XDATA].nreloc = 1) * PEOBJ_RELOC_SIZE;
205 /* Flags: 40 = read, 30 = align4, 40 = initialized data. */ 205 /* Flags: 40 = read, 30 = align4, 40 = initialized data. */
@@ -247,9 +247,12 @@ void emit_peobj(BuildCtx *ctx)
247 247
248#if LJ_TARGET_X64 248#if LJ_TARGET_X64
249 { /* Write .pdata section. */ 249 { /* Write .pdata section. */
250 uint32_t fcofs = (uint32_t)ctx->sym[ctx->nsym-1].ofs;
250 uint32_t pdata[3]; /* Start of .text, end of .text and .xdata. */ 251 uint32_t pdata[3]; /* Start of .text, end of .text and .xdata. */
251 PEreloc reloc; 252 PEreloc reloc;
252 pdata[0] = 0; pdata[1] = (uint32_t)ctx->codesz; pdata[2] = 0; 253 pdata[0] = 0; pdata[1] = fcofs; pdata[2] = 0;
254 owrite(ctx, &pdata, sizeof(pdata));
255 pdata[0] = fcofs; pdata[1] = (uint32_t)ctx->codesz; pdata[2] = 20;
253 owrite(ctx, &pdata, sizeof(pdata)); 256 owrite(ctx, &pdata, sizeof(pdata));
254 reloc.vaddr = 0; reloc.symidx = 1+2+nrsym+2+2+1; 257 reloc.vaddr = 0; reloc.symidx = 1+2+nrsym+2+2+1;
255 reloc.type = PEOBJ_RELOC_ADDR32NB; 258 reloc.type = PEOBJ_RELOC_ADDR32NB;
@@ -260,12 +263,21 @@ void emit_peobj(BuildCtx *ctx)
260 reloc.vaddr = 8; reloc.symidx = 1+2+nrsym+2; 263 reloc.vaddr = 8; reloc.symidx = 1+2+nrsym+2;
261 reloc.type = PEOBJ_RELOC_ADDR32NB; 264 reloc.type = PEOBJ_RELOC_ADDR32NB;
262 owrite(ctx, &reloc, PEOBJ_RELOC_SIZE); 265 owrite(ctx, &reloc, PEOBJ_RELOC_SIZE);
266 reloc.vaddr = 12; reloc.symidx = 1+2+nrsym+2+2+1;
267 reloc.type = PEOBJ_RELOC_ADDR32NB;
268 owrite(ctx, &reloc, PEOBJ_RELOC_SIZE);
269 reloc.vaddr = 16; reloc.symidx = 1+2+nrsym+2+2+1;
270 reloc.type = PEOBJ_RELOC_ADDR32NB;
271 owrite(ctx, &reloc, PEOBJ_RELOC_SIZE);
272 reloc.vaddr = 20; reloc.symidx = 1+2+nrsym+2;
273 reloc.type = PEOBJ_RELOC_ADDR32NB;
274 owrite(ctx, &reloc, PEOBJ_RELOC_SIZE);
263 } 275 }
264 { /* Write .xdata section. */ 276 { /* Write .xdata section. */
265 uint16_t xdata[8+2]; 277 uint16_t xdata[8+2+6];
266 PEreloc reloc; 278 PEreloc reloc;
267 xdata[0] = 0x01|0x08|0x10; /* Ver. 1, uhander/ehandler, prolog size 0. */ 279 xdata[0] = 0x01|0x08|0x10; /* Ver. 1, uhandler/ehandler, prolog size 0. */
268 xdata[1] = 5; /* Number of unwind codes, no frame pointer. */ 280 xdata[1] = 0x0005; /* Number of unwind codes, no frame pointer. */
269 xdata[2] = 0x4200; /* Stack offset 4*8+8 = aword*5. */ 281 xdata[2] = 0x4200; /* Stack offset 4*8+8 = aword*5. */
270 xdata[3] = 0x3000; /* Push rbx. */ 282 xdata[3] = 0x3000; /* Push rbx. */
271 xdata[4] = 0x6000; /* Push rsi. */ 283 xdata[4] = 0x6000; /* Push rsi. */
@@ -273,8 +285,14 @@ void emit_peobj(BuildCtx *ctx)
273 xdata[6] = 0x5000; /* Push rbp. */ 285 xdata[6] = 0x5000; /* Push rbp. */
274 xdata[7] = 0; /* Alignment. */ 286 xdata[7] = 0; /* Alignment. */
275 xdata[8] = xdata[9] = 0; /* Relocated address of exception handler. */ 287 xdata[8] = xdata[9] = 0; /* Relocated address of exception handler. */
288 xdata[10] = 0x01; /* Ver. 1, no handler, prolog size 0. */
289 xdata[11] = 0x1504; /* Number of unwind codes, fp = rbp, fpofs = 16. */
290 xdata[12] = 0x0300; /* set_fpreg. */
291 xdata[13] = 0x0200; /* stack offset 0*8+8 = aword*1. */
292 xdata[14] = 0x3000; /* Push rbx. */
293 xdata[15] = 0x5000; /* Push rbp. */
276 owrite(ctx, &xdata, sizeof(xdata)); 294 owrite(ctx, &xdata, sizeof(xdata));
277 reloc.vaddr = sizeof(xdata)-4; reloc.symidx = 1+2+nrsym+2+2; 295 reloc.vaddr = 2*8; reloc.symidx = 1+2+nrsym+2+2;
278 reloc.type = PEOBJ_RELOC_ADDR32NB; 296 reloc.type = PEOBJ_RELOC_ADDR32NB;
279 owrite(ctx, &reloc, PEOBJ_RELOC_SIZE); 297 owrite(ctx, &reloc, PEOBJ_RELOC_SIZE);
280 } 298 }
diff --git a/src/buildvm_ppc.dasc b/src/buildvm_ppc.dasc
index 0bcc5ad7..1cbf3a74 100644
--- a/src/buildvm_ppc.dasc
+++ b/src/buildvm_ppc.dasc
@@ -2527,7 +2527,8 @@ static void build_subroutines(BuildCtx *ctx)
2527 |//-- FFI helper functions ----------------------------------------------- 2527 |//-- FFI helper functions -----------------------------------------------
2528 |//----------------------------------------------------------------------- 2528 |//-----------------------------------------------------------------------
2529 | 2529 |
2530 |->vm_ffi_call: 2530 |->vm_ffi_call: // Call C function via FFI.
2531 | // Caveat: needs special frame unwinding, see below.
2531#if LJ_HASFFI 2532#if LJ_HASFFI
2532 | .type CCSTATE, CCallState, CARG1 2533 | .type CCSTATE, CCallState, CARG1
2533 | lwz TMP1, CCSTATE->spadj 2534 | lwz TMP1, CCSTATE->spadj
@@ -2541,8 +2542,10 @@ static void build_subroutines(BuildCtx *ctx)
2541 | addic. CARG2, CARG2, -1 2542 | addic. CARG2, CARG2, -1
2542 | stwux sp, sp, TMP1 2543 | stwux sp, sp, TMP1
2543 | crnot 4*cr1+eq, 4*cr1+eq // For vararg calls. 2544 | crnot 4*cr1+eq, 4*cr1+eq // For vararg calls.
2544 | stw CCSTATE, -4(TMP2) 2545 | stw r14, -4(TMP2)
2545 | li TMP3, 0 2546 | li TMP3, 0
2547 | stw CCSTATE, -8(TMP2)
2548 | mr r14, TMP2
2546 | la TMP1, CCSTATE->stack 2549 | la TMP1, CCSTATE->stack
2547 | slwi CARG2, CARG2, 2 2550 | slwi CARG2, CARG2, 2
2548 | blty >2 2551 | blty >2
@@ -2574,18 +2577,20 @@ static void build_subroutines(BuildCtx *ctx)
2574 | lwz r10, CCSTATE->gpr[7] 2577 | lwz r10, CCSTATE->gpr[7]
2575 | lwz CARG1, CCSTATE->gpr[0] // Do this last, since CCSTATE is CARG1. 2578 | lwz CARG1, CCSTATE->gpr[0] // Do this last, since CCSTATE is CARG1.
2576 | bctrl 2579 | bctrl
2577 | lwz TMP2, 0(sp) 2580 | lwz CCSTATE:TMP1, -8(r14)
2578 | lwz CCSTATE:TMP1, -4(TMP2) 2581 | lwz TMP2, -4(r14)
2579 | lwz TMP0, 4(TMP2) 2582 | lwz TMP0, 4(r14)
2580 | stw CARG1, CCSTATE:TMP1->gpr[0] 2583 | stw CARG1, CCSTATE:TMP1->gpr[0]
2581 | stfd FARG1, CCSTATE:TMP1->fpr[0] 2584 | stfd FARG1, CCSTATE:TMP1->fpr[0]
2582 | stw CARG2, CCSTATE:TMP1->gpr[1] 2585 | stw CARG2, CCSTATE:TMP1->gpr[1]
2583 | mtlr TMP0 2586 | mtlr TMP0
2584 | stw CARG3, CCSTATE:TMP1->gpr[2] 2587 | stw CARG3, CCSTATE:TMP1->gpr[2]
2585 | mr sp, TMP2 2588 | mr sp, r14
2586 | stw CARG4, CCSTATE:TMP1->gpr[3] 2589 | stw CARG4, CCSTATE:TMP1->gpr[3]
2590 | mr r14, TMP2
2587 | blr 2591 | blr
2588#endif 2592#endif
2593 |// Note: vm_ffi_call must be the last function in this object file!
2589 | 2594 |
2590 |//----------------------------------------------------------------------- 2595 |//-----------------------------------------------------------------------
2591} 2596}
@@ -4665,6 +4670,7 @@ static int build_backend(BuildCtx *ctx)
4665/* Emit pseudo frame-info for all assembler functions. */ 4670/* Emit pseudo frame-info for all assembler functions. */
4666static void emit_asm_debug(BuildCtx *ctx) 4671static void emit_asm_debug(BuildCtx *ctx)
4667{ 4672{
4673 int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
4668 int i; 4674 int i;
4669 switch (ctx->mode) { 4675 switch (ctx->mode) {
4670 case BUILD_elfasm: 4676 case BUILD_elfasm:
@@ -4692,7 +4698,7 @@ static void emit_asm_debug(BuildCtx *ctx)
4692 "\t.byte 0xe\n\t.uleb128 %d\n" 4698 "\t.byte 0xe\n\t.uleb128 %d\n"
4693 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n" 4699 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
4694 "\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n", 4700 "\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n",
4695 (int)ctx->codesz, CFRAME_SIZE); 4701 fcofs, CFRAME_SIZE);
4696 for (i = 14; i <= 31; i++) 4702 for (i = 14; i <= 31; i++)
4697 fprintf(ctx->fp, 4703 fprintf(ctx->fp,
4698 "\t.byte %d\n\t.uleb128 %d\n" 4704 "\t.byte %d\n\t.uleb128 %d\n"
@@ -4701,6 +4707,20 @@ static void emit_asm_debug(BuildCtx *ctx)
4701 fprintf(ctx->fp, 4707 fprintf(ctx->fp,
4702 "\t.align 2\n" 4708 "\t.align 2\n"
4703 ".LEFDE0:\n\n"); 4709 ".LEFDE0:\n\n");
4710#if LJ_HASFFI
4711 fprintf(ctx->fp,
4712 ".LSFDE1:\n"
4713 "\t.long .LEFDE1-.LASFDE1\n"
4714 ".LASFDE1:\n"
4715 "\t.long .Lframe0\n"
4716 "\t.long lj_vm_ffi_call\n"
4717 "\t.long %d\n"
4718 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
4719 "\t.byte 0x8e\n\t.uleb128 2\n"
4720 "\t.byte 0xd\n\t.uleb128 0xe\n"
4721 "\t.align 2\n"
4722 ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
4723#endif
4704 fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@progbits\n"); 4724 fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@progbits\n");
4705 fprintf(ctx->fp, 4725 fprintf(ctx->fp,
4706 ".Lframe1:\n" 4726 ".Lframe1:\n"
@@ -4720,17 +4740,17 @@ static void emit_asm_debug(BuildCtx *ctx)
4720 "\t.align 2\n" 4740 "\t.align 2\n"
4721 ".LECIE1:\n\n"); 4741 ".LECIE1:\n\n");
4722 fprintf(ctx->fp, 4742 fprintf(ctx->fp,
4723 ".LSFDE1:\n" 4743 ".LSFDE2:\n"
4724 "\t.long .LEFDE1-.LASFDE1\n" 4744 "\t.long .LEFDE2-.LASFDE2\n"
4725 ".LASFDE1:\n" 4745 ".LASFDE2:\n"
4726 "\t.long .LASFDE1-.Lframe1\n" 4746 "\t.long .LASFDE2-.Lframe1\n"
4727 "\t.long .Lbegin-.\n" 4747 "\t.long .Lbegin-.\n"
4728 "\t.long %d\n" 4748 "\t.long %d\n"
4729 "\t.uleb128 0\n" /* augmentation length */ 4749 "\t.uleb128 0\n" /* augmentation length */
4730 "\t.byte 0xe\n\t.uleb128 %d\n" 4750 "\t.byte 0xe\n\t.uleb128 %d\n"
4731 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n" 4751 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
4732 "\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n", 4752 "\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n",
4733 (int)ctx->codesz, CFRAME_SIZE); 4753 fcofs, CFRAME_SIZE);
4734 for (i = 14; i <= 31; i++) 4754 for (i = 14; i <= 31; i++)
4735 fprintf(ctx->fp, 4755 fprintf(ctx->fp,
4736 "\t.byte %d\n\t.uleb128 %d\n" 4756 "\t.byte %d\n\t.uleb128 %d\n"
@@ -4738,7 +4758,37 @@ static void emit_asm_debug(BuildCtx *ctx)
4738 0x80+i, 37+(31-i), 0x80+32+i, 2+2*(31-i)); 4758 0x80+i, 37+(31-i), 0x80+32+i, 2+2*(31-i));
4739 fprintf(ctx->fp, 4759 fprintf(ctx->fp,
4740 "\t.align 2\n" 4760 "\t.align 2\n"
4741 ".LEFDE1:\n\n"); 4761 ".LEFDE2:\n\n");
4762#if LJ_HASFFI
4763 fprintf(ctx->fp,
4764 ".Lframe2:\n"
4765 "\t.long .LECIE2-.LSCIE2\n"
4766 ".LSCIE2:\n"
4767 "\t.long 0\n"
4768 "\t.byte 0x1\n"
4769 "\t.string \"zR\"\n"
4770 "\t.uleb128 0x1\n"
4771 "\t.sleb128 -4\n"
4772 "\t.byte 65\n"
4773 "\t.uleb128 1\n" /* augmentation length */
4774 "\t.byte 0x1b\n" /* pcrel|sdata4 */
4775 "\t.byte 0xc\n\t.uleb128 1\n\t.uleb128 0\n"
4776 "\t.align 2\n"
4777 ".LECIE2:\n\n");
4778 fprintf(ctx->fp,
4779 ".LSFDE3:\n"
4780 "\t.long .LEFDE3-.LASFDE3\n"
4781 ".LASFDE3:\n"
4782 "\t.long .LASFDE3-.Lframe2\n"
4783 "\t.long lj_vm_ffi_call-.\n"
4784 "\t.long %d\n"
4785 "\t.uleb128 0\n" /* augmentation length */
4786 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
4787 "\t.byte 0x8e\n\t.uleb128 2\n"
4788 "\t.byte 0xd\n\t.uleb128 0xe\n"
4789 "\t.align 2\n"
4790 ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
4791#endif
4742 break; 4792 break;
4743 default: 4793 default:
4744 break; 4794 break;
diff --git a/src/buildvm_ppc.h b/src/buildvm_ppc.h
index ea35c990..80d713c9 100644
--- a/src/buildvm_ppc.h
+++ b/src/buildvm_ppc.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 int build_actionlist[7577] = { 15static const unsigned int build_actionlist[7580] = {
160x00010001, 160x00010001,
170x00060014, 170x00060014,
180x72000000, 180x72000000,
@@ -4112,8 +4112,10 @@ static const unsigned int build_actionlist[7577] = {
41120x3484ffff, 41120x3484ffff,
41130x7c21416e, 41130x7c21416e,
41140x4cc63042, 41140x4cc63042,
41150x9069fffc, 41150x91c9fffc,
41160x38c00000, 41160x38c00000,
41170x9069fff8,
41180x7d2e4b78,
41170x39030000, 41190x39030000,
41180x00098200, 41200x00098200,
41190x54841000, 41210x54841000,
@@ -4168,9 +4170,9 @@ static const unsigned int build_actionlist[7577] = {
41680x80630000, 41700x80630000,
41690x00098200, 41710x00098200,
41700x4e800421, 41720x4e800421,
41710x81210000, 41730x810efff8,
41720x8109fffc, 41740x812efffc,
41730x80090004, 41750x800e0004,
41740x90680000, 41760x90680000,
41750x00098200, 41770x00098200,
41760xd8280000, 41780xd8280000,
@@ -4180,9 +4182,10 @@ static const unsigned int build_actionlist[7577] = {
41800x7c0803a6, 41820x7c0803a6,
41810x90a80000, 41830x90a80000,
41820x00098200, 41840x00098200,
41830x7d214b78, 41850x7dc17378,
41840x90c80000, 41860x90c80000,
41850x00098200, 41870x00098200,
41880x7d2e4b78,
41860x4e800020, 41890x4e800020,
41870x00000000, 41900x00000000,
41880x00080000, 41910x00080000,
@@ -8349,7 +8352,7 @@ static void build_subroutines(BuildCtx *ctx)
8349#if LJ_HASFFI 8352#if LJ_HASFFI
8350#define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V) 8353#define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
8351 dasm_put(Dst, 4085, DtE(->spadj), DtE(->nsp), DtE(->nfpr), DtE(->stack), 31-2, DtE(->fpr[0]), DtE(->fpr[1]), DtE(->fpr[2]), DtE(->fpr[3]), DtE(->fpr[4]), DtE(->fpr[5]), DtE(->fpr[6]), DtE(->fpr[7]), DtE(->func), DtE(->gpr[1]), DtE(->gpr[2])); 8354 dasm_put(Dst, 4085, DtE(->spadj), DtE(->nsp), DtE(->nfpr), DtE(->stack), 31-2, DtE(->fpr[0]), DtE(->fpr[1]), DtE(->fpr[2]), DtE(->fpr[3]), DtE(->fpr[4]), DtE(->fpr[5]), DtE(->fpr[6]), DtE(->fpr[7]), DtE(->func), DtE(->gpr[1]), DtE(->gpr[2]));
8352 dasm_put(Dst, 4141, DtE(->gpr[3]), DtE(->gpr[4]), DtE(->gpr[5]), DtE(->gpr[6]), DtE(->gpr[7]), DtE(->gpr[0]), DtE(->gpr[0]), DtE(->fpr[0]), DtE(->gpr[1]), DtE(->gpr[2]), DtE(->gpr[3])); 8355 dasm_put(Dst, 4143, DtE(->gpr[3]), DtE(->gpr[4]), DtE(->gpr[5]), DtE(->gpr[6]), DtE(->gpr[7]), DtE(->gpr[0]), DtE(->gpr[0]), DtE(->fpr[0]), DtE(->gpr[1]), DtE(->gpr[2]), DtE(->gpr[3]));
8353#endif 8356#endif
8354} 8357}
8355 8358
@@ -8357,7 +8360,7 @@ static void build_subroutines(BuildCtx *ctx)
8357static void build_ins(BuildCtx *ctx, BCOp op, int defop) 8360static void build_ins(BuildCtx *ctx, BCOp op, int defop)
8358{ 8361{
8359 int vk = 0; 8362 int vk = 0;
8360 dasm_put(Dst, 4172, defop); 8363 dasm_put(Dst, 4175, defop);
8361 8364
8362 switch (op) { 8365 switch (op) {
8363 8366
@@ -8367,224 +8370,224 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
8367 8370
8368 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: 8371 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT:
8369 if (LJ_DUALNUM) { 8372 if (LJ_DUALNUM) {
8370 dasm_put(Dst, 4174, -(BCBIAS_J*4 >> 16)); 8373 dasm_put(Dst, 4177, -(BCBIAS_J*4 >> 16));
8371 if (op == BC_ISLT) { 8374 if (op == BC_ISLT) {
8372 dasm_put(Dst, 4191);
8373 } else if (op == BC_ISGE) {
8374 dasm_put(Dst, 4194); 8375 dasm_put(Dst, 4194);
8375 } else if (op == BC_ISLE) { 8376 } else if (op == BC_ISGE) {
8376 dasm_put(Dst, 4197); 8377 dasm_put(Dst, 4197);
8377 } else { 8378 } else if (op == BC_ISLE) {
8378 dasm_put(Dst, 4200); 8379 dasm_put(Dst, 4200);
8380 } else {
8381 dasm_put(Dst, 4203);
8379 } 8382 }
8380 dasm_put(Dst, 4203); 8383 dasm_put(Dst, 4206);
8381 if (op == BC_ISLT) { 8384 if (op == BC_ISLT) {
8382 dasm_put(Dst, 4242);
8383 } else if (op == BC_ISGE) {
8384 dasm_put(Dst, 4245); 8385 dasm_put(Dst, 4245);
8385 } else if (op == BC_ISLE) { 8386 } else if (op == BC_ISGE) {
8386 dasm_put(Dst, 4248); 8387 dasm_put(Dst, 4248);
8388 } else if (op == BC_ISLE) {
8389 dasm_put(Dst, 4251);
8387 } else { 8390 } else {
8388 dasm_put(Dst, 4252); 8391 dasm_put(Dst, 4255);
8389 } 8392 }
8390 dasm_put(Dst, 4256); 8393 dasm_put(Dst, 4259);
8391 } else { 8394 } else {
8392 dasm_put(Dst, 4259, -(BCBIAS_J*4 >> 16)); 8395 dasm_put(Dst, 4262, -(BCBIAS_J*4 >> 16));
8393 if (op == BC_ISLT) { 8396 if (op == BC_ISLT) {
8394 dasm_put(Dst, 4276);
8395 } else if (op == BC_ISGE) {
8396 dasm_put(Dst, 4279); 8397 dasm_put(Dst, 4279);
8397 } else if (op == BC_ISLE) { 8398 } else if (op == BC_ISGE) {
8398 dasm_put(Dst, 4282); 8399 dasm_put(Dst, 4282);
8400 } else if (op == BC_ISLE) {
8401 dasm_put(Dst, 4285);
8399 } else { 8402 } else {
8400 dasm_put(Dst, 4286); 8403 dasm_put(Dst, 4289);
8401 } 8404 }
8402 dasm_put(Dst, 4290); 8405 dasm_put(Dst, 4293);
8403 } 8406 }
8404 break; 8407 break;
8405 8408
8406 case BC_ISEQV: case BC_ISNEV: 8409 case BC_ISEQV: case BC_ISNEV:
8407 vk = op == BC_ISEQV; 8410 vk = op == BC_ISEQV;
8408 if (LJ_DUALNUM) { 8411 if (LJ_DUALNUM) {
8409 dasm_put(Dst, 4303, -(BCBIAS_J*4 >> 16)); 8412 dasm_put(Dst, 4306, -(BCBIAS_J*4 >> 16));
8410 if (vk) { 8413 if (vk) {
8411 dasm_put(Dst, 4316);
8412 } else {
8413 dasm_put(Dst, 4319); 8414 dasm_put(Dst, 4319);
8415 } else {
8416 dasm_put(Dst, 4322);
8414 } 8417 }
8415 } else { 8418 } else {
8416 dasm_put(Dst, 4322, -(BCBIAS_J*4 >> 16)); 8419 dasm_put(Dst, 4325, -(BCBIAS_J*4 >> 16));
8417 if (vk) { 8420 if (vk) {
8418 dasm_put(Dst, 4339); 8421 dasm_put(Dst, 4342);
8419 } else { 8422 } else {
8420 dasm_put(Dst, 4343); 8423 dasm_put(Dst, 4346);
8421 } 8424 }
8422 dasm_put(Dst, 4347); 8425 dasm_put(Dst, 4350);
8423 } 8426 }
8424 dasm_put(Dst, 4359); 8427 dasm_put(Dst, 4362);
8425 if (!LJ_DUALNUM) { 8428 if (!LJ_DUALNUM) {
8426 dasm_put(Dst, 4361); 8429 dasm_put(Dst, 4364);
8427 } 8430 }
8428 if (LJ_HASFFI) { 8431 if (LJ_HASFFI) {
8429 dasm_put(Dst, 4364, LJ_TCDATA, LJ_TCDATA); 8432 dasm_put(Dst, 4367, LJ_TCDATA, LJ_TCDATA);
8430 } 8433 }
8431 dasm_put(Dst, 4369, ~LJ_TISPRI); 8434 dasm_put(Dst, 4372, ~LJ_TISPRI);
8432 if (LJ_HASFFI) { 8435 if (LJ_HASFFI) {
8433 dasm_put(Dst, 4374); 8436 dasm_put(Dst, 4377);
8434 } 8437 }
8435 dasm_put(Dst, 4376, ~LJ_TISTABUD); 8438 dasm_put(Dst, 4379, ~LJ_TISTABUD);
8436 if (LJ_HASFFI) { 8439 if (LJ_HASFFI) {
8437 dasm_put(Dst, 4379); 8440 dasm_put(Dst, 4382);
8438 } 8441 }
8439 dasm_put(Dst, 4382); 8442 dasm_put(Dst, 4385);
8440 if (vk) { 8443 if (vk) {
8441 dasm_put(Dst, 4390); 8444 dasm_put(Dst, 4393);
8442 } else { 8445 } else {
8443 dasm_put(Dst, 4395); 8446 dasm_put(Dst, 4398);
8444 } 8447 }
8445 if (LJ_DUALNUM) { 8448 if (LJ_DUALNUM) {
8446 dasm_put(Dst, 4400); 8449 dasm_put(Dst, 4403);
8447 } else { 8450 } else {
8448 dasm_put(Dst, 4415); 8451 dasm_put(Dst, 4418);
8449 } 8452 }
8450 dasm_put(Dst, 4418, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq); 8453 dasm_put(Dst, 4421, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<<MM_eq);
8451 break; 8454 break;
8452 8455
8453 case BC_ISEQS: case BC_ISNES: 8456 case BC_ISEQS: case BC_ISNES:
8454 vk = op == BC_ISEQS; 8457 vk = op == BC_ISEQS;
8455 dasm_put(Dst, 4437, 32-1); 8458 dasm_put(Dst, 4440, 32-1);
8456 if (LJ_HASFFI) { 8459 if (LJ_HASFFI) {
8457 dasm_put(Dst, 4445, LJ_TCDATA); 8460 dasm_put(Dst, 4448, LJ_TCDATA);
8458 } 8461 }
8459 dasm_put(Dst, 4448, LJ_TSTR); 8462 dasm_put(Dst, 4451, LJ_TSTR);
8460 if (LJ_HASFFI) { 8463 if (LJ_HASFFI) {
8461 dasm_put(Dst, 4452); 8464 dasm_put(Dst, 4455);
8462 } 8465 }
8463 dasm_put(Dst, 4455, -(BCBIAS_J*4 >> 16)); 8466 dasm_put(Dst, 4458, -(BCBIAS_J*4 >> 16));
8464 if (vk) { 8467 if (vk) {
8465 dasm_put(Dst, 4463); 8468 dasm_put(Dst, 4466);
8466 } else { 8469 } else {
8467 dasm_put(Dst, 4465); 8470 dasm_put(Dst, 4468);
8468 } 8471 }
8469 dasm_put(Dst, 4467); 8472 dasm_put(Dst, 4470);
8470 break; 8473 break;
8471 8474
8472 case BC_ISEQN: case BC_ISNEN: 8475 case BC_ISEQN: case BC_ISNEN:
8473 vk = op == BC_ISEQN; 8476 vk = op == BC_ISEQN;
8474 if (LJ_DUALNUM) { 8477 if (LJ_DUALNUM) {
8475 dasm_put(Dst, 4479, -(BCBIAS_J*4 >> 16)); 8478 dasm_put(Dst, 4482, -(BCBIAS_J*4 >> 16));
8476 if (vk) { 8479 if (vk) {
8477 dasm_put(Dst, 4491); 8480 dasm_put(Dst, 4494);
8478 } else { 8481 } else {
8479 dasm_put(Dst, 4493); 8482 dasm_put(Dst, 4496);
8480 } 8483 }
8481 dasm_put(Dst, 4495); 8484 dasm_put(Dst, 4498);
8482 } else { 8485 } else {
8483 if (vk) { 8486 if (vk) {
8484 dasm_put(Dst, 4502); 8487 dasm_put(Dst, 4505);
8485 } else { 8488 } else {
8486 dasm_put(Dst, 4504); 8489 dasm_put(Dst, 4507);
8487 } 8490 }
8488 dasm_put(Dst, 4506, -(BCBIAS_J*4 >> 16)); 8491 dasm_put(Dst, 4509, -(BCBIAS_J*4 >> 16));
8489 } 8492 }
8490 if (vk) { 8493 if (vk) {
8491 dasm_put(Dst, 4519); 8494 dasm_put(Dst, 4522);
8492 if (!LJ_HASFFI) { 8495 if (!LJ_HASFFI) {
8493 dasm_put(Dst, 4524); 8496 dasm_put(Dst, 4527);
8494 } 8497 }
8495 } else { 8498 } else {
8496 dasm_put(Dst, 4526); 8499 dasm_put(Dst, 4529);
8497 if (!LJ_HASFFI) { 8500 if (!LJ_HASFFI) {
8498 dasm_put(Dst, 4530); 8501 dasm_put(Dst, 4533);
8499 } 8502 }
8500 dasm_put(Dst, 4532); 8503 dasm_put(Dst, 4535);
8501 } 8504 }
8502 dasm_put(Dst, 4535); 8505 dasm_put(Dst, 4538);
8503 if (LJ_HASFFI) { 8506 if (LJ_HASFFI) {
8504 dasm_put(Dst, 4546, LJ_TCDATA); 8507 dasm_put(Dst, 4549, LJ_TCDATA);
8505 } 8508 }
8506 if (LJ_DUALNUM) { 8509 if (LJ_DUALNUM) {
8507 dasm_put(Dst, 4554); 8510 dasm_put(Dst, 4557);
8508 } 8511 }
8509 break; 8512 break;
8510 8513
8511 case BC_ISEQP: case BC_ISNEP: 8514 case BC_ISEQP: case BC_ISNEP:
8512 vk = op == BC_ISEQP; 8515 vk = op == BC_ISEQP;
8513 dasm_put(Dst, 4578, 32-3); 8516 dasm_put(Dst, 4581, 32-3);
8514 if (LJ_HASFFI) { 8517 if (LJ_HASFFI) {
8515 dasm_put(Dst, 4585, LJ_TCDATA); 8518 dasm_put(Dst, 4588, LJ_TCDATA);
8516 } 8519 }
8517 dasm_put(Dst, 4588); 8520 dasm_put(Dst, 4591);
8518 if (LJ_HASFFI) { 8521 if (LJ_HASFFI) {
8519 dasm_put(Dst, 4590); 8522 dasm_put(Dst, 4593);
8520 } 8523 }
8521 dasm_put(Dst, 4593, -(BCBIAS_J*4 >> 16)); 8524 dasm_put(Dst, 4596, -(BCBIAS_J*4 >> 16));
8522 if (vk) { 8525 if (vk) {
8523 dasm_put(Dst, 4599); 8526 dasm_put(Dst, 4602);
8524 } else { 8527 } else {
8525 dasm_put(Dst, 4601); 8528 dasm_put(Dst, 4604);
8526 } 8529 }
8527 dasm_put(Dst, 4603); 8530 dasm_put(Dst, 4606);
8528 break; 8531 break;
8529 8532
8530 /* -- Unary test and copy ops ------------------------------------------- */ 8533 /* -- Unary test and copy ops ------------------------------------------- */
8531 8534
8532 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: 8535 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF:
8533 dasm_put(Dst, 4615); 8536 dasm_put(Dst, 4618);
8534 if (op == BC_IST || op == BC_ISF) { 8537 if (op == BC_IST || op == BC_ISF) {
8535 dasm_put(Dst, 4619, LJ_TTRUE, -(BCBIAS_J*4 >> 16)); 8538 dasm_put(Dst, 4622, LJ_TTRUE, -(BCBIAS_J*4 >> 16));
8536 if (op == BC_IST) { 8539 if (op == BC_IST) {
8537 dasm_put(Dst, 4626); 8540 dasm_put(Dst, 4629);
8538 } else { 8541 } else {
8539 dasm_put(Dst, 4628); 8542 dasm_put(Dst, 4631);
8540 } 8543 }
8541 dasm_put(Dst, 4630); 8544 dasm_put(Dst, 4633);
8542 } else { 8545 } else {
8543 dasm_put(Dst, 4632, LJ_TFALSE); 8546 dasm_put(Dst, 4635, LJ_TFALSE);
8544 if (op == BC_ISTC) { 8547 if (op == BC_ISTC) {
8545 dasm_put(Dst, 4637);
8546 } else {
8547 dasm_put(Dst, 4640); 8548 dasm_put(Dst, 4640);
8549 } else {
8550 dasm_put(Dst, 4643);
8548 } 8551 }
8549 dasm_put(Dst, 4643, -(BCBIAS_J*4 >> 16)); 8552 dasm_put(Dst, 4646, -(BCBIAS_J*4 >> 16));
8550 } 8553 }
8551 dasm_put(Dst, 4650); 8554 dasm_put(Dst, 4653);
8552 break; 8555 break;
8553 8556
8554 /* -- Unary ops --------------------------------------------------------- */ 8557 /* -- Unary ops --------------------------------------------------------- */
8555 8558
8556 case BC_MOV: 8559 case BC_MOV:
8557 dasm_put(Dst, 4661); 8560 dasm_put(Dst, 4664);
8558 break; 8561 break;
8559 case BC_NOT: 8562 case BC_NOT:
8560 dasm_put(Dst, 4674, LJ_TTRUE); 8563 dasm_put(Dst, 4677, LJ_TTRUE);
8561 break; 8564 break;
8562 case BC_UNM: 8565 case BC_UNM:
8563 dasm_put(Dst, 4690); 8566 dasm_put(Dst, 4693);
8564 if (LJ_DUALNUM) { 8567 if (LJ_DUALNUM) {
8565 dasm_put(Dst, 4694); 8568 dasm_put(Dst, 4697);
8566 } 8569 }
8567 dasm_put(Dst, 4722); 8570 dasm_put(Dst, 4725);
8568 if (LJ_DUALNUM) { 8571 if (LJ_DUALNUM) {
8569 dasm_put(Dst, 4732);
8570 } else {
8571 dasm_put(Dst, 4735); 8572 dasm_put(Dst, 4735);
8573 } else {
8574 dasm_put(Dst, 4738);
8572 } 8575 }
8573 break; 8576 break;
8574 case BC_LEN: 8577 case BC_LEN:
8575 dasm_put(Dst, 4744, LJ_TSTR, Dt5(->len)); 8578 dasm_put(Dst, 4747, LJ_TSTR, Dt5(->len));
8576 if (LJ_DUALNUM) { 8579 if (LJ_DUALNUM) {
8577 dasm_put(Dst, 4754); 8580 dasm_put(Dst, 4757);
8578 } else { 8581 } else {
8579 dasm_put(Dst, 4759); 8582 dasm_put(Dst, 4762);
8580 } 8583 }
8581 dasm_put(Dst, 4766, LJ_TTAB); 8584 dasm_put(Dst, 4769, LJ_TTAB);
8582#ifdef LUAJIT_ENABLE_LUA52COMPAT 8585#ifdef LUAJIT_ENABLE_LUA52COMPAT
8583 dasm_put(Dst, 4780, Dt6(->metatable)); 8586 dasm_put(Dst, 4783, Dt6(->metatable));
8584#endif 8587#endif
8585 dasm_put(Dst, 4787); 8588 dasm_put(Dst, 4790);
8586#ifdef LUAJIT_ENABLE_LUA52COMPAT 8589#ifdef LUAJIT_ENABLE_LUA52COMPAT
8587 dasm_put(Dst, 4793, Dt6(->nomm), 1<<MM_len); 8590 dasm_put(Dst, 4796, Dt6(->nomm), 1<<MM_len);
8588#endif 8591#endif
8589 break; 8592 break;
8590 8593
@@ -8596,77 +8599,77 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
8596 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 8599 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
8597 switch (vk) { 8600 switch (vk) {
8598 case 0: 8601 case 0:
8599 dasm_put(Dst, 4803); 8602 dasm_put(Dst, 4806);
8600 break; 8603 break;
8601 case 1: 8604 case 1:
8602 dasm_put(Dst, 4809); 8605 dasm_put(Dst, 4812);
8603 break; 8606 break;
8604 default: 8607 default:
8605 dasm_put(Dst, 4815); 8608 dasm_put(Dst, 4818);
8606 break; 8609 break;
8607 } 8610 }
8608 dasm_put(Dst, 4821); 8611 dasm_put(Dst, 4824);
8609 switch (vk) { 8612 switch (vk) {
8610 case 0: 8613 case 0:
8611 dasm_put(Dst, 4848); 8614 dasm_put(Dst, 4851);
8612 break; 8615 break;
8613 case 1: 8616 case 1:
8614 dasm_put(Dst, 4851); 8617 dasm_put(Dst, 4854);
8615 break; 8618 break;
8616 default: 8619 default:
8617 dasm_put(Dst, 4854); 8620 dasm_put(Dst, 4857);
8618 break; 8621 break;
8619 } 8622 }
8620 dasm_put(Dst, 4857); 8623 dasm_put(Dst, 4860);
8621 if (vk == 1) { 8624 if (vk == 1) {
8622 dasm_put(Dst, 4859); 8625 dasm_put(Dst, 4862);
8623 } else { 8626 } else {
8624 dasm_put(Dst, 4863); 8627 dasm_put(Dst, 4866);
8625 } 8628 }
8626 switch (vk) { 8629 switch (vk) {
8627 case 0: 8630 case 0:
8628 dasm_put(Dst, 4867); 8631 dasm_put(Dst, 4870);
8629 break; 8632 break;
8630 case 1: 8633 case 1:
8631 dasm_put(Dst, 4870); 8634 dasm_put(Dst, 4873);
8632 break; 8635 break;
8633 default: 8636 default:
8634 dasm_put(Dst, 4873); 8637 dasm_put(Dst, 4876);
8635 break; 8638 break;
8636 } 8639 }
8637 dasm_put(Dst, 4876); 8640 dasm_put(Dst, 4879);
8638 } else { 8641 } else {
8639 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 8642 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
8640 switch (vk) { 8643 switch (vk) {
8641 case 0: 8644 case 0:
8642 dasm_put(Dst, 4883); 8645 dasm_put(Dst, 4886);
8643 if (LJ_DUALNUM) { 8646 if (LJ_DUALNUM) {
8644 dasm_put(Dst, 4885); 8647 dasm_put(Dst, 4888);
8645 } 8648 }
8646 dasm_put(Dst, 4887);
8647 if (LJ_DUALNUM) {
8648 dasm_put(Dst, 4890); 8649 dasm_put(Dst, 4890);
8650 if (LJ_DUALNUM) {
8651 dasm_put(Dst, 4893);
8649 } else { 8652 } else {
8650 dasm_put(Dst, 4896); 8653 dasm_put(Dst, 4899);
8651 } 8654 }
8652 break; 8655 break;
8653 case 1: 8656 case 1:
8654 dasm_put(Dst, 4900); 8657 dasm_put(Dst, 4903);
8655 if (LJ_DUALNUM) { 8658 if (LJ_DUALNUM) {
8656 dasm_put(Dst, 4902); 8659 dasm_put(Dst, 4905);
8657 } 8660 }
8658 dasm_put(Dst, 4904);
8659 if (LJ_DUALNUM) {
8660 dasm_put(Dst, 4907); 8661 dasm_put(Dst, 4907);
8662 if (LJ_DUALNUM) {
8663 dasm_put(Dst, 4910);
8661 } else { 8664 } else {
8662 dasm_put(Dst, 4913); 8665 dasm_put(Dst, 4916);
8663 } 8666 }
8664 break; 8667 break;
8665 default: 8668 default:
8666 dasm_put(Dst, 4917); 8669 dasm_put(Dst, 4920);
8667 break; 8670 break;
8668 } 8671 }
8669 dasm_put(Dst, 4927); 8672 dasm_put(Dst, 4930);
8670 } 8673 }
8671 break; 8674 break;
8672 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: 8675 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV:
@@ -8674,77 +8677,77 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
8674 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 8677 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
8675 switch (vk) { 8678 switch (vk) {
8676 case 0: 8679 case 0:
8677 dasm_put(Dst, 4940); 8680 dasm_put(Dst, 4943);
8678 break; 8681 break;
8679 case 1: 8682 case 1:
8680 dasm_put(Dst, 4946); 8683 dasm_put(Dst, 4949);
8681 break; 8684 break;
8682 default: 8685 default:
8683 dasm_put(Dst, 4952); 8686 dasm_put(Dst, 4955);
8684 break; 8687 break;
8685 } 8688 }
8686 dasm_put(Dst, 4958); 8689 dasm_put(Dst, 4961);
8687 switch (vk) { 8690 switch (vk) {
8688 case 0: 8691 case 0:
8689 dasm_put(Dst, 4985); 8692 dasm_put(Dst, 4988);
8690 break; 8693 break;
8691 case 1: 8694 case 1:
8692 dasm_put(Dst, 4988); 8695 dasm_put(Dst, 4991);
8693 break; 8696 break;
8694 default: 8697 default:
8695 dasm_put(Dst, 4991); 8698 dasm_put(Dst, 4994);
8696 break; 8699 break;
8697 } 8700 }
8698 dasm_put(Dst, 4994); 8701 dasm_put(Dst, 4997);
8699 if (vk == 1) { 8702 if (vk == 1) {
8700 dasm_put(Dst, 4996); 8703 dasm_put(Dst, 4999);
8701 } else { 8704 } else {
8702 dasm_put(Dst, 5000); 8705 dasm_put(Dst, 5003);
8703 } 8706 }
8704 switch (vk) { 8707 switch (vk) {
8705 case 0: 8708 case 0:
8706 dasm_put(Dst, 5004); 8709 dasm_put(Dst, 5007);
8707 break; 8710 break;
8708 case 1: 8711 case 1:
8709 dasm_put(Dst, 5007); 8712 dasm_put(Dst, 5010);
8710 break; 8713 break;
8711 default: 8714 default:
8712 dasm_put(Dst, 5010); 8715 dasm_put(Dst, 5013);
8713 break; 8716 break;
8714 } 8717 }
8715 dasm_put(Dst, 5013); 8718 dasm_put(Dst, 5016);
8716 } else { 8719 } else {
8717 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 8720 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
8718 switch (vk) { 8721 switch (vk) {
8719 case 0: 8722 case 0:
8720 dasm_put(Dst, 5020); 8723 dasm_put(Dst, 5023);
8721 if (LJ_DUALNUM) { 8724 if (LJ_DUALNUM) {
8722 dasm_put(Dst, 5022); 8725 dasm_put(Dst, 5025);
8723 } 8726 }
8724 dasm_put(Dst, 5024);
8725 if (LJ_DUALNUM) {
8726 dasm_put(Dst, 5027); 8727 dasm_put(Dst, 5027);
8728 if (LJ_DUALNUM) {
8729 dasm_put(Dst, 5030);
8727 } else { 8730 } else {
8728 dasm_put(Dst, 5033); 8731 dasm_put(Dst, 5036);
8729 } 8732 }
8730 break; 8733 break;
8731 case 1: 8734 case 1:
8732 dasm_put(Dst, 5037); 8735 dasm_put(Dst, 5040);
8733 if (LJ_DUALNUM) { 8736 if (LJ_DUALNUM) {
8734 dasm_put(Dst, 5039); 8737 dasm_put(Dst, 5042);
8735 } 8738 }
8736 dasm_put(Dst, 5041);
8737 if (LJ_DUALNUM) {
8738 dasm_put(Dst, 5044); 8739 dasm_put(Dst, 5044);
8740 if (LJ_DUALNUM) {
8741 dasm_put(Dst, 5047);
8739 } else { 8742 } else {
8740 dasm_put(Dst, 5050); 8743 dasm_put(Dst, 5053);
8741 } 8744 }
8742 break; 8745 break;
8743 default: 8746 default:
8744 dasm_put(Dst, 5054); 8747 dasm_put(Dst, 5057);
8745 break; 8748 break;
8746 } 8749 }
8747 dasm_put(Dst, 5064); 8750 dasm_put(Dst, 5067);
8748 } 8751 }
8749 break; 8752 break;
8750 case BC_MULVN: case BC_MULNV: case BC_MULVV: 8753 case BC_MULVN: case BC_MULNV: case BC_MULVV:
@@ -8752,188 +8755,188 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
8752 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 8755 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
8753 switch (vk) { 8756 switch (vk) {
8754 case 0: 8757 case 0:
8755 dasm_put(Dst, 5077); 8758 dasm_put(Dst, 5080);
8756 break; 8759 break;
8757 case 1: 8760 case 1:
8758 dasm_put(Dst, 5083); 8761 dasm_put(Dst, 5086);
8759 break; 8762 break;
8760 default: 8763 default:
8761 dasm_put(Dst, 5089); 8764 dasm_put(Dst, 5092);
8762 break; 8765 break;
8763 } 8766 }
8764 dasm_put(Dst, 5095); 8767 dasm_put(Dst, 5098);
8765 switch (vk) { 8768 switch (vk) {
8766 case 0: 8769 case 0:
8767 dasm_put(Dst, 5122); 8770 dasm_put(Dst, 5125);
8768 break; 8771 break;
8769 case 1: 8772 case 1:
8770 dasm_put(Dst, 5125); 8773 dasm_put(Dst, 5128);
8771 break; 8774 break;
8772 default: 8775 default:
8773 dasm_put(Dst, 5128); 8776 dasm_put(Dst, 5131);
8774 break; 8777 break;
8775 } 8778 }
8776 dasm_put(Dst, 5131); 8779 dasm_put(Dst, 5134);
8777 if (vk == 1) { 8780 if (vk == 1) {
8778 dasm_put(Dst, 5133); 8781 dasm_put(Dst, 5136);
8779 } else { 8782 } else {
8780 dasm_put(Dst, 5137); 8783 dasm_put(Dst, 5140);
8781 } 8784 }
8782 switch (vk) { 8785 switch (vk) {
8783 case 0: 8786 case 0:
8784 dasm_put(Dst, 5141); 8787 dasm_put(Dst, 5144);
8785 break; 8788 break;
8786 case 1: 8789 case 1:
8787 dasm_put(Dst, 5144); 8790 dasm_put(Dst, 5147);
8788 break; 8791 break;
8789 default: 8792 default:
8790 dasm_put(Dst, 5147); 8793 dasm_put(Dst, 5150);
8791 break; 8794 break;
8792 } 8795 }
8793 dasm_put(Dst, 5150); 8796 dasm_put(Dst, 5153);
8794 } else { 8797 } else {
8795 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 8798 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
8796 switch (vk) { 8799 switch (vk) {
8797 case 0: 8800 case 0:
8798 dasm_put(Dst, 5157); 8801 dasm_put(Dst, 5160);
8799 if (LJ_DUALNUM) { 8802 if (LJ_DUALNUM) {
8800 dasm_put(Dst, 5159); 8803 dasm_put(Dst, 5162);
8801 } 8804 }
8802 dasm_put(Dst, 5161);
8803 if (LJ_DUALNUM) {
8804 dasm_put(Dst, 5164); 8805 dasm_put(Dst, 5164);
8806 if (LJ_DUALNUM) {
8807 dasm_put(Dst, 5167);
8805 } else { 8808 } else {
8806 dasm_put(Dst, 5170); 8809 dasm_put(Dst, 5173);
8807 } 8810 }
8808 break; 8811 break;
8809 case 1: 8812 case 1:
8810 dasm_put(Dst, 5174); 8813 dasm_put(Dst, 5177);
8811 if (LJ_DUALNUM) { 8814 if (LJ_DUALNUM) {
8812 dasm_put(Dst, 5176); 8815 dasm_put(Dst, 5179);
8813 } 8816 }
8814 dasm_put(Dst, 5178);
8815 if (LJ_DUALNUM) {
8816 dasm_put(Dst, 5181); 8817 dasm_put(Dst, 5181);
8818 if (LJ_DUALNUM) {
8819 dasm_put(Dst, 5184);
8817 } else { 8820 } else {
8818 dasm_put(Dst, 5187); 8821 dasm_put(Dst, 5190);
8819 } 8822 }
8820 break; 8823 break;
8821 default: 8824 default:
8822 dasm_put(Dst, 5191); 8825 dasm_put(Dst, 5194);
8823 break; 8826 break;
8824 } 8827 }
8825 dasm_put(Dst, 5201); 8828 dasm_put(Dst, 5204);
8826 } 8829 }
8827 break; 8830 break;
8828 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: 8831 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV:
8829 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 8832 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
8830 switch (vk) { 8833 switch (vk) {
8831 case 0: 8834 case 0:
8832 dasm_put(Dst, 5214); 8835 dasm_put(Dst, 5217);
8833 if (LJ_DUALNUM) { 8836 if (LJ_DUALNUM) {
8834 dasm_put(Dst, 5216); 8837 dasm_put(Dst, 5219);
8835 } 8838 }
8836 dasm_put(Dst, 5218);
8837 if (LJ_DUALNUM) {
8838 dasm_put(Dst, 5221); 8839 dasm_put(Dst, 5221);
8840 if (LJ_DUALNUM) {
8841 dasm_put(Dst, 5224);
8839 } else { 8842 } else {
8840 dasm_put(Dst, 5227); 8843 dasm_put(Dst, 5230);
8841 } 8844 }
8842 break; 8845 break;
8843 case 1: 8846 case 1:
8844 dasm_put(Dst, 5231); 8847 dasm_put(Dst, 5234);
8845 if (LJ_DUALNUM) { 8848 if (LJ_DUALNUM) {
8846 dasm_put(Dst, 5233); 8849 dasm_put(Dst, 5236);
8847 } 8850 }
8848 dasm_put(Dst, 5235);
8849 if (LJ_DUALNUM) {
8850 dasm_put(Dst, 5238); 8851 dasm_put(Dst, 5238);
8852 if (LJ_DUALNUM) {
8853 dasm_put(Dst, 5241);
8851 } else { 8854 } else {
8852 dasm_put(Dst, 5244); 8855 dasm_put(Dst, 5247);
8853 } 8856 }
8854 break; 8857 break;
8855 default: 8858 default:
8856 dasm_put(Dst, 5248); 8859 dasm_put(Dst, 5251);
8857 break; 8860 break;
8858 } 8861 }
8859 dasm_put(Dst, 5258); 8862 dasm_put(Dst, 5261);
8860 break; 8863 break;
8861 case BC_MODVN: 8864 case BC_MODVN:
8862 if (LJ_DUALNUM) { 8865 if (LJ_DUALNUM) {
8863 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 8866 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
8864 switch (vk) { 8867 switch (vk) {
8865 case 0: 8868 case 0:
8866 dasm_put(Dst, 5271); 8869 dasm_put(Dst, 5274);
8867 break; 8870 break;
8868 case 1: 8871 case 1:
8869 dasm_put(Dst, 5277); 8872 dasm_put(Dst, 5280);
8870 break; 8873 break;
8871 default: 8874 default:
8872 dasm_put(Dst, 5283); 8875 dasm_put(Dst, 5286);
8873 break; 8876 break;
8874 } 8877 }
8875 dasm_put(Dst, 5289); 8878 dasm_put(Dst, 5292);
8876 switch (vk) { 8879 switch (vk) {
8877 case 0: 8880 case 0:
8878 dasm_put(Dst, 5317); 8881 dasm_put(Dst, 5320);
8879 break; 8882 break;
8880 case 1: 8883 case 1:
8881 dasm_put(Dst, 5320); 8884 dasm_put(Dst, 5323);
8882 break; 8885 break;
8883 default: 8886 default:
8884 dasm_put(Dst, 5323); 8887 dasm_put(Dst, 5326);
8885 break; 8888 break;
8886 } 8889 }
8887 dasm_put(Dst, 5326); 8890 dasm_put(Dst, 5329);
8888 if (vk == 1) { 8891 if (vk == 1) {
8889 dasm_put(Dst, 5328); 8892 dasm_put(Dst, 5331);
8890 } else { 8893 } else {
8891 dasm_put(Dst, 5332); 8894 dasm_put(Dst, 5335);
8892 } 8895 }
8893 switch (vk) { 8896 switch (vk) {
8894 case 0: 8897 case 0:
8895 dasm_put(Dst, 5336); 8898 dasm_put(Dst, 5339);
8896 break; 8899 break;
8897 case 1: 8900 case 1:
8898 dasm_put(Dst, 5339); 8901 dasm_put(Dst, 5342);
8899 break; 8902 break;
8900 default: 8903 default:
8901 dasm_put(Dst, 5342); 8904 dasm_put(Dst, 5345);
8902 break; 8905 break;
8903 } 8906 }
8904 dasm_put(Dst, 5345); 8907 dasm_put(Dst, 5348);
8905 } else { 8908 } else {
8906 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 8909 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
8907 switch (vk) { 8910 switch (vk) {
8908 case 0: 8911 case 0:
8909 dasm_put(Dst, 5357); 8912 dasm_put(Dst, 5360);
8910 if (LJ_DUALNUM) { 8913 if (LJ_DUALNUM) {
8911 dasm_put(Dst, 5359); 8914 dasm_put(Dst, 5362);
8912 } 8915 }
8913 dasm_put(Dst, 5361);
8914 if (LJ_DUALNUM) {
8915 dasm_put(Dst, 5364); 8916 dasm_put(Dst, 5364);
8917 if (LJ_DUALNUM) {
8918 dasm_put(Dst, 5367);
8916 } else { 8919 } else {
8917 dasm_put(Dst, 5370); 8920 dasm_put(Dst, 5373);
8918 } 8921 }
8919 break; 8922 break;
8920 case 1: 8923 case 1:
8921 dasm_put(Dst, 5374); 8924 dasm_put(Dst, 5377);
8922 if (LJ_DUALNUM) { 8925 if (LJ_DUALNUM) {
8923 dasm_put(Dst, 5376); 8926 dasm_put(Dst, 5379);
8924 } 8927 }
8925 dasm_put(Dst, 5378);
8926 if (LJ_DUALNUM) {
8927 dasm_put(Dst, 5381); 8928 dasm_put(Dst, 5381);
8929 if (LJ_DUALNUM) {
8930 dasm_put(Dst, 5384);
8928 } else { 8931 } else {
8929 dasm_put(Dst, 5387); 8932 dasm_put(Dst, 5390);
8930 } 8933 }
8931 break; 8934 break;
8932 default: 8935 default:
8933 dasm_put(Dst, 5391); 8936 dasm_put(Dst, 5394);
8934 break; 8937 break;
8935 } 8938 }
8936 dasm_put(Dst, 5401); 8939 dasm_put(Dst, 5404);
8937 } 8940 }
8938 break; 8941 break;
8939 case BC_MODNV: case BC_MODVV: 8942 case BC_MODNV: case BC_MODVV:
@@ -8941,298 +8944,298 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
8941 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 8944 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
8942 switch (vk) { 8945 switch (vk) {
8943 case 0: 8946 case 0:
8944 dasm_put(Dst, 5419); 8947 dasm_put(Dst, 5422);
8945 break; 8948 break;
8946 case 1: 8949 case 1:
8947 dasm_put(Dst, 5425); 8950 dasm_put(Dst, 5428);
8948 break; 8951 break;
8949 default: 8952 default:
8950 dasm_put(Dst, 5431); 8953 dasm_put(Dst, 5434);
8951 break; 8954 break;
8952 } 8955 }
8953 dasm_put(Dst, 5437); 8956 dasm_put(Dst, 5440);
8954 switch (vk) { 8957 switch (vk) {
8955 case 0: 8958 case 0:
8956 dasm_put(Dst, 5465); 8959 dasm_put(Dst, 5468);
8957 break; 8960 break;
8958 case 1: 8961 case 1:
8959 dasm_put(Dst, 5468); 8962 dasm_put(Dst, 5471);
8960 break; 8963 break;
8961 default: 8964 default:
8962 dasm_put(Dst, 5471); 8965 dasm_put(Dst, 5474);
8963 break; 8966 break;
8964 } 8967 }
8965 dasm_put(Dst, 5474); 8968 dasm_put(Dst, 5477);
8966 if (vk == 1) { 8969 if (vk == 1) {
8967 dasm_put(Dst, 5476); 8970 dasm_put(Dst, 5479);
8968 } else { 8971 } else {
8969 dasm_put(Dst, 5480); 8972 dasm_put(Dst, 5483);
8970 } 8973 }
8971 switch (vk) { 8974 switch (vk) {
8972 case 0: 8975 case 0:
8973 dasm_put(Dst, 5484); 8976 dasm_put(Dst, 5487);
8974 break; 8977 break;
8975 case 1: 8978 case 1:
8976 dasm_put(Dst, 5487); 8979 dasm_put(Dst, 5490);
8977 break; 8980 break;
8978 default: 8981 default:
8979 dasm_put(Dst, 5490); 8982 dasm_put(Dst, 5493);
8980 break; 8983 break;
8981 } 8984 }
8982 dasm_put(Dst, 5493); 8985 dasm_put(Dst, 5496);
8983 } else { 8986 } else {
8984 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 8987 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
8985 switch (vk) { 8988 switch (vk) {
8986 case 0: 8989 case 0:
8987 dasm_put(Dst, 5496); 8990 dasm_put(Dst, 5499);
8988 if (LJ_DUALNUM) { 8991 if (LJ_DUALNUM) {
8989 dasm_put(Dst, 5498); 8992 dasm_put(Dst, 5501);
8990 } 8993 }
8991 dasm_put(Dst, 5500);
8992 if (LJ_DUALNUM) {
8993 dasm_put(Dst, 5503); 8994 dasm_put(Dst, 5503);
8995 if (LJ_DUALNUM) {
8996 dasm_put(Dst, 5506);
8994 } else { 8997 } else {
8995 dasm_put(Dst, 5509); 8998 dasm_put(Dst, 5512);
8996 } 8999 }
8997 break; 9000 break;
8998 case 1: 9001 case 1:
8999 dasm_put(Dst, 5513); 9002 dasm_put(Dst, 5516);
9000 if (LJ_DUALNUM) { 9003 if (LJ_DUALNUM) {
9001 dasm_put(Dst, 5515); 9004 dasm_put(Dst, 5518);
9002 } 9005 }
9003 dasm_put(Dst, 5517);
9004 if (LJ_DUALNUM) {
9005 dasm_put(Dst, 5520); 9006 dasm_put(Dst, 5520);
9007 if (LJ_DUALNUM) {
9008 dasm_put(Dst, 5523);
9006 } else { 9009 } else {
9007 dasm_put(Dst, 5526); 9010 dasm_put(Dst, 5529);
9008 } 9011 }
9009 break; 9012 break;
9010 default: 9013 default:
9011 dasm_put(Dst, 5530); 9014 dasm_put(Dst, 5533);
9012 break; 9015 break;
9013 } 9016 }
9014 dasm_put(Dst, 5540); 9017 dasm_put(Dst, 5543);
9015 } 9018 }
9016 break; 9019 break;
9017 case BC_POW: 9020 case BC_POW:
9018 dasm_put(Dst, 5543); 9021 dasm_put(Dst, 5546);
9019 break; 9022 break;
9020 9023
9021 case BC_CAT: 9024 case BC_CAT:
9022 dasm_put(Dst, 5566, Dt1(->base), 32-3, Dt1(->base)); 9025 dasm_put(Dst, 5569, Dt1(->base), 32-3, Dt1(->base));
9023 break; 9026 break;
9024 9027
9025 /* -- Constant ops ------------------------------------------------------ */ 9028 /* -- Constant ops ------------------------------------------------------ */
9026 9029
9027 case BC_KSTR: 9030 case BC_KSTR:
9028 dasm_put(Dst, 5596, 32-1, LJ_TSTR); 9031 dasm_put(Dst, 5599, 32-1, LJ_TSTR);
9029 break; 9032 break;
9030 case BC_KCDATA: 9033 case BC_KCDATA:
9031#if LJ_HASFFI 9034#if LJ_HASFFI
9032 dasm_put(Dst, 5615, 32-1, LJ_TCDATA); 9035 dasm_put(Dst, 5618, 32-1, LJ_TCDATA);
9033#endif 9036#endif
9034 break; 9037 break;
9035 case BC_KSHORT: 9038 case BC_KSHORT:
9036 if (LJ_DUALNUM) { 9039 if (LJ_DUALNUM) {
9037 dasm_put(Dst, 5634, 31-13); 9040 dasm_put(Dst, 5637, 31-13);
9038 } else { 9041 } else {
9039 dasm_put(Dst, 5650, 31-13, 31-20); 9042 dasm_put(Dst, 5653, 31-13, 31-20);
9040 } 9043 }
9041 break; 9044 break;
9042 case BC_KNUM: 9045 case BC_KNUM:
9043 dasm_put(Dst, 5678); 9046 dasm_put(Dst, 5681);
9044 break; 9047 break;
9045 case BC_KPRI: 9048 case BC_KPRI:
9046 dasm_put(Dst, 5691, 32-3); 9049 dasm_put(Dst, 5694, 32-3);
9047 break; 9050 break;
9048 case BC_KNIL: 9051 case BC_KNIL:
9049 dasm_put(Dst, 5706); 9052 dasm_put(Dst, 5709);
9050 break; 9053 break;
9051 9054
9052 /* -- Upvalue and function ops ------------------------------------------ */ 9055 /* -- Upvalue and function ops ------------------------------------------ */
9053 9056
9054 case BC_UGET: 9057 case BC_UGET:
9055 dasm_put(Dst, 5725, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); 9058 dasm_put(Dst, 5728, 32-1, offsetof(GCfuncL, uvptr), DtA(->v));
9056 break; 9059 break;
9057 case BC_USETV: 9060 case BC_USETV:
9058 dasm_put(Dst, 5746, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, DtA(->closed), -(LJ_TISNUM+1), LJ_TISGCV - (LJ_TISNUM+1), Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G); 9061 dasm_put(Dst, 5749, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, DtA(->closed), -(LJ_TISNUM+1), LJ_TISGCV - (LJ_TISNUM+1), Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G);
9059 break; 9062 break;
9060 case BC_USETS: 9063 case BC_USETS:
9061 dasm_put(Dst, 5799, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_TSTR, LJ_GC_WHITES, GG_DISP2G); 9064 dasm_put(Dst, 5802, 32-1, 32-1, offsetof(GCfuncL, uvptr), DtA(->marked), DtA(->v), LJ_GC_BLACK, Dt5(->marked), DtA(->closed), LJ_TSTR, LJ_GC_WHITES, GG_DISP2G);
9062 break; 9065 break;
9063 case BC_USETN: 9066 case BC_USETN:
9064 dasm_put(Dst, 5850, 32-1, offsetof(GCfuncL, uvptr), DtA(->v)); 9067 dasm_put(Dst, 5853, 32-1, offsetof(GCfuncL, uvptr), DtA(->v));
9065 break; 9068 break;
9066 case BC_USETP: 9069 case BC_USETP:
9067 dasm_put(Dst, 5871, 32-1, 32-3, offsetof(GCfuncL, uvptr), DtA(->v)); 9070 dasm_put(Dst, 5874, 32-1, 32-3, offsetof(GCfuncL, uvptr), DtA(->v));
9068 break; 9071 break;
9069 9072
9070 case BC_UCLO: 9073 case BC_UCLO:
9071 dasm_put(Dst, 5894, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base)); 9074 dasm_put(Dst, 5897, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base));
9072 break; 9075 break;
9073 9076
9074 case BC_FNEW: 9077 case BC_FNEW:
9075 dasm_put(Dst, 5924, 32-1, Dt1(->base), Dt1(->base), LJ_TFUNC); 9078 dasm_put(Dst, 5927, 32-1, Dt1(->base), Dt1(->base), LJ_TFUNC);
9076 break; 9079 break;
9077 9080
9078 /* -- Table ops --------------------------------------------------------- */ 9081 /* -- Table ops --------------------------------------------------------- */
9079 9082
9080 case BC_TNEW: 9083 case BC_TNEW:
9081 case BC_TDUP: 9084 case BC_TDUP:
9082 dasm_put(Dst, 5952, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base)); 9085 dasm_put(Dst, 5955, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base));
9083 if (op == BC_TNEW) { 9086 if (op == BC_TNEW) {
9084 dasm_put(Dst, 5965); 9087 dasm_put(Dst, 5968);
9085 } else { 9088 } else {
9086 dasm_put(Dst, 5974, 32-1); 9089 dasm_put(Dst, 5977, 32-1);
9087 } 9090 }
9088 dasm_put(Dst, 5981, Dt1(->base), LJ_TTAB); 9091 dasm_put(Dst, 5984, Dt1(->base), LJ_TTAB);
9089 if (op == BC_TNEW) { 9092 if (op == BC_TNEW) {
9090 dasm_put(Dst, 5998); 9093 dasm_put(Dst, 6001);
9091 } 9094 }
9092 dasm_put(Dst, 6003); 9095 dasm_put(Dst, 6006);
9093 break; 9096 break;
9094 9097
9095 case BC_GGET: 9098 case BC_GGET:
9096 case BC_GSET: 9099 case BC_GSET:
9097 dasm_put(Dst, 6012, 32-1, Dt7(->env)); 9100 dasm_put(Dst, 6015, 32-1, Dt7(->env));
9098 if (op == BC_GGET) { 9101 if (op == BC_GGET) {
9099 dasm_put(Dst, 6020);
9100 } else {
9101 dasm_put(Dst, 6023); 9102 dasm_put(Dst, 6023);
9103 } else {
9104 dasm_put(Dst, 6026);
9102 } 9105 }
9103 break; 9106 break;
9104 9107
9105 case BC_TGETV: 9108 case BC_TGETV:
9106 dasm_put(Dst, 6026); 9109 dasm_put(Dst, 6029);
9107 if (LJ_DUALNUM) { 9110 if (LJ_DUALNUM) {
9108 dasm_put(Dst, 6030); 9111 dasm_put(Dst, 6033);
9109 } else { 9112 } else {
9110 dasm_put(Dst, 6032); 9113 dasm_put(Dst, 6035);
9111 } 9114 }
9112 dasm_put(Dst, 6034, LJ_TTAB); 9115 dasm_put(Dst, 6037, LJ_TTAB);
9113 if (LJ_DUALNUM) { 9116 if (LJ_DUALNUM) {
9114 dasm_put(Dst, 6040, Dt6(->asize), Dt6(->array), 31-3); 9117 dasm_put(Dst, 6043, Dt6(->asize), Dt6(->array), 31-3);
9115 } else { 9118 } else {
9116 dasm_put(Dst, 6050, Dt6(->asize), Dt6(->array), 31-3); 9119 dasm_put(Dst, 6053, Dt6(->asize), Dt6(->array), 31-3);
9117 } 9120 }
9118 dasm_put(Dst, 6067, LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index, LJ_TSTR); 9121 dasm_put(Dst, 6070, LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index, LJ_TSTR);
9119 if (!LJ_DUALNUM) { 9122 if (!LJ_DUALNUM) {
9120 dasm_put(Dst, 6107); 9123 dasm_put(Dst, 6110);
9121 } 9124 }
9122 dasm_put(Dst, 6109); 9125 dasm_put(Dst, 6112);
9123 break; 9126 break;
9124 case BC_TGETS: 9127 case BC_TGETS:
9125 dasm_put(Dst, 6112, 32-1, LJ_TTAB, Dt6(->hmask), Dt5(->hash), Dt6(->node), 31-5, 31-3, DtB(->key), 4+offsetof(Node, key), DtB(->val), 4+offsetof(Node, val), LJ_TSTR, LJ_TNIL, DtB(->next)); 9128 dasm_put(Dst, 6115, 32-1, LJ_TTAB, Dt6(->hmask), Dt5(->hash), Dt6(->node), 31-5, 31-3, DtB(->key), 4+offsetof(Node, key), DtB(->val), 4+offsetof(Node, val), LJ_TSTR, LJ_TNIL, DtB(->next));
9126 dasm_put(Dst, 6173, LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 9129 dasm_put(Dst, 6176, LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
9127 break; 9130 break;
9128 case BC_TGETB: 9131 case BC_TGETB:
9129 dasm_put(Dst, 6193, 32-3, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 9132 dasm_put(Dst, 6196, 32-3, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
9130 break; 9133 break;
9131 9134
9132 case BC_TSETV: 9135 case BC_TSETV:
9133 dasm_put(Dst, 6241); 9136 dasm_put(Dst, 6244);
9134 if (LJ_DUALNUM) { 9137 if (LJ_DUALNUM) {
9135 dasm_put(Dst, 6245); 9138 dasm_put(Dst, 6248);
9136 } else { 9139 } else {
9137 dasm_put(Dst, 6247); 9140 dasm_put(Dst, 6250);
9138 } 9141 }
9139 dasm_put(Dst, 6249, LJ_TTAB); 9142 dasm_put(Dst, 6252, LJ_TTAB);
9140 if (LJ_DUALNUM) { 9143 if (LJ_DUALNUM) {
9141 dasm_put(Dst, 6255, Dt6(->asize), Dt6(->array), 31-3); 9144 dasm_put(Dst, 6258, Dt6(->asize), Dt6(->array), 31-3);
9142 } else { 9145 } else {
9143 dasm_put(Dst, 6265, Dt6(->asize), Dt6(->array), 31-3); 9146 dasm_put(Dst, 6268, Dt6(->asize), Dt6(->array), 31-3);
9144 } 9147 }
9145 dasm_put(Dst, 6282, Dt6(->marked), LJ_TNIL, LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR); 9148 dasm_put(Dst, 6285, Dt6(->marked), LJ_TNIL, LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR);
9146 if (!LJ_DUALNUM) { 9149 if (!LJ_DUALNUM) {
9147 dasm_put(Dst, 6329); 9150 dasm_put(Dst, 6332);
9148 } 9151 }
9149 dasm_put(Dst, 6331, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); 9152 dasm_put(Dst, 6334, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist));
9150 break; 9153 break;
9151 dasm_put(Dst, 6346, LJ_TSTR, LJ_TNIL); 9154 dasm_put(Dst, 6349, LJ_TSTR, LJ_TNIL);
9152 case BC_TSETS: 9155 case BC_TSETS:
9153 dasm_put(Dst, 6372, 32-1, LJ_TTAB, Dt6(->hmask), Dt5(->hash), Dt6(->node), Dt6(->nomm), 31-5, 31-3, Dt6(->marked), DtB(->key), 4+offsetof(Node, key), DtB(->val), 4+offsetof(Node, val), LJ_TSTR, LJ_TNIL); 9156 dasm_put(Dst, 6375, 32-1, LJ_TTAB, Dt6(->hmask), Dt5(->hash), Dt6(->node), Dt6(->nomm), 31-5, 31-3, Dt6(->marked), DtB(->key), 4+offsetof(Node, key), DtB(->val), 4+offsetof(Node, val), LJ_TSTR, LJ_TNIL);
9154 dasm_put(Dst, 6423, LJ_GC_BLACK, DtB(->val), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next), Dt6(->metatable), DISPATCH_GL(tmptv), Dt1(->base), Dt6(->nomm), 1<<MM_newindex); 9157 dasm_put(Dst, 6426, LJ_GC_BLACK, DtB(->val), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next), Dt6(->metatable), DISPATCH_GL(tmptv), Dt1(->base), Dt6(->nomm), 1<<MM_newindex);
9155 dasm_put(Dst, 6479, LJ_TSTR, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); 9158 dasm_put(Dst, 6482, LJ_TSTR, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist));
9156 break; 9159 break;
9157 case BC_TSETB: 9160 case BC_TSETB:
9158 dasm_put(Dst, 6504, 32-3, LJ_TTAB, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_TNIL, LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DISPATCH_GL(gc.grayagain)); 9161 dasm_put(Dst, 6507, 32-3, LJ_TTAB, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_TNIL, LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DISPATCH_GL(gc.grayagain));
9159 dasm_put(Dst, 6562, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); 9162 dasm_put(Dst, 6565, DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist));
9160 break; 9163 break;
9161 9164
9162 case BC_TSETM: 9165 case BC_TSETM:
9163 dasm_put(Dst, 6572, 32-3, Dt6(->asize), 31-3, Dt6(->marked), Dt6(->array), LJ_GC_BLACK, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist)); 9166 dasm_put(Dst, 6575, 32-3, Dt6(->asize), 31-3, Dt6(->marked), Dt6(->array), LJ_GC_BLACK, Dt1(->base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist));
9164 dasm_put(Dst, 6641); 9167 dasm_put(Dst, 6644);
9165 break; 9168 break;
9166 9169
9167 /* -- Calls and vararg handling ----------------------------------------- */ 9170 /* -- Calls and vararg handling ----------------------------------------- */
9168 9171
9169 case BC_CALLM: 9172 case BC_CALLM:
9170 dasm_put(Dst, 6644); 9173 dasm_put(Dst, 6647);
9171 break; 9174 break;
9172 case BC_CALL: 9175 case BC_CALL:
9173 dasm_put(Dst, 6646, LJ_TFUNC, Dt7(->pc)); 9176 dasm_put(Dst, 6649, LJ_TFUNC, Dt7(->pc));
9174 break; 9177 break;
9175 9178
9176 case BC_CALLMT: 9179 case BC_CALLMT:
9177 dasm_put(Dst, 6667); 9180 dasm_put(Dst, 6670);
9178 break; 9181 break;
9179 case BC_CALLT: 9182 case BC_CALLT:
9180 dasm_put(Dst, 6669, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); 9183 dasm_put(Dst, 6672, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP);
9181 dasm_put(Dst, 6733, FRAME_TYPE); 9184 dasm_put(Dst, 6736, FRAME_TYPE);
9182 break; 9185 break;
9183 9186
9184 case BC_ITERC: 9187 case BC_ITERC:
9185 dasm_put(Dst, 6742, LJ_TFUNC, Dt7(->pc)); 9188 dasm_put(Dst, 6745, LJ_TFUNC, Dt7(->pc));
9186 break; 9189 break;
9187 9190
9188 case BC_ITERN: 9191 case BC_ITERN:
9189#if LJ_HASJIT 9192#if LJ_HASJIT
9190#endif 9193#endif
9191 dasm_put(Dst, 6769, Dt6(->asize), Dt6(->array), 31-3, LJ_TNIL); 9194 dasm_put(Dst, 6772, Dt6(->asize), Dt6(->array), 31-3, LJ_TNIL);
9192 if (LJ_DUALNUM) { 9195 if (LJ_DUALNUM) {
9193 dasm_put(Dst, 6791);
9194 } else {
9195 dasm_put(Dst, 6794); 9196 dasm_put(Dst, 6794);
9197 } else {
9198 dasm_put(Dst, 6797);
9196 } 9199 }
9197 dasm_put(Dst, 6798, -(BCBIAS_J*4 >> 16)); 9200 dasm_put(Dst, 6801, -(BCBIAS_J*4 >> 16));
9198 if (!LJ_DUALNUM) { 9201 if (!LJ_DUALNUM) {
9199 dasm_put(Dst, 6806); 9202 dasm_put(Dst, 6809);
9200 } 9203 }
9201 dasm_put(Dst, 6808, Dt6(->hmask), Dt6(->node), 31-5, 31-3, LJ_TNIL, DtB(->key), -(BCBIAS_J*4 >> 16)); 9204 dasm_put(Dst, 6811, Dt6(->hmask), Dt6(->node), 31-5, 31-3, LJ_TNIL, DtB(->key), -(BCBIAS_J*4 >> 16));
9202 break; 9205 break;
9203 9206
9204 case BC_ISNEXT: 9207 case BC_ISNEXT:
9205 dasm_put(Dst, 6864, LJ_TTAB, LJ_TFUNC, LJ_TNIL, Dt8(->ffid), FF_next_N, 32-1, -(BCBIAS_J*4 >> 16), BC_JMP, BC_ITERC, -(BCBIAS_J*4 >> 16)); 9208 dasm_put(Dst, 6867, LJ_TTAB, LJ_TFUNC, LJ_TNIL, Dt8(->ffid), FF_next_N, 32-1, -(BCBIAS_J*4 >> 16), BC_JMP, BC_ITERC, -(BCBIAS_J*4 >> 16));
9206 break; 9209 break;
9207 9210
9208 case BC_VARG: 9211 case BC_VARG:
9209 dasm_put(Dst, 6914, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base)); 9212 dasm_put(Dst, 6917, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base));
9210 dasm_put(Dst, 6994); 9213 dasm_put(Dst, 6997);
9211 break; 9214 break;
9212 9215
9213 /* -- Returns ----------------------------------------------------------- */ 9216 /* -- Returns ----------------------------------------------------------- */
9214 9217
9215 case BC_RETM: 9218 case BC_RETM:
9216 dasm_put(Dst, 7000); 9219 dasm_put(Dst, 7003);
9217 break; 9220 break;
9218 9221
9219 case BC_RET: 9222 case BC_RET:
9220 dasm_put(Dst, 7002, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP); 9223 dasm_put(Dst, 7005, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP);
9221 break; 9224 break;
9222 9225
9223 case BC_RET0: case BC_RET1: 9226 case BC_RET0: case BC_RET1:
9224 dasm_put(Dst, 7072, FRAME_TYPE, FRAME_VARG); 9227 dasm_put(Dst, 7075, FRAME_TYPE, FRAME_VARG);
9225 if (op == BC_RET1) { 9228 if (op == BC_RET1) {
9226 dasm_put(Dst, 7085); 9229 dasm_put(Dst, 7088);
9227 } 9230 }
9228 dasm_put(Dst, 7088, Dt7(->pc), PC2PROTO(k)); 9231 dasm_put(Dst, 7091, Dt7(->pc), PC2PROTO(k));
9229 break; 9232 break;
9230 9233
9231 /* -- Loops and branches ------------------------------------------------ */ 9234 /* -- Loops and branches ------------------------------------------------ */
9232 9235
9233 case BC_FORL: 9236 case BC_FORL:
9234#if LJ_HASJIT 9237#if LJ_HASJIT
9235 dasm_put(Dst, 7116, GG_DISP2HOT, -HOTCOUNT_LOOP); 9238 dasm_put(Dst, 7119, GG_DISP2HOT, -HOTCOUNT_LOOP);
9236#endif 9239#endif
9237 break; 9240 break;
9238 9241
@@ -9245,100 +9248,100 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
9245 case BC_IFORL: 9248 case BC_IFORL:
9246 vk = (op == BC_IFORL || op == BC_JFORL); 9249 vk = (op == BC_IFORL || op == BC_JFORL);
9247 if (LJ_DUALNUM) { 9250 if (LJ_DUALNUM) {
9248 dasm_put(Dst, 7126, FORL_IDX*8+4); 9251 dasm_put(Dst, 7129, FORL_IDX*8+4);
9249 if (vk) { 9252 if (vk) {
9250 dasm_put(Dst, 7131, FORL_STEP*8+4, FORL_STOP*8+4, FORL_IDX*8+4); 9253 dasm_put(Dst, 7134, FORL_STEP*8+4, FORL_STOP*8+4, FORL_IDX*8+4);
9251 } else { 9254 } else {
9252 dasm_put(Dst, 7145, FORL_STEP*8, FORL_STEP*8+4, FORL_STOP*8, FORL_STOP*8+4); 9255 dasm_put(Dst, 7148, FORL_STEP*8, FORL_STEP*8+4, FORL_STOP*8, FORL_STOP*8+4);
9253 } 9256 }
9254 dasm_put(Dst, 7161, FORL_EXT*8); 9257 dasm_put(Dst, 7164, FORL_EXT*8);
9255 if (op != BC_JFORL) { 9258 if (op != BC_JFORL) {
9256 dasm_put(Dst, 7168, 32-1); 9259 dasm_put(Dst, 7171, 32-1);
9257 } 9260 }
9258 dasm_put(Dst, 7171, FORL_EXT*8+4); 9261 dasm_put(Dst, 7174, FORL_EXT*8+4);
9259 if (op != BC_JFORL) { 9262 if (op != BC_JFORL) {
9260 dasm_put(Dst, 7174); 9263 dasm_put(Dst, 7177);
9261 } 9264 }
9262 if (op == BC_FORI) { 9265 if (op == BC_FORI) {
9263 dasm_put(Dst, 7176); 9266 dasm_put(Dst, 7179);
9264 } else if (op == BC_JFORI) { 9267 } else if (op == BC_JFORI) {
9265 dasm_put(Dst, 7179, -(BCBIAS_J*4 >> 16)); 9268 dasm_put(Dst, 7182, -(BCBIAS_J*4 >> 16));
9266 } else if (op == BC_IFORL) { 9269 } else if (op == BC_IFORL) {
9267 dasm_put(Dst, 7184, -(BCBIAS_J*4 >> 16)); 9270 dasm_put(Dst, 7187, -(BCBIAS_J*4 >> 16));
9268 } else { 9271 } else {
9269 dasm_put(Dst, 7189, BC_JLOOP); 9272 dasm_put(Dst, 7192, BC_JLOOP);
9270 } 9273 }
9271 dasm_put(Dst, 7192); 9274 dasm_put(Dst, 7195);
9272 if (vk) { 9275 if (vk) {
9273 dasm_put(Dst, 7208); 9276 dasm_put(Dst, 7211);
9274 } 9277 }
9275 } 9278 }
9276 if (vk) { 9279 if (vk) {
9277 if (LJ_DUALNUM) { 9280 if (LJ_DUALNUM) {
9278 dasm_put(Dst, 7215, FORL_IDX*8); 9281 dasm_put(Dst, 7218, FORL_IDX*8);
9279 } else { 9282 } else {
9280 dasm_put(Dst, 7219); 9283 dasm_put(Dst, 7222);
9281 } 9284 }
9282 dasm_put(Dst, 7221, FORL_STEP*8, FORL_STOP*8, FORL_STEP*8, FORL_IDX*8); 9285 dasm_put(Dst, 7224, FORL_STEP*8, FORL_STOP*8, FORL_STEP*8, FORL_IDX*8);
9283 } else { 9286 } else {
9284 if (LJ_DUALNUM) { 9287 if (LJ_DUALNUM) {
9285 dasm_put(Dst, 7231); 9288 dasm_put(Dst, 7234);
9286 } else { 9289 } else {
9287 dasm_put(Dst, 7233, FORL_STEP*8, FORL_STOP*8); 9290 dasm_put(Dst, 7236, FORL_STEP*8, FORL_STOP*8);
9288 } 9291 }
9289 dasm_put(Dst, 7242, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8); 9292 dasm_put(Dst, 7245, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8);
9290 } 9293 }
9291 dasm_put(Dst, 7253); 9294 dasm_put(Dst, 7256);
9292 if (op != BC_JFORL) { 9295 if (op != BC_JFORL) {
9293 dasm_put(Dst, 7255, 32-1); 9296 dasm_put(Dst, 7258, 32-1);
9294 } 9297 }
9295 dasm_put(Dst, 7258, FORL_EXT*8); 9298 dasm_put(Dst, 7261, FORL_EXT*8);
9296 if (op != BC_JFORL) { 9299 if (op != BC_JFORL) {
9297 dasm_put(Dst, 7261); 9300 dasm_put(Dst, 7264);
9298 } 9301 }
9299 dasm_put(Dst, 7263); 9302 dasm_put(Dst, 7266);
9300 if (op == BC_JFORI) { 9303 if (op == BC_JFORI) {
9301 dasm_put(Dst, 7265, -(BCBIAS_J*4 >> 16)); 9304 dasm_put(Dst, 7268, -(BCBIAS_J*4 >> 16));
9302 } 9305 }
9303 dasm_put(Dst, 7268); 9306 dasm_put(Dst, 7271);
9304 if (op == BC_FORI) { 9307 if (op == BC_FORI) {
9305 dasm_put(Dst, 7271); 9308 dasm_put(Dst, 7274);
9306 } else if (op == BC_IFORL) { 9309 } else if (op == BC_IFORL) {
9307 if (LJ_DUALNUM) { 9310 if (LJ_DUALNUM) {
9308 dasm_put(Dst, 7274);
9309 } else {
9310 dasm_put(Dst, 7277); 9311 dasm_put(Dst, 7277);
9312 } else {
9313 dasm_put(Dst, 7280);
9311 } 9314 }
9312 dasm_put(Dst, 7280, -(BCBIAS_J*4 >> 16)); 9315 dasm_put(Dst, 7283, -(BCBIAS_J*4 >> 16));
9313 } else if (op == BC_JFORI) { 9316 } else if (op == BC_JFORI) {
9314 dasm_put(Dst, 7284); 9317 dasm_put(Dst, 7287);
9315 } else { 9318 } else {
9316 dasm_put(Dst, 7287, BC_JLOOP); 9319 dasm_put(Dst, 7290, BC_JLOOP);
9317 } 9320 }
9318 if (LJ_DUALNUM) { 9321 if (LJ_DUALNUM) {
9319 dasm_put(Dst, 7290);
9320 } else {
9321 dasm_put(Dst, 7293); 9322 dasm_put(Dst, 7293);
9323 } else {
9324 dasm_put(Dst, 7296);
9322 } 9325 }
9323 dasm_put(Dst, 7305); 9326 dasm_put(Dst, 7308);
9324 if (op == BC_FORI) { 9327 if (op == BC_FORI) {
9325 dasm_put(Dst, 7307, -(BCBIAS_J*4 >> 16)); 9328 dasm_put(Dst, 7310, -(BCBIAS_J*4 >> 16));
9326 } else if (op == BC_IFORL) { 9329 } else if (op == BC_IFORL) {
9327 dasm_put(Dst, 7313);
9328 } else if (op == BC_JFORI) {
9329 dasm_put(Dst, 7316); 9330 dasm_put(Dst, 7316);
9331 } else if (op == BC_JFORI) {
9332 dasm_put(Dst, 7319);
9330 } else { 9333 } else {
9331 dasm_put(Dst, 7319, BC_JLOOP); 9334 dasm_put(Dst, 7322, BC_JLOOP);
9332 } 9335 }
9333 dasm_put(Dst, 7322); 9336 dasm_put(Dst, 7325);
9334 if (op == BC_JFORI) { 9337 if (op == BC_JFORI) {
9335 dasm_put(Dst, 7325, BC_JLOOP); 9338 dasm_put(Dst, 7328, BC_JLOOP);
9336 } 9339 }
9337 break; 9340 break;
9338 9341
9339 case BC_ITERL: 9342 case BC_ITERL:
9340#if LJ_HASJIT 9343#if LJ_HASJIT
9341 dasm_put(Dst, 7331, GG_DISP2HOT, -HOTCOUNT_LOOP); 9344 dasm_put(Dst, 7334, GG_DISP2HOT, -HOTCOUNT_LOOP);
9342#endif 9345#endif
9343 break; 9346 break;
9344 9347
@@ -9347,40 +9350,40 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
9347 break; 9350 break;
9348#endif 9351#endif
9349 case BC_IITERL: 9352 case BC_IITERL:
9350 dasm_put(Dst, 7341, LJ_TNIL); 9353 dasm_put(Dst, 7344, LJ_TNIL);
9351 if (op == BC_JITERL) { 9354 if (op == BC_JITERL) {
9352 dasm_put(Dst, 7348, BC_JLOOP); 9355 dasm_put(Dst, 7351, BC_JLOOP);
9353 } else { 9356 } else {
9354 dasm_put(Dst, 7353, 32-1, -(BCBIAS_J*4 >> 16)); 9357 dasm_put(Dst, 7356, 32-1, -(BCBIAS_J*4 >> 16));
9355 } 9358 }
9356 dasm_put(Dst, 7361); 9359 dasm_put(Dst, 7364);
9357 break; 9360 break;
9358 9361
9359 case BC_LOOP: 9362 case BC_LOOP:
9360#if LJ_HASJIT 9363#if LJ_HASJIT
9361 dasm_put(Dst, 7373, GG_DISP2HOT, -HOTCOUNT_LOOP); 9364 dasm_put(Dst, 7376, GG_DISP2HOT, -HOTCOUNT_LOOP);
9362#endif 9365#endif
9363 break; 9366 break;
9364 9367
9365 case BC_ILOOP: 9368 case BC_ILOOP:
9366 dasm_put(Dst, 7383); 9369 dasm_put(Dst, 7386);
9367 break; 9370 break;
9368 9371
9369 case BC_JLOOP: 9372 case BC_JLOOP:
9370#if LJ_HASJIT 9373#if LJ_HASJIT
9371 dasm_put(Dst, 7394, DISPATCH_J(trace), 32-1, DISPATCH_GL(vmstate), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L), GG_DISP2G+32768); 9374 dasm_put(Dst, 7397, DISPATCH_J(trace), 32-1, DISPATCH_GL(vmstate), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L), GG_DISP2G+32768);
9372#endif 9375#endif
9373 break; 9376 break;
9374 9377
9375 case BC_JMP: 9378 case BC_JMP:
9376 dasm_put(Dst, 7413, 32-1, -(BCBIAS_J*4 >> 16)); 9379 dasm_put(Dst, 7416, 32-1, -(BCBIAS_J*4 >> 16));
9377 break; 9380 break;
9378 9381
9379 /* -- Function headers -------------------------------------------------- */ 9382 /* -- Function headers -------------------------------------------------- */
9380 9383
9381 case BC_FUNCF: 9384 case BC_FUNCF:
9382#if LJ_HASJIT 9385#if LJ_HASJIT
9383 dasm_put(Dst, 7429, GG_DISP2HOT, -HOTCOUNT_CALL); 9386 dasm_put(Dst, 7432, GG_DISP2HOT, -HOTCOUNT_CALL);
9384#endif 9387#endif
9385 case BC_FUNCV: /* NYI: compiled vararg functions. */ 9388 case BC_FUNCV: /* NYI: compiled vararg functions. */
9386 break; 9389 break;
@@ -9390,42 +9393,42 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
9390 break; 9393 break;
9391#endif 9394#endif
9392 case BC_IFUNCF: 9395 case BC_IFUNCF:
9393 dasm_put(Dst, 7439, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3); 9396 dasm_put(Dst, 7442, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3);
9394 if (op != BC_JFUNCF) { 9397 if (op != BC_JFUNCF) {
9395 dasm_put(Dst, 7451); 9398 dasm_put(Dst, 7454);
9396 } 9399 }
9397 dasm_put(Dst, 7454); 9400 dasm_put(Dst, 7457);
9398 if (op == BC_JFUNCF) { 9401 if (op == BC_JFUNCF) {
9399 dasm_put(Dst, 7459, BC_JLOOP); 9402 dasm_put(Dst, 7462, BC_JLOOP);
9400 } else { 9403 } else {
9401 dasm_put(Dst, 7463); 9404 dasm_put(Dst, 7466);
9402 } 9405 }
9403 dasm_put(Dst, 7472); 9406 dasm_put(Dst, 7475);
9404 break; 9407 break;
9405 9408
9406 case BC_JFUNCV: 9409 case BC_JFUNCV:
9407#if !LJ_HASJIT 9410#if !LJ_HASJIT
9408 break; 9411 break;
9409#endif 9412#endif
9410 dasm_put(Dst, 7478); 9413 dasm_put(Dst, 7481);
9411 break; /* NYI: compiled vararg functions. */ 9414 break; /* NYI: compiled vararg functions. */
9412 9415
9413 case BC_IFUNCV: 9416 case BC_IFUNCV:
9414 dasm_put(Dst, 7480, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams), LJ_TNIL); 9417 dasm_put(Dst, 7483, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams), LJ_TNIL);
9415 break; 9418 break;
9416 9419
9417 case BC_FUNCC: 9420 case BC_FUNCC:
9418 case BC_FUNCCW: 9421 case BC_FUNCCW:
9419 if (op == BC_FUNCC) { 9422 if (op == BC_FUNCC) {
9420 dasm_put(Dst, 7533, Dt8(->f)); 9423 dasm_put(Dst, 7536, Dt8(->f));
9421 } else { 9424 } else {
9422 dasm_put(Dst, 7536, DISPATCH_GL(wrapf)); 9425 dasm_put(Dst, 7539, DISPATCH_GL(wrapf));
9423 } 9426 }
9424 dasm_put(Dst, 7539, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C); 9427 dasm_put(Dst, 7542, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C);
9425 if (op == BC_FUNCCW) { 9428 if (op == BC_FUNCCW) {
9426 dasm_put(Dst, 7552, Dt8(->f)); 9429 dasm_put(Dst, 7555, Dt8(->f));
9427 } 9430 }
9428 dasm_put(Dst, 7555, DISPATCH_GL(vmstate), Dt1(->base), 31-3, Dt1(->top), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate)); 9431 dasm_put(Dst, 7558, DISPATCH_GL(vmstate), Dt1(->base), 31-3, Dt1(->top), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate));
9429 break; 9432 break;
9430 9433
9431 /* ---------------------------------------------------------------------- */ 9434 /* ---------------------------------------------------------------------- */
@@ -9445,7 +9448,7 @@ static int build_backend(BuildCtx *ctx)
9445 9448
9446 build_subroutines(ctx); 9449 build_subroutines(ctx);
9447 9450
9448 dasm_put(Dst, 7576); 9451 dasm_put(Dst, 7579);
9449 for (op = 0; op < BC__MAX; op++) 9452 for (op = 0; op < BC__MAX; op++)
9450 build_ins(ctx, (BCOp)op, op); 9453 build_ins(ctx, (BCOp)op, op);
9451 9454
@@ -9455,6 +9458,7 @@ static int build_backend(BuildCtx *ctx)
9455/* Emit pseudo frame-info for all assembler functions. */ 9458/* Emit pseudo frame-info for all assembler functions. */
9456static void emit_asm_debug(BuildCtx *ctx) 9459static void emit_asm_debug(BuildCtx *ctx)
9457{ 9460{
9461 int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
9458 int i; 9462 int i;
9459 switch (ctx->mode) { 9463 switch (ctx->mode) {
9460 case BUILD_elfasm: 9464 case BUILD_elfasm:
@@ -9482,7 +9486,7 @@ static void emit_asm_debug(BuildCtx *ctx)
9482 "\t.byte 0xe\n\t.uleb128 %d\n" 9486 "\t.byte 0xe\n\t.uleb128 %d\n"
9483 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n" 9487 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
9484 "\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n", 9488 "\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n",
9485 (int)ctx->codesz, CFRAME_SIZE); 9489 fcofs, CFRAME_SIZE);
9486 for (i = 14; i <= 31; i++) 9490 for (i = 14; i <= 31; i++)
9487 fprintf(ctx->fp, 9491 fprintf(ctx->fp,
9488 "\t.byte %d\n\t.uleb128 %d\n" 9492 "\t.byte %d\n\t.uleb128 %d\n"
@@ -9491,6 +9495,20 @@ static void emit_asm_debug(BuildCtx *ctx)
9491 fprintf(ctx->fp, 9495 fprintf(ctx->fp,
9492 "\t.align 2\n" 9496 "\t.align 2\n"
9493 ".LEFDE0:\n\n"); 9497 ".LEFDE0:\n\n");
9498#if LJ_HASFFI
9499 fprintf(ctx->fp,
9500 ".LSFDE1:\n"
9501 "\t.long .LEFDE1-.LASFDE1\n"
9502 ".LASFDE1:\n"
9503 "\t.long .Lframe0\n"
9504 "\t.long lj_vm_ffi_call\n"
9505 "\t.long %d\n"
9506 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
9507 "\t.byte 0x8e\n\t.uleb128 2\n"
9508 "\t.byte 0xd\n\t.uleb128 0xe\n"
9509 "\t.align 2\n"
9510 ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
9511#endif
9494 fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@progbits\n"); 9512 fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@progbits\n");
9495 fprintf(ctx->fp, 9513 fprintf(ctx->fp,
9496 ".Lframe1:\n" 9514 ".Lframe1:\n"
@@ -9510,17 +9528,17 @@ static void emit_asm_debug(BuildCtx *ctx)
9510 "\t.align 2\n" 9528 "\t.align 2\n"
9511 ".LECIE1:\n\n"); 9529 ".LECIE1:\n\n");
9512 fprintf(ctx->fp, 9530 fprintf(ctx->fp,
9513 ".LSFDE1:\n" 9531 ".LSFDE2:\n"
9514 "\t.long .LEFDE1-.LASFDE1\n" 9532 "\t.long .LEFDE2-.LASFDE2\n"
9515 ".LASFDE1:\n" 9533 ".LASFDE2:\n"
9516 "\t.long .LASFDE1-.Lframe1\n" 9534 "\t.long .LASFDE2-.Lframe1\n"
9517 "\t.long .Lbegin-.\n" 9535 "\t.long .Lbegin-.\n"
9518 "\t.long %d\n" 9536 "\t.long %d\n"
9519 "\t.uleb128 0\n" /* augmentation length */ 9537 "\t.uleb128 0\n" /* augmentation length */
9520 "\t.byte 0xe\n\t.uleb128 %d\n" 9538 "\t.byte 0xe\n\t.uleb128 %d\n"
9521 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n" 9539 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
9522 "\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n", 9540 "\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n",
9523 (int)ctx->codesz, CFRAME_SIZE); 9541 fcofs, CFRAME_SIZE);
9524 for (i = 14; i <= 31; i++) 9542 for (i = 14; i <= 31; i++)
9525 fprintf(ctx->fp, 9543 fprintf(ctx->fp,
9526 "\t.byte %d\n\t.uleb128 %d\n" 9544 "\t.byte %d\n\t.uleb128 %d\n"
@@ -9528,7 +9546,37 @@ static void emit_asm_debug(BuildCtx *ctx)
9528 0x80+i, 37+(31-i), 0x80+32+i, 2+2*(31-i)); 9546 0x80+i, 37+(31-i), 0x80+32+i, 2+2*(31-i));
9529 fprintf(ctx->fp, 9547 fprintf(ctx->fp,
9530 "\t.align 2\n" 9548 "\t.align 2\n"
9531 ".LEFDE1:\n\n"); 9549 ".LEFDE2:\n\n");
9550#if LJ_HASFFI
9551 fprintf(ctx->fp,
9552 ".Lframe2:\n"
9553 "\t.long .LECIE2-.LSCIE2\n"
9554 ".LSCIE2:\n"
9555 "\t.long 0\n"
9556 "\t.byte 0x1\n"
9557 "\t.string \"zR\"\n"
9558 "\t.uleb128 0x1\n"
9559 "\t.sleb128 -4\n"
9560 "\t.byte 65\n"
9561 "\t.uleb128 1\n" /* augmentation length */
9562 "\t.byte 0x1b\n" /* pcrel|sdata4 */
9563 "\t.byte 0xc\n\t.uleb128 1\n\t.uleb128 0\n"
9564 "\t.align 2\n"
9565 ".LECIE2:\n\n");
9566 fprintf(ctx->fp,
9567 ".LSFDE3:\n"
9568 "\t.long .LEFDE3-.LASFDE3\n"
9569 ".LASFDE3:\n"
9570 "\t.long .LASFDE3-.Lframe2\n"
9571 "\t.long lj_vm_ffi_call-.\n"
9572 "\t.long %d\n"
9573 "\t.uleb128 0\n" /* augmentation length */
9574 "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
9575 "\t.byte 0x8e\n\t.uleb128 2\n"
9576 "\t.byte 0xd\n\t.uleb128 0xe\n"
9577 "\t.align 2\n"
9578 ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
9579#endif
9532 break; 9580 break;
9533 default: 9581 default:
9534 break; 9582 break;
diff --git a/src/buildvm_x64.h b/src/buildvm_x64.h
index bd4ab408..06d6b038 100644
--- a/src/buildvm_x64.h
+++ b/src/buildvm_x64.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[16164] = { 15static const unsigned char build_actionlist[16165] = {
16 254,1,248,10,252,247,195,237,15,132,244,11,131,227,252,248,41,218,72,141, 16 254,1,248,10,252,247,195,237,15,132,244,11,131,227,252,248,41,218,72,141,
17 76,25,252,248,139,90,252,252,199,68,10,4,237,248,12,131,192,1,137,68,36,4, 17 76,25,252,248,139,90,252,252,199,68,10,4,237,248,12,131,192,1,137,68,36,4,
18 252,247,195,237,15,132,244,13,248,14,129,252,243,239,252,247,195,237,15,133, 18 252,247,195,237,15,132,244,13,248,14,129,252,243,239,252,247,195,237,15,133,
@@ -489,75 +489,75 @@ static const unsigned char build_actionlist[16164] = {
489 223,224,252,246,196,1,15,132,244,248,217,201,248,2,221,216,195,248,1,221, 489 223,224,252,246,196,1,15,132,244,248,217,201,248,2,221,216,195,248,1,221,
490 225,223,224,252,246,196,1,15,133,244,248,217,201,248,2,221,216,195,255,248, 490 225,223,224,252,246,196,1,15,133,244,248,217,201,248,2,221,216,195,255,248,
491 163,137,252,248,83,15,162,137,6,137,94,4,137,78,8,137,86,12,91,195,248,164, 491 163,137,252,248,83,15,162,137,6,137,94,4,137,78,8,137,86,12,91,195,248,164,
492 255,85,72,137,229,83,72,137,252,251,139,131,233,72,41,196,255,15,182,139, 492 255,204,248,165,255,85,72,137,229,83,72,137,252,251,139,131,233,72,41,196,
493 233,131,252,233,1,15,136,244,248,248,1,72,139,132,253,203,233,72,137,132, 493 255,15,182,139,233,131,252,233,1,15,136,244,248,248,1,72,139,132,253,203,
494 253,204,233,131,252,233,1,15,137,244,1,248,2,15,182,131,233,72,139,187,233, 494 233,72,137,132,253,204,233,131,252,233,1,15,137,244,1,248,2,15,182,131,233,
495 72,139,179,233,72,139,147,233,72,139,139,233,76,139,131,233,76,139,139,233, 495 72,139,187,233,72,139,179,233,72,139,147,233,72,139,139,233,76,139,131,233,
496 133,192,15,132,244,251,15,40,131,233,15,40,139,233,255,15,40,147,233,15,40, 496 76,139,139,233,133,192,15,132,244,251,15,40,131,233,15,40,139,233,255,15,
497 155,233,131,252,248,4,15,134,244,251,15,40,163,233,15,40,171,233,15,40,179, 497 40,147,233,15,40,155,233,131,252,248,4,15,134,244,251,15,40,163,233,15,40,
498 233,15,40,187,233,248,5,252,255,147,233,72,137,131,233,15,41,131,233,72,137, 498 171,233,15,40,179,233,15,40,187,233,248,5,252,255,147,233,72,137,131,233,
499 147,233,15,41,139,233,255,72,139,93,252,248,201,195,255,248,165,255,249,255, 499 15,41,131,233,72,137,147,233,15,41,139,233,255,72,139,93,252,248,201,195,
500 129,124,253,202,4,239,15,133,244,253,129,124,253,194,4,239,15,133,244,254, 500 255,249,255,129,124,253,202,4,239,15,133,244,253,129,124,253,194,4,239,15,
501 139,44,202,131,195,4,59,44,194,255,15,141,244,255,255,15,140,244,255,255, 501 133,244,254,139,44,202,131,195,4,59,44,194,255,15,141,244,255,255,15,140,
502 15,143,244,255,255,15,142,244,255,255,248,6,15,183,67,252,254,141,156,253, 502 244,255,255,15,143,244,255,255,15,142,244,255,255,248,6,15,183,67,252,254,
503 131,233,248,9,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255, 503 141,156,253,131,233,248,9,139,3,15,182,204,15,182,232,131,195,4,193,232,16,
504 36,252,238,248,7,15,135,244,43,129,124,253,194,4,239,15,130,244,247,15,133, 504 65,252,255,36,252,238,248,7,15,135,244,43,129,124,253,194,4,239,15,130,244,
505 244,43,255,252,242,15,42,4,194,252,233,244,248,255,221,4,202,219,4,194,252, 505 247,15,133,244,43,255,252,242,15,42,4,194,252,233,244,248,255,221,4,202,219,
506 233,244,249,255,248,8,15,135,244,43,255,252,242,15,42,12,202,252,242,15,16, 506 4,194,252,233,244,249,255,248,8,15,135,244,43,255,252,242,15,42,12,202,252,
507 4,194,131,195,4,102,15,46,193,255,15,134,244,9,255,15,135,244,9,255,15,130, 507 242,15,16,4,194,131,195,4,102,15,46,193,255,15,134,244,9,255,15,135,244,9,
508 244,9,255,15,131,244,9,255,252,233,244,6,255,219,4,202,252,233,244,248,255, 508 255,15,130,244,9,255,15,131,244,9,255,252,233,244,6,255,219,4,202,252,233,
509 129,124,253,202,4,239,15,131,244,43,129,124,253,194,4,239,15,131,244,43,255, 509 244,248,255,129,124,253,202,4,239,15,131,244,43,129,124,253,194,4,239,15,
510 248,1,252,242,15,16,4,194,248,2,131,195,4,102,15,46,4,202,248,3,255,248,1, 510 131,244,43,255,248,1,252,242,15,16,4,194,248,2,131,195,4,102,15,46,4,202,
511 221,4,202,248,2,221,4,194,248,3,131,195,4,255,223,252,233,221,216,255,218, 511 248,3,255,248,1,221,4,202,248,2,221,4,194,248,3,131,195,4,255,223,252,233,
512 252,233,223,224,158,255,15,134,244,247,255,15,135,244,247,255,15,130,244, 512 221,216,255,218,252,233,223,224,158,255,15,134,244,247,255,15,135,244,247,
513 247,255,15,131,244,247,255,15,183,67,252,254,141,156,253,131,233,248,1,139, 513 255,15,130,244,247,255,15,131,244,247,255,15,183,67,252,254,141,156,253,131,
514 3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,255,139, 514 233,248,1,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,
515 108,194,4,131,195,4,255,129,252,253,239,15,133,244,253,129,124,253,202,4, 515 252,238,255,139,108,194,4,131,195,4,255,129,252,253,239,15,133,244,253,129,
516 239,15,133,244,254,139,44,194,59,44,202,255,15,133,244,255,255,15,132,244, 516 124,253,202,4,239,15,133,244,254,139,44,194,59,44,202,255,15,133,244,255,
517 255,255,15,183,67,252,254,141,156,253,131,233,248,9,139,3,15,182,204,15,182, 517 255,15,132,244,255,255,15,183,67,252,254,141,156,253,131,233,248,9,139,3,
518 232,131,195,4,193,232,16,65,252,255,36,252,238,248,7,15,135,244,251,129,124, 518 15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,7,15,
519 253,202,4,239,15,130,244,247,15,133,244,251,255,252,242,15,42,4,202,255,219, 519 135,244,251,129,124,253,202,4,239,15,130,244,247,15,133,244,251,255,252,242,
520 4,202,255,252,233,244,248,248,8,15,135,244,251,255,252,242,15,42,4,194,102, 520 15,42,4,202,255,219,4,202,255,252,233,244,248,248,8,15,135,244,251,255,252,
521 15,46,4,202,255,219,4,194,221,4,202,255,252,233,244,250,255,129,252,253,239, 521 242,15,42,4,194,102,15,46,4,202,255,219,4,194,221,4,202,255,252,233,244,250,
522 15,131,244,251,129,124,253,202,4,239,15,131,244,251,255,248,1,252,242,15, 522 255,129,252,253,239,15,131,244,251,129,124,253,202,4,239,15,131,244,251,255,
523 16,4,202,248,2,102,15,46,4,194,248,4,255,248,1,221,4,202,248,2,221,4,194, 523 248,1,252,242,15,16,4,202,248,2,102,15,46,4,194,248,4,255,248,1,221,4,202,
524 248,4,255,15,138,244,248,15,133,244,248,255,15,138,244,248,15,132,244,247, 524 248,2,221,4,194,248,4,255,15,138,244,248,15,133,244,248,255,15,138,244,248,
525 255,248,1,15,183,67,252,254,141,156,253,131,233,248,2,255,248,2,15,183,67, 525 15,132,244,247,255,248,1,15,183,67,252,254,141,156,253,131,233,248,2,255,
526 252,254,141,156,253,131,233,248,1,255,252,233,244,9,255,248,5,255,129,252, 526 248,2,15,183,67,252,254,141,156,253,131,233,248,1,255,252,233,244,9,255,248,
527 253,239,15,132,244,48,129,124,253,202,4,239,15,132,244,48,255,57,108,202, 527 5,255,129,252,253,239,15,132,244,48,129,124,253,202,4,239,15,132,244,48,255,
528 4,15,133,244,2,129,252,253,239,15,131,244,1,139,12,202,139,4,194,57,193,15, 528 57,108,202,4,15,133,244,2,129,252,253,239,15,131,244,1,139,12,202,139,4,194,
529 132,244,1,129,252,253,239,15,135,244,2,129,252,253,239,15,130,244,2,139,169, 529 57,193,15,132,244,1,129,252,253,239,15,135,244,2,129,252,253,239,15,130,244,
530 233,133,252,237,15,132,244,2,252,246,133,233,235,15,133,244,2,255,49,252, 530 2,139,169,233,133,252,237,15,132,244,2,252,246,133,233,235,15,133,244,2,255,
531 237,255,189,1,0,0,0,255,252,233,244,47,255,248,3,129,252,253,239,255,15,133, 531 49,252,237,255,189,1,0,0,0,255,252,233,244,47,255,248,3,129,252,253,239,255,
532 244,9,255,252,233,244,48,255,72,252,247,208,139,108,202,4,131,195,4,129,252, 532 15,133,244,9,255,252,233,244,48,255,72,252,247,208,139,108,202,4,131,195,
533 253,239,15,133,244,249,139,12,202,65,59,12,135,255,139,108,202,4,131,195, 533 4,129,252,253,239,15,133,244,249,139,12,202,65,59,12,135,255,139,108,202,
534 4,255,129,252,253,239,15,133,244,253,65,129,124,253,199,4,239,15,133,244, 534 4,131,195,4,255,129,252,253,239,15,133,244,253,65,129,124,253,199,4,239,15,
535 254,65,139,44,199,59,44,202,255,15,183,67,252,254,141,156,253,131,233,248, 535 133,244,254,65,139,44,199,59,44,202,255,15,183,67,252,254,141,156,253,131,
536 9,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238, 536 233,248,9,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,
537 248,7,15,135,244,249,65,129,124,253,199,4,239,15,130,244,247,255,252,242, 537 252,238,248,7,15,135,244,249,65,129,124,253,199,4,239,15,130,244,247,255,
538 65,15,42,4,199,255,65,219,4,199,255,252,233,244,248,248,8,255,252,242,15, 538 252,242,65,15,42,4,199,255,65,219,4,199,255,252,233,244,248,248,8,255,252,
539 42,4,202,102,65,15,46,4,199,255,219,4,202,65,221,4,199,255,129,252,253,239, 539 242,15,42,4,202,102,65,15,46,4,199,255,219,4,202,65,221,4,199,255,129,252,
540 15,131,244,249,255,248,1,252,242,65,15,16,4,199,248,2,102,15,46,4,202,248, 540 253,239,15,131,244,249,255,248,1,252,242,65,15,16,4,199,248,2,102,15,46,4,
541 4,255,248,1,65,221,4,199,248,2,221,4,202,248,4,255,72,252,247,208,139,108, 541 202,248,4,255,248,1,65,221,4,199,248,2,221,4,202,248,4,255,72,252,247,208,
542 202,4,131,195,4,57,197,255,15,133,244,249,15,183,67,252,254,141,156,253,131, 542 139,108,202,4,131,195,4,57,197,255,15,133,244,249,15,183,67,252,254,141,156,
543 233,248,2,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36, 543 253,131,233,248,2,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,
544 252,238,248,3,129,252,253,239,15,133,244,2,252,233,244,48,255,15,132,244, 544 255,36,252,238,248,3,129,252,253,239,15,133,244,2,252,233,244,48,255,15,132,
545 248,129,252,253,239,15,132,244,48,15,183,67,252,254,141,156,253,131,233,248, 545 244,248,129,252,253,239,15,132,244,48,15,183,67,252,254,141,156,253,131,233,
546 2,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238, 546 248,2,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,
547 255,139,108,194,4,131,195,4,129,252,253,239,255,137,108,202,4,139,44,194, 547 238,255,139,108,194,4,131,195,4,129,252,253,239,255,137,108,202,4,139,44,
548 137,44,202,255,72,139,44,194,72,137,44,202,139,3,15,182,204,15,182,232,131, 548 194,137,44,202,255,72,139,44,194,72,137,44,202,139,3,15,182,204,15,182,232,
549 195,4,193,232,16,65,252,255,36,252,238,255,49,252,237,129,124,253,194,4,239, 549 131,195,4,193,232,16,65,252,255,36,252,238,255,49,252,237,129,124,253,194,
550 129,213,239,137,108,202,4,139,3,15,182,204,15,182,232,131,195,4,193,232,16, 550 4,239,129,213,239,137,108,202,4,139,3,15,182,204,15,182,232,131,195,4,193,
551 65,252,255,36,252,238,255,129,124,253,194,4,239,15,133,244,251,139,44,194, 551 232,16,65,252,255,36,252,238,255,129,124,253,194,4,239,15,133,244,251,139,
552 252,247,221,15,128,244,250,199,68,202,4,237,137,44,202,248,9,139,3,15,182, 552 44,194,252,247,221,15,128,244,250,199,68,202,4,237,137,44,202,248,9,139,3,
553 204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,4,199,68,202, 553 15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,4,199,
554 4,0,0,224,65,199,4,202,0,0,0,0,252,233,244,9,248,5,15,135,244,53,255,129, 554 68,202,4,0,0,224,65,199,4,202,0,0,0,0,252,233,244,9,248,5,15,135,244,53,255,
555 124,253,194,4,239,15,131,244,53,255,252,242,15,16,4,194,72,184,237,237,102, 555 129,124,253,194,4,239,15,131,244,53,255,252,242,15,16,4,194,72,184,237,237,
556 72,15,110,200,15,87,193,252,242,15,17,4,202,255,221,4,194,217,224,221,28, 556 102,72,15,110,200,15,87,193,252,242,15,17,4,202,255,221,4,194,217,224,221,
557 202,255,129,124,253,194,4,239,15,133,244,248,139,4,194,255,139,128,233,248, 557 28,202,255,129,124,253,194,4,239,15,133,244,248,139,4,194,255,139,128,233,
558 1,199,68,202,4,237,137,4,202,255,15,87,192,252,242,15,42,128,233,248,1,252, 558 248,1,199,68,202,4,237,137,4,202,255,15,87,192,252,242,15,42,128,233,248,
559 242,15,17,4,202,255,219,128,233,248,1,221,28,202,255,139,3,15,182,204,15, 559 1,252,242,15,17,4,202,255,219,128,233,248,1,221,28,202,255,139,3,15,182,204,
560 182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,2,129,124,253,194, 560 15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,2,129,124,253,194,
561 4,239,15,133,244,56,139,60,194,255,139,175,233,131,252,253,0,15,133,244,255, 561 4,239,15,133,244,56,139,60,194,255,139,175,233,131,252,253,0,15,133,244,255,
562 248,3,255,248,57,137,213,232,251,1,21,255,252,242,15,42,192,255,137,252,234, 562 248,3,255,248,57,137,213,232,251,1,21,255,252,242,15,42,192,255,137,252,234,
563 15,182,75,252,253,252,233,244,1,255,248,9,252,246,133,233,235,15,133,244, 563 15,182,75,252,253,252,233,244,1,255,248,9,252,246,133,233,235,15,133,244,
@@ -754,8 +754,8 @@ static const unsigned char build_actionlist[16164] = {
754 255,1,252,233,255,137,221,209,252,237,129,229,239,102,65,129,172,253,46,233, 754 255,1,252,233,255,137,221,209,252,237,129,229,239,102,65,129,172,253,46,233,
755 238,15,130,244,148,255,141,12,202,255,129,121,253,4,239,15,133,244,255,255, 755 238,15,130,244,148,255,141,12,202,255,129,121,253,4,239,15,133,244,255,255,
756 129,121,253,12,239,15,133,244,60,129,121,253,20,239,15,133,244,60,139,41, 756 129,121,253,12,239,15,133,244,60,129,121,253,20,239,15,133,244,60,139,41,
757 131,121,16,0,15,140,244,251,255,129,121,253,12,239,15,133,244,165,129,121, 757 131,121,16,0,15,140,244,251,255,129,121,253,12,239,15,133,244,164,129,121,
758 253,20,239,15,133,244,165,255,139,105,16,133,252,237,15,136,244,251,3,41, 758 253,20,239,15,133,244,164,255,139,105,16,133,252,237,15,136,244,251,3,41,
759 15,128,244,247,137,41,255,59,105,8,199,65,28,237,137,105,24,255,15,142,244, 759 15,128,244,247,137,41,255,59,105,8,199,65,28,237,137,105,24,255,15,142,244,
760 253,248,1,248,6,141,156,253,131,233,255,141,156,253,131,233,15,183,67,252, 760 253,248,1,248,6,141,156,253,131,233,255,141,156,253,131,233,15,183,67,252,
761 254,15,142,245,248,1,248,6,255,15,143,244,253,248,6,141,156,253,131,233,248, 761 254,15,142,245,248,1,248,6,255,15,143,244,253,248,6,141,156,253,131,233,248,
@@ -763,7 +763,7 @@ static const unsigned char build_actionlist[16164] = {
763 252,238,248,5,255,3,41,15,128,244,1,137,41,255,15,141,244,7,255,141,156,253, 763 252,238,248,5,255,3,41,15,128,244,1,137,41,255,15,141,244,7,255,141,156,253,
764 131,233,15,183,67,252,254,15,141,245,255,15,140,244,7,255,252,233,244,6,248, 764 131,233,15,183,67,252,254,15,141,245,255,15,140,244,7,255,252,233,244,6,248,
765 9,255,129,121,253,4,239,255,15,131,244,60,129,121,253,12,239,15,131,244,60, 765 9,255,129,121,253,4,239,255,15,131,244,60,129,121,253,12,239,15,131,244,60,
766 255,129,121,253,12,239,15,131,244,165,129,121,253,20,239,15,131,244,165,255, 766 255,129,121,253,12,239,15,131,244,164,129,121,253,20,239,15,131,244,164,255,
767 139,105,20,255,129,252,253,239,15,131,244,60,255,252,242,15,16,1,252,242, 767 139,105,20,255,129,252,253,239,15,131,244,60,255,252,242,15,16,1,252,242,
768 15,16,73,8,255,252,242,15,88,65,16,252,242,15,17,1,133,252,237,15,136,244, 768 15,16,73,8,255,252,242,15,88,65,16,252,242,15,17,1,133,252,237,15,136,244,
769 249,255,15,140,244,249,255,102,15,46,200,248,1,252,242,15,17,65,24,255,221, 769 249,255,15,140,244,249,255,102,15,46,200,248,1,252,242,15,17,65,24,255,221,
@@ -950,8 +950,8 @@ enum {
950 GLOB_vm_foldfpm, 950 GLOB_vm_foldfpm,
951 GLOB_vm_foldarith, 951 GLOB_vm_foldarith,
952 GLOB_vm_cpuid, 952 GLOB_vm_cpuid,
953 GLOB_vm_ffi_call,
954 GLOB_assert_bad_for_arg_type, 953 GLOB_assert_bad_for_arg_type,
954 GLOB_vm_ffi_call,
955 GLOB_BC_MODVN_Z, 955 GLOB_BC_MODVN_Z,
956 GLOB_BC_TGETS_Z, 956 GLOB_BC_TGETS_Z,
957 GLOB_BC_TSETS_Z, 957 GLOB_BC_TSETS_Z,
@@ -1112,8 +1112,8 @@ static const char *const globnames[] = {
1112 "vm_foldfpm", 1112 "vm_foldfpm",
1113 "vm_foldarith", 1113 "vm_foldarith",
1114 "vm_cpuid", 1114 "vm_cpuid",
1115 "vm_ffi_call@4",
1116 "assert_bad_for_arg_type", 1115 "assert_bad_for_arg_type",
1116 "vm_ffi_call@4",
1117 "BC_MODVN_Z", 1117 "BC_MODVN_Z",
1118 "BC_TGETS_Z", 1118 "BC_TGETS_Z",
1119 "BC_TSETS_Z", 1119 "BC_TSETS_Z",
@@ -1834,29 +1834,28 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
1834 dasm_put(Dst, 9411); 1834 dasm_put(Dst, 9411);
1835 } 1835 }
1836 dasm_put(Dst, 9829); 1836 dasm_put(Dst, 9829);
1837#ifdef LUA_USE_ASSERT
1838 dasm_put(Dst, 9413);
1839#endif
1840 dasm_put(Dst, 9853);
1837#if LJ_HASFFI 1841#if LJ_HASFFI
1838#define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V) 1842#define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
1839 dasm_put(Dst, 9853, DtE(->spadj)); 1843 dasm_put(Dst, 9857, DtE(->spadj));
1840#if LJ_TARGET_WINDOWS 1844#if LJ_TARGET_WINDOWS
1841#endif 1845#endif
1842 dasm_put(Dst, 9869, DtE(->nsp), offsetof(CCallState, stack), CCALL_SPS_EXTRA*8, DtE(->nfpr), DtE(->gpr[0]), DtE(->gpr[1]), DtE(->gpr[2]), DtE(->gpr[3]), DtE(->gpr[4]), DtE(->gpr[5]), DtE(->fpr[0]), DtE(->fpr[1])); 1846 dasm_put(Dst, 9873, DtE(->nsp), offsetof(CCallState, stack), CCALL_SPS_EXTRA*8, DtE(->nfpr), DtE(->gpr[0]), DtE(->gpr[1]), DtE(->gpr[2]), DtE(->gpr[3]), DtE(->gpr[4]), DtE(->gpr[5]), DtE(->fpr[0]), DtE(->fpr[1]));
1843 dasm_put(Dst, 9948, DtE(->fpr[2]), DtE(->fpr[3]), DtE(->fpr[4]), DtE(->fpr[5]), DtE(->fpr[6]), DtE(->fpr[7]), DtE(->func), DtE(->gpr[0]), DtE(->fpr[0]), DtE(->gpr[1]), DtE(->fpr[1])); 1847 dasm_put(Dst, 9952, DtE(->fpr[2]), DtE(->fpr[3]), DtE(->fpr[4]), DtE(->fpr[5]), DtE(->fpr[6]), DtE(->fpr[7]), DtE(->func), DtE(->gpr[0]), DtE(->fpr[0]), DtE(->gpr[1]), DtE(->fpr[1]));
1844#if LJ_TARGET_WINDOWS 1848#if LJ_TARGET_WINDOWS
1845#endif 1849#endif
1846 dasm_put(Dst, 10003); 1850 dasm_put(Dst, 10007);
1847#endif
1848 dasm_put(Dst, 10011);
1849#ifdef LUA_USE_ASSERT
1850 dasm_put(Dst, 9413);
1851#endif 1851#endif
1852 dasm_put(Dst, 9413);
1853} 1852}
1854 1853
1855/* Generate the code for a single instruction. */ 1854/* Generate the code for a single instruction. */
1856static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse) 1855static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
1857{ 1856{
1858 int vk = 0; 1857 int vk = 0;
1859 dasm_put(Dst, 10014, defop); 1858 dasm_put(Dst, 10015, defop);
1860 1859
1861 switch (op) { 1860 switch (op) {
1862 1861
@@ -1867,145 +1866,145 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
1867 1866
1868 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: 1867 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT:
1869 if (LJ_DUALNUM) { 1868 if (LJ_DUALNUM) {
1870 dasm_put(Dst, 10016, LJ_TISNUM, LJ_TISNUM); 1869 dasm_put(Dst, 10017, LJ_TISNUM, LJ_TISNUM);
1871 switch (op) { 1870 switch (op) {
1872 case BC_ISLT: 1871 case BC_ISLT:
1873 dasm_put(Dst, 10046); 1872 dasm_put(Dst, 10047);
1874 break; 1873 break;
1875 case BC_ISGE: 1874 case BC_ISGE:
1876 dasm_put(Dst, 10051); 1875 dasm_put(Dst, 10052);
1877 break; 1876 break;
1878 case BC_ISLE: 1877 case BC_ISLE:
1879 dasm_put(Dst, 10056); 1878 dasm_put(Dst, 10057);
1880 break; 1879 break;
1881 case BC_ISGT: 1880 case BC_ISGT:
1882 dasm_put(Dst, 10061); 1881 dasm_put(Dst, 10062);
1883 break; 1882 break;
1884 default: break; /* Shut up GCC. */ 1883 default: break; /* Shut up GCC. */
1885 } 1884 }
1886 dasm_put(Dst, 10066, -BCBIAS_J*4, LJ_TISNUM); 1885 dasm_put(Dst, 10067, -BCBIAS_J*4, LJ_TISNUM);
1887 if (sse) { 1886 if (sse) {
1888 dasm_put(Dst, 10121); 1887 dasm_put(Dst, 10122);
1889 } else { 1888 } else {
1890 dasm_put(Dst, 10132); 1889 dasm_put(Dst, 10133);
1891 } 1890 }
1892 dasm_put(Dst, 10143); 1891 dasm_put(Dst, 10144);
1893 if (sse) { 1892 if (sse) {
1894 dasm_put(Dst, 10150); 1893 dasm_put(Dst, 10151);
1895 switch (op) { 1894 switch (op) {
1896 case BC_ISLT: 1895 case BC_ISLT:
1897 dasm_put(Dst, 10170); 1896 dasm_put(Dst, 10171);
1898 break; 1897 break;
1899 case BC_ISGE: 1898 case BC_ISGE:
1900 dasm_put(Dst, 10175); 1899 dasm_put(Dst, 10176);
1901 break; 1900 break;
1902 case BC_ISLE: 1901 case BC_ISLE:
1903 dasm_put(Dst, 10180); 1902 dasm_put(Dst, 10181);
1904 break; 1903 break;
1905 case BC_ISGT: 1904 case BC_ISGT:
1906 dasm_put(Dst, 10185); 1905 dasm_put(Dst, 10186);
1907 break; 1906 break;
1908 default: break; /* Shut up GCC. */ 1907 default: break; /* Shut up GCC. */
1909 } 1908 }
1910 dasm_put(Dst, 10190); 1909 dasm_put(Dst, 10191);
1911 } else { 1910 } else {
1912 dasm_put(Dst, 10195); 1911 dasm_put(Dst, 10196);
1913 } 1912 }
1914 } else { 1913 } else {
1915 dasm_put(Dst, 10203, LJ_TISNUM, LJ_TISNUM); 1914 dasm_put(Dst, 10204, LJ_TISNUM, LJ_TISNUM);
1916 } 1915 }
1917 if (sse) { 1916 if (sse) {
1918 dasm_put(Dst, 10224); 1917 dasm_put(Dst, 10225);
1919 } else { 1918 } else {
1920 dasm_put(Dst, 10245); 1919 dasm_put(Dst, 10246);
1921 if (cmov) { 1920 if (cmov) {
1922 dasm_put(Dst, 10261); 1921 dasm_put(Dst, 10262);
1923 } else { 1922 } else {
1924 dasm_put(Dst, 10267); 1923 dasm_put(Dst, 10268);
1925 } 1924 }
1926 } 1925 }
1927 if (LJ_DUALNUM) { 1926 if (LJ_DUALNUM) {
1928 switch (op) { 1927 switch (op) {
1929 case BC_ISLT: 1928 case BC_ISLT:
1930 dasm_put(Dst, 10170); 1929 dasm_put(Dst, 10171);
1931 break; 1930 break;
1932 case BC_ISGE: 1931 case BC_ISGE:
1933 dasm_put(Dst, 10175); 1932 dasm_put(Dst, 10176);
1934 break; 1933 break;
1935 case BC_ISLE: 1934 case BC_ISLE:
1936 dasm_put(Dst, 10180); 1935 dasm_put(Dst, 10181);
1937 break; 1936 break;
1938 case BC_ISGT: 1937 case BC_ISGT:
1939 dasm_put(Dst, 10185); 1938 dasm_put(Dst, 10186);
1940 break; 1939 break;
1941 default: break; /* Shut up GCC. */ 1940 default: break; /* Shut up GCC. */
1942 } 1941 }
1943 dasm_put(Dst, 10190); 1942 dasm_put(Dst, 10191);
1944 } else { 1943 } else {
1945 switch (op) { 1944 switch (op) {
1946 case BC_ISLT: 1945 case BC_ISLT:
1947 dasm_put(Dst, 10274); 1946 dasm_put(Dst, 10275);
1948 break; 1947 break;
1949 case BC_ISGE: 1948 case BC_ISGE:
1950 dasm_put(Dst, 10279); 1949 dasm_put(Dst, 10280);
1951 break; 1950 break;
1952 case BC_ISLE: 1951 case BC_ISLE:
1953 dasm_put(Dst, 10284); 1952 dasm_put(Dst, 10285);
1954 break; 1953 break;
1955 case BC_ISGT: 1954 case BC_ISGT:
1956 dasm_put(Dst, 10289); 1955 dasm_put(Dst, 10290);
1957 break; 1956 break;
1958 default: break; /* Shut up GCC. */ 1957 default: break; /* Shut up GCC. */
1959 } 1958 }
1960 dasm_put(Dst, 10294, -BCBIAS_J*4); 1959 dasm_put(Dst, 10295, -BCBIAS_J*4);
1961 } 1960 }
1962 break; 1961 break;
1963 1962
1964 case BC_ISEQV: case BC_ISNEV: 1963 case BC_ISEQV: case BC_ISNEV:
1965 vk = op == BC_ISEQV; 1964 vk = op == BC_ISEQV;
1966 dasm_put(Dst, 10327); 1965 dasm_put(Dst, 10328);
1967 if (LJ_DUALNUM) { 1966 if (LJ_DUALNUM) {
1968 dasm_put(Dst, 10335, LJ_TISNUM, LJ_TISNUM); 1967 dasm_put(Dst, 10336, LJ_TISNUM, LJ_TISNUM);
1969 if (vk) { 1968 if (vk) {
1970 dasm_put(Dst, 10360); 1969 dasm_put(Dst, 10361);
1971 } else { 1970 } else {
1972 dasm_put(Dst, 10365); 1971 dasm_put(Dst, 10366);
1973 } 1972 }
1974 dasm_put(Dst, 10370, -BCBIAS_J*4, LJ_TISNUM); 1973 dasm_put(Dst, 10371, -BCBIAS_J*4, LJ_TISNUM);
1975 if (sse) { 1974 if (sse) {
1976 dasm_put(Dst, 10423); 1975 dasm_put(Dst, 10424);
1977 } else { 1976 } else {
1978 dasm_put(Dst, 10430); 1977 dasm_put(Dst, 10431);
1979 } 1978 }
1980 dasm_put(Dst, 10434); 1979 dasm_put(Dst, 10435);
1981 if (sse) { 1980 if (sse) {
1982 dasm_put(Dst, 10445); 1981 dasm_put(Dst, 10446);
1983 } else { 1982 } else {
1984 dasm_put(Dst, 10457); 1983 dasm_put(Dst, 10458);
1985 } 1984 }
1986 dasm_put(Dst, 10464); 1985 dasm_put(Dst, 10465);
1987 } else { 1986 } else {
1988 dasm_put(Dst, 10469, LJ_TISNUM, LJ_TISNUM); 1987 dasm_put(Dst, 10470, LJ_TISNUM, LJ_TISNUM);
1989 } 1988 }
1990 if (sse) { 1989 if (sse) {
1991 dasm_put(Dst, 10488); 1990 dasm_put(Dst, 10489);
1992 } else { 1991 } else {
1993 dasm_put(Dst, 10506); 1992 dasm_put(Dst, 10507);
1994 if (cmov) { 1993 if (cmov) {
1995 dasm_put(Dst, 10261); 1994 dasm_put(Dst, 10262);
1996 } else { 1995 } else {
1997 dasm_put(Dst, 10267); 1996 dasm_put(Dst, 10268);
1998 } 1997 }
1999 } 1998 }
2000 iseqne_fp: 1999 iseqne_fp:
2001 if (vk) { 2000 if (vk) {
2002 dasm_put(Dst, 10519); 2001 dasm_put(Dst, 10520);
2003 } else { 2002 } else {
2004 dasm_put(Dst, 10528); 2003 dasm_put(Dst, 10529);
2005 } 2004 }
2006 iseqne_end: 2005 iseqne_end:
2007 if (vk) { 2006 if (vk) {
2008 dasm_put(Dst, 10537, -BCBIAS_J*4); 2007 dasm_put(Dst, 10538, -BCBIAS_J*4);
2009 if (!LJ_HASFFI) { 2008 if (!LJ_HASFFI) {
2010 dasm_put(Dst, 4675); 2009 dasm_put(Dst, 4675);
2011 } 2010 }
@@ -2013,156 +2012,156 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2013 if (!LJ_HASFFI) { 2012 if (!LJ_HASFFI) {
2014 dasm_put(Dst, 4675); 2013 dasm_put(Dst, 4675);
2015 } 2014 }
2016 dasm_put(Dst, 10552, -BCBIAS_J*4); 2015 dasm_put(Dst, 10553, -BCBIAS_J*4);
2017 } 2016 }
2018 if (LJ_DUALNUM && (op == BC_ISEQV || op == BC_ISNEV || 2017 if (LJ_DUALNUM && (op == BC_ISEQV || op == BC_ISNEV ||
2019 op == BC_ISEQN || op == BC_ISNEN)) { 2018 op == BC_ISEQN || op == BC_ISNEN)) {
2020 dasm_put(Dst, 10567); 2019 dasm_put(Dst, 10568);
2021 } else { 2020 } else {
2022 dasm_put(Dst, 10306); 2021 dasm_put(Dst, 10307);
2023 } 2022 }
2024 if (op == BC_ISEQV || op == BC_ISNEV) { 2023 if (op == BC_ISEQV || op == BC_ISNEV) {
2025 dasm_put(Dst, 10572); 2024 dasm_put(Dst, 10573);
2026 if (LJ_HASFFI) { 2025 if (LJ_HASFFI) {
2027 dasm_put(Dst, 10575, LJ_TCDATA, LJ_TCDATA); 2026 dasm_put(Dst, 10576, LJ_TCDATA, LJ_TCDATA);
2028 } 2027 }
2029 dasm_put(Dst, 10594, LJ_TISPRI, LJ_TISTABUD, LJ_TUDATA, Dt6(->metatable), Dt6(->nomm), 1<<MM_eq); 2028 dasm_put(Dst, 10595, LJ_TISPRI, LJ_TISTABUD, LJ_TUDATA, Dt6(->metatable), Dt6(->nomm), 1<<MM_eq);
2030 if (vk) { 2029 if (vk) {
2031 dasm_put(Dst, 10658); 2030 dasm_put(Dst, 10659);
2032 } else { 2031 } else {
2033 dasm_put(Dst, 10662); 2032 dasm_put(Dst, 10663);
2034 } 2033 }
2035 dasm_put(Dst, 10668); 2034 dasm_put(Dst, 10669);
2036 } else if (LJ_HASFFI) { 2035 } else if (LJ_HASFFI) {
2037 dasm_put(Dst, 10673, LJ_TCDATA); 2036 dasm_put(Dst, 10674, LJ_TCDATA);
2038 if (LJ_DUALNUM && vk) { 2037 if (LJ_DUALNUM && vk) {
2039 dasm_put(Dst, 10680); 2038 dasm_put(Dst, 10681);
2040 } else { 2039 } else {
2041 dasm_put(Dst, 10653); 2040 dasm_put(Dst, 10654);
2042 } 2041 }
2043 dasm_put(Dst, 10685); 2042 dasm_put(Dst, 10686);
2044 } 2043 }
2045 break; 2044 break;
2046 case BC_ISEQS: case BC_ISNES: 2045 case BC_ISEQS: case BC_ISNES:
2047 vk = op == BC_ISEQS; 2046 vk = op == BC_ISEQS;
2048 dasm_put(Dst, 10690, LJ_TSTR); 2047 dasm_put(Dst, 10691, LJ_TSTR);
2049 iseqne_test: 2048 iseqne_test:
2050 if (vk) { 2049 if (vk) {
2051 dasm_put(Dst, 10523); 2050 dasm_put(Dst, 10524);
2052 } else { 2051 } else {
2053 dasm_put(Dst, 814); 2052 dasm_put(Dst, 814);
2054 } 2053 }
2055 goto iseqne_end; 2054 goto iseqne_end;
2056 case BC_ISEQN: case BC_ISNEN: 2055 case BC_ISEQN: case BC_ISNEN:
2057 vk = op == BC_ISEQN; 2056 vk = op == BC_ISEQN;
2058 dasm_put(Dst, 10717); 2057 dasm_put(Dst, 10718);
2059 if (LJ_DUALNUM) { 2058 if (LJ_DUALNUM) {
2060 dasm_put(Dst, 10725, LJ_TISNUM, LJ_TISNUM); 2059 dasm_put(Dst, 10726, LJ_TISNUM, LJ_TISNUM);
2061 if (vk) { 2060 if (vk) {
2062 dasm_put(Dst, 10360); 2061 dasm_put(Dst, 10361);
2063 } else { 2062 } else {
2064 dasm_put(Dst, 10365); 2063 dasm_put(Dst, 10366);
2065 } 2064 }
2066 dasm_put(Dst, 10752, -BCBIAS_J*4, LJ_TISNUM); 2065 dasm_put(Dst, 10753, -BCBIAS_J*4, LJ_TISNUM);
2067 if (sse) { 2066 if (sse) {
2068 dasm_put(Dst, 10802); 2067 dasm_put(Dst, 10803);
2069 } else { 2068 } else {
2070 dasm_put(Dst, 10810); 2069 dasm_put(Dst, 10811);
2071 } 2070 }
2072 dasm_put(Dst, 10815); 2071 dasm_put(Dst, 10816);
2073 if (sse) { 2072 if (sse) {
2074 dasm_put(Dst, 10822); 2073 dasm_put(Dst, 10823);
2075 } else { 2074 } else {
2076 dasm_put(Dst, 10835); 2075 dasm_put(Dst, 10836);
2077 } 2076 }
2078 dasm_put(Dst, 10464); 2077 dasm_put(Dst, 10465);
2079 } else { 2078 } else {
2080 dasm_put(Dst, 10843, LJ_TISNUM); 2079 dasm_put(Dst, 10844, LJ_TISNUM);
2081 } 2080 }
2082 if (sse) { 2081 if (sse) {
2083 dasm_put(Dst, 10852); 2082 dasm_put(Dst, 10853);
2084 } else { 2083 } else {
2085 dasm_put(Dst, 10871); 2084 dasm_put(Dst, 10872);
2086 if (cmov) { 2085 if (cmov) {
2087 dasm_put(Dst, 10261); 2086 dasm_put(Dst, 10262);
2088 } else { 2087 } else {
2089 dasm_put(Dst, 10267); 2088 dasm_put(Dst, 10268);
2090 } 2089 }
2091 } 2090 }
2092 goto iseqne_fp; 2091 goto iseqne_fp;
2093 case BC_ISEQP: case BC_ISNEP: 2092 case BC_ISEQP: case BC_ISNEP:
2094 vk = op == BC_ISEQP; 2093 vk = op == BC_ISEQP;
2095 dasm_put(Dst, 10885); 2094 dasm_put(Dst, 10886);
2096 if (!LJ_HASFFI) goto iseqne_test; 2095 if (!LJ_HASFFI) goto iseqne_test;
2097 if (vk) { 2096 if (vk) {
2098 dasm_put(Dst, 10899, -BCBIAS_J*4, LJ_TCDATA); 2097 dasm_put(Dst, 10900, -BCBIAS_J*4, LJ_TCDATA);
2099 } else { 2098 } else {
2100 dasm_put(Dst, 10950, LJ_TCDATA, -BCBIAS_J*4); 2099 dasm_put(Dst, 10951, LJ_TCDATA, -BCBIAS_J*4);
2101 } 2100 }
2102 break; 2101 break;
2103 2102
2104 /* -- Unary test and copy ops ------------------------------------------- */ 2103 /* -- Unary test and copy ops ------------------------------------------- */
2105 2104
2106 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: 2105 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF:
2107 dasm_put(Dst, 10995, LJ_TISTRUECOND); 2106 dasm_put(Dst, 10996, LJ_TISTRUECOND);
2108 if (op == BC_IST || op == BC_ISTC) { 2107 if (op == BC_IST || op == BC_ISTC) {
2109 dasm_put(Dst, 10289); 2108 dasm_put(Dst, 10290);
2110 } else { 2109 } else {
2111 dasm_put(Dst, 10284); 2110 dasm_put(Dst, 10285);
2112 } 2111 }
2113 if (op == BC_ISTC || op == BC_ISFC) { 2112 if (op == BC_ISTC || op == BC_ISFC) {
2114 dasm_put(Dst, 11007); 2113 dasm_put(Dst, 11008);
2115 } 2114 }
2116 dasm_put(Dst, 10294, -BCBIAS_J*4); 2115 dasm_put(Dst, 10295, -BCBIAS_J*4);
2117 break; 2116 break;
2118 2117
2119 /* -- Unary ops --------------------------------------------------------- */ 2118 /* -- Unary ops --------------------------------------------------------- */
2120 2119
2121 case BC_MOV: 2120 case BC_MOV:
2122 dasm_put(Dst, 11018); 2121 dasm_put(Dst, 11019);
2123 break; 2122 break;
2124 case BC_NOT: 2123 case BC_NOT:
2125 dasm_put(Dst, 11047, LJ_TISTRUECOND, LJ_TTRUE); 2124 dasm_put(Dst, 11048, LJ_TISTRUECOND, LJ_TTRUE);
2126 break; 2125 break;
2127 case BC_UNM: 2126 case BC_UNM:
2128 if (LJ_DUALNUM) { 2127 if (LJ_DUALNUM) {
2129 dasm_put(Dst, 11084, LJ_TISNUM, LJ_TISNUM); 2128 dasm_put(Dst, 11085, LJ_TISNUM, LJ_TISNUM);
2130 } else { 2129 } else {
2131 dasm_put(Dst, 11162, LJ_TISNUM); 2130 dasm_put(Dst, 11163, LJ_TISNUM);
2132 } 2131 }
2133 if (sse) { 2132 if (sse) {
2134 dasm_put(Dst, 11173, (unsigned int)(U64x(80000000,00000000)), (unsigned int)((U64x(80000000,00000000))>>32)); 2133 dasm_put(Dst, 11174, (unsigned int)(U64x(80000000,00000000)), (unsigned int)((U64x(80000000,00000000))>>32));
2135 } else { 2134 } else {
2136 dasm_put(Dst, 11198); 2135 dasm_put(Dst, 11199);
2137 } 2136 }
2138 if (LJ_DUALNUM) { 2137 if (LJ_DUALNUM) {
2139 dasm_put(Dst, 10567); 2138 dasm_put(Dst, 10568);
2140 } else { 2139 } else {
2141 dasm_put(Dst, 10306); 2140 dasm_put(Dst, 10307);
2142 } 2141 }
2143 break; 2142 break;
2144 case BC_LEN: 2143 case BC_LEN:
2145 dasm_put(Dst, 11207, LJ_TSTR); 2144 dasm_put(Dst, 11208, LJ_TSTR);
2146 if (LJ_DUALNUM) { 2145 if (LJ_DUALNUM) {
2147 dasm_put(Dst, 11221, Dt5(->len), LJ_TISNUM); 2146 dasm_put(Dst, 11222, Dt5(->len), LJ_TISNUM);
2148 } else if (sse) { 2147 } else if (sse) {
2149 dasm_put(Dst, 11235, Dt5(->len)); 2148 dasm_put(Dst, 11236, Dt5(->len));
2150 } else { 2149 } else {
2151 dasm_put(Dst, 11253, Dt5(->len)); 2150 dasm_put(Dst, 11254, Dt5(->len));
2152 } 2151 }
2153 dasm_put(Dst, 11262, LJ_TTAB); 2152 dasm_put(Dst, 11263, LJ_TTAB);
2154#ifdef LUAJIT_ENABLE_LUA52COMPAT 2153#ifdef LUAJIT_ENABLE_LUA52COMPAT
2155 dasm_put(Dst, 11298, Dt6(->metatable)); 2154 dasm_put(Dst, 11299, Dt6(->metatable));
2156#endif 2155#endif
2157 dasm_put(Dst, 11312); 2156 dasm_put(Dst, 11313);
2158 if (LJ_DUALNUM) { 2157 if (LJ_DUALNUM) {
2159 } else if (sse) { 2158 } else if (sse) {
2160 dasm_put(Dst, 11321); 2159 dasm_put(Dst, 11322);
2161 } else { 2160 } else {
2162 } 2161 }
2163 dasm_put(Dst, 11327); 2162 dasm_put(Dst, 11328);
2164#ifdef LUAJIT_ENABLE_LUA52COMPAT 2163#ifdef LUAJIT_ENABLE_LUA52COMPAT
2165 dasm_put(Dst, 11340, Dt6(->nomm), 1<<MM_len); 2164 dasm_put(Dst, 11341, Dt6(->nomm), 1<<MM_len);
2166#endif 2165#endif
2167 break; 2166 break;
2168 2167
@@ -2171,603 +2170,603 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2171 2170
2172 case BC_ADDVN: case BC_ADDNV: case BC_ADDVV: 2171 case BC_ADDVN: case BC_ADDNV: case BC_ADDVV:
2173 if (LJ_DUALNUM) { 2172 if (LJ_DUALNUM) {
2174 dasm_put(Dst, 11356); 2173 dasm_put(Dst, 11357);
2175 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2174 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2176 switch (vk) { 2175 switch (vk) {
2177 case 0: 2176 case 0:
2178 dasm_put(Dst, 11364, LJ_TISNUM, LJ_TISNUM); 2177 dasm_put(Dst, 11365, LJ_TISNUM, LJ_TISNUM);
2179 break; 2178 break;
2180 case 1: 2179 case 1:
2181 dasm_put(Dst, 11399, LJ_TISNUM, LJ_TISNUM); 2180 dasm_put(Dst, 11400, LJ_TISNUM, LJ_TISNUM);
2182 break; 2181 break;
2183 default: 2182 default:
2184 dasm_put(Dst, 11434, LJ_TISNUM, LJ_TISNUM); 2183 dasm_put(Dst, 11435, LJ_TISNUM, LJ_TISNUM);
2185 break; 2184 break;
2186 } 2185 }
2187 dasm_put(Dst, 11467, LJ_TISNUM); 2186 dasm_put(Dst, 11468, LJ_TISNUM);
2188 if (vk == 1) { 2187 if (vk == 1) {
2189 dasm_put(Dst, 11231); 2188 dasm_put(Dst, 11232);
2190 } else { 2189 } else {
2191 dasm_put(Dst, 11014); 2190 dasm_put(Dst, 11015);
2192 } 2191 }
2193 dasm_put(Dst, 10306); 2192 dasm_put(Dst, 10307);
2194 } else { 2193 } else {
2195 dasm_put(Dst, 11356); 2194 dasm_put(Dst, 11357);
2196 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2195 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2197 switch (vk) { 2196 switch (vk) {
2198 case 0: 2197 case 0:
2199 dasm_put(Dst, 11473, LJ_TISNUM); 2198 dasm_put(Dst, 11474, LJ_TISNUM);
2200 if (LJ_DUALNUM) { 2199 if (LJ_DUALNUM) {
2201 dasm_put(Dst, 11485, LJ_TISNUM); 2200 dasm_put(Dst, 11486, LJ_TISNUM);
2202 } 2201 }
2203 if (sse) { 2202 if (sse) {
2204 dasm_put(Dst, 11497); 2203 dasm_put(Dst, 11498);
2205 } else { 2204 } else {
2206 dasm_put(Dst, 11512); 2205 dasm_put(Dst, 11513);
2207 } 2206 }
2208 break; 2207 break;
2209 case 1: 2208 case 1:
2210 dasm_put(Dst, 11521, LJ_TISNUM); 2209 dasm_put(Dst, 11522, LJ_TISNUM);
2211 if (LJ_DUALNUM) { 2210 if (LJ_DUALNUM) {
2212 dasm_put(Dst, 11533, LJ_TISNUM); 2211 dasm_put(Dst, 11534, LJ_TISNUM);
2213 } 2212 }
2214 if (sse) { 2213 if (sse) {
2215 dasm_put(Dst, 11545); 2214 dasm_put(Dst, 11546);
2216 } else { 2215 } else {
2217 dasm_put(Dst, 11560); 2216 dasm_put(Dst, 11561);
2218 } 2217 }
2219 break; 2218 break;
2220 default: 2219 default:
2221 dasm_put(Dst, 11569, LJ_TISNUM, LJ_TISNUM); 2220 dasm_put(Dst, 11570, LJ_TISNUM, LJ_TISNUM);
2222 if (sse) { 2221 if (sse) {
2223 dasm_put(Dst, 11591); 2222 dasm_put(Dst, 11592);
2224 } else { 2223 } else {
2225 dasm_put(Dst, 11605); 2224 dasm_put(Dst, 11606);
2226 } 2225 }
2227 break; 2226 break;
2228 } 2227 }
2229 if (sse) { 2228 if (sse) {
2230 dasm_put(Dst, 11191); 2229 dasm_put(Dst, 11192);
2231 } else { 2230 } else {
2232 dasm_put(Dst, 11203); 2231 dasm_put(Dst, 11204);
2233 } 2232 }
2234 dasm_put(Dst, 10306); 2233 dasm_put(Dst, 10307);
2235 } 2234 }
2236 break; 2235 break;
2237 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: 2236 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV:
2238 if (LJ_DUALNUM) { 2237 if (LJ_DUALNUM) {
2239 dasm_put(Dst, 11356); 2238 dasm_put(Dst, 11357);
2240 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2239 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2241 switch (vk) { 2240 switch (vk) {
2242 case 0: 2241 case 0:
2243 dasm_put(Dst, 11613, LJ_TISNUM, LJ_TISNUM); 2242 dasm_put(Dst, 11614, LJ_TISNUM, LJ_TISNUM);
2244 break; 2243 break;
2245 case 1: 2244 case 1:
2246 dasm_put(Dst, 11648, LJ_TISNUM, LJ_TISNUM); 2245 dasm_put(Dst, 11649, LJ_TISNUM, LJ_TISNUM);
2247 break; 2246 break;
2248 default: 2247 default:
2249 dasm_put(Dst, 11683, LJ_TISNUM, LJ_TISNUM); 2248 dasm_put(Dst, 11684, LJ_TISNUM, LJ_TISNUM);
2250 break; 2249 break;
2251 } 2250 }
2252 dasm_put(Dst, 11467, LJ_TISNUM); 2251 dasm_put(Dst, 11468, LJ_TISNUM);
2253 if (vk == 1) { 2252 if (vk == 1) {
2254 dasm_put(Dst, 11231); 2253 dasm_put(Dst, 11232);
2255 } else { 2254 } else {
2256 dasm_put(Dst, 11014); 2255 dasm_put(Dst, 11015);
2257 } 2256 }
2258 dasm_put(Dst, 10306); 2257 dasm_put(Dst, 10307);
2259 } else { 2258 } else {
2260 dasm_put(Dst, 11356); 2259 dasm_put(Dst, 11357);
2261 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2260 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2262 switch (vk) { 2261 switch (vk) {
2263 case 0: 2262 case 0:
2264 dasm_put(Dst, 11473, LJ_TISNUM); 2263 dasm_put(Dst, 11474, LJ_TISNUM);
2265 if (LJ_DUALNUM) { 2264 if (LJ_DUALNUM) {
2266 dasm_put(Dst, 11485, LJ_TISNUM); 2265 dasm_put(Dst, 11486, LJ_TISNUM);
2267 } 2266 }
2268 if (sse) { 2267 if (sse) {
2269 dasm_put(Dst, 11716); 2268 dasm_put(Dst, 11717);
2270 } else { 2269 } else {
2271 dasm_put(Dst, 11731); 2270 dasm_put(Dst, 11732);
2272 } 2271 }
2273 break; 2272 break;
2274 case 1: 2273 case 1:
2275 dasm_put(Dst, 11521, LJ_TISNUM); 2274 dasm_put(Dst, 11522, LJ_TISNUM);
2276 if (LJ_DUALNUM) { 2275 if (LJ_DUALNUM) {
2277 dasm_put(Dst, 11533, LJ_TISNUM); 2276 dasm_put(Dst, 11534, LJ_TISNUM);
2278 } 2277 }
2279 if (sse) { 2278 if (sse) {
2280 dasm_put(Dst, 11740); 2279 dasm_put(Dst, 11741);
2281 } else { 2280 } else {
2282 dasm_put(Dst, 11755); 2281 dasm_put(Dst, 11756);
2283 } 2282 }
2284 break; 2283 break;
2285 default: 2284 default:
2286 dasm_put(Dst, 11569, LJ_TISNUM, LJ_TISNUM); 2285 dasm_put(Dst, 11570, LJ_TISNUM, LJ_TISNUM);
2287 if (sse) { 2286 if (sse) {
2288 dasm_put(Dst, 11764); 2287 dasm_put(Dst, 11765);
2289 } else { 2288 } else {
2290 dasm_put(Dst, 11778); 2289 dasm_put(Dst, 11779);
2291 } 2290 }
2292 break; 2291 break;
2293 } 2292 }
2294 if (sse) { 2293 if (sse) {
2295 dasm_put(Dst, 11191); 2294 dasm_put(Dst, 11192);
2296 } else { 2295 } else {
2297 dasm_put(Dst, 11203); 2296 dasm_put(Dst, 11204);
2298 } 2297 }
2299 dasm_put(Dst, 10306); 2298 dasm_put(Dst, 10307);
2300 } 2299 }
2301 break; 2300 break;
2302 case BC_MULVN: case BC_MULNV: case BC_MULVV: 2301 case BC_MULVN: case BC_MULNV: case BC_MULVV:
2303 if (LJ_DUALNUM) { 2302 if (LJ_DUALNUM) {
2304 dasm_put(Dst, 11356); 2303 dasm_put(Dst, 11357);
2305 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2304 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2306 switch (vk) { 2305 switch (vk) {
2307 case 0: 2306 case 0:
2308 dasm_put(Dst, 11786, LJ_TISNUM, LJ_TISNUM); 2307 dasm_put(Dst, 11787, LJ_TISNUM, LJ_TISNUM);
2309 break; 2308 break;
2310 case 1: 2309 case 1:
2311 dasm_put(Dst, 11822, LJ_TISNUM, LJ_TISNUM); 2310 dasm_put(Dst, 11823, LJ_TISNUM, LJ_TISNUM);
2312 break; 2311 break;
2313 default: 2312 default:
2314 dasm_put(Dst, 11858, LJ_TISNUM, LJ_TISNUM); 2313 dasm_put(Dst, 11859, LJ_TISNUM, LJ_TISNUM);
2315 break; 2314 break;
2316 } 2315 }
2317 dasm_put(Dst, 11467, LJ_TISNUM); 2316 dasm_put(Dst, 11468, LJ_TISNUM);
2318 if (vk == 1) { 2317 if (vk == 1) {
2319 dasm_put(Dst, 11231); 2318 dasm_put(Dst, 11232);
2320 } else { 2319 } else {
2321 dasm_put(Dst, 11014); 2320 dasm_put(Dst, 11015);
2322 } 2321 }
2323 dasm_put(Dst, 10306); 2322 dasm_put(Dst, 10307);
2324 } else { 2323 } else {
2325 dasm_put(Dst, 11356); 2324 dasm_put(Dst, 11357);
2326 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2325 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2327 switch (vk) { 2326 switch (vk) {
2328 case 0: 2327 case 0:
2329 dasm_put(Dst, 11473, LJ_TISNUM); 2328 dasm_put(Dst, 11474, LJ_TISNUM);
2330 if (LJ_DUALNUM) { 2329 if (LJ_DUALNUM) {
2331 dasm_put(Dst, 11485, LJ_TISNUM); 2330 dasm_put(Dst, 11486, LJ_TISNUM);
2332 } 2331 }
2333 if (sse) { 2332 if (sse) {
2334 dasm_put(Dst, 11892); 2333 dasm_put(Dst, 11893);
2335 } else { 2334 } else {
2336 dasm_put(Dst, 11907); 2335 dasm_put(Dst, 11908);
2337 } 2336 }
2338 break; 2337 break;
2339 case 1: 2338 case 1:
2340 dasm_put(Dst, 11521, LJ_TISNUM); 2339 dasm_put(Dst, 11522, LJ_TISNUM);
2341 if (LJ_DUALNUM) { 2340 if (LJ_DUALNUM) {
2342 dasm_put(Dst, 11533, LJ_TISNUM); 2341 dasm_put(Dst, 11534, LJ_TISNUM);
2343 } 2342 }
2344 if (sse) { 2343 if (sse) {
2345 dasm_put(Dst, 11916); 2344 dasm_put(Dst, 11917);
2346 } else { 2345 } else {
2347 dasm_put(Dst, 11931); 2346 dasm_put(Dst, 11932);
2348 } 2347 }
2349 break; 2348 break;
2350 default: 2349 default:
2351 dasm_put(Dst, 11569, LJ_TISNUM, LJ_TISNUM); 2350 dasm_put(Dst, 11570, LJ_TISNUM, LJ_TISNUM);
2352 if (sse) { 2351 if (sse) {
2353 dasm_put(Dst, 11940); 2352 dasm_put(Dst, 11941);
2354 } else { 2353 } else {
2355 dasm_put(Dst, 11954); 2354 dasm_put(Dst, 11955);
2356 } 2355 }
2357 break; 2356 break;
2358 } 2357 }
2359 if (sse) { 2358 if (sse) {
2360 dasm_put(Dst, 11191); 2359 dasm_put(Dst, 11192);
2361 } else { 2360 } else {
2362 dasm_put(Dst, 11203); 2361 dasm_put(Dst, 11204);
2363 } 2362 }
2364 dasm_put(Dst, 10306); 2363 dasm_put(Dst, 10307);
2365 } 2364 }
2366 break; 2365 break;
2367 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: 2366 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV:
2368 dasm_put(Dst, 11356); 2367 dasm_put(Dst, 11357);
2369 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2368 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2370 switch (vk) { 2369 switch (vk) {
2371 case 0: 2370 case 0:
2372 dasm_put(Dst, 11473, LJ_TISNUM); 2371 dasm_put(Dst, 11474, LJ_TISNUM);
2373 if (LJ_DUALNUM) { 2372 if (LJ_DUALNUM) {
2374 dasm_put(Dst, 11485, LJ_TISNUM); 2373 dasm_put(Dst, 11486, LJ_TISNUM);
2375 } 2374 }
2376 if (sse) { 2375 if (sse) {
2377 dasm_put(Dst, 11962); 2376 dasm_put(Dst, 11963);
2378 } else { 2377 } else {
2379 dasm_put(Dst, 11977); 2378 dasm_put(Dst, 11978);
2380 } 2379 }
2381 break; 2380 break;
2382 case 1: 2381 case 1:
2383 dasm_put(Dst, 11521, LJ_TISNUM); 2382 dasm_put(Dst, 11522, LJ_TISNUM);
2384 if (LJ_DUALNUM) { 2383 if (LJ_DUALNUM) {
2385 dasm_put(Dst, 11533, LJ_TISNUM); 2384 dasm_put(Dst, 11534, LJ_TISNUM);
2386 } 2385 }
2387 if (sse) { 2386 if (sse) {
2388 dasm_put(Dst, 11986); 2387 dasm_put(Dst, 11987);
2389 } else { 2388 } else {
2390 dasm_put(Dst, 12001); 2389 dasm_put(Dst, 12002);
2391 } 2390 }
2392 break; 2391 break;
2393 default: 2392 default:
2394 dasm_put(Dst, 11569, LJ_TISNUM, LJ_TISNUM); 2393 dasm_put(Dst, 11570, LJ_TISNUM, LJ_TISNUM);
2395 if (sse) { 2394 if (sse) {
2396 dasm_put(Dst, 12010); 2395 dasm_put(Dst, 12011);
2397 } else { 2396 } else {
2398 dasm_put(Dst, 12024); 2397 dasm_put(Dst, 12025);
2399 } 2398 }
2400 break; 2399 break;
2401 } 2400 }
2402 if (sse) { 2401 if (sse) {
2403 dasm_put(Dst, 11191); 2402 dasm_put(Dst, 11192);
2404 } else { 2403 } else {
2405 dasm_put(Dst, 11203); 2404 dasm_put(Dst, 11204);
2406 } 2405 }
2407 dasm_put(Dst, 10306); 2406 dasm_put(Dst, 10307);
2408 break; 2407 break;
2409 case BC_MODVN: 2408 case BC_MODVN:
2410 dasm_put(Dst, 11356); 2409 dasm_put(Dst, 11357);
2411 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2410 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2412 switch (vk) { 2411 switch (vk) {
2413 case 0: 2412 case 0:
2414 dasm_put(Dst, 11473, LJ_TISNUM); 2413 dasm_put(Dst, 11474, LJ_TISNUM);
2415 if (LJ_DUALNUM) { 2414 if (LJ_DUALNUM) {
2416 dasm_put(Dst, 11485, LJ_TISNUM); 2415 dasm_put(Dst, 11486, LJ_TISNUM);
2417 } 2416 }
2418 if (sse) { 2417 if (sse) {
2419 dasm_put(Dst, 12032); 2418 dasm_put(Dst, 12033);
2420 } else { 2419 } else {
2421 dasm_put(Dst, 12047); 2420 dasm_put(Dst, 12048);
2422 } 2421 }
2423 break; 2422 break;
2424 case 1: 2423 case 1:
2425 dasm_put(Dst, 11521, LJ_TISNUM); 2424 dasm_put(Dst, 11522, LJ_TISNUM);
2426 if (LJ_DUALNUM) { 2425 if (LJ_DUALNUM) {
2427 dasm_put(Dst, 11533, LJ_TISNUM); 2426 dasm_put(Dst, 11534, LJ_TISNUM);
2428 } 2427 }
2429 if (sse) { 2428 if (sse) {
2430 dasm_put(Dst, 12056); 2429 dasm_put(Dst, 12057);
2431 } else { 2430 } else {
2432 dasm_put(Dst, 12071); 2431 dasm_put(Dst, 12072);
2433 } 2432 }
2434 break; 2433 break;
2435 default: 2434 default:
2436 dasm_put(Dst, 11569, LJ_TISNUM, LJ_TISNUM); 2435 dasm_put(Dst, 11570, LJ_TISNUM, LJ_TISNUM);
2437 if (sse) { 2436 if (sse) {
2438 dasm_put(Dst, 12080); 2437 dasm_put(Dst, 12081);
2439 } else { 2438 } else {
2440 dasm_put(Dst, 12094); 2439 dasm_put(Dst, 12095);
2441 } 2440 }
2442 break; 2441 break;
2443 } 2442 }
2444 dasm_put(Dst, 12102); 2443 dasm_put(Dst, 12103);
2445 if (sse) { 2444 if (sse) {
2446 dasm_put(Dst, 11191); 2445 dasm_put(Dst, 11192);
2447 } else { 2446 } else {
2448 dasm_put(Dst, 11203); 2447 dasm_put(Dst, 11204);
2449 } 2448 }
2450 dasm_put(Dst, 10306); 2449 dasm_put(Dst, 10307);
2451 break; 2450 break;
2452 case BC_MODNV: case BC_MODVV: 2451 case BC_MODNV: case BC_MODVV:
2453 dasm_put(Dst, 11356); 2452 dasm_put(Dst, 11357);
2454 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2453 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2455 switch (vk) { 2454 switch (vk) {
2456 case 0: 2455 case 0:
2457 dasm_put(Dst, 11473, LJ_TISNUM); 2456 dasm_put(Dst, 11474, LJ_TISNUM);
2458 if (LJ_DUALNUM) { 2457 if (LJ_DUALNUM) {
2459 dasm_put(Dst, 11485, LJ_TISNUM); 2458 dasm_put(Dst, 11486, LJ_TISNUM);
2460 } 2459 }
2461 if (sse) { 2460 if (sse) {
2462 dasm_put(Dst, 12032); 2461 dasm_put(Dst, 12033);
2463 } else { 2462 } else {
2464 dasm_put(Dst, 12047); 2463 dasm_put(Dst, 12048);
2465 } 2464 }
2466 break; 2465 break;
2467 case 1: 2466 case 1:
2468 dasm_put(Dst, 11521, LJ_TISNUM); 2467 dasm_put(Dst, 11522, LJ_TISNUM);
2469 if (LJ_DUALNUM) { 2468 if (LJ_DUALNUM) {
2470 dasm_put(Dst, 11533, LJ_TISNUM); 2469 dasm_put(Dst, 11534, LJ_TISNUM);
2471 } 2470 }
2472 if (sse) { 2471 if (sse) {
2473 dasm_put(Dst, 12056); 2472 dasm_put(Dst, 12057);
2474 } else { 2473 } else {
2475 dasm_put(Dst, 12071); 2474 dasm_put(Dst, 12072);
2476 } 2475 }
2477 break; 2476 break;
2478 default: 2477 default:
2479 dasm_put(Dst, 11569, LJ_TISNUM, LJ_TISNUM); 2478 dasm_put(Dst, 11570, LJ_TISNUM, LJ_TISNUM);
2480 if (sse) { 2479 if (sse) {
2481 dasm_put(Dst, 12080); 2480 dasm_put(Dst, 12081);
2482 } else { 2481 } else {
2483 dasm_put(Dst, 12094); 2482 dasm_put(Dst, 12095);
2484 } 2483 }
2485 break; 2484 break;
2486 } 2485 }
2487 dasm_put(Dst, 12108); 2486 dasm_put(Dst, 12109);
2488 break; 2487 break;
2489 case BC_POW: 2488 case BC_POW:
2490 dasm_put(Dst, 11356); 2489 dasm_put(Dst, 11357);
2491 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 2490 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2492 switch (vk) { 2491 switch (vk) {
2493 case 0: 2492 case 0:
2494 dasm_put(Dst, 11473, LJ_TISNUM); 2493 dasm_put(Dst, 11474, LJ_TISNUM);
2495 if (LJ_DUALNUM) { 2494 if (LJ_DUALNUM) {
2496 dasm_put(Dst, 11485, LJ_TISNUM); 2495 dasm_put(Dst, 11486, LJ_TISNUM);
2497 } 2496 }
2498 if (sse) { 2497 if (sse) {
2499 dasm_put(Dst, 12032); 2498 dasm_put(Dst, 12033);
2500 } else { 2499 } else {
2501 dasm_put(Dst, 12047); 2500 dasm_put(Dst, 12048);
2502 } 2501 }
2503 break; 2502 break;
2504 case 1: 2503 case 1:
2505 dasm_put(Dst, 11521, LJ_TISNUM); 2504 dasm_put(Dst, 11522, LJ_TISNUM);
2506 if (LJ_DUALNUM) { 2505 if (LJ_DUALNUM) {
2507 dasm_put(Dst, 11533, LJ_TISNUM); 2506 dasm_put(Dst, 11534, LJ_TISNUM);
2508 } 2507 }
2509 if (sse) { 2508 if (sse) {
2510 dasm_put(Dst, 12056); 2509 dasm_put(Dst, 12057);
2511 } else { 2510 } else {
2512 dasm_put(Dst, 12071); 2511 dasm_put(Dst, 12072);
2513 } 2512 }
2514 break; 2513 break;
2515 default: 2514 default:
2516 dasm_put(Dst, 11569, LJ_TISNUM, LJ_TISNUM); 2515 dasm_put(Dst, 11570, LJ_TISNUM, LJ_TISNUM);
2517 if (sse) { 2516 if (sse) {
2518 dasm_put(Dst, 12080); 2517 dasm_put(Dst, 12081);
2519 } else { 2518 } else {
2520 dasm_put(Dst, 12094); 2519 dasm_put(Dst, 12095);
2521 } 2520 }
2522 break; 2521 break;
2523 } 2522 }
2524 dasm_put(Dst, 12113); 2523 dasm_put(Dst, 12114);
2525 if (sse) { 2524 if (sse) {
2526 dasm_put(Dst, 11191); 2525 dasm_put(Dst, 11192);
2527 } else { 2526 } else {
2528 dasm_put(Dst, 11203); 2527 dasm_put(Dst, 11204);
2529 } 2528 }
2530 dasm_put(Dst, 10306); 2529 dasm_put(Dst, 10307);
2531 break; 2530 break;
2532 2531
2533 case BC_CAT: 2532 case BC_CAT:
2534 dasm_put(Dst, 12117, Dt1(->base), Dt1(->base)); 2533 dasm_put(Dst, 12118, Dt1(->base), Dt1(->base));
2535 break; 2534 break;
2536 2535
2537 /* -- Constant ops ------------------------------------------------------ */ 2536 /* -- Constant ops ------------------------------------------------------ */
2538 2537
2539 case BC_KSTR: 2538 case BC_KSTR:
2540 dasm_put(Dst, 12201, LJ_TSTR); 2539 dasm_put(Dst, 12202, LJ_TSTR);
2541 break; 2540 break;
2542 case BC_KCDATA: 2541 case BC_KCDATA:
2543#if LJ_HASFFI 2542#if LJ_HASFFI
2544 dasm_put(Dst, 12201, LJ_TCDATA); 2543 dasm_put(Dst, 12202, LJ_TCDATA);
2545#endif 2544#endif
2546 break; 2545 break;
2547 case BC_KSHORT: 2546 case BC_KSHORT:
2548 if (LJ_DUALNUM) { 2547 if (LJ_DUALNUM) {
2549 dasm_put(Dst, 12238, LJ_TISNUM); 2548 dasm_put(Dst, 12239, LJ_TISNUM);
2550 } else if (sse) { 2549 } else if (sse) {
2551 dasm_put(Dst, 12250); 2550 dasm_put(Dst, 12251);
2552 } else { 2551 } else {
2553 dasm_put(Dst, 12265); 2552 dasm_put(Dst, 12266);
2554 } 2553 }
2555 dasm_put(Dst, 10306); 2554 dasm_put(Dst, 10307);
2556 break; 2555 break;
2557 case BC_KNUM: 2556 case BC_KNUM:
2558 if (sse) { 2557 if (sse) {
2559 dasm_put(Dst, 12273); 2558 dasm_put(Dst, 12274);
2560 } else { 2559 } else {
2561 dasm_put(Dst, 12287); 2560 dasm_put(Dst, 12288);
2562 } 2561 }
2563 dasm_put(Dst, 10306); 2562 dasm_put(Dst, 10307);
2564 break; 2563 break;
2565 case BC_KPRI: 2564 case BC_KPRI:
2566 dasm_put(Dst, 12295); 2565 dasm_put(Dst, 12296);
2567 break; 2566 break;
2568 case BC_KNIL: 2567 case BC_KNIL:
2569 dasm_put(Dst, 12324, LJ_TNIL); 2568 dasm_put(Dst, 12325, LJ_TNIL);
2570 break; 2569 break;
2571 2570
2572 /* -- Upvalue and function ops ------------------------------------------ */ 2571 /* -- Upvalue and function ops ------------------------------------------ */
2573 2572
2574 case BC_UGET: 2573 case BC_UGET:
2575 dasm_put(Dst, 12372, offsetof(GCfuncL, uvptr), DtA(->v)); 2574 dasm_put(Dst, 12373, offsetof(GCfuncL, uvptr), DtA(->v));
2576 break; 2575 break;
2577 case BC_USETV: 2576 case BC_USETV:
2578#define TV2MARKOFS \ 2577#define TV2MARKOFS \
2579 ((int32_t)offsetof(GCupval, marked)-(int32_t)offsetof(GCupval, tv)) 2578 ((int32_t)offsetof(GCupval, marked)-(int32_t)offsetof(GCupval, tv))
2580 dasm_put(Dst, 12413, 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, 12414, 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);
2581 dasm_put(Dst, 12509); 2580 dasm_put(Dst, 12510);
2582 break; 2581 break;
2583#undef TV2MARKOFS 2582#undef TV2MARKOFS
2584 case BC_USETS: 2583 case BC_USETS:
2585 dasm_put(Dst, 12521, offsetof(GCfuncL, uvptr), DtA(->v), LJ_TSTR, DtA(->marked), LJ_GC_BLACK, Dt4(->gch.marked), LJ_GC_WHITES, DtA(->closed), GG_DISP2G); 2584 dasm_put(Dst, 12522, offsetof(GCfuncL, uvptr), DtA(->v), LJ_TSTR, DtA(->marked), LJ_GC_BLACK, Dt4(->gch.marked), LJ_GC_WHITES, DtA(->closed), GG_DISP2G);
2586 break; 2585 break;
2587 case BC_USETN: 2586 case BC_USETN:
2588 dasm_put(Dst, 12617); 2587 dasm_put(Dst, 12618);
2589 if (sse) { 2588 if (sse) {
2590 dasm_put(Dst, 12622); 2589 dasm_put(Dst, 12623);
2591 } else { 2590 } else {
2592 dasm_put(Dst, 10838); 2591 dasm_put(Dst, 10839);
2593 } 2592 }
2594 dasm_put(Dst, 12630, offsetof(GCfuncL, uvptr), DtA(->v)); 2593 dasm_put(Dst, 12631, offsetof(GCfuncL, uvptr), DtA(->v));
2595 if (sse) { 2594 if (sse) {
2596 dasm_put(Dst, 12639); 2595 dasm_put(Dst, 12640);
2597 } else { 2596 } else {
2598 dasm_put(Dst, 12645); 2597 dasm_put(Dst, 12646);
2599 } 2598 }
2600 dasm_put(Dst, 10306); 2599 dasm_put(Dst, 10307);
2601 break; 2600 break;
2602 case BC_USETP: 2601 case BC_USETP:
2603 dasm_put(Dst, 12648, offsetof(GCfuncL, uvptr), DtA(->v)); 2602 dasm_put(Dst, 12649, offsetof(GCfuncL, uvptr), DtA(->v));
2604 break; 2603 break;
2605 case BC_UCLO: 2604 case BC_UCLO:
2606 dasm_put(Dst, 12688, -BCBIAS_J*4, Dt1(->openupval), Dt1(->base), Dt1(->base)); 2605 dasm_put(Dst, 12689, -BCBIAS_J*4, Dt1(->openupval), Dt1(->base), Dt1(->base));
2607 break; 2606 break;
2608 2607
2609 case BC_FNEW: 2608 case BC_FNEW:
2610 dasm_put(Dst, 12744, Dt1(->base), Dt1(->base), LJ_TFUNC); 2609 dasm_put(Dst, 12745, Dt1(->base), Dt1(->base), LJ_TFUNC);
2611 break; 2610 break;
2612 2611
2613 /* -- Table ops --------------------------------------------------------- */ 2612 /* -- Table ops --------------------------------------------------------- */
2614 2613
2615 case BC_TNEW: 2614 case BC_TNEW:
2616 dasm_put(Dst, 12811, Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), LJ_TTAB); 2615 dasm_put(Dst, 12812, Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), LJ_TTAB);
2617 break; 2616 break;
2618 case BC_TDUP: 2617 case BC_TDUP:
2619 dasm_put(Dst, 12935, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB); 2618 dasm_put(Dst, 12936, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB);
2620 break; 2619 break;
2621 2620
2622 case BC_GGET: 2621 case BC_GGET:
2623 dasm_put(Dst, 13034, Dt7(->env)); 2622 dasm_put(Dst, 13035, Dt7(->env));
2624 break; 2623 break;
2625 case BC_GSET: 2624 case BC_GSET:
2626 dasm_put(Dst, 13054, Dt7(->env)); 2625 dasm_put(Dst, 13055, Dt7(->env));
2627 break; 2626 break;
2628 2627
2629 case BC_TGETV: 2628 case BC_TGETV:
2630 dasm_put(Dst, 13074, LJ_TTAB); 2629 dasm_put(Dst, 13075, LJ_TTAB);
2631 if (LJ_DUALNUM) { 2630 if (LJ_DUALNUM) {
2632 dasm_put(Dst, 13097, LJ_TISNUM); 2631 dasm_put(Dst, 13098, LJ_TISNUM);
2633 } else { 2632 } else {
2634 dasm_put(Dst, 13111, LJ_TISNUM); 2633 dasm_put(Dst, 13112, LJ_TISNUM);
2635 if (sse) { 2634 if (sse) {
2636 dasm_put(Dst, 13122); 2635 dasm_put(Dst, 13123);
2637 } else { 2636 } else {
2638 } 2637 }
2639 dasm_put(Dst, 13143); 2638 dasm_put(Dst, 13144);
2640 } 2639 }
2641 dasm_put(Dst, 13148, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index, LJ_TNIL); 2640 dasm_put(Dst, 13149, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index, LJ_TNIL);
2642 dasm_put(Dst, 13240, LJ_TSTR); 2641 dasm_put(Dst, 13241, LJ_TSTR);
2643 break; 2642 break;
2644 case BC_TGETS: 2643 case BC_TGETS:
2645 dasm_put(Dst, 13258, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL); 2644 dasm_put(Dst, 13259, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL);
2646 dasm_put(Dst, 13343, LJ_TNIL, DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 2645 dasm_put(Dst, 13344, LJ_TNIL, DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
2647 break; 2646 break;
2648 case BC_TGETB: 2647 case BC_TGETB:
2649 dasm_put(Dst, 13415, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 2648 dasm_put(Dst, 13416, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
2650 dasm_put(Dst, 13511, LJ_TNIL); 2649 dasm_put(Dst, 13512, LJ_TNIL);
2651 break; 2650 break;
2652 2651
2653 case BC_TSETV: 2652 case BC_TSETV:
2654 dasm_put(Dst, 13528, LJ_TTAB); 2653 dasm_put(Dst, 13529, LJ_TTAB);
2655 if (LJ_DUALNUM) { 2654 if (LJ_DUALNUM) {
2656 dasm_put(Dst, 13097, LJ_TISNUM); 2655 dasm_put(Dst, 13098, LJ_TISNUM);
2657 } else { 2656 } else {
2658 dasm_put(Dst, 13111, LJ_TISNUM); 2657 dasm_put(Dst, 13112, LJ_TISNUM);
2659 if (sse) { 2658 if (sse) {
2660 dasm_put(Dst, 13122); 2659 dasm_put(Dst, 13123);
2661 } else { 2660 } else {
2662 } 2661 }
2663 dasm_put(Dst, 13551); 2662 dasm_put(Dst, 13552);
2664 } 2663 }
2665 dasm_put(Dst, 13556, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex); 2664 dasm_put(Dst, 13557, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex);
2666 dasm_put(Dst, 13637, LJ_TSTR, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); 2665 dasm_put(Dst, 13638, LJ_TSTR, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
2667 break; 2666 break;
2668 case BC_TSETS: 2667 case BC_TSETS:
2669 dasm_put(Dst, 13696, 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, 13697, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->nomm), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL);
2670 dasm_put(Dst, 13773, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next)); 2669 dasm_put(Dst, 13774, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next));
2671 dasm_put(Dst, 13860, 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 dasm_put(Dst, 13861, 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));
2672 break; 2671 break;
2673 case BC_TSETB: 2672 case BC_TSETB:
2674 dasm_put(Dst, 13952, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable)); 2673 dasm_put(Dst, 13953, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable));
2675 dasm_put(Dst, 14047, 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 dasm_put(Dst, 14048, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
2676 break; 2675 break;
2677 2676
2678 case BC_TSETM: 2677 case BC_TSETM:
2679 dasm_put(Dst, 14095, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base)); 2678 dasm_put(Dst, 14096, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
2680 dasm_put(Dst, 14245, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); 2679 dasm_put(Dst, 14246, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
2681 break; 2680 break;
2682 2681
2683 /* -- Calls and vararg handling ----------------------------------------- */ 2682 /* -- Calls and vararg handling ----------------------------------------- */
2684 2683
2685 case BC_CALL: case BC_CALLM: 2684 case BC_CALL: case BC_CALLM:
2686 dasm_put(Dst, 11360); 2685 dasm_put(Dst, 11361);
2687 if (op == BC_CALLM) { 2686 if (op == BC_CALLM) {
2688 dasm_put(Dst, 14265); 2687 dasm_put(Dst, 14266);
2689 } 2688 }
2690 dasm_put(Dst, 14270, LJ_TFUNC, Dt7(->pc)); 2689 dasm_put(Dst, 14271, LJ_TFUNC, Dt7(->pc));
2691 break; 2690 break;
2692 2691
2693 case BC_CALLMT: 2692 case BC_CALLMT:
2694 dasm_put(Dst, 14265); 2693 dasm_put(Dst, 14266);
2695 break; 2694 break;
2696 case BC_CALLT: 2695 case BC_CALLT:
2697 dasm_put(Dst, 14313, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc)); 2696 dasm_put(Dst, 14314, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc));
2698 dasm_put(Dst, 14431, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG); 2697 dasm_put(Dst, 14432, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG);
2699 break; 2698 break;
2700 2699
2701 case BC_ITERC: 2700 case BC_ITERC:
2702 dasm_put(Dst, 14505, LJ_TFUNC, 2+1, Dt7(->pc)); 2701 dasm_put(Dst, 14506, LJ_TFUNC, 2+1, Dt7(->pc));
2703 break; 2702 break;
2704 2703
2705 case BC_ITERN: 2704 case BC_ITERN:
2706#if LJ_HASJIT 2705#if LJ_HASJIT
2707#endif 2706#endif
2708 dasm_put(Dst, 14577, Dt6(->asize), Dt6(->array), LJ_TNIL); 2707 dasm_put(Dst, 14578, Dt6(->asize), Dt6(->array), LJ_TNIL);
2709 if (LJ_DUALNUM) { 2708 if (LJ_DUALNUM) {
2710 dasm_put(Dst, 11226, LJ_TISNUM); 2709 dasm_put(Dst, 11227, LJ_TISNUM);
2711 } else if (sse) { 2710 } else if (sse) {
2712 dasm_put(Dst, 11321); 2711 dasm_put(Dst, 11322);
2713 } else { 2712 } else {
2714 dasm_put(Dst, 14629); 2713 dasm_put(Dst, 14630);
2715 } 2714 }
2716 dasm_put(Dst, 14635); 2715 dasm_put(Dst, 14636);
2717 if (LJ_DUALNUM) { 2716 if (LJ_DUALNUM) {
2718 } else if (sse) { 2717 } else if (sse) {
2719 dasm_put(Dst, 11191); 2718 dasm_put(Dst, 11192);
2720 } else { 2719 } else {
2721 dasm_put(Dst, 11203); 2720 dasm_put(Dst, 11204);
2722 } 2721 }
2723 dasm_put(Dst, 14648, -BCBIAS_J*4); 2722 dasm_put(Dst, 14649, -BCBIAS_J*4);
2724 if (!LJ_DUALNUM && !sse) { 2723 if (!LJ_DUALNUM && !sse) {
2725 dasm_put(Dst, 14702); 2724 dasm_put(Dst, 14703);
2726 } 2725 }
2727 dasm_put(Dst, 14708, Dt6(->hmask), sizeof(Node), Dt6(->node), DtB(->val.it), LJ_TNIL, DtB(->key), DtB(->val)); 2726 dasm_put(Dst, 14709, Dt6(->hmask), sizeof(Node), Dt6(->node), DtB(->val.it), LJ_TNIL, DtB(->key), DtB(->val));
2728 break; 2727 break;
2729 2728
2730 case BC_ISNEXT: 2729 case BC_ISNEXT:
2731 dasm_put(Dst, 14787, LJ_TFUNC, LJ_TTAB, LJ_TNIL, Dt8(->ffid), FF_next_N, -BCBIAS_J*4, BC_JMP, -BCBIAS_J*4, BC_ITERC); 2730 dasm_put(Dst, 14788, LJ_TFUNC, LJ_TTAB, LJ_TNIL, Dt8(->ffid), FF_next_N, -BCBIAS_J*4, BC_JMP, -BCBIAS_J*4, BC_ITERC);
2732 break; 2731 break;
2733 2732
2734 case BC_VARG: 2733 case BC_VARG:
2735 dasm_put(Dst, 14888, (8+FRAME_VARG), LJ_TNIL, Dt1(->maxstack)); 2734 dasm_put(Dst, 14889, (8+FRAME_VARG), LJ_TNIL, Dt1(->maxstack));
2736 dasm_put(Dst, 15055, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); 2735 dasm_put(Dst, 15056, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
2737 break; 2736 break;
2738 2737
2739 /* -- Returns ----------------------------------------------------------- */ 2738 /* -- Returns ----------------------------------------------------------- */
2740 2739
2741 case BC_RETM: 2740 case BC_RETM:
2742 dasm_put(Dst, 14265); 2741 dasm_put(Dst, 14266);
2743 break; 2742 break;
2744 2743
2745 case BC_RET: case BC_RET0: case BC_RET1: 2744 case BC_RET: case BC_RET0: case BC_RET1:
2746 if (op != BC_RET0) { 2745 if (op != BC_RET0) {
2747 dasm_put(Dst, 15125); 2746 dasm_put(Dst, 15126);
2748 } 2747 }
2749 dasm_put(Dst, 15129, FRAME_TYPE); 2748 dasm_put(Dst, 15130, FRAME_TYPE);
2750 switch (op) { 2749 switch (op) {
2751 case BC_RET: 2750 case BC_RET:
2752 dasm_put(Dst, 15148); 2751 dasm_put(Dst, 15149);
2753 break; 2752 break;
2754 case BC_RET1: 2753 case BC_RET1:
2755 dasm_put(Dst, 15202); 2754 dasm_put(Dst, 15203);
2756 /* fallthrough */ 2755 /* fallthrough */
2757 case BC_RET0: 2756 case BC_RET0:
2758 dasm_put(Dst, 15212); 2757 dasm_put(Dst, 15213);
2759 default: 2758 default:
2760 break; 2759 break;
2761 } 2760 }
2762 dasm_put(Dst, 15223, Dt7(->pc), PC2PROTO(k)); 2761 dasm_put(Dst, 15224, Dt7(->pc), PC2PROTO(k));
2763 if (op == BC_RET) { 2762 if (op == BC_RET) {
2764 dasm_put(Dst, 15271, LJ_TNIL); 2763 dasm_put(Dst, 15272, LJ_TNIL);
2765 } else { 2764 } else {
2766 dasm_put(Dst, 15282, LJ_TNIL); 2765 dasm_put(Dst, 15283, LJ_TNIL);
2767 } 2766 }
2768 dasm_put(Dst, 15289, -FRAME_VARG, FRAME_TYPEP); 2767 dasm_put(Dst, 15290, -FRAME_VARG, FRAME_TYPEP);
2769 if (op != BC_RET0) { 2768 if (op != BC_RET0) {
2770 dasm_put(Dst, 15313); 2769 dasm_put(Dst, 15314);
2771 } 2770 }
2772 dasm_put(Dst, 4752); 2771 dasm_put(Dst, 4752);
2773 break; 2772 break;
@@ -2777,7 +2776,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2777 2776
2778 case BC_FORL: 2777 case BC_FORL:
2779#if LJ_HASJIT 2778#if LJ_HASJIT
2780 dasm_put(Dst, 15317, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP); 2779 dasm_put(Dst, 15318, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
2781#endif 2780#endif
2782 break; 2781 break;
2783 2782
@@ -2789,111 +2788,111 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2789 case BC_FORI: 2788 case BC_FORI:
2790 case BC_IFORL: 2789 case BC_IFORL:
2791 vk = (op == BC_IFORL || op == BC_JFORL); 2790 vk = (op == BC_IFORL || op == BC_JFORL);
2792 dasm_put(Dst, 15338); 2791 dasm_put(Dst, 15339);
2793 if (LJ_DUALNUM) { 2792 if (LJ_DUALNUM) {
2794 dasm_put(Dst, 15342, LJ_TISNUM); 2793 dasm_put(Dst, 15343, LJ_TISNUM);
2795 if (!vk) { 2794 if (!vk) {
2796 dasm_put(Dst, 15352, LJ_TISNUM, LJ_TISNUM); 2795 dasm_put(Dst, 15353, LJ_TISNUM, LJ_TISNUM);
2797 } else { 2796 } else {
2798#ifdef LUA_USE_ASSERT 2797#ifdef LUA_USE_ASSERT
2799 dasm_put(Dst, 15381, LJ_TISNUM, LJ_TISNUM); 2798 dasm_put(Dst, 15382, LJ_TISNUM, LJ_TISNUM);
2800#endif 2799#endif
2801 dasm_put(Dst, 15400); 2800 dasm_put(Dst, 15401);
2802 } 2801 }
2803 dasm_put(Dst, 15419, LJ_TISNUM); 2802 dasm_put(Dst, 15420, LJ_TISNUM);
2804 if (op == BC_FORI) { 2803 if (op == BC_FORI) {
2805 dasm_put(Dst, 15430, -BCBIAS_J*4); 2804 dasm_put(Dst, 15431, -BCBIAS_J*4);
2806 } else if (op == BC_JFORI) { 2805 } else if (op == BC_JFORI) {
2807 dasm_put(Dst, 15444, -BCBIAS_J*4, BC_JLOOP); 2806 dasm_put(Dst, 15445, -BCBIAS_J*4, BC_JLOOP);
2808 } else if (op == BC_IFORL) { 2807 } else if (op == BC_IFORL) {
2809 dasm_put(Dst, 15462, -BCBIAS_J*4); 2808 dasm_put(Dst, 15463, -BCBIAS_J*4);
2810 } else { 2809 } else {
2811 dasm_put(Dst, 15454, BC_JLOOP); 2810 dasm_put(Dst, 15455, BC_JLOOP);
2812 } 2811 }
2813 dasm_put(Dst, 15476); 2812 dasm_put(Dst, 15477);
2814 if (vk) { 2813 if (vk) {
2815 dasm_put(Dst, 15501); 2814 dasm_put(Dst, 15502);
2816 } 2815 }
2817 dasm_put(Dst, 15419, LJ_TISNUM); 2816 dasm_put(Dst, 15420, LJ_TISNUM);
2818 if (op == BC_FORI) { 2817 if (op == BC_FORI) {
2819 dasm_put(Dst, 15510); 2818 dasm_put(Dst, 15511);
2820 } else if (op == BC_JFORI) { 2819 } else if (op == BC_JFORI) {
2821 dasm_put(Dst, 15515, -BCBIAS_J*4, BC_JLOOP); 2820 dasm_put(Dst, 15516, -BCBIAS_J*4, BC_JLOOP);
2822 } else if (op == BC_IFORL) { 2821 } else if (op == BC_IFORL) {
2823 dasm_put(Dst, 15529); 2822 dasm_put(Dst, 15530);
2824 } else { 2823 } else {
2825 dasm_put(Dst, 15525, BC_JLOOP); 2824 dasm_put(Dst, 15526, BC_JLOOP);
2826 } 2825 }
2827 dasm_put(Dst, 15534); 2826 dasm_put(Dst, 15535);
2828 } else if (!vk) { 2827 } else if (!vk) {
2829 dasm_put(Dst, 15541, LJ_TISNUM); 2828 dasm_put(Dst, 15542, LJ_TISNUM);
2830 } 2829 }
2831 if (!vk) { 2830 if (!vk) {
2832 dasm_put(Dst, 15547, LJ_TISNUM); 2831 dasm_put(Dst, 15548, LJ_TISNUM);
2833 } else { 2832 } else {
2834#ifdef LUA_USE_ASSERT 2833#ifdef LUA_USE_ASSERT
2835 dasm_put(Dst, 15561, LJ_TISNUM, LJ_TISNUM); 2834 dasm_put(Dst, 15562, LJ_TISNUM, LJ_TISNUM);
2836#endif 2835#endif
2837 } 2836 }
2838 dasm_put(Dst, 15580); 2837 dasm_put(Dst, 15581);
2839 if (!vk) { 2838 if (!vk) {
2840 dasm_put(Dst, 15584, LJ_TISNUM); 2839 dasm_put(Dst, 15585, LJ_TISNUM);
2841 } 2840 }
2842 if (sse) { 2841 if (sse) {
2843 dasm_put(Dst, 15593); 2842 dasm_put(Dst, 15594);
2844 if (vk) { 2843 if (vk) {
2845 dasm_put(Dst, 15605); 2844 dasm_put(Dst, 15606);
2846 } else { 2845 } else {
2847 dasm_put(Dst, 15624); 2846 dasm_put(Dst, 15625);
2848 } 2847 }
2849 dasm_put(Dst, 15629); 2848 dasm_put(Dst, 15630);
2850 } else { 2849 } else {
2851 dasm_put(Dst, 15642); 2850 dasm_put(Dst, 15643);
2852 if (vk) { 2851 if (vk) {
2853 dasm_put(Dst, 15648); 2852 dasm_put(Dst, 15649);
2854 } else { 2853 } else {
2855 dasm_put(Dst, 15664); 2854 dasm_put(Dst, 15665);
2856 } 2855 }
2857 dasm_put(Dst, 15672); 2856 dasm_put(Dst, 15673);
2858 if (cmov) { 2857 if (cmov) {
2859 dasm_put(Dst, 10261); 2858 dasm_put(Dst, 10262);
2860 } else { 2859 } else {
2861 dasm_put(Dst, 10267); 2860 dasm_put(Dst, 10268);
2862 } 2861 }
2863 if (!cmov) { 2862 if (!cmov) {
2864 dasm_put(Dst, 15677); 2863 dasm_put(Dst, 15678);
2865 } 2864 }
2866 } 2865 }
2867 if (op == BC_FORI) { 2866 if (op == BC_FORI) {
2868 if (LJ_DUALNUM) { 2867 if (LJ_DUALNUM) {
2869 dasm_put(Dst, 15683); 2868 dasm_put(Dst, 15684);
2870 } else { 2869 } else {
2871 dasm_put(Dst, 15688, -BCBIAS_J*4); 2870 dasm_put(Dst, 15689, -BCBIAS_J*4);
2872 } 2871 }
2873 } else if (op == BC_JFORI) { 2872 } else if (op == BC_JFORI) {
2874 dasm_put(Dst, 15698, -BCBIAS_J*4, BC_JLOOP); 2873 dasm_put(Dst, 15699, -BCBIAS_J*4, BC_JLOOP);
2875 } else if (op == BC_IFORL) { 2874 } else if (op == BC_IFORL) {
2876 if (LJ_DUALNUM) { 2875 if (LJ_DUALNUM) {
2877 dasm_put(Dst, 15712); 2876 dasm_put(Dst, 15713);
2878 } else { 2877 } else {
2879 dasm_put(Dst, 15717, -BCBIAS_J*4); 2878 dasm_put(Dst, 15718, -BCBIAS_J*4);
2880 } 2879 }
2881 } else { 2880 } else {
2882 dasm_put(Dst, 15708, BC_JLOOP); 2881 dasm_put(Dst, 15709, BC_JLOOP);
2883 } 2882 }
2884 if (LJ_DUALNUM) { 2883 if (LJ_DUALNUM) {
2885 dasm_put(Dst, 10190); 2884 dasm_put(Dst, 10191);
2886 } else { 2885 } else {
2887 dasm_put(Dst, 10972); 2886 dasm_put(Dst, 10973);
2888 } 2887 }
2889 if (sse) { 2888 if (sse) {
2890 dasm_put(Dst, 15727); 2889 dasm_put(Dst, 15728);
2891 } 2890 }
2892 break; 2891 break;
2893 2892
2894 case BC_ITERL: 2893 case BC_ITERL:
2895#if LJ_HASJIT 2894#if LJ_HASJIT
2896 dasm_put(Dst, 15317, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP); 2895 dasm_put(Dst, 15318, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
2897#endif 2896#endif
2898 break; 2897 break;
2899 2898
@@ -2902,33 +2901,33 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2902 break; 2901 break;
2903#endif 2902#endif
2904 case BC_IITERL: 2903 case BC_IITERL:
2905 dasm_put(Dst, 15738, LJ_TNIL); 2904 dasm_put(Dst, 15739, LJ_TNIL);
2906 if (op == BC_JITERL) { 2905 if (op == BC_JITERL) {
2907 dasm_put(Dst, 15753, BC_JLOOP); 2906 dasm_put(Dst, 15754, BC_JLOOP);
2908 } else { 2907 } else {
2909 dasm_put(Dst, 15767, -BCBIAS_J*4); 2908 dasm_put(Dst, 15768, -BCBIAS_J*4);
2910 } 2909 }
2911 dasm_put(Dst, 10304); 2910 dasm_put(Dst, 10305);
2912 break; 2911 break;
2913 2912
2914 case BC_LOOP: 2913 case BC_LOOP:
2915#if LJ_HASJIT 2914#if LJ_HASJIT
2916 dasm_put(Dst, 15317, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP); 2915 dasm_put(Dst, 15318, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
2917#endif 2916#endif
2918 break; 2917 break;
2919 2918
2920 case BC_ILOOP: 2919 case BC_ILOOP:
2921 dasm_put(Dst, 10306); 2920 dasm_put(Dst, 10307);
2922 break; 2921 break;
2923 2922
2924 case BC_JLOOP: 2923 case BC_JLOOP:
2925#if LJ_HASJIT 2924#if LJ_HASJIT
2926 dasm_put(Dst, 15783, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L)); 2925 dasm_put(Dst, 15784, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L));
2927#endif 2926#endif
2928 break; 2927 break;
2929 2928
2930 case BC_JMP: 2929 case BC_JMP:
2931 dasm_put(Dst, 15824, -BCBIAS_J*4); 2930 dasm_put(Dst, 15825, -BCBIAS_J*4);
2932 break; 2931 break;
2933 2932
2934 /* -- Function headers -------------------------------------------------- */ 2933 /* -- Function headers -------------------------------------------------- */
@@ -2942,7 +2941,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2942 2941
2943 case BC_FUNCF: 2942 case BC_FUNCF:
2944#if LJ_HASJIT 2943#if LJ_HASJIT
2945 dasm_put(Dst, 15850, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_CALL); 2944 dasm_put(Dst, 15851, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_CALL);
2946#endif 2945#endif
2947 case BC_FUNCV: /* NYI: compiled vararg functions. */ 2946 case BC_FUNCV: /* NYI: compiled vararg functions. */
2948 break; 2947 break;
@@ -2952,13 +2951,13 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2952 break; 2951 break;
2953#endif 2952#endif
2954 case BC_IFUNCF: 2953 case BC_IFUNCF:
2955 dasm_put(Dst, 15871, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams)); 2954 dasm_put(Dst, 15872, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams));
2956 if (op == BC_JFUNCF) { 2955 if (op == BC_JFUNCF) {
2957 dasm_put(Dst, 15902, BC_JLOOP); 2956 dasm_put(Dst, 15903, BC_JLOOP);
2958 } else { 2957 } else {
2959 dasm_put(Dst, 10306); 2958 dasm_put(Dst, 10307);
2960 } 2959 }
2961 dasm_put(Dst, 15911, LJ_TNIL); 2960 dasm_put(Dst, 15912, LJ_TNIL);
2962 break; 2961 break;
2963 2962
2964 case BC_JFUNCV: 2963 case BC_JFUNCV:
@@ -2969,30 +2968,30 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2969 break; /* NYI: compiled vararg functions. */ 2968 break; /* NYI: compiled vararg functions. */
2970 2969
2971 case BC_IFUNCV: 2970 case BC_IFUNCV:
2972 dasm_put(Dst, 15933, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL); 2971 dasm_put(Dst, 15934, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL);
2973 if (op == BC_JFUNCV) { 2972 if (op == BC_JFUNCV) {
2974 dasm_put(Dst, 15902, BC_JLOOP); 2973 dasm_put(Dst, 15903, BC_JLOOP);
2975 } else { 2974 } else {
2976 dasm_put(Dst, 16030, -4+PC2PROTO(k)); 2975 dasm_put(Dst, 16031, -4+PC2PROTO(k));
2977 } 2976 }
2978 dasm_put(Dst, 16055, LJ_TNIL); 2977 dasm_put(Dst, 16056, LJ_TNIL);
2979 break; 2978 break;
2980 2979
2981 case BC_FUNCC: 2980 case BC_FUNCC:
2982 case BC_FUNCCW: 2981 case BC_FUNCCW:
2983 dasm_put(Dst, 16077, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top)); 2982 dasm_put(Dst, 16078, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top));
2984 if (op == BC_FUNCC) { 2983 if (op == BC_FUNCC) {
2985 dasm_put(Dst, 2424); 2984 dasm_put(Dst, 2424);
2986 } else { 2985 } else {
2987 dasm_put(Dst, 16107); 2986 dasm_put(Dst, 16108);
2988 } 2987 }
2989 dasm_put(Dst, 16115, DISPATCH_GL(vmstate), ~LJ_VMST_C); 2988 dasm_put(Dst, 16116, DISPATCH_GL(vmstate), ~LJ_VMST_C);
2990 if (op == BC_FUNCC) { 2989 if (op == BC_FUNCC) {
2991 dasm_put(Dst, 16125); 2990 dasm_put(Dst, 16126);
2992 } else { 2991 } else {
2993 dasm_put(Dst, 16130, DISPATCH_GL(wrapf)); 2992 dasm_put(Dst, 16131, DISPATCH_GL(wrapf));
2994 } 2993 }
2995 dasm_put(Dst, 16136, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top)); 2994 dasm_put(Dst, 16137, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top));
2996 break; 2995 break;
2997 2996
2998 /* ---------------------------------------------------------------------- */ 2997 /* ---------------------------------------------------------------------- */
@@ -3020,7 +3019,7 @@ static int build_backend(BuildCtx *ctx)
3020 3019
3021 build_subroutines(ctx, cmov, sse); 3020 build_subroutines(ctx, cmov, sse);
3022 3021
3023 dasm_put(Dst, 16162); 3022 dasm_put(Dst, 16163);
3024 for (op = 0; op < BC__MAX; op++) 3023 for (op = 0; op < BC__MAX; op++)
3025 build_ins(ctx, (BCOp)op, op, cmov, sse); 3024 build_ins(ctx, (BCOp)op, op, cmov, sse);
3026 3025
@@ -3030,6 +3029,7 @@ static int build_backend(BuildCtx *ctx)
3030/* Emit pseudo frame-info for all assembler functions. */ 3029/* Emit pseudo frame-info for all assembler functions. */
3031static void emit_asm_debug(BuildCtx *ctx) 3030static void emit_asm_debug(BuildCtx *ctx)
3032{ 3031{
3032 int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
3033#if LJ_64 3033#if LJ_64
3034#define SZPTR "8" 3034#define SZPTR "8"
3035#define BSZPTR "3" 3035#define BSZPTR "3"
@@ -3063,22 +3063,49 @@ static void emit_asm_debug(BuildCtx *ctx)
3063 "\t.long .LEFDE0-.LASFDE0\n" 3063 "\t.long .LEFDE0-.LASFDE0\n"
3064 ".LASFDE0:\n" 3064 ".LASFDE0:\n"
3065 "\t.long .Lframe0\n" 3065 "\t.long .Lframe0\n"
3066 "\t.long .Lbegin\n"
3067 "\t.long %d\n"
3068 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
3069#if LJ_64 3066#if LJ_64
3067 "\t.quad .Lbegin\n"
3068 "\t.quad %d\n"
3069 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
3070 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */ 3070 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
3071 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */ 3071 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
3072 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */ 3072 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
3073 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */ 3073 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
3074#else 3074#else
3075 "\t.long .Lbegin\n"
3076 "\t.long %d\n"
3077 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
3075 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */ 3078 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
3076 "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */ 3079 "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */
3077 "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */ 3080 "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */
3078 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ 3081 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
3079#endif 3082#endif
3080 "\t.align " SZPTR "\n" 3083 "\t.align " SZPTR "\n"
3081 ".LEFDE0:\n\n", (int)ctx->codesz, CFRAME_SIZE); 3084 ".LEFDE0:\n\n", fcofs, CFRAME_SIZE);
3085#if LJ_HASFFI
3086 fprintf(ctx->fp,
3087 ".LSFDE1:\n"
3088 "\t.long .LEFDE1-.LASFDE1\n"
3089 ".LASFDE1:\n"
3090 "\t.long .Lframe0\n"
3091#if LJ_64
3092 "\t.quad lj_vm_ffi_call\n"
3093 "\t.quad %d\n"
3094 "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
3095 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
3096 "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
3097 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
3098#else
3099 "\t.long lj_vm_ffi_call\n"
3100 "\t.long %d\n"
3101 "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
3102 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
3103 "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
3104 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
3105#endif
3106 "\t.align " SZPTR "\n"
3107 ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
3108#endif
3082#if (defined(__sun__) && defined(__svr4__)) || defined(__solaris_) 3109#if (defined(__sun__) && defined(__svr4__)) || defined(__solaris_)
3083 fprintf(ctx->fp, "\t.section .eh_frame,\"aw\",@progbits\n"); 3110 fprintf(ctx->fp, "\t.section .eh_frame,\"aw\",@progbits\n");
3084#else 3111#else
@@ -3103,10 +3130,10 @@ static void emit_asm_debug(BuildCtx *ctx)
3103 "\t.align " SZPTR "\n" 3130 "\t.align " SZPTR "\n"
3104 ".LECIE1:\n\n"); 3131 ".LECIE1:\n\n");
3105 fprintf(ctx->fp, 3132 fprintf(ctx->fp,
3106 ".LSFDE1:\n" 3133 ".LSFDE2:\n"
3107 "\t.long .LEFDE1-.LASFDE1\n" 3134 "\t.long .LEFDE2-.LASFDE2\n"
3108 ".LASFDE1:\n" 3135 ".LASFDE2:\n"
3109 "\t.long .LASFDE1-.Lframe1\n" 3136 "\t.long .LASFDE2-.Lframe1\n"
3110 "\t.long .Lbegin-.\n" 3137 "\t.long .Lbegin-.\n"
3111 "\t.long %d\n" 3138 "\t.long %d\n"
3112 "\t.uleb128 0\n" /* augmentation length */ 3139 "\t.uleb128 0\n" /* augmentation length */
@@ -3123,7 +3150,46 @@ static void emit_asm_debug(BuildCtx *ctx)
3123 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ 3150 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
3124#endif 3151#endif
3125 "\t.align " SZPTR "\n" 3152 "\t.align " SZPTR "\n"
3126 ".LEFDE1:\n\n", (int)ctx->codesz, CFRAME_SIZE); 3153 ".LEFDE2:\n\n", fcofs, CFRAME_SIZE);
3154#if LJ_HASFFI
3155 fprintf(ctx->fp,
3156 ".Lframe2:\n"
3157 "\t.long .LECIE2-.LSCIE2\n"
3158 ".LSCIE2:\n"
3159 "\t.long 0\n"
3160 "\t.byte 0x1\n"
3161 "\t.string \"zR\"\n"
3162 "\t.uleb128 0x1\n"
3163 "\t.sleb128 -" SZPTR "\n"
3164 "\t.byte " REG_RA "\n"
3165 "\t.uleb128 1\n" /* augmentation length */
3166 "\t.byte 0x1b\n" /* pcrel|sdata4 */
3167 "\t.byte 0xc\n\t.uleb128 " REG_SP "\n\t.uleb128 " SZPTR "\n"
3168 "\t.byte 0x80+" REG_RA "\n\t.uleb128 0x1\n"
3169 "\t.align " SZPTR "\n"
3170 ".LECIE2:\n\n");
3171 fprintf(ctx->fp,
3172 ".LSFDE3:\n"
3173 "\t.long .LEFDE3-.LASFDE3\n"
3174 ".LASFDE3:\n"
3175 "\t.long .LASFDE3-.Lframe2\n"
3176 "\t.long lj_vm_ffi_call-.\n"
3177 "\t.long %d\n"
3178 "\t.uleb128 0\n" /* augmentation length */
3179#if LJ_64
3180 "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
3181 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
3182 "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
3183 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
3184#else
3185 "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
3186 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
3187 "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
3188 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
3189#endif
3190 "\t.align " SZPTR "\n"
3191 ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
3192#endif
3127 break; 3193 break;
3128 case BUILD_coffasm: 3194 case BUILD_coffasm:
3129 fprintf(ctx->fp, "\t.section .eh_frame,\"dr\"\n"); 3195 fprintf(ctx->fp, "\t.section .eh_frame,\"dr\"\n");
@@ -3174,6 +3240,9 @@ static void emit_asm_debug(BuildCtx *ctx)
3174 ** Or a linker. Or a plastic case. But I digress. 3240 ** Or a linker. Or a plastic case. But I digress.
3175 */ 3241 */
3176 case BUILD_machasm: { 3242 case BUILD_machasm: {
3243#if LJ_HASFFI
3244 int fcsize = 0;
3245#endif
3177 int i; 3246 int i;
3178 fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n"); 3247 fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n");
3179 fprintf(ctx->fp, 3248 fprintf(ctx->fp,
@@ -3205,6 +3274,9 @@ static void emit_asm_debug(BuildCtx *ctx)
3205 const char *name = ctx->sym[i].name; 3274 const char *name = ctx->sym[i].name;
3206 int32_t size = ctx->sym[i+1].ofs - ctx->sym[i].ofs; 3275 int32_t size = ctx->sym[i+1].ofs - ctx->sym[i].ofs;
3207 if (size == 0) continue; 3276 if (size == 0) continue;
3277#if LJ_HASFFI
3278 if (!strcmp(name, "_lj_vm_ffi_call")) { fcsize = size; continue; }
3279#endif
3208 fprintf(ctx->fp, 3280 fprintf(ctx->fp,
3209 "%s.eh:\n" 3281 "%s.eh:\n"
3210 "LSFDE%d:\n" 3282 "LSFDE%d:\n"
@@ -3214,23 +3286,72 @@ static void emit_asm_debug(BuildCtx *ctx)
3214 "\t.long LASFDE%d-EH_frame1\n" 3286 "\t.long LASFDE%d-EH_frame1\n"
3215 "\t.long %s-.\n" 3287 "\t.long %s-.\n"
3216 "\t.long %d\n" 3288 "\t.long %d\n"
3217 "\t.byte 0\n" /* augmentation length */ 3289 "\t.byte 0\n" /* augmentation length */
3218 "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */ 3290 "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */
3219#if LJ_64 3291#if LJ_64
3220 "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */ 3292 "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
3221 "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */ 3293 "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
3222 "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */ 3294 "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */
3223 "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */ 3295 "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */
3224#else 3296#else
3225 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/ 3297 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
3226 "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */ 3298 "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */
3227 "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */ 3299 "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */
3228 "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */ 3300 "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */
3229#endif 3301#endif
3230 "\t.align " BSZPTR "\n" 3302 "\t.align " BSZPTR "\n"
3231 "LEFDE%d:\n\n", 3303 "LEFDE%d:\n\n",
3232 name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i); 3304 name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i);
3233 } 3305 }
3306#if LJ_HASFFI
3307 if (fcsize) {
3308 fprintf(ctx->fp,
3309 "EH_frame2:\n"
3310 "\t.set L$set$y,LECIEY-LSCIEY\n"
3311 "\t.long L$set$y\n"
3312 "LSCIEY:\n"
3313 "\t.long 0\n"
3314 "\t.byte 0x1\n"
3315 "\t.ascii \"zR\\0\"\n"
3316 "\t.byte 0x1\n"
3317 "\t.byte 128-" SZPTR "\n"
3318 "\t.byte " REG_RA "\n"
3319 "\t.byte 1\n" /* augmentation length */
3320#if LJ_64
3321 "\t.byte 0x1b\n" /* pcrel|sdata4 */
3322 "\t.byte 0xc\n\t.byte " REG_SP "\n\t.byte " SZPTR "\n"
3323#else
3324 "\t.byte 0x1b\n" /* pcrel|sdata4 */
3325 "\t.byte 0xc\n\t.byte 0x5\n\t.byte 0x4\n" /* esp=5 on 32 bit MACH. */
3326#endif
3327 "\t.byte 0x80+" REG_RA "\n\t.byte 0x1\n"
3328 "\t.align " BSZPTR "\n"
3329 "LECIEY:\n\n");
3330 fprintf(ctx->fp,
3331 "_lj_vm_ffi_call.eh:\n"
3332 "LSFDEY:\n"
3333 "\t.set L$set$yy,LEFDEY-LASFDEY\n"
3334 "\t.long L$set$yy\n"
3335 "LASFDEY:\n"
3336 "\t.long LASFDEY-EH_frame2\n"
3337 "\t.long _lj_vm_ffi_call-.\n"
3338 "\t.long %d\n"
3339 "\t.byte 0\n" /* augmentation length */
3340#if LJ_64
3341 "\t.byte 0xe\n\t.byte 16\n" /* def_cfa_offset */
3342 "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
3343 "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
3344 "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
3345#else
3346 "\t.byte 0xe\n\t.byte 8\n" /* def_cfa_offset */
3347 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
3348 "\t.byte 0xd\n\t.uleb128 0x4\n" /* def_cfa_register ebp */
3349 "\t.byte 0x83\n\t.byte 0x3\n" /* offset ebx */
3350#endif
3351 "\t.align " BSZPTR "\n"
3352 "LEFDEY:\n\n", fcsize);
3353 }
3354#endif
3234#if LJ_64 3355#if LJ_64
3235 fprintf(ctx->fp, "\t.subsections_via_symbols\n"); 3356 fprintf(ctx->fp, "\t.subsections_via_symbols\n");
3236#else 3357#else
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
diff --git a/src/buildvm_x86.dasc b/src/buildvm_x86.dasc
index a667bcb6..dd409c5c 100644
--- a/src/buildvm_x86.dasc
+++ b/src/buildvm_x86.dasc
@@ -3687,10 +3687,21 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
3687 |.endif 3687 |.endif
3688 | 3688 |
3689 |//----------------------------------------------------------------------- 3689 |//-----------------------------------------------------------------------
3690 |//-- Assertions ---------------------------------------------------------
3691 |//-----------------------------------------------------------------------
3692 |
3693 |->assert_bad_for_arg_type:
3694#ifdef LUA_USE_ASSERT
3695 | int3
3696#endif
3697 | int3
3698 |
3699 |//-----------------------------------------------------------------------
3690 |//-- FFI helper functions ----------------------------------------------- 3700 |//-- FFI helper functions -----------------------------------------------
3691 |//----------------------------------------------------------------------- 3701 |//-----------------------------------------------------------------------
3692 | 3702 |
3693 |->vm_ffi_call@4: 3703 |->vm_ffi_call@4: // Call C function via FFI.
3704 | // Caveat: needs special frame unwinding, see below.
3694#if LJ_HASFFI 3705#if LJ_HASFFI
3695 |.if X64 3706 |.if X64
3696 | .type CCSTATE, CCallState, rbx 3707 | .type CCSTATE, CCallState, rbx
@@ -3786,16 +3797,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
3786 | mov ebx, [ebp-4]; leave; ret 3797 | mov ebx, [ebp-4]; leave; ret
3787 |.endif 3798 |.endif
3788#endif 3799#endif
3789 | 3800 |// Note: vm_ffi_call must be the last function in this object file!
3790 |//-----------------------------------------------------------------------
3791 |//-- Assertions ---------------------------------------------------------
3792 |//-----------------------------------------------------------------------
3793 |
3794 |->assert_bad_for_arg_type:
3795#ifdef LUA_USE_ASSERT
3796 | int3
3797#endif
3798 | int3
3799 | 3801 |
3800 |//----------------------------------------------------------------------- 3802 |//-----------------------------------------------------------------------
3801} 3803}
@@ -6001,6 +6003,7 @@ static int build_backend(BuildCtx *ctx)
6001/* Emit pseudo frame-info for all assembler functions. */ 6003/* Emit pseudo frame-info for all assembler functions. */
6002static void emit_asm_debug(BuildCtx *ctx) 6004static void emit_asm_debug(BuildCtx *ctx)
6003{ 6005{
6006 int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
6004#if LJ_64 6007#if LJ_64
6005#define SZPTR "8" 6008#define SZPTR "8"
6006#define BSZPTR "3" 6009#define BSZPTR "3"
@@ -6034,22 +6037,49 @@ static void emit_asm_debug(BuildCtx *ctx)
6034 "\t.long .LEFDE0-.LASFDE0\n" 6037 "\t.long .LEFDE0-.LASFDE0\n"
6035 ".LASFDE0:\n" 6038 ".LASFDE0:\n"
6036 "\t.long .Lframe0\n" 6039 "\t.long .Lframe0\n"
6037 "\t.long .Lbegin\n"
6038 "\t.long %d\n"
6039 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
6040#if LJ_64 6040#if LJ_64
6041 "\t.quad .Lbegin\n"
6042 "\t.quad %d\n"
6043 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
6041 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */ 6044 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
6042 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */ 6045 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
6043 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */ 6046 "\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
6044 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */ 6047 "\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
6045#else 6048#else
6049 "\t.long .Lbegin\n"
6050 "\t.long %d\n"
6051 "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
6046 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */ 6052 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
6047 "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */ 6053 "\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */
6048 "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */ 6054 "\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */
6049 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ 6055 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
6050#endif 6056#endif
6051 "\t.align " SZPTR "\n" 6057 "\t.align " SZPTR "\n"
6052 ".LEFDE0:\n\n", (int)ctx->codesz, CFRAME_SIZE); 6058 ".LEFDE0:\n\n", fcofs, CFRAME_SIZE);
6059#if LJ_HASFFI
6060 fprintf(ctx->fp,
6061 ".LSFDE1:\n"
6062 "\t.long .LEFDE1-.LASFDE1\n"
6063 ".LASFDE1:\n"
6064 "\t.long .Lframe0\n"
6065#if LJ_64
6066 "\t.quad lj_vm_ffi_call\n"
6067 "\t.quad %d\n"
6068 "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
6069 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
6070 "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
6071 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
6072#else
6073 "\t.long lj_vm_ffi_call\n"
6074 "\t.long %d\n"
6075 "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
6076 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
6077 "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
6078 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
6079#endif
6080 "\t.align " SZPTR "\n"
6081 ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
6082#endif
6053#if (defined(__sun__) && defined(__svr4__)) || defined(__solaris_) 6083#if (defined(__sun__) && defined(__svr4__)) || defined(__solaris_)
6054 fprintf(ctx->fp, "\t.section .eh_frame,\"aw\",@progbits\n"); 6084 fprintf(ctx->fp, "\t.section .eh_frame,\"aw\",@progbits\n");
6055#else 6085#else
@@ -6074,10 +6104,10 @@ static void emit_asm_debug(BuildCtx *ctx)
6074 "\t.align " SZPTR "\n" 6104 "\t.align " SZPTR "\n"
6075 ".LECIE1:\n\n"); 6105 ".LECIE1:\n\n");
6076 fprintf(ctx->fp, 6106 fprintf(ctx->fp,
6077 ".LSFDE1:\n" 6107 ".LSFDE2:\n"
6078 "\t.long .LEFDE1-.LASFDE1\n" 6108 "\t.long .LEFDE2-.LASFDE2\n"
6079 ".LASFDE1:\n" 6109 ".LASFDE2:\n"
6080 "\t.long .LASFDE1-.Lframe1\n" 6110 "\t.long .LASFDE2-.Lframe1\n"
6081 "\t.long .Lbegin-.\n" 6111 "\t.long .Lbegin-.\n"
6082 "\t.long %d\n" 6112 "\t.long %d\n"
6083 "\t.uleb128 0\n" /* augmentation length */ 6113 "\t.uleb128 0\n" /* augmentation length */
@@ -6094,7 +6124,46 @@ static void emit_asm_debug(BuildCtx *ctx)
6094 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */ 6124 "\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
6095#endif 6125#endif
6096 "\t.align " SZPTR "\n" 6126 "\t.align " SZPTR "\n"
6097 ".LEFDE1:\n\n", (int)ctx->codesz, CFRAME_SIZE); 6127 ".LEFDE2:\n\n", fcofs, CFRAME_SIZE);
6128#if LJ_HASFFI
6129 fprintf(ctx->fp,
6130 ".Lframe2:\n"
6131 "\t.long .LECIE2-.LSCIE2\n"
6132 ".LSCIE2:\n"
6133 "\t.long 0\n"
6134 "\t.byte 0x1\n"
6135 "\t.string \"zR\"\n"
6136 "\t.uleb128 0x1\n"
6137 "\t.sleb128 -" SZPTR "\n"
6138 "\t.byte " REG_RA "\n"
6139 "\t.uleb128 1\n" /* augmentation length */
6140 "\t.byte 0x1b\n" /* pcrel|sdata4 */
6141 "\t.byte 0xc\n\t.uleb128 " REG_SP "\n\t.uleb128 " SZPTR "\n"
6142 "\t.byte 0x80+" REG_RA "\n\t.uleb128 0x1\n"
6143 "\t.align " SZPTR "\n"
6144 ".LECIE2:\n\n");
6145 fprintf(ctx->fp,
6146 ".LSFDE3:\n"
6147 "\t.long .LEFDE3-.LASFDE3\n"
6148 ".LASFDE3:\n"
6149 "\t.long .LASFDE3-.Lframe2\n"
6150 "\t.long lj_vm_ffi_call-.\n"
6151 "\t.long %d\n"
6152 "\t.uleb128 0\n" /* augmentation length */
6153#if LJ_64
6154 "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
6155 "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
6156 "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
6157 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
6158#else
6159 "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
6160 "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
6161 "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
6162 "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
6163#endif
6164 "\t.align " SZPTR "\n"
6165 ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
6166#endif
6098 break; 6167 break;
6099 case BUILD_coffasm: 6168 case BUILD_coffasm:
6100 fprintf(ctx->fp, "\t.section .eh_frame,\"dr\"\n"); 6169 fprintf(ctx->fp, "\t.section .eh_frame,\"dr\"\n");
@@ -6145,6 +6214,9 @@ static void emit_asm_debug(BuildCtx *ctx)
6145 ** Or a linker. Or a plastic case. But I digress. 6214 ** Or a linker. Or a plastic case. But I digress.
6146 */ 6215 */
6147 case BUILD_machasm: { 6216 case BUILD_machasm: {
6217#if LJ_HASFFI
6218 int fcsize = 0;
6219#endif
6148 int i; 6220 int i;
6149 fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n"); 6221 fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n");
6150 fprintf(ctx->fp, 6222 fprintf(ctx->fp,
@@ -6176,6 +6248,9 @@ static void emit_asm_debug(BuildCtx *ctx)
6176 const char *name = ctx->sym[i].name; 6248 const char *name = ctx->sym[i].name;
6177 int32_t size = ctx->sym[i+1].ofs - ctx->sym[i].ofs; 6249 int32_t size = ctx->sym[i+1].ofs - ctx->sym[i].ofs;
6178 if (size == 0) continue; 6250 if (size == 0) continue;
6251#if LJ_HASFFI
6252 if (!strcmp(name, "_lj_vm_ffi_call")) { fcsize = size; continue; }
6253#endif
6179 fprintf(ctx->fp, 6254 fprintf(ctx->fp,
6180 "%s.eh:\n" 6255 "%s.eh:\n"
6181 "LSFDE%d:\n" 6256 "LSFDE%d:\n"
@@ -6185,23 +6260,72 @@ static void emit_asm_debug(BuildCtx *ctx)
6185 "\t.long LASFDE%d-EH_frame1\n" 6260 "\t.long LASFDE%d-EH_frame1\n"
6186 "\t.long %s-.\n" 6261 "\t.long %s-.\n"
6187 "\t.long %d\n" 6262 "\t.long %d\n"
6188 "\t.byte 0\n" /* augmentation length */ 6263 "\t.byte 0\n" /* augmentation length */
6189 "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */ 6264 "\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */
6190#if LJ_64 6265#if LJ_64
6191 "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */ 6266 "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
6192 "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */ 6267 "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
6193 "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */ 6268 "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */
6194 "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */ 6269 "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */
6195#else 6270#else
6196 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/ 6271 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
6197 "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */ 6272 "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */
6198 "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */ 6273 "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */
6199 "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */ 6274 "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */
6200#endif 6275#endif
6201 "\t.align " BSZPTR "\n" 6276 "\t.align " BSZPTR "\n"
6202 "LEFDE%d:\n\n", 6277 "LEFDE%d:\n\n",
6203 name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i); 6278 name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i);
6204 } 6279 }
6280#if LJ_HASFFI
6281 if (fcsize) {
6282 fprintf(ctx->fp,
6283 "EH_frame2:\n"
6284 "\t.set L$set$y,LECIEY-LSCIEY\n"
6285 "\t.long L$set$y\n"
6286 "LSCIEY:\n"
6287 "\t.long 0\n"
6288 "\t.byte 0x1\n"
6289 "\t.ascii \"zR\\0\"\n"
6290 "\t.byte 0x1\n"
6291 "\t.byte 128-" SZPTR "\n"
6292 "\t.byte " REG_RA "\n"
6293 "\t.byte 1\n" /* augmentation length */
6294#if LJ_64
6295 "\t.byte 0x1b\n" /* pcrel|sdata4 */
6296 "\t.byte 0xc\n\t.byte " REG_SP "\n\t.byte " SZPTR "\n"
6297#else
6298 "\t.byte 0x1b\n" /* pcrel|sdata4 */
6299 "\t.byte 0xc\n\t.byte 0x5\n\t.byte 0x4\n" /* esp=5 on 32 bit MACH. */
6300#endif
6301 "\t.byte 0x80+" REG_RA "\n\t.byte 0x1\n"
6302 "\t.align " BSZPTR "\n"
6303 "LECIEY:\n\n");
6304 fprintf(ctx->fp,
6305 "_lj_vm_ffi_call.eh:\n"
6306 "LSFDEY:\n"
6307 "\t.set L$set$yy,LEFDEY-LASFDEY\n"
6308 "\t.long L$set$yy\n"
6309 "LASFDEY:\n"
6310 "\t.long LASFDEY-EH_frame2\n"
6311 "\t.long _lj_vm_ffi_call-.\n"
6312 "\t.long %d\n"
6313 "\t.byte 0\n" /* augmentation length */
6314#if LJ_64
6315 "\t.byte 0xe\n\t.byte 16\n" /* def_cfa_offset */
6316 "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
6317 "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
6318 "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
6319#else
6320 "\t.byte 0xe\n\t.byte 8\n" /* def_cfa_offset */
6321 "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
6322 "\t.byte 0xd\n\t.uleb128 0x4\n" /* def_cfa_register ebp */
6323 "\t.byte 0x83\n\t.byte 0x3\n" /* offset ebx */
6324#endif
6325 "\t.align " BSZPTR "\n"
6326 "LEFDEY:\n\n", fcsize);
6327 }
6328#endif
6205#if LJ_64 6329#if LJ_64
6206 fprintf(ctx->fp, "\t.subsections_via_symbols\n"); 6330 fprintf(ctx->fp, "\t.subsections_via_symbols\n");
6207#else 6331#else
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
diff --git a/src/lj_ccall.h b/src/lj_ccall.h
index 890f665d..14f61924 100644
--- a/src/lj_ccall.h
+++ b/src/lj_ccall.h
@@ -64,8 +64,8 @@ typedef intptr_t GPRArg;
64#define CCALL_NARG_FPR 8 64#define CCALL_NARG_FPR 8
65#define CCALL_NRET_GPR 4 /* For complex double. */ 65#define CCALL_NRET_GPR 4 /* For complex double. */
66#define CCALL_NRET_FPR 1 66#define CCALL_NRET_FPR 1
67#define CCALL_SPS_EXTRA 3 67#define CCALL_SPS_EXTRA 4
68#define CCALL_SPS_FREE 1 68#define CCALL_SPS_FREE 0
69 69
70typedef intptr_t GPRArg; 70typedef intptr_t GPRArg;
71typedef double FPRArg; 71typedef double FPRArg;