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:
Callbacks from C code to Lua functions.
Passing structs by value to vararg C functions.
C++ exception interoperability
-does not extend to C functions called via the FFI.
+does not extend to C functions called via the FFI, if the call is
+compiled.
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)
|//-- FFI helper functions -----------------------------------------------
|//-----------------------------------------------------------------------
|
- |->vm_ffi_call:
+ |->vm_ffi_call: // Call C function via FFI.
+ | // Caveat: needs special frame unwinding, see below.
#if LJ_HASFFI
| .type CCSTATE, CCallState, r4
| push {CCSTATE, r5, r11, lr}
@@ -2207,6 +2208,7 @@ static void build_subroutines(BuildCtx *ctx)
| str CRET2, CCSTATE->gpr[1]
| pop {CCSTATE, r5, r11, pc}
#endif
+ |// Note: vm_ffi_call must be the last function in this object file!
|
|//-----------------------------------------------------------------------
}
@@ -4003,6 +4005,7 @@ static int build_backend(BuildCtx *ctx)
/* Emit pseudo frame-info for all assembler functions. */
static void emit_asm_debug(BuildCtx *ctx)
{
+ int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
int i;
switch (ctx->mode) {
case BUILD_elfasm:
@@ -4028,13 +4031,30 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.long .Lbegin\n"
"\t.long %d\n"
"\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
- "\t.byte 0x8e\n\t.uleb128 1\n", /* Restore lr. */
- (int)ctx->codesz, CFRAME_SIZE);
- for (i = 11; i >= 4; i--) /* Restore r4-r11. */
+ "\t.byte 0x8e\n\t.uleb128 1\n", /* offset lr */
+ fcofs, CFRAME_SIZE);
+ for (i = 11; i >= 4; i--) /* offset r4-r11 */
fprintf(ctx->fp, "\t.byte %d\n\t.uleb128 %d\n", 0x80+i, 2+(11-i));
fprintf(ctx->fp,
"\t.align 2\n"
".LEFDE0:\n\n");
+#if LJ_HASFFI
+ fprintf(ctx->fp,
+ ".LSFDE1:\n"
+ "\t.long .LEFDE1-.LASFDE1\n"
+ ".LASFDE1:\n"
+ "\t.long .Lframe0\n"
+ "\t.long lj_vm_ffi_call\n"
+ "\t.long %d\n"
+ "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
+ "\t.byte 0x8e\n\t.uleb128 1\n" /* offset lr */
+ "\t.byte 0x8b\n\t.uleb128 2\n" /* offset r11 */
+ "\t.byte 0x85\n\t.uleb128 3\n" /* offset r5 */
+ "\t.byte 0x84\n\t.uleb128 4\n" /* offset r4 */
+ "\t.byte 0xd\n\t.uleb128 0xb\n" /* def_cfa_register r11 */
+ "\t.align 2\n"
+ ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
+#endif
break;
default:
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)
/* Emit pseudo frame-info for all assembler functions. */
static void emit_asm_debug(BuildCtx *ctx)
{
+ int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
int i;
switch (ctx->mode) {
case BUILD_elfasm:
@@ -7357,13 +7358,30 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.long .Lbegin\n"
"\t.long %d\n"
"\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
- "\t.byte 0x8e\n\t.uleb128 1\n", /* Restore lr. */
- (int)ctx->codesz, CFRAME_SIZE);
- for (i = 11; i >= 4; i--) /* Restore r4-r11. */
+ "\t.byte 0x8e\n\t.uleb128 1\n", /* offset lr */
+ fcofs, CFRAME_SIZE);
+ for (i = 11; i >= 4; i--) /* offset r4-r11 */
fprintf(ctx->fp, "\t.byte %d\n\t.uleb128 %d\n", 0x80+i, 2+(11-i));
fprintf(ctx->fp,
"\t.align 2\n"
".LEFDE0:\n\n");
+#if LJ_HASFFI
+ fprintf(ctx->fp,
+ ".LSFDE1:\n"
+ "\t.long .LEFDE1-.LASFDE1\n"
+ ".LASFDE1:\n"
+ "\t.long .Lframe0\n"
+ "\t.long lj_vm_ffi_call\n"
+ "\t.long %d\n"
+ "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
+ "\t.byte 0x8e\n\t.uleb128 1\n" /* offset lr */
+ "\t.byte 0x8b\n\t.uleb128 2\n" /* offset r11 */
+ "\t.byte 0x85\n\t.uleb128 3\n" /* offset r5 */
+ "\t.byte 0x84\n\t.uleb128 4\n" /* offset r4 */
+ "\t.byte 0xd\n\t.uleb128 0xb\n" /* def_cfa_register r11 */
+ "\t.align 2\n"
+ ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
+#endif
break;
default:
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)
for (i = rel = 0; i < ctx->nsym; i++) {
int32_t ofs = ctx->sym[i].ofs;
int32_t next = ctx->sym[i+1].ofs;
+#if LJ_TARGET_ARM && defined(__GNUC__) && !defined(LUAJIT_NO_UNWIND) && \
+ LJ_HASFFI
+ if (!strcmp(ctx->sym[i].name, "lj_vm_ffi_call"))
+ fprintf(ctx->fp,
+ ".globl lj_err_unwind_arm\n"
+ ".personality lj_err_unwind_arm\n"
+ ".fnend\n"
+ ".fnstart\n"
+ ".save {r4, r5, r11, lr}\n"
+ ".setfp r11, sp\n");
+#endif
emit_asm_label(ctx, ctx->sym[i].name, next - ofs, 1);
while (rel < ctx->nreloc && ctx->reloc[rel].ofs <= next) {
BuildReloc *r = &ctx->reloc[rel];
@@ -229,8 +240,10 @@ void emit_asm(BuildCtx *ctx)
#if LJ_TARGET_ARM && defined(__GNUC__) && !defined(LUAJIT_NO_UNWIND)
fprintf(ctx->fp,
+#if !LJ_HASFFI
".globl lj_err_unwind_arm\n"
".personality lj_err_unwind_arm\n"
+#endif
".fnend\n");
#endif
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)
#if LJ_TARGET_X64
memcpy(pesect[PEOBJ_SECT_PDATA].name, ".pdata", sizeof(".pdata")-1);
pesect[PEOBJ_SECT_PDATA].ofs = sofs;
- sofs += (pesect[PEOBJ_SECT_PDATA].size = 3*4);
+ sofs += (pesect[PEOBJ_SECT_PDATA].size = 6*4);
pesect[PEOBJ_SECT_PDATA].relocofs = sofs;
- sofs += (pesect[PEOBJ_SECT_PDATA].nreloc = 3) * PEOBJ_RELOC_SIZE;
+ sofs += (pesect[PEOBJ_SECT_PDATA].nreloc = 6) * PEOBJ_RELOC_SIZE;
/* Flags: 40 = read, 30 = align4, 40 = initialized data. */
pesect[PEOBJ_SECT_PDATA].flags = 0x40300040;
memcpy(pesect[PEOBJ_SECT_XDATA].name, ".xdata", sizeof(".xdata")-1);
pesect[PEOBJ_SECT_XDATA].ofs = sofs;
- sofs += (pesect[PEOBJ_SECT_XDATA].size = 8*2+4); /* See below. */
+ sofs += (pesect[PEOBJ_SECT_XDATA].size = 8*2+4+6*2); /* See below. */
pesect[PEOBJ_SECT_XDATA].relocofs = sofs;
sofs += (pesect[PEOBJ_SECT_XDATA].nreloc = 1) * PEOBJ_RELOC_SIZE;
/* Flags: 40 = read, 30 = align4, 40 = initialized data. */
@@ -247,9 +247,12 @@ void emit_peobj(BuildCtx *ctx)
#if LJ_TARGET_X64
{ /* Write .pdata section. */
+ uint32_t fcofs = (uint32_t)ctx->sym[ctx->nsym-1].ofs;
uint32_t pdata[3]; /* Start of .text, end of .text and .xdata. */
PEreloc reloc;
- pdata[0] = 0; pdata[1] = (uint32_t)ctx->codesz; pdata[2] = 0;
+ pdata[0] = 0; pdata[1] = fcofs; pdata[2] = 0;
+ owrite(ctx, &pdata, sizeof(pdata));
+ pdata[0] = fcofs; pdata[1] = (uint32_t)ctx->codesz; pdata[2] = 20;
owrite(ctx, &pdata, sizeof(pdata));
reloc.vaddr = 0; reloc.symidx = 1+2+nrsym+2+2+1;
reloc.type = PEOBJ_RELOC_ADDR32NB;
@@ -260,12 +263,21 @@ void emit_peobj(BuildCtx *ctx)
reloc.vaddr = 8; reloc.symidx = 1+2+nrsym+2;
reloc.type = PEOBJ_RELOC_ADDR32NB;
owrite(ctx, &reloc, PEOBJ_RELOC_SIZE);
+ reloc.vaddr = 12; reloc.symidx = 1+2+nrsym+2+2+1;
+ reloc.type = PEOBJ_RELOC_ADDR32NB;
+ owrite(ctx, &reloc, PEOBJ_RELOC_SIZE);
+ reloc.vaddr = 16; reloc.symidx = 1+2+nrsym+2+2+1;
+ reloc.type = PEOBJ_RELOC_ADDR32NB;
+ owrite(ctx, &reloc, PEOBJ_RELOC_SIZE);
+ reloc.vaddr = 20; reloc.symidx = 1+2+nrsym+2;
+ reloc.type = PEOBJ_RELOC_ADDR32NB;
+ owrite(ctx, &reloc, PEOBJ_RELOC_SIZE);
}
{ /* Write .xdata section. */
- uint16_t xdata[8+2];
+ uint16_t xdata[8+2+6];
PEreloc reloc;
- xdata[0] = 0x01|0x08|0x10; /* Ver. 1, uhander/ehandler, prolog size 0. */
- xdata[1] = 5; /* Number of unwind codes, no frame pointer. */
+ xdata[0] = 0x01|0x08|0x10; /* Ver. 1, uhandler/ehandler, prolog size 0. */
+ xdata[1] = 0x0005; /* Number of unwind codes, no frame pointer. */
xdata[2] = 0x4200; /* Stack offset 4*8+8 = aword*5. */
xdata[3] = 0x3000; /* Push rbx. */
xdata[4] = 0x6000; /* Push rsi. */
@@ -273,8 +285,14 @@ void emit_peobj(BuildCtx *ctx)
xdata[6] = 0x5000; /* Push rbp. */
xdata[7] = 0; /* Alignment. */
xdata[8] = xdata[9] = 0; /* Relocated address of exception handler. */
+ xdata[10] = 0x01; /* Ver. 1, no handler, prolog size 0. */
+ xdata[11] = 0x1504; /* Number of unwind codes, fp = rbp, fpofs = 16. */
+ xdata[12] = 0x0300; /* set_fpreg. */
+ xdata[13] = 0x0200; /* stack offset 0*8+8 = aword*1. */
+ xdata[14] = 0x3000; /* Push rbx. */
+ xdata[15] = 0x5000; /* Push rbp. */
owrite(ctx, &xdata, sizeof(xdata));
- reloc.vaddr = sizeof(xdata)-4; reloc.symidx = 1+2+nrsym+2+2;
+ reloc.vaddr = 2*8; reloc.symidx = 1+2+nrsym+2+2;
reloc.type = PEOBJ_RELOC_ADDR32NB;
owrite(ctx, &reloc, PEOBJ_RELOC_SIZE);
}
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)
|//-- FFI helper functions -----------------------------------------------
|//-----------------------------------------------------------------------
|
- |->vm_ffi_call:
+ |->vm_ffi_call: // Call C function via FFI.
+ | // Caveat: needs special frame unwinding, see below.
#if LJ_HASFFI
| .type CCSTATE, CCallState, CARG1
| lwz TMP1, CCSTATE->spadj
@@ -2541,8 +2542,10 @@ static void build_subroutines(BuildCtx *ctx)
| addic. CARG2, CARG2, -1
| stwux sp, sp, TMP1
| crnot 4*cr1+eq, 4*cr1+eq // For vararg calls.
- | stw CCSTATE, -4(TMP2)
+ | stw r14, -4(TMP2)
| li TMP3, 0
+ | stw CCSTATE, -8(TMP2)
+ | mr r14, TMP2
| la TMP1, CCSTATE->stack
| slwi CARG2, CARG2, 2
| blty >2
@@ -2574,18 +2577,20 @@ static void build_subroutines(BuildCtx *ctx)
| lwz r10, CCSTATE->gpr[7]
| lwz CARG1, CCSTATE->gpr[0] // Do this last, since CCSTATE is CARG1.
| bctrl
- | lwz TMP2, 0(sp)
- | lwz CCSTATE:TMP1, -4(TMP2)
- | lwz TMP0, 4(TMP2)
+ | lwz CCSTATE:TMP1, -8(r14)
+ | lwz TMP2, -4(r14)
+ | lwz TMP0, 4(r14)
| stw CARG1, CCSTATE:TMP1->gpr[0]
| stfd FARG1, CCSTATE:TMP1->fpr[0]
| stw CARG2, CCSTATE:TMP1->gpr[1]
| mtlr TMP0
| stw CARG3, CCSTATE:TMP1->gpr[2]
- | mr sp, TMP2
+ | mr sp, r14
| stw CARG4, CCSTATE:TMP1->gpr[3]
+ | mr r14, TMP2
| blr
#endif
+ |// Note: vm_ffi_call must be the last function in this object file!
|
|//-----------------------------------------------------------------------
}
@@ -4665,6 +4670,7 @@ static int build_backend(BuildCtx *ctx)
/* Emit pseudo frame-info for all assembler functions. */
static void emit_asm_debug(BuildCtx *ctx)
{
+ int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
int i;
switch (ctx->mode) {
case BUILD_elfasm:
@@ -4692,7 +4698,7 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.byte 0xe\n\t.uleb128 %d\n"
"\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
"\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n",
- (int)ctx->codesz, CFRAME_SIZE);
+ fcofs, CFRAME_SIZE);
for (i = 14; i <= 31; i++)
fprintf(ctx->fp,
"\t.byte %d\n\t.uleb128 %d\n"
@@ -4701,6 +4707,20 @@ static void emit_asm_debug(BuildCtx *ctx)
fprintf(ctx->fp,
"\t.align 2\n"
".LEFDE0:\n\n");
+#if LJ_HASFFI
+ fprintf(ctx->fp,
+ ".LSFDE1:\n"
+ "\t.long .LEFDE1-.LASFDE1\n"
+ ".LASFDE1:\n"
+ "\t.long .Lframe0\n"
+ "\t.long lj_vm_ffi_call\n"
+ "\t.long %d\n"
+ "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
+ "\t.byte 0x8e\n\t.uleb128 2\n"
+ "\t.byte 0xd\n\t.uleb128 0xe\n"
+ "\t.align 2\n"
+ ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
+#endif
fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@progbits\n");
fprintf(ctx->fp,
".Lframe1:\n"
@@ -4720,17 +4740,17 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.align 2\n"
".LECIE1:\n\n");
fprintf(ctx->fp,
- ".LSFDE1:\n"
- "\t.long .LEFDE1-.LASFDE1\n"
- ".LASFDE1:\n"
- "\t.long .LASFDE1-.Lframe1\n"
+ ".LSFDE2:\n"
+ "\t.long .LEFDE2-.LASFDE2\n"
+ ".LASFDE2:\n"
+ "\t.long .LASFDE2-.Lframe1\n"
"\t.long .Lbegin-.\n"
"\t.long %d\n"
"\t.uleb128 0\n" /* augmentation length */
"\t.byte 0xe\n\t.uleb128 %d\n"
"\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
"\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n",
- (int)ctx->codesz, CFRAME_SIZE);
+ fcofs, CFRAME_SIZE);
for (i = 14; i <= 31; i++)
fprintf(ctx->fp,
"\t.byte %d\n\t.uleb128 %d\n"
@@ -4738,7 +4758,37 @@ static void emit_asm_debug(BuildCtx *ctx)
0x80+i, 37+(31-i), 0x80+32+i, 2+2*(31-i));
fprintf(ctx->fp,
"\t.align 2\n"
- ".LEFDE1:\n\n");
+ ".LEFDE2:\n\n");
+#if LJ_HASFFI
+ fprintf(ctx->fp,
+ ".Lframe2:\n"
+ "\t.long .LECIE2-.LSCIE2\n"
+ ".LSCIE2:\n"
+ "\t.long 0\n"
+ "\t.byte 0x1\n"
+ "\t.string \"zR\"\n"
+ "\t.uleb128 0x1\n"
+ "\t.sleb128 -4\n"
+ "\t.byte 65\n"
+ "\t.uleb128 1\n" /* augmentation length */
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.uleb128 1\n\t.uleb128 0\n"
+ "\t.align 2\n"
+ ".LECIE2:\n\n");
+ fprintf(ctx->fp,
+ ".LSFDE3:\n"
+ "\t.long .LEFDE3-.LASFDE3\n"
+ ".LASFDE3:\n"
+ "\t.long .LASFDE3-.Lframe2\n"
+ "\t.long lj_vm_ffi_call-.\n"
+ "\t.long %d\n"
+ "\t.uleb128 0\n" /* augmentation length */
+ "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
+ "\t.byte 0x8e\n\t.uleb128 2\n"
+ "\t.byte 0xd\n\t.uleb128 0xe\n"
+ "\t.align 2\n"
+ ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
+#endif
break;
default:
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 @@
#define DASM_SECTION_CODE_OP 0
#define DASM_SECTION_CODE_SUB 1
#define DASM_MAXSECTION 2
-static const unsigned int build_actionlist[7577] = {
+static const unsigned int build_actionlist[7580] = {
0x00010001,
0x00060014,
0x72000000,
@@ -4112,8 +4112,10 @@ static const unsigned int build_actionlist[7577] = {
0x3484ffff,
0x7c21416e,
0x4cc63042,
-0x9069fffc,
+0x91c9fffc,
0x38c00000,
+0x9069fff8,
+0x7d2e4b78,
0x39030000,
0x00098200,
0x54841000,
@@ -4168,9 +4170,9 @@ static const unsigned int build_actionlist[7577] = {
0x80630000,
0x00098200,
0x4e800421,
-0x81210000,
-0x8109fffc,
-0x80090004,
+0x810efff8,
+0x812efffc,
+0x800e0004,
0x90680000,
0x00098200,
0xd8280000,
@@ -4180,9 +4182,10 @@ static const unsigned int build_actionlist[7577] = {
0x7c0803a6,
0x90a80000,
0x00098200,
-0x7d214b78,
+0x7dc17378,
0x90c80000,
0x00098200,
+0x7d2e4b78,
0x4e800020,
0x00000000,
0x00080000,
@@ -8349,7 +8352,7 @@ static void build_subroutines(BuildCtx *ctx)
#if LJ_HASFFI
#define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
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]));
- 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]));
+ 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]));
#endif
}
@@ -8357,7 +8360,7 @@ static void build_subroutines(BuildCtx *ctx)
static void build_ins(BuildCtx *ctx, BCOp op, int defop)
{
int vk = 0;
- dasm_put(Dst, 4172, defop);
+ dasm_put(Dst, 4175, defop);
switch (op) {
@@ -8367,224 +8370,224 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT:
if (LJ_DUALNUM) {
- dasm_put(Dst, 4174, -(BCBIAS_J*4 >> 16));
+ dasm_put(Dst, 4177, -(BCBIAS_J*4 >> 16));
if (op == BC_ISLT) {
- dasm_put(Dst, 4191);
- } else if (op == BC_ISGE) {
dasm_put(Dst, 4194);
- } else if (op == BC_ISLE) {
+ } else if (op == BC_ISGE) {
dasm_put(Dst, 4197);
- } else {
+ } else if (op == BC_ISLE) {
dasm_put(Dst, 4200);
+ } else {
+ dasm_put(Dst, 4203);
}
- dasm_put(Dst, 4203);
+ dasm_put(Dst, 4206);
if (op == BC_ISLT) {
- dasm_put(Dst, 4242);
- } else if (op == BC_ISGE) {
dasm_put(Dst, 4245);
- } else if (op == BC_ISLE) {
- dasm_put(Dst, 4248);
- } else {
- dasm_put(Dst, 4252);
- }
- dasm_put(Dst, 4256);
- } else {
- dasm_put(Dst, 4259, -(BCBIAS_J*4 >> 16));
- if (op == BC_ISLT) {
- dasm_put(Dst, 4276);
} else if (op == BC_ISGE) {
- dasm_put(Dst, 4279);
+ dasm_put(Dst, 4248);
} else if (op == BC_ISLE) {
- dasm_put(Dst, 4282);
+ dasm_put(Dst, 4251);
} else {
- dasm_put(Dst, 4286);
+ dasm_put(Dst, 4255);
}
- dasm_put(Dst, 4290);
+ dasm_put(Dst, 4259);
+ } else {
+ dasm_put(Dst, 4262, -(BCBIAS_J*4 >> 16));
+ if (op == BC_ISLT) {
+ dasm_put(Dst, 4279);
+ } else if (op == BC_ISGE) {
+ dasm_put(Dst, 4282);
+ } else if (op == BC_ISLE) {
+ dasm_put(Dst, 4285);
+ } else {
+ dasm_put(Dst, 4289);
+ }
+ dasm_put(Dst, 4293);
}
break;
case BC_ISEQV: case BC_ISNEV:
vk = op == BC_ISEQV;
if (LJ_DUALNUM) {
- dasm_put(Dst, 4303, -(BCBIAS_J*4 >> 16));
+ dasm_put(Dst, 4306, -(BCBIAS_J*4 >> 16));
if (vk) {
- dasm_put(Dst, 4316);
- } else {
dasm_put(Dst, 4319);
- }
- } else {
- dasm_put(Dst, 4322, -(BCBIAS_J*4 >> 16));
- if (vk) {
- dasm_put(Dst, 4339);
} else {
- dasm_put(Dst, 4343);
+ dasm_put(Dst, 4322);
}
- dasm_put(Dst, 4347);
- }
- dasm_put(Dst, 4359);
- if (!LJ_DUALNUM) {
- dasm_put(Dst, 4361);
- }
- if (LJ_HASFFI) {
- dasm_put(Dst, 4364, LJ_TCDATA, LJ_TCDATA);
- }
- dasm_put(Dst, 4369, ~LJ_TISPRI);
- if (LJ_HASFFI) {
- dasm_put(Dst, 4374);
- }
- dasm_put(Dst, 4376, ~LJ_TISTABUD);
- if (LJ_HASFFI) {
- dasm_put(Dst, 4379);
- }
- dasm_put(Dst, 4382);
- if (vk) {
- dasm_put(Dst, 4390);
} else {
- dasm_put(Dst, 4395);
+ dasm_put(Dst, 4325, -(BCBIAS_J*4 >> 16));
+ if (vk) {
+ dasm_put(Dst, 4342);
+ } else {
+ dasm_put(Dst, 4346);
+ }
+ dasm_put(Dst, 4350);
+ }
+ dasm_put(Dst, 4362);
+ if (!LJ_DUALNUM) {
+ dasm_put(Dst, 4364);
+ }
+ if (LJ_HASFFI) {
+ dasm_put(Dst, 4367, LJ_TCDATA, LJ_TCDATA);
+ }
+ dasm_put(Dst, 4372, ~LJ_TISPRI);
+ if (LJ_HASFFI) {
+ dasm_put(Dst, 4377);
+ }
+ dasm_put(Dst, 4379, ~LJ_TISTABUD);
+ if (LJ_HASFFI) {
+ dasm_put(Dst, 4382);
+ }
+ dasm_put(Dst, 4385);
+ if (vk) {
+ dasm_put(Dst, 4393);
+ } else {
+ dasm_put(Dst, 4398);
}
if (LJ_DUALNUM) {
- dasm_put(Dst, 4400);
+ dasm_put(Dst, 4403);
} else {
- dasm_put(Dst, 4415);
+ dasm_put(Dst, 4418);
}
- dasm_put(Dst, 4418, Dt6(->metatable), 1-vk, Dt6(->nomm), 1<metatable), 1-vk, Dt6(->nomm), 1<> 16));
+ dasm_put(Dst, 4458, -(BCBIAS_J*4 >> 16));
if (vk) {
- dasm_put(Dst, 4463);
+ dasm_put(Dst, 4466);
} else {
- dasm_put(Dst, 4465);
+ dasm_put(Dst, 4468);
}
- dasm_put(Dst, 4467);
+ dasm_put(Dst, 4470);
break;
case BC_ISEQN: case BC_ISNEN:
vk = op == BC_ISEQN;
if (LJ_DUALNUM) {
- dasm_put(Dst, 4479, -(BCBIAS_J*4 >> 16));
+ dasm_put(Dst, 4482, -(BCBIAS_J*4 >> 16));
if (vk) {
- dasm_put(Dst, 4491);
+ dasm_put(Dst, 4494);
} else {
- dasm_put(Dst, 4493);
+ dasm_put(Dst, 4496);
}
- dasm_put(Dst, 4495);
+ dasm_put(Dst, 4498);
} else {
if (vk) {
- dasm_put(Dst, 4502);
+ dasm_put(Dst, 4505);
} else {
- dasm_put(Dst, 4504);
+ dasm_put(Dst, 4507);
}
- dasm_put(Dst, 4506, -(BCBIAS_J*4 >> 16));
+ dasm_put(Dst, 4509, -(BCBIAS_J*4 >> 16));
}
if (vk) {
- dasm_put(Dst, 4519);
+ dasm_put(Dst, 4522);
if (!LJ_HASFFI) {
- dasm_put(Dst, 4524);
+ dasm_put(Dst, 4527);
}
} else {
- dasm_put(Dst, 4526);
+ dasm_put(Dst, 4529);
if (!LJ_HASFFI) {
- dasm_put(Dst, 4530);
+ dasm_put(Dst, 4533);
}
- dasm_put(Dst, 4532);
+ dasm_put(Dst, 4535);
}
- dasm_put(Dst, 4535);
+ dasm_put(Dst, 4538);
if (LJ_HASFFI) {
- dasm_put(Dst, 4546, LJ_TCDATA);
+ dasm_put(Dst, 4549, LJ_TCDATA);
}
if (LJ_DUALNUM) {
- dasm_put(Dst, 4554);
+ dasm_put(Dst, 4557);
}
break;
case BC_ISEQP: case BC_ISNEP:
vk = op == BC_ISEQP;
- dasm_put(Dst, 4578, 32-3);
+ dasm_put(Dst, 4581, 32-3);
if (LJ_HASFFI) {
- dasm_put(Dst, 4585, LJ_TCDATA);
+ dasm_put(Dst, 4588, LJ_TCDATA);
}
- dasm_put(Dst, 4588);
+ dasm_put(Dst, 4591);
if (LJ_HASFFI) {
- dasm_put(Dst, 4590);
+ dasm_put(Dst, 4593);
}
- dasm_put(Dst, 4593, -(BCBIAS_J*4 >> 16));
+ dasm_put(Dst, 4596, -(BCBIAS_J*4 >> 16));
if (vk) {
- dasm_put(Dst, 4599);
+ dasm_put(Dst, 4602);
} else {
- dasm_put(Dst, 4601);
+ dasm_put(Dst, 4604);
}
- dasm_put(Dst, 4603);
+ dasm_put(Dst, 4606);
break;
/* -- Unary test and copy ops ------------------------------------------- */
case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF:
- dasm_put(Dst, 4615);
+ dasm_put(Dst, 4618);
if (op == BC_IST || op == BC_ISF) {
- dasm_put(Dst, 4619, LJ_TTRUE, -(BCBIAS_J*4 >> 16));
+ dasm_put(Dst, 4622, LJ_TTRUE, -(BCBIAS_J*4 >> 16));
if (op == BC_IST) {
- dasm_put(Dst, 4626);
+ dasm_put(Dst, 4629);
} else {
- dasm_put(Dst, 4628);
+ dasm_put(Dst, 4631);
}
- dasm_put(Dst, 4630);
+ dasm_put(Dst, 4633);
} else {
- dasm_put(Dst, 4632, LJ_TFALSE);
+ dasm_put(Dst, 4635, LJ_TFALSE);
if (op == BC_ISTC) {
- dasm_put(Dst, 4637);
- } else {
dasm_put(Dst, 4640);
+ } else {
+ dasm_put(Dst, 4643);
}
- dasm_put(Dst, 4643, -(BCBIAS_J*4 >> 16));
+ dasm_put(Dst, 4646, -(BCBIAS_J*4 >> 16));
}
- dasm_put(Dst, 4650);
+ dasm_put(Dst, 4653);
break;
/* -- Unary ops --------------------------------------------------------- */
case BC_MOV:
- dasm_put(Dst, 4661);
+ dasm_put(Dst, 4664);
break;
case BC_NOT:
- dasm_put(Dst, 4674, LJ_TTRUE);
+ dasm_put(Dst, 4677, LJ_TTRUE);
break;
case BC_UNM:
- dasm_put(Dst, 4690);
+ dasm_put(Dst, 4693);
if (LJ_DUALNUM) {
- dasm_put(Dst, 4694);
+ dasm_put(Dst, 4697);
}
- dasm_put(Dst, 4722);
+ dasm_put(Dst, 4725);
if (LJ_DUALNUM) {
- dasm_put(Dst, 4732);
- } else {
dasm_put(Dst, 4735);
+ } else {
+ dasm_put(Dst, 4738);
}
break;
case BC_LEN:
- dasm_put(Dst, 4744, LJ_TSTR, Dt5(->len));
+ dasm_put(Dst, 4747, LJ_TSTR, Dt5(->len));
if (LJ_DUALNUM) {
- dasm_put(Dst, 4754);
+ dasm_put(Dst, 4757);
} else {
- dasm_put(Dst, 4759);
+ dasm_put(Dst, 4762);
}
- dasm_put(Dst, 4766, LJ_TTAB);
+ dasm_put(Dst, 4769, LJ_TTAB);
#ifdef LUAJIT_ENABLE_LUA52COMPAT
- dasm_put(Dst, 4780, Dt6(->metatable));
+ dasm_put(Dst, 4783, Dt6(->metatable));
#endif
- dasm_put(Dst, 4787);
+ dasm_put(Dst, 4790);
#ifdef LUAJIT_ENABLE_LUA52COMPAT
- dasm_put(Dst, 4793, Dt6(->nomm), 1<nomm), 1<base), 32-3, Dt1(->base));
+ dasm_put(Dst, 5569, Dt1(->base), 32-3, Dt1(->base));
break;
/* -- Constant ops ------------------------------------------------------ */
case BC_KSTR:
- dasm_put(Dst, 5596, 32-1, LJ_TSTR);
+ dasm_put(Dst, 5599, 32-1, LJ_TSTR);
break;
case BC_KCDATA:
#if LJ_HASFFI
- dasm_put(Dst, 5615, 32-1, LJ_TCDATA);
+ dasm_put(Dst, 5618, 32-1, LJ_TCDATA);
#endif
break;
case BC_KSHORT:
if (LJ_DUALNUM) {
- dasm_put(Dst, 5634, 31-13);
+ dasm_put(Dst, 5637, 31-13);
} else {
- dasm_put(Dst, 5650, 31-13, 31-20);
+ dasm_put(Dst, 5653, 31-13, 31-20);
}
break;
case BC_KNUM:
- dasm_put(Dst, 5678);
+ dasm_put(Dst, 5681);
break;
case BC_KPRI:
- dasm_put(Dst, 5691, 32-3);
+ dasm_put(Dst, 5694, 32-3);
break;
case BC_KNIL:
- dasm_put(Dst, 5706);
+ dasm_put(Dst, 5709);
break;
/* -- Upvalue and function ops ------------------------------------------ */
case BC_UGET:
- dasm_put(Dst, 5725, 32-1, offsetof(GCfuncL, uvptr), DtA(->v));
+ dasm_put(Dst, 5728, 32-1, offsetof(GCfuncL, uvptr), DtA(->v));
break;
case BC_USETV:
- 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);
+ 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);
break;
case BC_USETS:
- 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);
+ 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);
break;
case BC_USETN:
- dasm_put(Dst, 5850, 32-1, offsetof(GCfuncL, uvptr), DtA(->v));
+ dasm_put(Dst, 5853, 32-1, offsetof(GCfuncL, uvptr), DtA(->v));
break;
case BC_USETP:
- dasm_put(Dst, 5871, 32-1, 32-3, offsetof(GCfuncL, uvptr), DtA(->v));
+ dasm_put(Dst, 5874, 32-1, 32-3, offsetof(GCfuncL, uvptr), DtA(->v));
break;
case BC_UCLO:
- dasm_put(Dst, 5894, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base));
+ dasm_put(Dst, 5897, Dt1(->openupval), 32-1, -(BCBIAS_J*4 >> 16), Dt1(->base), Dt1(->base));
break;
case BC_FNEW:
- dasm_put(Dst, 5924, 32-1, Dt1(->base), Dt1(->base), LJ_TFUNC);
+ dasm_put(Dst, 5927, 32-1, Dt1(->base), Dt1(->base), LJ_TFUNC);
break;
/* -- Table ops --------------------------------------------------------- */
case BC_TNEW:
case BC_TDUP:
- dasm_put(Dst, 5952, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base));
+ dasm_put(Dst, 5955, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base));
if (op == BC_TNEW) {
- dasm_put(Dst, 5965);
+ dasm_put(Dst, 5968);
} else {
- dasm_put(Dst, 5974, 32-1);
+ dasm_put(Dst, 5977, 32-1);
}
- dasm_put(Dst, 5981, Dt1(->base), LJ_TTAB);
+ dasm_put(Dst, 5984, Dt1(->base), LJ_TTAB);
if (op == BC_TNEW) {
- dasm_put(Dst, 5998);
+ dasm_put(Dst, 6001);
}
- dasm_put(Dst, 6003);
+ dasm_put(Dst, 6006);
break;
case BC_GGET:
case BC_GSET:
- dasm_put(Dst, 6012, 32-1, Dt7(->env));
+ dasm_put(Dst, 6015, 32-1, Dt7(->env));
if (op == BC_GGET) {
- dasm_put(Dst, 6020);
- } else {
dasm_put(Dst, 6023);
+ } else {
+ dasm_put(Dst, 6026);
}
break;
case BC_TGETV:
- dasm_put(Dst, 6026);
+ dasm_put(Dst, 6029);
if (LJ_DUALNUM) {
- dasm_put(Dst, 6030);
+ dasm_put(Dst, 6033);
} else {
- dasm_put(Dst, 6032);
+ dasm_put(Dst, 6035);
}
- dasm_put(Dst, 6034, LJ_TTAB);
+ dasm_put(Dst, 6037, LJ_TTAB);
if (LJ_DUALNUM) {
- dasm_put(Dst, 6040, Dt6(->asize), Dt6(->array), 31-3);
+ dasm_put(Dst, 6043, Dt6(->asize), Dt6(->array), 31-3);
} else {
- dasm_put(Dst, 6050, Dt6(->asize), Dt6(->array), 31-3);
+ dasm_put(Dst, 6053, Dt6(->asize), Dt6(->array), 31-3);
}
- dasm_put(Dst, 6067, LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<metatable), Dt6(->nomm), 1<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));
- dasm_put(Dst, 6173, LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<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));
+ dasm_put(Dst, 6176, LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->nomm), 1<asize), Dt6(->array), 31-3);
+ dasm_put(Dst, 6258, Dt6(->asize), Dt6(->array), 31-3);
} else {
- dasm_put(Dst, 6265, Dt6(->asize), Dt6(->array), 31-3);
+ dasm_put(Dst, 6268, Dt6(->asize), Dt6(->array), 31-3);
}
- dasm_put(Dst, 6282, Dt6(->marked), LJ_TNIL, LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<marked), LJ_TNIL, LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<marked), Dt6(->gclist));
+ dasm_put(Dst, 6334, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist));
break;
- dasm_put(Dst, 6346, LJ_TSTR, LJ_TNIL);
+ dasm_put(Dst, 6349, LJ_TSTR, LJ_TNIL);
case BC_TSETS:
- 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);
- dasm_put(Dst, 6423, LJ_GC_BLACK, DtB(->val), Dt6(->metatable), Dt6(->nomm), 1<next), Dt6(->metatable), DISPATCH_GL(tmptv), Dt1(->base), Dt6(->nomm), 1<base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist));
+ 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);
+ dasm_put(Dst, 6426, LJ_GC_BLACK, DtB(->val), Dt6(->metatable), Dt6(->nomm), 1<next), Dt6(->metatable), DISPATCH_GL(tmptv), Dt1(->base), Dt6(->nomm), 1<base), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->marked), Dt6(->gclist));
break;
case BC_TSETB:
- dasm_put(Dst, 6504, 32-3, LJ_TTAB, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_TNIL, LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<marked), Dt6(->gclist));
+ dasm_put(Dst, 6507, 32-3, LJ_TTAB, Dt6(->asize), Dt6(->array), Dt6(->marked), LJ_TNIL, LJ_GC_BLACK, Dt6(->metatable), Dt6(->nomm), 1<marked), Dt6(->gclist));
break;
case BC_TSETM:
- 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));
- dasm_put(Dst, 6641);
+ 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));
+ dasm_put(Dst, 6644);
break;
/* -- Calls and vararg handling ----------------------------------------- */
case BC_CALLM:
- dasm_put(Dst, 6644);
+ dasm_put(Dst, 6647);
break;
case BC_CALL:
- dasm_put(Dst, 6646, LJ_TFUNC, Dt7(->pc));
+ dasm_put(Dst, 6649, LJ_TFUNC, Dt7(->pc));
break;
case BC_CALLMT:
- dasm_put(Dst, 6667);
+ dasm_put(Dst, 6670);
break;
case BC_CALLT:
- dasm_put(Dst, 6669, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP);
- dasm_put(Dst, 6733, FRAME_TYPE);
+ dasm_put(Dst, 6672, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), FRAME_VARG, Dt7(->pc), -4-8, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP);
+ dasm_put(Dst, 6736, FRAME_TYPE);
break;
case BC_ITERC:
- dasm_put(Dst, 6742, LJ_TFUNC, Dt7(->pc));
+ dasm_put(Dst, 6745, LJ_TFUNC, Dt7(->pc));
break;
case BC_ITERN:
#if LJ_HASJIT
#endif
- dasm_put(Dst, 6769, Dt6(->asize), Dt6(->array), 31-3, LJ_TNIL);
+ dasm_put(Dst, 6772, Dt6(->asize), Dt6(->array), 31-3, LJ_TNIL);
if (LJ_DUALNUM) {
- dasm_put(Dst, 6791);
- } else {
dasm_put(Dst, 6794);
+ } else {
+ dasm_put(Dst, 6797);
}
- dasm_put(Dst, 6798, -(BCBIAS_J*4 >> 16));
+ dasm_put(Dst, 6801, -(BCBIAS_J*4 >> 16));
if (!LJ_DUALNUM) {
- dasm_put(Dst, 6806);
+ dasm_put(Dst, 6809);
}
- dasm_put(Dst, 6808, Dt6(->hmask), Dt6(->node), 31-5, 31-3, LJ_TNIL, DtB(->key), -(BCBIAS_J*4 >> 16));
+ dasm_put(Dst, 6811, Dt6(->hmask), Dt6(->node), 31-5, 31-3, LJ_TNIL, DtB(->key), -(BCBIAS_J*4 >> 16));
break;
case BC_ISNEXT:
- 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));
+ 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));
break;
case BC_VARG:
- dasm_put(Dst, 6914, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base));
- dasm_put(Dst, 6994);
+ dasm_put(Dst, 6917, FRAME_VARG, Dt1(->maxstack), Dt1(->top), Dt1(->base), 32-3, Dt1(->base));
+ dasm_put(Dst, 6997);
break;
/* -- Returns ----------------------------------------------------------- */
case BC_RETM:
- dasm_put(Dst, 7000);
+ dasm_put(Dst, 7003);
break;
case BC_RET:
- dasm_put(Dst, 7002, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP);
+ dasm_put(Dst, 7005, FRAME_TYPE, FRAME_VARG, Dt7(->pc), PC2PROTO(k), FRAME_TYPEP);
break;
case BC_RET0: case BC_RET1:
- dasm_put(Dst, 7072, FRAME_TYPE, FRAME_VARG);
+ dasm_put(Dst, 7075, FRAME_TYPE, FRAME_VARG);
if (op == BC_RET1) {
- dasm_put(Dst, 7085);
+ dasm_put(Dst, 7088);
}
- dasm_put(Dst, 7088, Dt7(->pc), PC2PROTO(k));
+ dasm_put(Dst, 7091, Dt7(->pc), PC2PROTO(k));
break;
/* -- Loops and branches ------------------------------------------------ */
case BC_FORL:
#if LJ_HASJIT
- dasm_put(Dst, 7116, GG_DISP2HOT, -HOTCOUNT_LOOP);
+ dasm_put(Dst, 7119, GG_DISP2HOT, -HOTCOUNT_LOOP);
#endif
break;
@@ -9245,100 +9248,100 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
case BC_IFORL:
vk = (op == BC_IFORL || op == BC_JFORL);
if (LJ_DUALNUM) {
- dasm_put(Dst, 7126, FORL_IDX*8+4);
+ dasm_put(Dst, 7129, FORL_IDX*8+4);
if (vk) {
- dasm_put(Dst, 7131, FORL_STEP*8+4, FORL_STOP*8+4, FORL_IDX*8+4);
+ dasm_put(Dst, 7134, FORL_STEP*8+4, FORL_STOP*8+4, FORL_IDX*8+4);
} else {
- dasm_put(Dst, 7145, FORL_STEP*8, FORL_STEP*8+4, FORL_STOP*8, FORL_STOP*8+4);
+ dasm_put(Dst, 7148, FORL_STEP*8, FORL_STEP*8+4, FORL_STOP*8, FORL_STOP*8+4);
}
- dasm_put(Dst, 7161, FORL_EXT*8);
+ dasm_put(Dst, 7164, FORL_EXT*8);
if (op != BC_JFORL) {
- dasm_put(Dst, 7168, 32-1);
+ dasm_put(Dst, 7171, 32-1);
}
- dasm_put(Dst, 7171, FORL_EXT*8+4);
+ dasm_put(Dst, 7174, FORL_EXT*8+4);
if (op != BC_JFORL) {
- dasm_put(Dst, 7174);
+ dasm_put(Dst, 7177);
}
if (op == BC_FORI) {
- dasm_put(Dst, 7176);
+ dasm_put(Dst, 7179);
} else if (op == BC_JFORI) {
- dasm_put(Dst, 7179, -(BCBIAS_J*4 >> 16));
+ dasm_put(Dst, 7182, -(BCBIAS_J*4 >> 16));
} else if (op == BC_IFORL) {
- dasm_put(Dst, 7184, -(BCBIAS_J*4 >> 16));
+ dasm_put(Dst, 7187, -(BCBIAS_J*4 >> 16));
} else {
- dasm_put(Dst, 7189, BC_JLOOP);
+ dasm_put(Dst, 7192, BC_JLOOP);
}
- dasm_put(Dst, 7192);
+ dasm_put(Dst, 7195);
if (vk) {
- dasm_put(Dst, 7208);
+ dasm_put(Dst, 7211);
}
}
if (vk) {
if (LJ_DUALNUM) {
- dasm_put(Dst, 7215, FORL_IDX*8);
+ dasm_put(Dst, 7218, FORL_IDX*8);
} else {
- dasm_put(Dst, 7219);
+ dasm_put(Dst, 7222);
}
- dasm_put(Dst, 7221, FORL_STEP*8, FORL_STOP*8, FORL_STEP*8, FORL_IDX*8);
+ dasm_put(Dst, 7224, FORL_STEP*8, FORL_STOP*8, FORL_STEP*8, FORL_IDX*8);
} else {
if (LJ_DUALNUM) {
- dasm_put(Dst, 7231);
+ dasm_put(Dst, 7234);
} else {
- dasm_put(Dst, 7233, FORL_STEP*8, FORL_STOP*8);
+ dasm_put(Dst, 7236, FORL_STEP*8, FORL_STOP*8);
}
- dasm_put(Dst, 7242, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8);
+ dasm_put(Dst, 7245, FORL_IDX*8, FORL_STEP*8, FORL_STOP*8);
}
- dasm_put(Dst, 7253);
+ dasm_put(Dst, 7256);
if (op != BC_JFORL) {
- dasm_put(Dst, 7255, 32-1);
+ dasm_put(Dst, 7258, 32-1);
}
- dasm_put(Dst, 7258, FORL_EXT*8);
+ dasm_put(Dst, 7261, FORL_EXT*8);
if (op != BC_JFORL) {
- dasm_put(Dst, 7261);
+ dasm_put(Dst, 7264);
}
- dasm_put(Dst, 7263);
+ dasm_put(Dst, 7266);
if (op == BC_JFORI) {
- dasm_put(Dst, 7265, -(BCBIAS_J*4 >> 16));
+ dasm_put(Dst, 7268, -(BCBIAS_J*4 >> 16));
}
- dasm_put(Dst, 7268);
+ dasm_put(Dst, 7271);
if (op == BC_FORI) {
- dasm_put(Dst, 7271);
+ dasm_put(Dst, 7274);
} else if (op == BC_IFORL) {
if (LJ_DUALNUM) {
- dasm_put(Dst, 7274);
- } else {
dasm_put(Dst, 7277);
+ } else {
+ dasm_put(Dst, 7280);
}
- dasm_put(Dst, 7280, -(BCBIAS_J*4 >> 16));
+ dasm_put(Dst, 7283, -(BCBIAS_J*4 >> 16));
} else if (op == BC_JFORI) {
- dasm_put(Dst, 7284);
+ dasm_put(Dst, 7287);
} else {
- dasm_put(Dst, 7287, BC_JLOOP);
+ dasm_put(Dst, 7290, BC_JLOOP);
}
if (LJ_DUALNUM) {
- dasm_put(Dst, 7290);
- } else {
dasm_put(Dst, 7293);
- }
- dasm_put(Dst, 7305);
- if (op == BC_FORI) {
- dasm_put(Dst, 7307, -(BCBIAS_J*4 >> 16));
- } else if (op == BC_IFORL) {
- dasm_put(Dst, 7313);
- } else if (op == BC_JFORI) {
- dasm_put(Dst, 7316);
} else {
- dasm_put(Dst, 7319, BC_JLOOP);
+ dasm_put(Dst, 7296);
}
- dasm_put(Dst, 7322);
+ dasm_put(Dst, 7308);
+ if (op == BC_FORI) {
+ dasm_put(Dst, 7310, -(BCBIAS_J*4 >> 16));
+ } else if (op == BC_IFORL) {
+ dasm_put(Dst, 7316);
+ } else if (op == BC_JFORI) {
+ dasm_put(Dst, 7319);
+ } else {
+ dasm_put(Dst, 7322, BC_JLOOP);
+ }
+ dasm_put(Dst, 7325);
if (op == BC_JFORI) {
- dasm_put(Dst, 7325, BC_JLOOP);
+ dasm_put(Dst, 7328, BC_JLOOP);
}
break;
case BC_ITERL:
#if LJ_HASJIT
- dasm_put(Dst, 7331, GG_DISP2HOT, -HOTCOUNT_LOOP);
+ dasm_put(Dst, 7334, GG_DISP2HOT, -HOTCOUNT_LOOP);
#endif
break;
@@ -9347,40 +9350,40 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
break;
#endif
case BC_IITERL:
- dasm_put(Dst, 7341, LJ_TNIL);
+ dasm_put(Dst, 7344, LJ_TNIL);
if (op == BC_JITERL) {
- dasm_put(Dst, 7348, BC_JLOOP);
+ dasm_put(Dst, 7351, BC_JLOOP);
} else {
- dasm_put(Dst, 7353, 32-1, -(BCBIAS_J*4 >> 16));
+ dasm_put(Dst, 7356, 32-1, -(BCBIAS_J*4 >> 16));
}
- dasm_put(Dst, 7361);
+ dasm_put(Dst, 7364);
break;
case BC_LOOP:
#if LJ_HASJIT
- dasm_put(Dst, 7373, GG_DISP2HOT, -HOTCOUNT_LOOP);
+ dasm_put(Dst, 7376, GG_DISP2HOT, -HOTCOUNT_LOOP);
#endif
break;
case BC_ILOOP:
- dasm_put(Dst, 7383);
+ dasm_put(Dst, 7386);
break;
case BC_JLOOP:
#if LJ_HASJIT
- 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);
+ 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);
#endif
break;
case BC_JMP:
- dasm_put(Dst, 7413, 32-1, -(BCBIAS_J*4 >> 16));
+ dasm_put(Dst, 7416, 32-1, -(BCBIAS_J*4 >> 16));
break;
/* -- Function headers -------------------------------------------------- */
case BC_FUNCF:
#if LJ_HASJIT
- dasm_put(Dst, 7429, GG_DISP2HOT, -HOTCOUNT_CALL);
+ dasm_put(Dst, 7432, GG_DISP2HOT, -HOTCOUNT_CALL);
#endif
case BC_FUNCV: /* NYI: compiled vararg functions. */
break;
@@ -9390,42 +9393,42 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
break;
#endif
case BC_IFUNCF:
- dasm_put(Dst, 7439, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3);
+ dasm_put(Dst, 7442, Dt1(->maxstack), -4+PC2PROTO(numparams), -4+PC2PROTO(k), 31-3);
if (op != BC_JFUNCF) {
- dasm_put(Dst, 7451);
+ dasm_put(Dst, 7454);
}
- dasm_put(Dst, 7454);
+ dasm_put(Dst, 7457);
if (op == BC_JFUNCF) {
- dasm_put(Dst, 7459, BC_JLOOP);
+ dasm_put(Dst, 7462, BC_JLOOP);
} else {
- dasm_put(Dst, 7463);
+ dasm_put(Dst, 7466);
}
- dasm_put(Dst, 7472);
+ dasm_put(Dst, 7475);
break;
case BC_JFUNCV:
#if !LJ_HASJIT
break;
#endif
- dasm_put(Dst, 7478);
+ dasm_put(Dst, 7481);
break; /* NYI: compiled vararg functions. */
case BC_IFUNCV:
- dasm_put(Dst, 7480, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams), LJ_TNIL);
+ dasm_put(Dst, 7483, Dt1(->maxstack), 8+FRAME_VARG, -4+PC2PROTO(k), -4+PC2PROTO(numparams), LJ_TNIL);
break;
case BC_FUNCC:
case BC_FUNCCW:
if (op == BC_FUNCC) {
- dasm_put(Dst, 7533, Dt8(->f));
+ dasm_put(Dst, 7536, Dt8(->f));
} else {
- dasm_put(Dst, 7536, DISPATCH_GL(wrapf));
+ dasm_put(Dst, 7539, DISPATCH_GL(wrapf));
}
- dasm_put(Dst, 7539, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C);
+ dasm_put(Dst, 7542, Dt1(->maxstack), Dt1(->base), Dt1(->top), ~LJ_VMST_C);
if (op == BC_FUNCCW) {
- dasm_put(Dst, 7552, Dt8(->f));
+ dasm_put(Dst, 7555, Dt8(->f));
}
- dasm_put(Dst, 7555, DISPATCH_GL(vmstate), Dt1(->base), 31-3, Dt1(->top), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate));
+ dasm_put(Dst, 7558, DISPATCH_GL(vmstate), Dt1(->base), 31-3, Dt1(->top), ~LJ_VMST_INTERP, DISPATCH_GL(vmstate));
break;
/* ---------------------------------------------------------------------- */
@@ -9445,7 +9448,7 @@ static int build_backend(BuildCtx *ctx)
build_subroutines(ctx);
- dasm_put(Dst, 7576);
+ dasm_put(Dst, 7579);
for (op = 0; op < BC__MAX; op++)
build_ins(ctx, (BCOp)op, op);
@@ -9455,6 +9458,7 @@ static int build_backend(BuildCtx *ctx)
/* Emit pseudo frame-info for all assembler functions. */
static void emit_asm_debug(BuildCtx *ctx)
{
+ int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
int i;
switch (ctx->mode) {
case BUILD_elfasm:
@@ -9482,7 +9486,7 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.byte 0xe\n\t.uleb128 %d\n"
"\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
"\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n",
- (int)ctx->codesz, CFRAME_SIZE);
+ fcofs, CFRAME_SIZE);
for (i = 14; i <= 31; i++)
fprintf(ctx->fp,
"\t.byte %d\n\t.uleb128 %d\n"
@@ -9491,6 +9495,20 @@ static void emit_asm_debug(BuildCtx *ctx)
fprintf(ctx->fp,
"\t.align 2\n"
".LEFDE0:\n\n");
+#if LJ_HASFFI
+ fprintf(ctx->fp,
+ ".LSFDE1:\n"
+ "\t.long .LEFDE1-.LASFDE1\n"
+ ".LASFDE1:\n"
+ "\t.long .Lframe0\n"
+ "\t.long lj_vm_ffi_call\n"
+ "\t.long %d\n"
+ "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
+ "\t.byte 0x8e\n\t.uleb128 2\n"
+ "\t.byte 0xd\n\t.uleb128 0xe\n"
+ "\t.align 2\n"
+ ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
+#endif
fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@progbits\n");
fprintf(ctx->fp,
".Lframe1:\n"
@@ -9510,17 +9528,17 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.align 2\n"
".LECIE1:\n\n");
fprintf(ctx->fp,
- ".LSFDE1:\n"
- "\t.long .LEFDE1-.LASFDE1\n"
- ".LASFDE1:\n"
- "\t.long .LASFDE1-.Lframe1\n"
+ ".LSFDE2:\n"
+ "\t.long .LEFDE2-.LASFDE2\n"
+ ".LASFDE2:\n"
+ "\t.long .LASFDE2-.Lframe1\n"
"\t.long .Lbegin-.\n"
"\t.long %d\n"
"\t.uleb128 0\n" /* augmentation length */
"\t.byte 0xe\n\t.uleb128 %d\n"
"\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
"\t.byte 0x5\n\t.uleb128 70\n\t.uleb128 55\n",
- (int)ctx->codesz, CFRAME_SIZE);
+ fcofs, CFRAME_SIZE);
for (i = 14; i <= 31; i++)
fprintf(ctx->fp,
"\t.byte %d\n\t.uleb128 %d\n"
@@ -9528,7 +9546,37 @@ static void emit_asm_debug(BuildCtx *ctx)
0x80+i, 37+(31-i), 0x80+32+i, 2+2*(31-i));
fprintf(ctx->fp,
"\t.align 2\n"
- ".LEFDE1:\n\n");
+ ".LEFDE2:\n\n");
+#if LJ_HASFFI
+ fprintf(ctx->fp,
+ ".Lframe2:\n"
+ "\t.long .LECIE2-.LSCIE2\n"
+ ".LSCIE2:\n"
+ "\t.long 0\n"
+ "\t.byte 0x1\n"
+ "\t.string \"zR\"\n"
+ "\t.uleb128 0x1\n"
+ "\t.sleb128 -4\n"
+ "\t.byte 65\n"
+ "\t.uleb128 1\n" /* augmentation length */
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.uleb128 1\n\t.uleb128 0\n"
+ "\t.align 2\n"
+ ".LECIE2:\n\n");
+ fprintf(ctx->fp,
+ ".LSFDE3:\n"
+ "\t.long .LEFDE3-.LASFDE3\n"
+ ".LASFDE3:\n"
+ "\t.long .LASFDE3-.Lframe2\n"
+ "\t.long lj_vm_ffi_call-.\n"
+ "\t.long %d\n"
+ "\t.uleb128 0\n" /* augmentation length */
+ "\t.byte 0x11\n\t.uleb128 65\n\t.sleb128 -1\n"
+ "\t.byte 0x8e\n\t.uleb128 2\n"
+ "\t.byte 0xd\n\t.uleb128 0xe\n"
+ "\t.align 2\n"
+ ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
+#endif
break;
default:
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 @@
#define DASM_SECTION_CODE_OP 0
#define DASM_SECTION_CODE_SUB 1
#define DASM_MAXSECTION 2
-static const unsigned char build_actionlist[16164] = {
+static const unsigned char build_actionlist[16165] = {
254,1,248,10,252,247,195,237,15,132,244,11,131,227,252,248,41,218,72,141,
76,25,252,248,139,90,252,252,199,68,10,4,237,248,12,131,192,1,137,68,36,4,
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] = {
223,224,252,246,196,1,15,132,244,248,217,201,248,2,221,216,195,248,1,221,
225,223,224,252,246,196,1,15,133,244,248,217,201,248,2,221,216,195,255,248,
163,137,252,248,83,15,162,137,6,137,94,4,137,78,8,137,86,12,91,195,248,164,
- 255,85,72,137,229,83,72,137,252,251,139,131,233,72,41,196,255,15,182,139,
- 233,131,252,233,1,15,136,244,248,248,1,72,139,132,253,203,233,72,137,132,
- 253,204,233,131,252,233,1,15,137,244,1,248,2,15,182,131,233,72,139,187,233,
- 72,139,179,233,72,139,147,233,72,139,139,233,76,139,131,233,76,139,139,233,
- 133,192,15,132,244,251,15,40,131,233,15,40,139,233,255,15,40,147,233,15,40,
- 155,233,131,252,248,4,15,134,244,251,15,40,163,233,15,40,171,233,15,40,179,
- 233,15,40,187,233,248,5,252,255,147,233,72,137,131,233,15,41,131,233,72,137,
- 147,233,15,41,139,233,255,72,139,93,252,248,201,195,255,248,165,255,249,255,
- 129,124,253,202,4,239,15,133,244,253,129,124,253,194,4,239,15,133,244,254,
- 139,44,202,131,195,4,59,44,194,255,15,141,244,255,255,15,140,244,255,255,
- 15,143,244,255,255,15,142,244,255,255,248,6,15,183,67,252,254,141,156,253,
- 131,233,248,9,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,
- 36,252,238,248,7,15,135,244,43,129,124,253,194,4,239,15,130,244,247,15,133,
- 244,43,255,252,242,15,42,4,194,252,233,244,248,255,221,4,202,219,4,194,252,
- 233,244,249,255,248,8,15,135,244,43,255,252,242,15,42,12,202,252,242,15,16,
- 4,194,131,195,4,102,15,46,193,255,15,134,244,9,255,15,135,244,9,255,15,130,
- 244,9,255,15,131,244,9,255,252,233,244,6,255,219,4,202,252,233,244,248,255,
- 129,124,253,202,4,239,15,131,244,43,129,124,253,194,4,239,15,131,244,43,255,
- 248,1,252,242,15,16,4,194,248,2,131,195,4,102,15,46,4,202,248,3,255,248,1,
- 221,4,202,248,2,221,4,194,248,3,131,195,4,255,223,252,233,221,216,255,218,
- 252,233,223,224,158,255,15,134,244,247,255,15,135,244,247,255,15,130,244,
- 247,255,15,131,244,247,255,15,183,67,252,254,141,156,253,131,233,248,1,139,
- 3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,255,139,
- 108,194,4,131,195,4,255,129,252,253,239,15,133,244,253,129,124,253,202,4,
- 239,15,133,244,254,139,44,194,59,44,202,255,15,133,244,255,255,15,132,244,
- 255,255,15,183,67,252,254,141,156,253,131,233,248,9,139,3,15,182,204,15,182,
- 232,131,195,4,193,232,16,65,252,255,36,252,238,248,7,15,135,244,251,129,124,
- 253,202,4,239,15,130,244,247,15,133,244,251,255,252,242,15,42,4,202,255,219,
- 4,202,255,252,233,244,248,248,8,15,135,244,251,255,252,242,15,42,4,194,102,
- 15,46,4,202,255,219,4,194,221,4,202,255,252,233,244,250,255,129,252,253,239,
- 15,131,244,251,129,124,253,202,4,239,15,131,244,251,255,248,1,252,242,15,
- 16,4,202,248,2,102,15,46,4,194,248,4,255,248,1,221,4,202,248,2,221,4,194,
- 248,4,255,15,138,244,248,15,133,244,248,255,15,138,244,248,15,132,244,247,
- 255,248,1,15,183,67,252,254,141,156,253,131,233,248,2,255,248,2,15,183,67,
- 252,254,141,156,253,131,233,248,1,255,252,233,244,9,255,248,5,255,129,252,
- 253,239,15,132,244,48,129,124,253,202,4,239,15,132,244,48,255,57,108,202,
- 4,15,133,244,2,129,252,253,239,15,131,244,1,139,12,202,139,4,194,57,193,15,
- 132,244,1,129,252,253,239,15,135,244,2,129,252,253,239,15,130,244,2,139,169,
- 233,133,252,237,15,132,244,2,252,246,133,233,235,15,133,244,2,255,49,252,
- 237,255,189,1,0,0,0,255,252,233,244,47,255,248,3,129,252,253,239,255,15,133,
- 244,9,255,252,233,244,48,255,72,252,247,208,139,108,202,4,131,195,4,129,252,
- 253,239,15,133,244,249,139,12,202,65,59,12,135,255,139,108,202,4,131,195,
- 4,255,129,252,253,239,15,133,244,253,65,129,124,253,199,4,239,15,133,244,
- 254,65,139,44,199,59,44,202,255,15,183,67,252,254,141,156,253,131,233,248,
- 9,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,
- 248,7,15,135,244,249,65,129,124,253,199,4,239,15,130,244,247,255,252,242,
- 65,15,42,4,199,255,65,219,4,199,255,252,233,244,248,248,8,255,252,242,15,
- 42,4,202,102,65,15,46,4,199,255,219,4,202,65,221,4,199,255,129,252,253,239,
- 15,131,244,249,255,248,1,252,242,65,15,16,4,199,248,2,102,15,46,4,202,248,
- 4,255,248,1,65,221,4,199,248,2,221,4,202,248,4,255,72,252,247,208,139,108,
- 202,4,131,195,4,57,197,255,15,133,244,249,15,183,67,252,254,141,156,253,131,
- 233,248,2,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,
- 252,238,248,3,129,252,253,239,15,133,244,2,252,233,244,48,255,15,132,244,
- 248,129,252,253,239,15,132,244,48,15,183,67,252,254,141,156,253,131,233,248,
- 2,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,
- 255,139,108,194,4,131,195,4,129,252,253,239,255,137,108,202,4,139,44,194,
- 137,44,202,255,72,139,44,194,72,137,44,202,139,3,15,182,204,15,182,232,131,
- 195,4,193,232,16,65,252,255,36,252,238,255,49,252,237,129,124,253,194,4,239,
- 129,213,239,137,108,202,4,139,3,15,182,204,15,182,232,131,195,4,193,232,16,
- 65,252,255,36,252,238,255,129,124,253,194,4,239,15,133,244,251,139,44,194,
- 252,247,221,15,128,244,250,199,68,202,4,237,137,44,202,248,9,139,3,15,182,
- 204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,4,199,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,129,
- 124,253,194,4,239,15,131,244,53,255,252,242,15,16,4,194,72,184,237,237,102,
- 72,15,110,200,15,87,193,252,242,15,17,4,202,255,221,4,194,217,224,221,28,
- 202,255,129,124,253,194,4,239,15,133,244,248,139,4,194,255,139,128,233,248,
- 1,199,68,202,4,237,137,4,202,255,15,87,192,252,242,15,42,128,233,248,1,252,
- 242,15,17,4,202,255,219,128,233,248,1,221,28,202,255,139,3,15,182,204,15,
- 182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,2,129,124,253,194,
+ 255,204,248,165,255,85,72,137,229,83,72,137,252,251,139,131,233,72,41,196,
+ 255,15,182,139,233,131,252,233,1,15,136,244,248,248,1,72,139,132,253,203,
+ 233,72,137,132,253,204,233,131,252,233,1,15,137,244,1,248,2,15,182,131,233,
+ 72,139,187,233,72,139,179,233,72,139,147,233,72,139,139,233,76,139,131,233,
+ 76,139,139,233,133,192,15,132,244,251,15,40,131,233,15,40,139,233,255,15,
+ 40,147,233,15,40,155,233,131,252,248,4,15,134,244,251,15,40,163,233,15,40,
+ 171,233,15,40,179,233,15,40,187,233,248,5,252,255,147,233,72,137,131,233,
+ 15,41,131,233,72,137,147,233,15,41,139,233,255,72,139,93,252,248,201,195,
+ 255,249,255,129,124,253,202,4,239,15,133,244,253,129,124,253,194,4,239,15,
+ 133,244,254,139,44,202,131,195,4,59,44,194,255,15,141,244,255,255,15,140,
+ 244,255,255,15,143,244,255,255,15,142,244,255,255,248,6,15,183,67,252,254,
+ 141,156,253,131,233,248,9,139,3,15,182,204,15,182,232,131,195,4,193,232,16,
+ 65,252,255,36,252,238,248,7,15,135,244,43,129,124,253,194,4,239,15,130,244,
+ 247,15,133,244,43,255,252,242,15,42,4,194,252,233,244,248,255,221,4,202,219,
+ 4,194,252,233,244,249,255,248,8,15,135,244,43,255,252,242,15,42,12,202,252,
+ 242,15,16,4,194,131,195,4,102,15,46,193,255,15,134,244,9,255,15,135,244,9,
+ 255,15,130,244,9,255,15,131,244,9,255,252,233,244,6,255,219,4,202,252,233,
+ 244,248,255,129,124,253,202,4,239,15,131,244,43,129,124,253,194,4,239,15,
+ 131,244,43,255,248,1,252,242,15,16,4,194,248,2,131,195,4,102,15,46,4,202,
+ 248,3,255,248,1,221,4,202,248,2,221,4,194,248,3,131,195,4,255,223,252,233,
+ 221,216,255,218,252,233,223,224,158,255,15,134,244,247,255,15,135,244,247,
+ 255,15,130,244,247,255,15,131,244,247,255,15,183,67,252,254,141,156,253,131,
+ 233,248,1,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,
+ 252,238,255,139,108,194,4,131,195,4,255,129,252,253,239,15,133,244,253,129,
+ 124,253,202,4,239,15,133,244,254,139,44,194,59,44,202,255,15,133,244,255,
+ 255,15,132,244,255,255,15,183,67,252,254,141,156,253,131,233,248,9,139,3,
+ 15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,7,15,
+ 135,244,251,129,124,253,202,4,239,15,130,244,247,15,133,244,251,255,252,242,
+ 15,42,4,202,255,219,4,202,255,252,233,244,248,248,8,15,135,244,251,255,252,
+ 242,15,42,4,194,102,15,46,4,202,255,219,4,194,221,4,202,255,252,233,244,250,
+ 255,129,252,253,239,15,131,244,251,129,124,253,202,4,239,15,131,244,251,255,
+ 248,1,252,242,15,16,4,202,248,2,102,15,46,4,194,248,4,255,248,1,221,4,202,
+ 248,2,221,4,194,248,4,255,15,138,244,248,15,133,244,248,255,15,138,244,248,
+ 15,132,244,247,255,248,1,15,183,67,252,254,141,156,253,131,233,248,2,255,
+ 248,2,15,183,67,252,254,141,156,253,131,233,248,1,255,252,233,244,9,255,248,
+ 5,255,129,252,253,239,15,132,244,48,129,124,253,202,4,239,15,132,244,48,255,
+ 57,108,202,4,15,133,244,2,129,252,253,239,15,131,244,1,139,12,202,139,4,194,
+ 57,193,15,132,244,1,129,252,253,239,15,135,244,2,129,252,253,239,15,130,244,
+ 2,139,169,233,133,252,237,15,132,244,2,252,246,133,233,235,15,133,244,2,255,
+ 49,252,237,255,189,1,0,0,0,255,252,233,244,47,255,248,3,129,252,253,239,255,
+ 15,133,244,9,255,252,233,244,48,255,72,252,247,208,139,108,202,4,131,195,
+ 4,129,252,253,239,15,133,244,249,139,12,202,65,59,12,135,255,139,108,202,
+ 4,131,195,4,255,129,252,253,239,15,133,244,253,65,129,124,253,199,4,239,15,
+ 133,244,254,65,139,44,199,59,44,202,255,15,183,67,252,254,141,156,253,131,
+ 233,248,9,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,
+ 252,238,248,7,15,135,244,249,65,129,124,253,199,4,239,15,130,244,247,255,
+ 252,242,65,15,42,4,199,255,65,219,4,199,255,252,233,244,248,248,8,255,252,
+ 242,15,42,4,202,102,65,15,46,4,199,255,219,4,202,65,221,4,199,255,129,252,
+ 253,239,15,131,244,249,255,248,1,252,242,65,15,16,4,199,248,2,102,15,46,4,
+ 202,248,4,255,248,1,65,221,4,199,248,2,221,4,202,248,4,255,72,252,247,208,
+ 139,108,202,4,131,195,4,57,197,255,15,133,244,249,15,183,67,252,254,141,156,
+ 253,131,233,248,2,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,
+ 255,36,252,238,248,3,129,252,253,239,15,133,244,2,252,233,244,48,255,15,132,
+ 244,248,129,252,253,239,15,132,244,48,15,183,67,252,254,141,156,253,131,233,
+ 248,2,139,3,15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,
+ 238,255,139,108,194,4,131,195,4,129,252,253,239,255,137,108,202,4,139,44,
+ 194,137,44,202,255,72,139,44,194,72,137,44,202,139,3,15,182,204,15,182,232,
+ 131,195,4,193,232,16,65,252,255,36,252,238,255,49,252,237,129,124,253,194,
+ 4,239,129,213,239,137,108,202,4,139,3,15,182,204,15,182,232,131,195,4,193,
+ 232,16,65,252,255,36,252,238,255,129,124,253,194,4,239,15,133,244,251,139,
+ 44,194,252,247,221,15,128,244,250,199,68,202,4,237,137,44,202,248,9,139,3,
+ 15,182,204,15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,4,199,
+ 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,
+ 129,124,253,194,4,239,15,131,244,53,255,252,242,15,16,4,194,72,184,237,237,
+ 102,72,15,110,200,15,87,193,252,242,15,17,4,202,255,221,4,194,217,224,221,
+ 28,202,255,129,124,253,194,4,239,15,133,244,248,139,4,194,255,139,128,233,
+ 248,1,199,68,202,4,237,137,4,202,255,15,87,192,252,242,15,42,128,233,248,
+ 1,252,242,15,17,4,202,255,219,128,233,248,1,221,28,202,255,139,3,15,182,204,
+ 15,182,232,131,195,4,193,232,16,65,252,255,36,252,238,248,2,129,124,253,194,
4,239,15,133,244,56,139,60,194,255,139,175,233,131,252,253,0,15,133,244,255,
248,3,255,248,57,137,213,232,251,1,21,255,252,242,15,42,192,255,137,252,234,
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] = {
255,1,252,233,255,137,221,209,252,237,129,229,239,102,65,129,172,253,46,233,
238,15,130,244,148,255,141,12,202,255,129,121,253,4,239,15,133,244,255,255,
129,121,253,12,239,15,133,244,60,129,121,253,20,239,15,133,244,60,139,41,
- 131,121,16,0,15,140,244,251,255,129,121,253,12,239,15,133,244,165,129,121,
- 253,20,239,15,133,244,165,255,139,105,16,133,252,237,15,136,244,251,3,41,
+ 131,121,16,0,15,140,244,251,255,129,121,253,12,239,15,133,244,164,129,121,
+ 253,20,239,15,133,244,164,255,139,105,16,133,252,237,15,136,244,251,3,41,
15,128,244,247,137,41,255,59,105,8,199,65,28,237,137,105,24,255,15,142,244,
253,248,1,248,6,141,156,253,131,233,255,141,156,253,131,233,15,183,67,252,
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] = {
252,238,248,5,255,3,41,15,128,244,1,137,41,255,15,141,244,7,255,141,156,253,
131,233,15,183,67,252,254,15,141,245,255,15,140,244,7,255,252,233,244,6,248,
9,255,129,121,253,4,239,255,15,131,244,60,129,121,253,12,239,15,131,244,60,
- 255,129,121,253,12,239,15,131,244,165,129,121,253,20,239,15,131,244,165,255,
+ 255,129,121,253,12,239,15,131,244,164,129,121,253,20,239,15,131,244,164,255,
139,105,20,255,129,252,253,239,15,131,244,60,255,252,242,15,16,1,252,242,
15,16,73,8,255,252,242,15,88,65,16,252,242,15,17,1,133,252,237,15,136,244,
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 {
GLOB_vm_foldfpm,
GLOB_vm_foldarith,
GLOB_vm_cpuid,
- GLOB_vm_ffi_call,
GLOB_assert_bad_for_arg_type,
+ GLOB_vm_ffi_call,
GLOB_BC_MODVN_Z,
GLOB_BC_TGETS_Z,
GLOB_BC_TSETS_Z,
@@ -1112,8 +1112,8 @@ static const char *const globnames[] = {
"vm_foldfpm",
"vm_foldarith",
"vm_cpuid",
- "vm_ffi_call@4",
"assert_bad_for_arg_type",
+ "vm_ffi_call@4",
"BC_MODVN_Z",
"BC_TGETS_Z",
"BC_TSETS_Z",
@@ -1834,29 +1834,28 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
dasm_put(Dst, 9411);
}
dasm_put(Dst, 9829);
-#if LJ_HASFFI
-#define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
- dasm_put(Dst, 9853, DtE(->spadj));
-#if LJ_TARGET_WINDOWS
-#endif
- 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]));
- 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]));
-#if LJ_TARGET_WINDOWS
-#endif
- dasm_put(Dst, 10003);
-#endif
- dasm_put(Dst, 10011);
#ifdef LUA_USE_ASSERT
dasm_put(Dst, 9413);
#endif
- dasm_put(Dst, 9413);
+ dasm_put(Dst, 9853);
+#if LJ_HASFFI
+#define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
+ dasm_put(Dst, 9857, DtE(->spadj));
+#if LJ_TARGET_WINDOWS
+#endif
+ 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]));
+ 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]));
+#if LJ_TARGET_WINDOWS
+#endif
+ dasm_put(Dst, 10007);
+#endif
}
/* Generate the code for a single instruction. */
static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
{
int vk = 0;
- dasm_put(Dst, 10014, defop);
+ dasm_put(Dst, 10015, defop);
switch (op) {
@@ -1867,145 +1866,145 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT:
if (LJ_DUALNUM) {
- dasm_put(Dst, 10016, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 10017, LJ_TISNUM, LJ_TISNUM);
switch (op) {
case BC_ISLT:
- dasm_put(Dst, 10046);
+ dasm_put(Dst, 10047);
break;
case BC_ISGE:
- dasm_put(Dst, 10051);
+ dasm_put(Dst, 10052);
break;
case BC_ISLE:
- dasm_put(Dst, 10056);
+ dasm_put(Dst, 10057);
break;
case BC_ISGT:
- dasm_put(Dst, 10061);
+ dasm_put(Dst, 10062);
break;
default: break; /* Shut up GCC. */
}
- dasm_put(Dst, 10066, -BCBIAS_J*4, LJ_TISNUM);
+ dasm_put(Dst, 10067, -BCBIAS_J*4, LJ_TISNUM);
if (sse) {
- dasm_put(Dst, 10121);
+ dasm_put(Dst, 10122);
} else {
- dasm_put(Dst, 10132);
+ dasm_put(Dst, 10133);
}
- dasm_put(Dst, 10143);
+ dasm_put(Dst, 10144);
if (sse) {
- dasm_put(Dst, 10150);
+ dasm_put(Dst, 10151);
switch (op) {
case BC_ISLT:
- dasm_put(Dst, 10170);
+ dasm_put(Dst, 10171);
break;
case BC_ISGE:
- dasm_put(Dst, 10175);
+ dasm_put(Dst, 10176);
break;
case BC_ISLE:
- dasm_put(Dst, 10180);
+ dasm_put(Dst, 10181);
break;
case BC_ISGT:
- dasm_put(Dst, 10185);
+ dasm_put(Dst, 10186);
break;
default: break; /* Shut up GCC. */
}
- dasm_put(Dst, 10190);
+ dasm_put(Dst, 10191);
} else {
- dasm_put(Dst, 10195);
+ dasm_put(Dst, 10196);
}
} else {
- dasm_put(Dst, 10203, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 10204, LJ_TISNUM, LJ_TISNUM);
}
if (sse) {
- dasm_put(Dst, 10224);
+ dasm_put(Dst, 10225);
} else {
- dasm_put(Dst, 10245);
+ dasm_put(Dst, 10246);
if (cmov) {
- dasm_put(Dst, 10261);
+ dasm_put(Dst, 10262);
} else {
- dasm_put(Dst, 10267);
+ dasm_put(Dst, 10268);
}
}
if (LJ_DUALNUM) {
switch (op) {
case BC_ISLT:
- dasm_put(Dst, 10170);
+ dasm_put(Dst, 10171);
break;
case BC_ISGE:
- dasm_put(Dst, 10175);
+ dasm_put(Dst, 10176);
break;
case BC_ISLE:
- dasm_put(Dst, 10180);
+ dasm_put(Dst, 10181);
break;
case BC_ISGT:
- dasm_put(Dst, 10185);
+ dasm_put(Dst, 10186);
break;
default: break; /* Shut up GCC. */
}
- dasm_put(Dst, 10190);
+ dasm_put(Dst, 10191);
} else {
switch (op) {
case BC_ISLT:
- dasm_put(Dst, 10274);
+ dasm_put(Dst, 10275);
break;
case BC_ISGE:
- dasm_put(Dst, 10279);
+ dasm_put(Dst, 10280);
break;
case BC_ISLE:
- dasm_put(Dst, 10284);
+ dasm_put(Dst, 10285);
break;
case BC_ISGT:
- dasm_put(Dst, 10289);
+ dasm_put(Dst, 10290);
break;
default: break; /* Shut up GCC. */
}
- dasm_put(Dst, 10294, -BCBIAS_J*4);
+ dasm_put(Dst, 10295, -BCBIAS_J*4);
}
break;
case BC_ISEQV: case BC_ISNEV:
vk = op == BC_ISEQV;
- dasm_put(Dst, 10327);
+ dasm_put(Dst, 10328);
if (LJ_DUALNUM) {
- dasm_put(Dst, 10335, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 10336, LJ_TISNUM, LJ_TISNUM);
if (vk) {
- dasm_put(Dst, 10360);
+ dasm_put(Dst, 10361);
} else {
- dasm_put(Dst, 10365);
+ dasm_put(Dst, 10366);
}
- dasm_put(Dst, 10370, -BCBIAS_J*4, LJ_TISNUM);
+ dasm_put(Dst, 10371, -BCBIAS_J*4, LJ_TISNUM);
if (sse) {
- dasm_put(Dst, 10423);
+ dasm_put(Dst, 10424);
} else {
- dasm_put(Dst, 10430);
+ dasm_put(Dst, 10431);
}
- dasm_put(Dst, 10434);
+ dasm_put(Dst, 10435);
if (sse) {
- dasm_put(Dst, 10445);
+ dasm_put(Dst, 10446);
} else {
- dasm_put(Dst, 10457);
+ dasm_put(Dst, 10458);
}
- dasm_put(Dst, 10464);
+ dasm_put(Dst, 10465);
} else {
- dasm_put(Dst, 10469, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 10470, LJ_TISNUM, LJ_TISNUM);
}
if (sse) {
- dasm_put(Dst, 10488);
+ dasm_put(Dst, 10489);
} else {
- dasm_put(Dst, 10506);
+ dasm_put(Dst, 10507);
if (cmov) {
- dasm_put(Dst, 10261);
+ dasm_put(Dst, 10262);
} else {
- dasm_put(Dst, 10267);
+ dasm_put(Dst, 10268);
}
}
iseqne_fp:
if (vk) {
- dasm_put(Dst, 10519);
+ dasm_put(Dst, 10520);
} else {
- dasm_put(Dst, 10528);
+ dasm_put(Dst, 10529);
}
iseqne_end:
if (vk) {
- dasm_put(Dst, 10537, -BCBIAS_J*4);
+ dasm_put(Dst, 10538, -BCBIAS_J*4);
if (!LJ_HASFFI) {
dasm_put(Dst, 4675);
}
@@ -2013,156 +2012,156 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
if (!LJ_HASFFI) {
dasm_put(Dst, 4675);
}
- dasm_put(Dst, 10552, -BCBIAS_J*4);
+ dasm_put(Dst, 10553, -BCBIAS_J*4);
}
if (LJ_DUALNUM && (op == BC_ISEQV || op == BC_ISNEV ||
op == BC_ISEQN || op == BC_ISNEN)) {
- dasm_put(Dst, 10567);
+ dasm_put(Dst, 10568);
} else {
- dasm_put(Dst, 10306);
+ dasm_put(Dst, 10307);
}
if (op == BC_ISEQV || op == BC_ISNEV) {
- dasm_put(Dst, 10572);
+ dasm_put(Dst, 10573);
if (LJ_HASFFI) {
- dasm_put(Dst, 10575, LJ_TCDATA, LJ_TCDATA);
+ dasm_put(Dst, 10576, LJ_TCDATA, LJ_TCDATA);
}
- dasm_put(Dst, 10594, LJ_TISPRI, LJ_TISTABUD, LJ_TUDATA, Dt6(->metatable), Dt6(->nomm), 1<metatable), Dt6(->nomm), 1<>32));
+ dasm_put(Dst, 11174, (unsigned int)(U64x(80000000,00000000)), (unsigned int)((U64x(80000000,00000000))>>32));
} else {
- dasm_put(Dst, 11198);
+ dasm_put(Dst, 11199);
}
if (LJ_DUALNUM) {
- dasm_put(Dst, 10567);
+ dasm_put(Dst, 10568);
} else {
- dasm_put(Dst, 10306);
+ dasm_put(Dst, 10307);
}
break;
case BC_LEN:
- dasm_put(Dst, 11207, LJ_TSTR);
+ dasm_put(Dst, 11208, LJ_TSTR);
if (LJ_DUALNUM) {
- dasm_put(Dst, 11221, Dt5(->len), LJ_TISNUM);
+ dasm_put(Dst, 11222, Dt5(->len), LJ_TISNUM);
} else if (sse) {
- dasm_put(Dst, 11235, Dt5(->len));
+ dasm_put(Dst, 11236, Dt5(->len));
} else {
- dasm_put(Dst, 11253, Dt5(->len));
+ dasm_put(Dst, 11254, Dt5(->len));
}
- dasm_put(Dst, 11262, LJ_TTAB);
+ dasm_put(Dst, 11263, LJ_TTAB);
#ifdef LUAJIT_ENABLE_LUA52COMPAT
- dasm_put(Dst, 11298, Dt6(->metatable));
+ dasm_put(Dst, 11299, Dt6(->metatable));
#endif
- dasm_put(Dst, 11312);
+ dasm_put(Dst, 11313);
if (LJ_DUALNUM) {
} else if (sse) {
- dasm_put(Dst, 11321);
+ dasm_put(Dst, 11322);
} else {
}
- dasm_put(Dst, 11327);
+ dasm_put(Dst, 11328);
#ifdef LUAJIT_ENABLE_LUA52COMPAT
- dasm_put(Dst, 11340, Dt6(->nomm), 1<nomm), 1<base), Dt1(->base));
+ dasm_put(Dst, 12118, Dt1(->base), Dt1(->base));
break;
/* -- Constant ops ------------------------------------------------------ */
case BC_KSTR:
- dasm_put(Dst, 12201, LJ_TSTR);
+ dasm_put(Dst, 12202, LJ_TSTR);
break;
case BC_KCDATA:
#if LJ_HASFFI
- dasm_put(Dst, 12201, LJ_TCDATA);
+ dasm_put(Dst, 12202, LJ_TCDATA);
#endif
break;
case BC_KSHORT:
if (LJ_DUALNUM) {
- dasm_put(Dst, 12238, LJ_TISNUM);
+ dasm_put(Dst, 12239, LJ_TISNUM);
} else if (sse) {
- dasm_put(Dst, 12250);
+ dasm_put(Dst, 12251);
} else {
- dasm_put(Dst, 12265);
+ dasm_put(Dst, 12266);
}
- dasm_put(Dst, 10306);
+ dasm_put(Dst, 10307);
break;
case BC_KNUM:
if (sse) {
- dasm_put(Dst, 12273);
+ dasm_put(Dst, 12274);
} else {
- dasm_put(Dst, 12287);
+ dasm_put(Dst, 12288);
}
- dasm_put(Dst, 10306);
+ dasm_put(Dst, 10307);
break;
case BC_KPRI:
- dasm_put(Dst, 12295);
+ dasm_put(Dst, 12296);
break;
case BC_KNIL:
- dasm_put(Dst, 12324, LJ_TNIL);
+ dasm_put(Dst, 12325, LJ_TNIL);
break;
/* -- Upvalue and function ops ------------------------------------------ */
case BC_UGET:
- dasm_put(Dst, 12372, offsetof(GCfuncL, uvptr), DtA(->v));
+ dasm_put(Dst, 12373, offsetof(GCfuncL, uvptr), DtA(->v));
break;
case BC_USETV:
#define TV2MARKOFS \
((int32_t)offsetof(GCupval, marked)-(int32_t)offsetof(GCupval, tv))
- 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);
- dasm_put(Dst, 12509);
+ 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);
+ dasm_put(Dst, 12510);
break;
#undef TV2MARKOFS
case BC_USETS:
- 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);
+ 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);
break;
case BC_USETN:
- dasm_put(Dst, 12617);
+ dasm_put(Dst, 12618);
if (sse) {
- dasm_put(Dst, 12622);
+ dasm_put(Dst, 12623);
} else {
- dasm_put(Dst, 10838);
+ dasm_put(Dst, 10839);
}
- dasm_put(Dst, 12630, offsetof(GCfuncL, uvptr), DtA(->v));
+ dasm_put(Dst, 12631, offsetof(GCfuncL, uvptr), DtA(->v));
if (sse) {
- dasm_put(Dst, 12639);
+ dasm_put(Dst, 12640);
} else {
- dasm_put(Dst, 12645);
+ dasm_put(Dst, 12646);
}
- dasm_put(Dst, 10306);
+ dasm_put(Dst, 10307);
break;
case BC_USETP:
- dasm_put(Dst, 12648, offsetof(GCfuncL, uvptr), DtA(->v));
+ dasm_put(Dst, 12649, offsetof(GCfuncL, uvptr), DtA(->v));
break;
case BC_UCLO:
- dasm_put(Dst, 12688, -BCBIAS_J*4, Dt1(->openupval), Dt1(->base), Dt1(->base));
+ dasm_put(Dst, 12689, -BCBIAS_J*4, Dt1(->openupval), Dt1(->base), Dt1(->base));
break;
case BC_FNEW:
- dasm_put(Dst, 12744, Dt1(->base), Dt1(->base), LJ_TFUNC);
+ dasm_put(Dst, 12745, Dt1(->base), Dt1(->base), LJ_TFUNC);
break;
/* -- Table ops --------------------------------------------------------- */
case BC_TNEW:
- dasm_put(Dst, 12811, Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), LJ_TTAB);
+ dasm_put(Dst, 12812, Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), LJ_TTAB);
break;
case BC_TDUP:
- dasm_put(Dst, 12935, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB);
+ dasm_put(Dst, 12936, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB);
break;
case BC_GGET:
- dasm_put(Dst, 13034, Dt7(->env));
+ dasm_put(Dst, 13035, Dt7(->env));
break;
case BC_GSET:
- dasm_put(Dst, 13054, Dt7(->env));
+ dasm_put(Dst, 13055, Dt7(->env));
break;
case BC_TGETV:
- dasm_put(Dst, 13074, LJ_TTAB);
+ dasm_put(Dst, 13075, LJ_TTAB);
if (LJ_DUALNUM) {
- dasm_put(Dst, 13097, LJ_TISNUM);
+ dasm_put(Dst, 13098, LJ_TISNUM);
} else {
- dasm_put(Dst, 13111, LJ_TISNUM);
+ dasm_put(Dst, 13112, LJ_TISNUM);
if (sse) {
- dasm_put(Dst, 13122);
+ dasm_put(Dst, 13123);
} else {
}
- dasm_put(Dst, 13143);
+ dasm_put(Dst, 13144);
}
- dasm_put(Dst, 13148, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL);
- dasm_put(Dst, 13343, LJ_TNIL, DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL);
+ dasm_put(Dst, 13344, LJ_TNIL, DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
+ dasm_put(Dst, 13557, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
break;
case BC_TSETS:
- 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);
- dasm_put(Dst, 13773, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<next));
- dasm_put(Dst, 13860, Dt6(->metatable), Dt6(->nomm), 1<base), Dt1(->base), Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
+ 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);
+ dasm_put(Dst, 13774, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<next));
+ dasm_put(Dst, 13861, Dt6(->metatable), Dt6(->nomm), 1<base), Dt1(->base), Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
break;
case BC_TSETB:
- dasm_put(Dst, 13952, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable));
- dasm_put(Dst, 14047, Dt6(->metatable), Dt6(->nomm), 1<marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
+ dasm_put(Dst, 13953, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable));
+ dasm_put(Dst, 14048, Dt6(->metatable), Dt6(->nomm), 1<marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
break;
case BC_TSETM:
- dasm_put(Dst, 14095, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
- dasm_put(Dst, 14245, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
+ dasm_put(Dst, 14096, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
+ dasm_put(Dst, 14246, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
break;
/* -- Calls and vararg handling ----------------------------------------- */
case BC_CALL: case BC_CALLM:
- dasm_put(Dst, 11360);
+ dasm_put(Dst, 11361);
if (op == BC_CALLM) {
- dasm_put(Dst, 14265);
+ dasm_put(Dst, 14266);
}
- dasm_put(Dst, 14270, LJ_TFUNC, Dt7(->pc));
+ dasm_put(Dst, 14271, LJ_TFUNC, Dt7(->pc));
break;
case BC_CALLMT:
- dasm_put(Dst, 14265);
+ dasm_put(Dst, 14266);
break;
case BC_CALLT:
- dasm_put(Dst, 14313, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc));
- dasm_put(Dst, 14431, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG);
+ dasm_put(Dst, 14314, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc));
+ dasm_put(Dst, 14432, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG);
break;
case BC_ITERC:
- dasm_put(Dst, 14505, LJ_TFUNC, 2+1, Dt7(->pc));
+ dasm_put(Dst, 14506, LJ_TFUNC, 2+1, Dt7(->pc));
break;
case BC_ITERN:
#if LJ_HASJIT
#endif
- dasm_put(Dst, 14577, Dt6(->asize), Dt6(->array), LJ_TNIL);
+ dasm_put(Dst, 14578, Dt6(->asize), Dt6(->array), LJ_TNIL);
if (LJ_DUALNUM) {
- dasm_put(Dst, 11226, LJ_TISNUM);
+ dasm_put(Dst, 11227, LJ_TISNUM);
} else if (sse) {
- dasm_put(Dst, 11321);
+ dasm_put(Dst, 11322);
} else {
- dasm_put(Dst, 14629);
+ dasm_put(Dst, 14630);
}
- dasm_put(Dst, 14635);
+ dasm_put(Dst, 14636);
if (LJ_DUALNUM) {
} else if (sse) {
- dasm_put(Dst, 11191);
+ dasm_put(Dst, 11192);
} else {
- dasm_put(Dst, 11203);
+ dasm_put(Dst, 11204);
}
- dasm_put(Dst, 14648, -BCBIAS_J*4);
+ dasm_put(Dst, 14649, -BCBIAS_J*4);
if (!LJ_DUALNUM && !sse) {
- dasm_put(Dst, 14702);
+ dasm_put(Dst, 14703);
}
- dasm_put(Dst, 14708, Dt6(->hmask), sizeof(Node), Dt6(->node), DtB(->val.it), LJ_TNIL, DtB(->key), DtB(->val));
+ dasm_put(Dst, 14709, Dt6(->hmask), sizeof(Node), Dt6(->node), DtB(->val.it), LJ_TNIL, DtB(->key), DtB(->val));
break;
case BC_ISNEXT:
- 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);
+ 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);
break;
case BC_VARG:
- dasm_put(Dst, 14888, (8+FRAME_VARG), LJ_TNIL, Dt1(->maxstack));
- dasm_put(Dst, 15055, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
+ dasm_put(Dst, 14889, (8+FRAME_VARG), LJ_TNIL, Dt1(->maxstack));
+ dasm_put(Dst, 15056, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
break;
/* -- Returns ----------------------------------------------------------- */
case BC_RETM:
- dasm_put(Dst, 14265);
+ dasm_put(Dst, 14266);
break;
case BC_RET: case BC_RET0: case BC_RET1:
if (op != BC_RET0) {
- dasm_put(Dst, 15125);
+ dasm_put(Dst, 15126);
}
- dasm_put(Dst, 15129, FRAME_TYPE);
+ dasm_put(Dst, 15130, FRAME_TYPE);
switch (op) {
case BC_RET:
- dasm_put(Dst, 15148);
+ dasm_put(Dst, 15149);
break;
case BC_RET1:
- dasm_put(Dst, 15202);
+ dasm_put(Dst, 15203);
/* fallthrough */
case BC_RET0:
- dasm_put(Dst, 15212);
+ dasm_put(Dst, 15213);
default:
break;
}
- dasm_put(Dst, 15223, Dt7(->pc), PC2PROTO(k));
+ dasm_put(Dst, 15224, Dt7(->pc), PC2PROTO(k));
if (op == BC_RET) {
- dasm_put(Dst, 15271, LJ_TNIL);
+ dasm_put(Dst, 15272, LJ_TNIL);
} else {
- dasm_put(Dst, 15282, LJ_TNIL);
+ dasm_put(Dst, 15283, LJ_TNIL);
}
- dasm_put(Dst, 15289, -FRAME_VARG, FRAME_TYPEP);
+ dasm_put(Dst, 15290, -FRAME_VARG, FRAME_TYPEP);
if (op != BC_RET0) {
- dasm_put(Dst, 15313);
+ dasm_put(Dst, 15314);
}
dasm_put(Dst, 4752);
break;
@@ -2777,7 +2776,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_FORL:
#if LJ_HASJIT
- dasm_put(Dst, 15317, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
+ dasm_put(Dst, 15318, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
#endif
break;
@@ -2789,111 +2788,111 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_FORI:
case BC_IFORL:
vk = (op == BC_IFORL || op == BC_JFORL);
- dasm_put(Dst, 15338);
+ dasm_put(Dst, 15339);
if (LJ_DUALNUM) {
- dasm_put(Dst, 15342, LJ_TISNUM);
+ dasm_put(Dst, 15343, LJ_TISNUM);
if (!vk) {
- dasm_put(Dst, 15352, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 15353, LJ_TISNUM, LJ_TISNUM);
} else {
#ifdef LUA_USE_ASSERT
- dasm_put(Dst, 15381, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 15382, LJ_TISNUM, LJ_TISNUM);
#endif
- dasm_put(Dst, 15400);
+ dasm_put(Dst, 15401);
}
- dasm_put(Dst, 15419, LJ_TISNUM);
+ dasm_put(Dst, 15420, LJ_TISNUM);
if (op == BC_FORI) {
- dasm_put(Dst, 15430, -BCBIAS_J*4);
+ dasm_put(Dst, 15431, -BCBIAS_J*4);
} else if (op == BC_JFORI) {
- dasm_put(Dst, 15444, -BCBIAS_J*4, BC_JLOOP);
+ dasm_put(Dst, 15445, -BCBIAS_J*4, BC_JLOOP);
} else if (op == BC_IFORL) {
- dasm_put(Dst, 15462, -BCBIAS_J*4);
+ dasm_put(Dst, 15463, -BCBIAS_J*4);
} else {
- dasm_put(Dst, 15454, BC_JLOOP);
+ dasm_put(Dst, 15455, BC_JLOOP);
}
- dasm_put(Dst, 15476);
+ dasm_put(Dst, 15477);
if (vk) {
- dasm_put(Dst, 15501);
+ dasm_put(Dst, 15502);
}
- dasm_put(Dst, 15419, LJ_TISNUM);
+ dasm_put(Dst, 15420, LJ_TISNUM);
if (op == BC_FORI) {
- dasm_put(Dst, 15510);
+ dasm_put(Dst, 15511);
} else if (op == BC_JFORI) {
- dasm_put(Dst, 15515, -BCBIAS_J*4, BC_JLOOP);
+ dasm_put(Dst, 15516, -BCBIAS_J*4, BC_JLOOP);
} else if (op == BC_IFORL) {
- dasm_put(Dst, 15529);
+ dasm_put(Dst, 15530);
} else {
- dasm_put(Dst, 15525, BC_JLOOP);
+ dasm_put(Dst, 15526, BC_JLOOP);
}
- dasm_put(Dst, 15534);
+ dasm_put(Dst, 15535);
} else if (!vk) {
- dasm_put(Dst, 15541, LJ_TISNUM);
+ dasm_put(Dst, 15542, LJ_TISNUM);
}
if (!vk) {
- dasm_put(Dst, 15547, LJ_TISNUM);
+ dasm_put(Dst, 15548, LJ_TISNUM);
} else {
#ifdef LUA_USE_ASSERT
- dasm_put(Dst, 15561, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 15562, LJ_TISNUM, LJ_TISNUM);
#endif
}
- dasm_put(Dst, 15580);
+ dasm_put(Dst, 15581);
if (!vk) {
- dasm_put(Dst, 15584, LJ_TISNUM);
+ dasm_put(Dst, 15585, LJ_TISNUM);
}
if (sse) {
- dasm_put(Dst, 15593);
+ dasm_put(Dst, 15594);
if (vk) {
- dasm_put(Dst, 15605);
+ dasm_put(Dst, 15606);
} else {
- dasm_put(Dst, 15624);
+ dasm_put(Dst, 15625);
}
- dasm_put(Dst, 15629);
+ dasm_put(Dst, 15630);
} else {
- dasm_put(Dst, 15642);
+ dasm_put(Dst, 15643);
if (vk) {
- dasm_put(Dst, 15648);
+ dasm_put(Dst, 15649);
} else {
- dasm_put(Dst, 15664);
+ dasm_put(Dst, 15665);
}
- dasm_put(Dst, 15672);
+ dasm_put(Dst, 15673);
if (cmov) {
- dasm_put(Dst, 10261);
+ dasm_put(Dst, 10262);
} else {
- dasm_put(Dst, 10267);
+ dasm_put(Dst, 10268);
}
if (!cmov) {
- dasm_put(Dst, 15677);
+ dasm_put(Dst, 15678);
}
}
if (op == BC_FORI) {
if (LJ_DUALNUM) {
- dasm_put(Dst, 15683);
+ dasm_put(Dst, 15684);
} else {
- dasm_put(Dst, 15688, -BCBIAS_J*4);
+ dasm_put(Dst, 15689, -BCBIAS_J*4);
}
} else if (op == BC_JFORI) {
- dasm_put(Dst, 15698, -BCBIAS_J*4, BC_JLOOP);
+ dasm_put(Dst, 15699, -BCBIAS_J*4, BC_JLOOP);
} else if (op == BC_IFORL) {
if (LJ_DUALNUM) {
- dasm_put(Dst, 15712);
+ dasm_put(Dst, 15713);
} else {
- dasm_put(Dst, 15717, -BCBIAS_J*4);
+ dasm_put(Dst, 15718, -BCBIAS_J*4);
}
} else {
- dasm_put(Dst, 15708, BC_JLOOP);
+ dasm_put(Dst, 15709, BC_JLOOP);
}
if (LJ_DUALNUM) {
- dasm_put(Dst, 10190);
+ dasm_put(Dst, 10191);
} else {
- dasm_put(Dst, 10972);
+ dasm_put(Dst, 10973);
}
if (sse) {
- dasm_put(Dst, 15727);
+ dasm_put(Dst, 15728);
}
break;
case BC_ITERL:
#if LJ_HASJIT
- dasm_put(Dst, 15317, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
+ dasm_put(Dst, 15318, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
#endif
break;
@@ -2902,33 +2901,33 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break;
#endif
case BC_IITERL:
- dasm_put(Dst, 15738, LJ_TNIL);
+ dasm_put(Dst, 15739, LJ_TNIL);
if (op == BC_JITERL) {
- dasm_put(Dst, 15753, BC_JLOOP);
+ dasm_put(Dst, 15754, BC_JLOOP);
} else {
- dasm_put(Dst, 15767, -BCBIAS_J*4);
+ dasm_put(Dst, 15768, -BCBIAS_J*4);
}
- dasm_put(Dst, 10304);
+ dasm_put(Dst, 10305);
break;
case BC_LOOP:
#if LJ_HASJIT
- dasm_put(Dst, 15317, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
+ dasm_put(Dst, 15318, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
#endif
break;
case BC_ILOOP:
- dasm_put(Dst, 10306);
+ dasm_put(Dst, 10307);
break;
case BC_JLOOP:
#if LJ_HASJIT
- dasm_put(Dst, 15783, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L));
+ dasm_put(Dst, 15784, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L));
#endif
break;
case BC_JMP:
- dasm_put(Dst, 15824, -BCBIAS_J*4);
+ dasm_put(Dst, 15825, -BCBIAS_J*4);
break;
/* -- Function headers -------------------------------------------------- */
@@ -2942,7 +2941,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_FUNCF:
#if LJ_HASJIT
- dasm_put(Dst, 15850, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_CALL);
+ dasm_put(Dst, 15851, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_CALL);
#endif
case BC_FUNCV: /* NYI: compiled vararg functions. */
break;
@@ -2952,13 +2951,13 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break;
#endif
case BC_IFUNCF:
- dasm_put(Dst, 15871, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams));
+ dasm_put(Dst, 15872, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams));
if (op == BC_JFUNCF) {
- dasm_put(Dst, 15902, BC_JLOOP);
+ dasm_put(Dst, 15903, BC_JLOOP);
} else {
- dasm_put(Dst, 10306);
+ dasm_put(Dst, 10307);
}
- dasm_put(Dst, 15911, LJ_TNIL);
+ dasm_put(Dst, 15912, LJ_TNIL);
break;
case BC_JFUNCV:
@@ -2969,30 +2968,30 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; /* NYI: compiled vararg functions. */
case BC_IFUNCV:
- dasm_put(Dst, 15933, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL);
+ dasm_put(Dst, 15934, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL);
if (op == BC_JFUNCV) {
- dasm_put(Dst, 15902, BC_JLOOP);
+ dasm_put(Dst, 15903, BC_JLOOP);
} else {
- dasm_put(Dst, 16030, -4+PC2PROTO(k));
+ dasm_put(Dst, 16031, -4+PC2PROTO(k));
}
- dasm_put(Dst, 16055, LJ_TNIL);
+ dasm_put(Dst, 16056, LJ_TNIL);
break;
case BC_FUNCC:
case BC_FUNCCW:
- dasm_put(Dst, 16077, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top));
+ dasm_put(Dst, 16078, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top));
if (op == BC_FUNCC) {
dasm_put(Dst, 2424);
} else {
- dasm_put(Dst, 16107);
+ dasm_put(Dst, 16108);
}
- dasm_put(Dst, 16115, DISPATCH_GL(vmstate), ~LJ_VMST_C);
+ dasm_put(Dst, 16116, DISPATCH_GL(vmstate), ~LJ_VMST_C);
if (op == BC_FUNCC) {
- dasm_put(Dst, 16125);
+ dasm_put(Dst, 16126);
} else {
- dasm_put(Dst, 16130, DISPATCH_GL(wrapf));
+ dasm_put(Dst, 16131, DISPATCH_GL(wrapf));
}
- dasm_put(Dst, 16136, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top));
+ dasm_put(Dst, 16137, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top));
break;
/* ---------------------------------------------------------------------- */
@@ -3020,7 +3019,7 @@ static int build_backend(BuildCtx *ctx)
build_subroutines(ctx, cmov, sse);
- dasm_put(Dst, 16162);
+ dasm_put(Dst, 16163);
for (op = 0; op < BC__MAX; op++)
build_ins(ctx, (BCOp)op, op, cmov, sse);
@@ -3030,6 +3029,7 @@ static int build_backend(BuildCtx *ctx)
/* Emit pseudo frame-info for all assembler functions. */
static void emit_asm_debug(BuildCtx *ctx)
{
+ int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
#if LJ_64
#define SZPTR "8"
#define BSZPTR "3"
@@ -3063,22 +3063,49 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.long .LEFDE0-.LASFDE0\n"
".LASFDE0:\n"
"\t.long .Lframe0\n"
- "\t.long .Lbegin\n"
- "\t.long %d\n"
- "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
#if LJ_64
+ "\t.quad .Lbegin\n"
+ "\t.quad %d\n"
+ "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
"\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
"\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
"\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
"\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
#else
+ "\t.long .Lbegin\n"
+ "\t.long %d\n"
+ "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
"\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
"\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */
"\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */
"\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
#endif
"\t.align " SZPTR "\n"
- ".LEFDE0:\n\n", (int)ctx->codesz, CFRAME_SIZE);
+ ".LEFDE0:\n\n", fcofs, CFRAME_SIZE);
+#if LJ_HASFFI
+ fprintf(ctx->fp,
+ ".LSFDE1:\n"
+ "\t.long .LEFDE1-.LASFDE1\n"
+ ".LASFDE1:\n"
+ "\t.long .Lframe0\n"
+#if LJ_64
+ "\t.quad lj_vm_ffi_call\n"
+ "\t.quad %d\n"
+ "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
+ "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
+ "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
+#else
+ "\t.long lj_vm_ffi_call\n"
+ "\t.long %d\n"
+ "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
+ "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
+ "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
+#endif
+ "\t.align " SZPTR "\n"
+ ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
+#endif
#if (defined(__sun__) && defined(__svr4__)) || defined(__solaris_)
fprintf(ctx->fp, "\t.section .eh_frame,\"aw\",@progbits\n");
#else
@@ -3103,10 +3130,10 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.align " SZPTR "\n"
".LECIE1:\n\n");
fprintf(ctx->fp,
- ".LSFDE1:\n"
- "\t.long .LEFDE1-.LASFDE1\n"
- ".LASFDE1:\n"
- "\t.long .LASFDE1-.Lframe1\n"
+ ".LSFDE2:\n"
+ "\t.long .LEFDE2-.LASFDE2\n"
+ ".LASFDE2:\n"
+ "\t.long .LASFDE2-.Lframe1\n"
"\t.long .Lbegin-.\n"
"\t.long %d\n"
"\t.uleb128 0\n" /* augmentation length */
@@ -3123,7 +3150,46 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
#endif
"\t.align " SZPTR "\n"
- ".LEFDE1:\n\n", (int)ctx->codesz, CFRAME_SIZE);
+ ".LEFDE2:\n\n", fcofs, CFRAME_SIZE);
+#if LJ_HASFFI
+ fprintf(ctx->fp,
+ ".Lframe2:\n"
+ "\t.long .LECIE2-.LSCIE2\n"
+ ".LSCIE2:\n"
+ "\t.long 0\n"
+ "\t.byte 0x1\n"
+ "\t.string \"zR\"\n"
+ "\t.uleb128 0x1\n"
+ "\t.sleb128 -" SZPTR "\n"
+ "\t.byte " REG_RA "\n"
+ "\t.uleb128 1\n" /* augmentation length */
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.uleb128 " REG_SP "\n\t.uleb128 " SZPTR "\n"
+ "\t.byte 0x80+" REG_RA "\n\t.uleb128 0x1\n"
+ "\t.align " SZPTR "\n"
+ ".LECIE2:\n\n");
+ fprintf(ctx->fp,
+ ".LSFDE3:\n"
+ "\t.long .LEFDE3-.LASFDE3\n"
+ ".LASFDE3:\n"
+ "\t.long .LASFDE3-.Lframe2\n"
+ "\t.long lj_vm_ffi_call-.\n"
+ "\t.long %d\n"
+ "\t.uleb128 0\n" /* augmentation length */
+#if LJ_64
+ "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
+ "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
+ "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
+#else
+ "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
+ "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
+ "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
+#endif
+ "\t.align " SZPTR "\n"
+ ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
+#endif
break;
case BUILD_coffasm:
fprintf(ctx->fp, "\t.section .eh_frame,\"dr\"\n");
@@ -3174,6 +3240,9 @@ static void emit_asm_debug(BuildCtx *ctx)
** Or a linker. Or a plastic case. But I digress.
*/
case BUILD_machasm: {
+#if LJ_HASFFI
+ int fcsize = 0;
+#endif
int i;
fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n");
fprintf(ctx->fp,
@@ -3205,6 +3274,9 @@ static void emit_asm_debug(BuildCtx *ctx)
const char *name = ctx->sym[i].name;
int32_t size = ctx->sym[i+1].ofs - ctx->sym[i].ofs;
if (size == 0) continue;
+#if LJ_HASFFI
+ if (!strcmp(name, "_lj_vm_ffi_call")) { fcsize = size; continue; }
+#endif
fprintf(ctx->fp,
"%s.eh:\n"
"LSFDE%d:\n"
@@ -3214,23 +3286,72 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.long LASFDE%d-EH_frame1\n"
"\t.long %s-.\n"
"\t.long %d\n"
- "\t.byte 0\n" /* augmentation length */
+ "\t.byte 0\n" /* augmentation length */
"\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */
#if LJ_64
- "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
- "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
- "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */
- "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */
+ "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
+ "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
+ "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */
+ "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */
#else
- "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
- "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */
- "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */
- "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */
+ "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
+ "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */
+ "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */
+ "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */
#endif
"\t.align " BSZPTR "\n"
"LEFDE%d:\n\n",
name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i);
}
+#if LJ_HASFFI
+ if (fcsize) {
+ fprintf(ctx->fp,
+ "EH_frame2:\n"
+ "\t.set L$set$y,LECIEY-LSCIEY\n"
+ "\t.long L$set$y\n"
+ "LSCIEY:\n"
+ "\t.long 0\n"
+ "\t.byte 0x1\n"
+ "\t.ascii \"zR\\0\"\n"
+ "\t.byte 0x1\n"
+ "\t.byte 128-" SZPTR "\n"
+ "\t.byte " REG_RA "\n"
+ "\t.byte 1\n" /* augmentation length */
+#if LJ_64
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.byte " REG_SP "\n\t.byte " SZPTR "\n"
+#else
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.byte 0x5\n\t.byte 0x4\n" /* esp=5 on 32 bit MACH. */
+#endif
+ "\t.byte 0x80+" REG_RA "\n\t.byte 0x1\n"
+ "\t.align " BSZPTR "\n"
+ "LECIEY:\n\n");
+ fprintf(ctx->fp,
+ "_lj_vm_ffi_call.eh:\n"
+ "LSFDEY:\n"
+ "\t.set L$set$yy,LEFDEY-LASFDEY\n"
+ "\t.long L$set$yy\n"
+ "LASFDEY:\n"
+ "\t.long LASFDEY-EH_frame2\n"
+ "\t.long _lj_vm_ffi_call-.\n"
+ "\t.long %d\n"
+ "\t.byte 0\n" /* augmentation length */
+#if LJ_64
+ "\t.byte 0xe\n\t.byte 16\n" /* def_cfa_offset */
+ "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
+ "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
+ "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
+#else
+ "\t.byte 0xe\n\t.byte 8\n" /* def_cfa_offset */
+ "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
+ "\t.byte 0xd\n\t.uleb128 0x4\n" /* def_cfa_register ebp */
+ "\t.byte 0x83\n\t.byte 0x3\n" /* offset ebx */
+#endif
+ "\t.align " BSZPTR "\n"
+ "LEFDEY:\n\n", fcsize);
+ }
+#endif
#if LJ_64
fprintf(ctx->fp, "\t.subsections_via_symbols\n");
#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 @@
#define DASM_SECTION_CODE_OP 0
#define DASM_SECTION_CODE_SUB 1
#define DASM_MAXSECTION 2
-static const unsigned char build_actionlist[16019] = {
+static const unsigned char build_actionlist[16020] = {
254,1,248,10,252,247,198,237,15,132,244,11,131,230,252,248,41,252,242,72,
141,76,49,252,248,139,114,252,252,199,68,10,4,237,248,12,131,192,1,137,68,
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] = {
252,233,218,209,221,217,195,255,221,225,223,224,252,246,196,1,15,132,244,
248,217,201,248,2,221,216,195,248,1,221,225,223,224,252,246,196,1,15,133,
244,248,217,201,248,2,221,216,195,255,248,163,137,200,86,72,137,214,83,15,
- 162,137,6,137,94,4,137,78,8,137,86,12,91,94,195,248,164,255,85,72,137,229,
- 83,72,137,203,139,131,233,72,41,196,255,15,182,139,233,131,252,233,1,15,136,
- 244,248,248,1,72,139,132,253,203,233,72,137,132,253,204,233,131,252,233,1,
- 15,137,244,1,248,2,15,182,131,233,72,139,139,233,72,139,147,233,76,139,131,
- 233,76,139,139,233,133,192,15,132,244,251,15,40,131,233,15,40,139,233,15,
- 40,147,233,15,40,155,233,248,5,255,252,255,147,233,72,137,131,233,15,41,131,
- 233,255,72,139,93,252,248,201,195,255,248,165,255,249,255,129,124,253,202,
- 4,239,15,133,244,253,129,124,253,194,4,239,15,133,244,254,139,44,202,131,
- 198,4,59,44,194,255,15,141,244,255,255,15,140,244,255,255,15,143,244,255,
- 255,15,142,244,255,255,248,6,15,183,70,252,254,141,180,253,134,233,248,9,
- 139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,252,235,248,7,
- 15,135,244,43,129,124,253,194,4,239,15,130,244,247,15,133,244,43,255,252,
+ 162,137,6,137,94,4,137,78,8,137,86,12,91,94,195,248,164,255,204,248,165,255,
+ 85,72,137,229,83,72,137,203,139,131,233,72,41,196,255,15,182,139,233,131,
+ 252,233,1,15,136,244,248,248,1,72,139,132,253,203,233,72,137,132,253,204,
+ 233,131,252,233,1,15,137,244,1,248,2,15,182,131,233,72,139,139,233,72,139,
+ 147,233,76,139,131,233,76,139,139,233,133,192,15,132,244,251,15,40,131,233,
+ 15,40,139,233,15,40,147,233,15,40,155,233,248,5,255,252,255,147,233,72,137,
+ 131,233,15,41,131,233,255,72,139,93,252,248,201,195,255,249,255,129,124,253,
+ 202,4,239,15,133,244,253,129,124,253,194,4,239,15,133,244,254,139,44,202,
+ 131,198,4,59,44,194,255,15,141,244,255,255,15,140,244,255,255,15,143,244,
+ 255,255,15,142,244,255,255,248,6,15,183,70,252,254,141,180,253,134,233,248,
+ 9,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,252,235,248,
+ 7,15,135,244,43,129,124,253,194,4,239,15,130,244,247,15,133,244,43,255,252,
242,15,42,4,194,252,233,244,248,255,221,4,202,219,4,194,252,233,244,249,255,
248,8,15,135,244,43,255,252,242,15,42,12,202,252,242,15,16,4,194,131,198,
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] = {
252,237,129,229,239,102,129,172,253,43,233,238,15,130,244,148,255,141,12,
202,255,129,121,253,4,239,15,133,244,255,255,129,121,253,12,239,15,133,244,
60,129,121,253,20,239,15,133,244,60,139,41,131,121,16,0,15,140,244,251,255,
- 129,121,253,12,239,15,133,244,165,129,121,253,20,239,15,133,244,165,255,139,
+ 129,121,253,12,239,15,133,244,164,129,121,253,20,239,15,133,244,164,255,139,
105,16,133,252,237,15,136,244,251,3,41,15,128,244,247,137,41,255,59,105,8,
199,65,28,237,137,105,24,255,15,142,244,253,248,1,248,6,141,180,253,134,233,
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] = {
41,255,15,141,244,7,255,141,180,253,134,233,15,183,70,252,254,15,141,245,
255,15,140,244,7,255,252,233,244,6,248,9,255,129,121,253,4,239,255,15,131,
244,60,129,121,253,12,239,15,131,244,60,255,129,121,253,12,239,15,131,244,
- 165,129,121,253,20,239,15,131,244,165,255,139,105,20,255,129,252,253,239,
+ 164,129,121,253,20,239,15,131,244,164,255,139,105,20,255,129,252,253,239,
15,131,244,60,255,252,242,15,16,1,252,242,15,16,73,8,255,252,242,15,88,65,
16,252,242,15,17,1,133,252,237,15,136,244,249,255,15,140,244,249,255,102,
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 {
GLOB_vm_foldfpm,
GLOB_vm_foldarith,
GLOB_vm_cpuid,
- GLOB_vm_ffi_call,
GLOB_assert_bad_for_arg_type,
+ GLOB_vm_ffi_call,
GLOB_BC_MODVN_Z,
GLOB_BC_TGETS_Z,
GLOB_BC_TSETS_Z,
@@ -1109,8 +1109,8 @@ static const char *const globnames[] = {
"vm_foldfpm",
"vm_foldarith",
"vm_cpuid",
- "vm_ffi_call@4",
"assert_bad_for_arg_type",
+ "vm_ffi_call@4",
"BC_MODVN_Z",
"BC_TGETS_Z",
"BC_TSETS_Z",
@@ -1832,29 +1832,28 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
dasm_put(Dst, 9398);
}
dasm_put(Dst, 9816);
-#if LJ_HASFFI
-#define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
- dasm_put(Dst, 9844, DtE(->spadj));
-#if LJ_TARGET_WINDOWS
-#endif
- 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]));
- dasm_put(Dst, 9940, DtE(->func), DtE(->gpr[0]), DtE(->fpr[0]));
-#if LJ_TARGET_WINDOWS
-#endif
- dasm_put(Dst, 9953);
-#endif
- dasm_put(Dst, 9961);
#ifdef LUA_USE_ASSERT
dasm_put(Dst, 9400);
#endif
- dasm_put(Dst, 9400);
+ dasm_put(Dst, 9844);
+#if LJ_HASFFI
+#define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
+ dasm_put(Dst, 9848, DtE(->spadj));
+#if LJ_TARGET_WINDOWS
+#endif
+ 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]));
+ dasm_put(Dst, 9944, DtE(->func), DtE(->gpr[0]), DtE(->fpr[0]));
+#if LJ_TARGET_WINDOWS
+#endif
+ dasm_put(Dst, 9957);
+#endif
}
/* Generate the code for a single instruction. */
static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
{
int vk = 0;
- dasm_put(Dst, 9964, defop);
+ dasm_put(Dst, 9965, defop);
switch (op) {
@@ -1865,145 +1864,145 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT:
if (LJ_DUALNUM) {
- dasm_put(Dst, 9966, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 9967, LJ_TISNUM, LJ_TISNUM);
switch (op) {
case BC_ISLT:
- dasm_put(Dst, 9996);
+ dasm_put(Dst, 9997);
break;
case BC_ISGE:
- dasm_put(Dst, 10001);
+ dasm_put(Dst, 10002);
break;
case BC_ISLE:
- dasm_put(Dst, 10006);
+ dasm_put(Dst, 10007);
break;
case BC_ISGT:
- dasm_put(Dst, 10011);
+ dasm_put(Dst, 10012);
break;
default: break; /* Shut up GCC. */
}
- dasm_put(Dst, 10016, -BCBIAS_J*4, LJ_TISNUM);
+ dasm_put(Dst, 10017, -BCBIAS_J*4, LJ_TISNUM);
if (sse) {
- dasm_put(Dst, 10070);
+ dasm_put(Dst, 10071);
} else {
- dasm_put(Dst, 10081);
+ dasm_put(Dst, 10082);
}
- dasm_put(Dst, 10092);
+ dasm_put(Dst, 10093);
if (sse) {
- dasm_put(Dst, 10099);
+ dasm_put(Dst, 10100);
switch (op) {
case BC_ISLT:
- dasm_put(Dst, 10119);
+ dasm_put(Dst, 10120);
break;
case BC_ISGE:
- dasm_put(Dst, 10124);
+ dasm_put(Dst, 10125);
break;
case BC_ISLE:
- dasm_put(Dst, 10129);
+ dasm_put(Dst, 10130);
break;
case BC_ISGT:
- dasm_put(Dst, 10134);
+ dasm_put(Dst, 10135);
break;
default: break; /* Shut up GCC. */
}
- dasm_put(Dst, 10139);
+ dasm_put(Dst, 10140);
} else {
- dasm_put(Dst, 10144);
+ dasm_put(Dst, 10145);
}
} else {
- dasm_put(Dst, 10152, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 10153, LJ_TISNUM, LJ_TISNUM);
}
if (sse) {
- dasm_put(Dst, 10173);
+ dasm_put(Dst, 10174);
} else {
- dasm_put(Dst, 10194);
+ dasm_put(Dst, 10195);
if (cmov) {
- dasm_put(Dst, 10210);
+ dasm_put(Dst, 10211);
} else {
- dasm_put(Dst, 10216);
+ dasm_put(Dst, 10217);
}
}
if (LJ_DUALNUM) {
switch (op) {
case BC_ISLT:
- dasm_put(Dst, 10119);
+ dasm_put(Dst, 10120);
break;
case BC_ISGE:
- dasm_put(Dst, 10124);
+ dasm_put(Dst, 10125);
break;
case BC_ISLE:
- dasm_put(Dst, 10129);
+ dasm_put(Dst, 10130);
break;
case BC_ISGT:
- dasm_put(Dst, 10134);
+ dasm_put(Dst, 10135);
break;
default: break; /* Shut up GCC. */
}
- dasm_put(Dst, 10139);
+ dasm_put(Dst, 10140);
} else {
switch (op) {
case BC_ISLT:
- dasm_put(Dst, 10223);
+ dasm_put(Dst, 10224);
break;
case BC_ISGE:
- dasm_put(Dst, 10228);
+ dasm_put(Dst, 10229);
break;
case BC_ISLE:
- dasm_put(Dst, 10233);
+ dasm_put(Dst, 10234);
break;
case BC_ISGT:
- dasm_put(Dst, 10238);
+ dasm_put(Dst, 10239);
break;
default: break; /* Shut up GCC. */
}
- dasm_put(Dst, 10243, -BCBIAS_J*4);
+ dasm_put(Dst, 10244, -BCBIAS_J*4);
}
break;
case BC_ISEQV: case BC_ISNEV:
vk = op == BC_ISEQV;
- dasm_put(Dst, 10275);
+ dasm_put(Dst, 10276);
if (LJ_DUALNUM) {
- dasm_put(Dst, 10283, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 10284, LJ_TISNUM, LJ_TISNUM);
if (vk) {
- dasm_put(Dst, 10308);
+ dasm_put(Dst, 10309);
} else {
- dasm_put(Dst, 10313);
+ dasm_put(Dst, 10314);
}
- dasm_put(Dst, 10318, -BCBIAS_J*4, LJ_TISNUM);
+ dasm_put(Dst, 10319, -BCBIAS_J*4, LJ_TISNUM);
if (sse) {
- dasm_put(Dst, 10370);
+ dasm_put(Dst, 10371);
} else {
- dasm_put(Dst, 10377);
+ dasm_put(Dst, 10378);
}
- dasm_put(Dst, 10381);
+ dasm_put(Dst, 10382);
if (sse) {
- dasm_put(Dst, 10392);
+ dasm_put(Dst, 10393);
} else {
- dasm_put(Dst, 10404);
+ dasm_put(Dst, 10405);
}
- dasm_put(Dst, 10411);
+ dasm_put(Dst, 10412);
} else {
- dasm_put(Dst, 10416, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 10417, LJ_TISNUM, LJ_TISNUM);
}
if (sse) {
- dasm_put(Dst, 10435);
+ dasm_put(Dst, 10436);
} else {
- dasm_put(Dst, 10453);
+ dasm_put(Dst, 10454);
if (cmov) {
- dasm_put(Dst, 10210);
+ dasm_put(Dst, 10211);
} else {
- dasm_put(Dst, 10216);
+ dasm_put(Dst, 10217);
}
}
iseqne_fp:
if (vk) {
- dasm_put(Dst, 10466);
+ dasm_put(Dst, 10467);
} else {
- dasm_put(Dst, 10475);
+ dasm_put(Dst, 10476);
}
iseqne_end:
if (vk) {
- dasm_put(Dst, 10484, -BCBIAS_J*4);
+ dasm_put(Dst, 10485, -BCBIAS_J*4);
if (!LJ_HASFFI) {
dasm_put(Dst, 4629);
}
@@ -2011,156 +2010,156 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
if (!LJ_HASFFI) {
dasm_put(Dst, 4629);
}
- dasm_put(Dst, 10499, -BCBIAS_J*4);
+ dasm_put(Dst, 10500, -BCBIAS_J*4);
}
if (LJ_DUALNUM && (op == BC_ISEQV || op == BC_ISNEV ||
op == BC_ISEQN || op == BC_ISNEN)) {
- dasm_put(Dst, 10514);
+ dasm_put(Dst, 10515);
} else {
- dasm_put(Dst, 10255);
+ dasm_put(Dst, 10256);
}
if (op == BC_ISEQV || op == BC_ISNEV) {
- dasm_put(Dst, 9937);
+ dasm_put(Dst, 9941);
if (LJ_HASFFI) {
- dasm_put(Dst, 10519, LJ_TCDATA, LJ_TCDATA);
+ dasm_put(Dst, 10520, LJ_TCDATA, LJ_TCDATA);
}
- dasm_put(Dst, 10538, LJ_TISPRI, LJ_TISTABUD, LJ_TUDATA, Dt6(->metatable), Dt6(->nomm), 1<metatable), Dt6(->nomm), 1<>32));
+ dasm_put(Dst, 11102, (unsigned int)(U64x(80000000,00000000)), (unsigned int)((U64x(80000000,00000000))>>32));
} else {
- dasm_put(Dst, 11126);
+ dasm_put(Dst, 11127);
}
if (LJ_DUALNUM) {
- dasm_put(Dst, 10514);
+ dasm_put(Dst, 10515);
} else {
- dasm_put(Dst, 10255);
+ dasm_put(Dst, 10256);
}
break;
case BC_LEN:
- dasm_put(Dst, 11135, LJ_TSTR);
+ dasm_put(Dst, 11136, LJ_TSTR);
if (LJ_DUALNUM) {
- dasm_put(Dst, 11149, Dt5(->len), LJ_TISNUM);
+ dasm_put(Dst, 11150, Dt5(->len), LJ_TISNUM);
} else if (sse) {
- dasm_put(Dst, 11163, Dt5(->len));
+ dasm_put(Dst, 11164, Dt5(->len));
} else {
- dasm_put(Dst, 11181, Dt5(->len));
+ dasm_put(Dst, 11182, Dt5(->len));
}
- dasm_put(Dst, 11190, LJ_TTAB);
+ dasm_put(Dst, 11191, LJ_TTAB);
#ifdef LUAJIT_ENABLE_LUA52COMPAT
- dasm_put(Dst, 11225, Dt6(->metatable));
+ dasm_put(Dst, 11226, Dt6(->metatable));
#endif
- dasm_put(Dst, 11239);
+ dasm_put(Dst, 11240);
if (LJ_DUALNUM) {
} else if (sse) {
- dasm_put(Dst, 11248);
+ dasm_put(Dst, 11249);
} else {
}
- dasm_put(Dst, 11254);
+ dasm_put(Dst, 11255);
#ifdef LUAJIT_ENABLE_LUA52COMPAT
- dasm_put(Dst, 11267, Dt6(->nomm), 1<nomm), 1<base), Dt1(->base));
+ dasm_put(Dst, 12011, Dt1(->base), Dt1(->base));
break;
/* -- Constant ops ------------------------------------------------------ */
case BC_KSTR:
- dasm_put(Dst, 12093, LJ_TSTR);
+ dasm_put(Dst, 12094, LJ_TSTR);
break;
case BC_KCDATA:
#if LJ_HASFFI
- dasm_put(Dst, 12093, LJ_TCDATA);
+ dasm_put(Dst, 12094, LJ_TCDATA);
#endif
break;
case BC_KSHORT:
if (LJ_DUALNUM) {
- dasm_put(Dst, 12128, LJ_TISNUM);
+ dasm_put(Dst, 12129, LJ_TISNUM);
} else if (sse) {
- dasm_put(Dst, 12140);
+ dasm_put(Dst, 12141);
} else {
- dasm_put(Dst, 12155);
+ dasm_put(Dst, 12156);
}
- dasm_put(Dst, 10255);
+ dasm_put(Dst, 10256);
break;
case BC_KNUM:
if (sse) {
- dasm_put(Dst, 12163);
+ dasm_put(Dst, 12164);
} else {
- dasm_put(Dst, 12176);
+ dasm_put(Dst, 12177);
}
- dasm_put(Dst, 10255);
+ dasm_put(Dst, 10256);
break;
case BC_KPRI:
- dasm_put(Dst, 12183);
+ dasm_put(Dst, 12184);
break;
case BC_KNIL:
- dasm_put(Dst, 12211, LJ_TNIL);
+ dasm_put(Dst, 12212, LJ_TNIL);
break;
/* -- Upvalue and function ops ------------------------------------------ */
case BC_UGET:
- dasm_put(Dst, 12258, offsetof(GCfuncL, uvptr), DtA(->v));
+ dasm_put(Dst, 12259, offsetof(GCfuncL, uvptr), DtA(->v));
break;
case BC_USETV:
#define TV2MARKOFS \
((int32_t)offsetof(GCupval, marked)-(int32_t)offsetof(GCupval, tv))
- 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);
- dasm_put(Dst, 12389);
+ 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);
+ dasm_put(Dst, 12390);
break;
#undef TV2MARKOFS
case BC_USETS:
- 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);
+ 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);
break;
case BC_USETN:
- dasm_put(Dst, 12494);
+ dasm_put(Dst, 12495);
if (sse) {
- dasm_put(Dst, 12499);
+ dasm_put(Dst, 12500);
} else {
- dasm_put(Dst, 10774);
+ dasm_put(Dst, 10775);
}
- dasm_put(Dst, 12506, offsetof(GCfuncL, uvptr), DtA(->v));
+ dasm_put(Dst, 12507, offsetof(GCfuncL, uvptr), DtA(->v));
if (sse) {
- dasm_put(Dst, 12515);
+ dasm_put(Dst, 12516);
} else {
- dasm_put(Dst, 12521);
+ dasm_put(Dst, 12522);
}
- dasm_put(Dst, 10255);
+ dasm_put(Dst, 10256);
break;
case BC_USETP:
- dasm_put(Dst, 12524, offsetof(GCfuncL, uvptr), DtA(->v));
+ dasm_put(Dst, 12525, offsetof(GCfuncL, uvptr), DtA(->v));
break;
case BC_UCLO:
- dasm_put(Dst, 12563, -BCBIAS_J*4, Dt1(->openupval), Dt1(->base), Dt1(->base));
+ dasm_put(Dst, 12564, -BCBIAS_J*4, Dt1(->openupval), Dt1(->base), Dt1(->base));
break;
case BC_FNEW:
- dasm_put(Dst, 12618, Dt1(->base), Dt1(->base), LJ_TFUNC);
+ dasm_put(Dst, 12619, Dt1(->base), Dt1(->base), LJ_TFUNC);
break;
/* -- Table ops --------------------------------------------------------- */
case BC_TNEW:
- dasm_put(Dst, 12684, Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), LJ_TTAB);
+ dasm_put(Dst, 12685, Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), LJ_TTAB);
break;
case BC_TDUP:
- dasm_put(Dst, 12806, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB);
+ dasm_put(Dst, 12807, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB);
break;
case BC_GGET:
- dasm_put(Dst, 12901, Dt7(->env));
+ dasm_put(Dst, 12902, Dt7(->env));
break;
case BC_GSET:
- dasm_put(Dst, 12920, Dt7(->env));
+ dasm_put(Dst, 12921, Dt7(->env));
break;
case BC_TGETV:
- dasm_put(Dst, 12939, LJ_TTAB);
+ dasm_put(Dst, 12940, LJ_TTAB);
if (LJ_DUALNUM) {
- dasm_put(Dst, 12962, LJ_TISNUM);
+ dasm_put(Dst, 12963, LJ_TISNUM);
} else {
- dasm_put(Dst, 12976, LJ_TISNUM);
+ dasm_put(Dst, 12977, LJ_TISNUM);
if (sse) {
- dasm_put(Dst, 12987);
+ dasm_put(Dst, 12988);
} else {
}
- dasm_put(Dst, 13008);
+ dasm_put(Dst, 13009);
}
- dasm_put(Dst, 13013, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL);
- dasm_put(Dst, 13206, LJ_TNIL, DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL);
+ dasm_put(Dst, 13207, LJ_TNIL, DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
+ dasm_put(Dst, 13418, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
break;
case BC_TSETS:
- 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);
- dasm_put(Dst, 13630, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<next));
- dasm_put(Dst, 13718, Dt6(->metatable), Dt6(->nomm), 1<base), Dt1(->base), Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
+ 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);
+ dasm_put(Dst, 13631, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<next));
+ dasm_put(Dst, 13719, Dt6(->metatable), Dt6(->nomm), 1<base), Dt1(->base), Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
break;
case BC_TSETB:
- dasm_put(Dst, 13809, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable));
- dasm_put(Dst, 13903, Dt6(->metatable), Dt6(->nomm), 1<marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
+ dasm_put(Dst, 13810, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable));
+ dasm_put(Dst, 13904, Dt6(->metatable), Dt6(->nomm), 1<marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
break;
case BC_TSETM:
- dasm_put(Dst, 13949, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
- dasm_put(Dst, 14092, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
+ dasm_put(Dst, 13950, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
+ dasm_put(Dst, 14093, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
break;
/* -- Calls and vararg handling ----------------------------------------- */
case BC_CALL: case BC_CALLM:
- dasm_put(Dst, 11287);
+ dasm_put(Dst, 11288);
if (op == BC_CALLM) {
- dasm_put(Dst, 14110);
+ dasm_put(Dst, 14111);
}
- dasm_put(Dst, 14115, LJ_TFUNC, Dt7(->pc));
+ dasm_put(Dst, 14116, LJ_TFUNC, Dt7(->pc));
break;
case BC_CALLMT:
- dasm_put(Dst, 14110);
+ dasm_put(Dst, 14111);
break;
case BC_CALLT:
- dasm_put(Dst, 14157, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc));
- dasm_put(Dst, 14272, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG);
+ dasm_put(Dst, 14158, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc));
+ dasm_put(Dst, 14273, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG);
break;
case BC_ITERC:
- dasm_put(Dst, 14343, LJ_TFUNC, 2+1, Dt7(->pc));
+ dasm_put(Dst, 14344, LJ_TFUNC, 2+1, Dt7(->pc));
break;
case BC_ITERN:
#if LJ_HASJIT
#endif
- dasm_put(Dst, 14414, Dt6(->asize), Dt6(->array), LJ_TNIL);
+ dasm_put(Dst, 14415, Dt6(->asize), Dt6(->array), LJ_TNIL);
if (LJ_DUALNUM) {
- dasm_put(Dst, 11154, LJ_TISNUM);
+ dasm_put(Dst, 11155, LJ_TISNUM);
} else if (sse) {
- dasm_put(Dst, 11248);
+ dasm_put(Dst, 11249);
} else {
- dasm_put(Dst, 14460);
+ dasm_put(Dst, 14461);
}
- dasm_put(Dst, 14466);
+ dasm_put(Dst, 14467);
if (LJ_DUALNUM) {
} else if (sse) {
- dasm_put(Dst, 11119);
+ dasm_put(Dst, 11120);
} else {
- dasm_put(Dst, 11131);
+ dasm_put(Dst, 11132);
}
- dasm_put(Dst, 14479, -BCBIAS_J*4);
+ dasm_put(Dst, 14480, -BCBIAS_J*4);
if (!LJ_DUALNUM && !sse) {
- dasm_put(Dst, 14531);
+ dasm_put(Dst, 14532);
}
- dasm_put(Dst, 14537, Dt6(->hmask), sizeof(Node), Dt6(->node), DtB(->val.it), LJ_TNIL, DtB(->key), DtB(->val));
+ dasm_put(Dst, 14538, Dt6(->hmask), sizeof(Node), Dt6(->node), DtB(->val.it), LJ_TNIL, DtB(->key), DtB(->val));
break;
case BC_ISNEXT:
- 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);
+ 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);
break;
case BC_VARG:
- dasm_put(Dst, 14709, (8+FRAME_VARG), LJ_TNIL, Dt1(->maxstack));
- dasm_put(Dst, 14869, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
+ dasm_put(Dst, 14710, (8+FRAME_VARG), LJ_TNIL, Dt1(->maxstack));
+ dasm_put(Dst, 14870, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
break;
/* -- Returns ----------------------------------------------------------- */
case BC_RETM:
- dasm_put(Dst, 14110);
+ dasm_put(Dst, 14111);
break;
case BC_RET: case BC_RET0: case BC_RET1:
if (op != BC_RET0) {
- dasm_put(Dst, 14935);
+ dasm_put(Dst, 14936);
}
- dasm_put(Dst, 14939, FRAME_TYPE);
+ dasm_put(Dst, 14940, FRAME_TYPE);
switch (op) {
case BC_RET:
- dasm_put(Dst, 14958);
+ dasm_put(Dst, 14959);
break;
case BC_RET1:
- dasm_put(Dst, 15010);
+ dasm_put(Dst, 15011);
/* fallthrough */
case BC_RET0:
- dasm_put(Dst, 15020);
+ dasm_put(Dst, 15021);
default:
break;
}
- dasm_put(Dst, 15031, Dt7(->pc), PC2PROTO(k));
+ dasm_put(Dst, 15032, Dt7(->pc), PC2PROTO(k));
if (op == BC_RET) {
- dasm_put(Dst, 15075, LJ_TNIL);
+ dasm_put(Dst, 15076, LJ_TNIL);
} else {
- dasm_put(Dst, 15084, LJ_TNIL);
+ dasm_put(Dst, 15085, LJ_TNIL);
}
- dasm_put(Dst, 15091, -FRAME_VARG, FRAME_TYPEP);
+ dasm_put(Dst, 15092, -FRAME_VARG, FRAME_TYPEP);
if (op != BC_RET0) {
- dasm_put(Dst, 15115);
+ dasm_put(Dst, 15116);
}
dasm_put(Dst, 4708);
break;
@@ -2775,7 +2774,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_FORL:
#if LJ_HASJIT
- dasm_put(Dst, 15119, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
+ dasm_put(Dst, 15120, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
#endif
break;
@@ -2787,111 +2786,111 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_FORI:
case BC_IFORL:
vk = (op == BC_IFORL || op == BC_JFORL);
- dasm_put(Dst, 15140);
+ dasm_put(Dst, 15141);
if (LJ_DUALNUM) {
- dasm_put(Dst, 15144, LJ_TISNUM);
+ dasm_put(Dst, 15145, LJ_TISNUM);
if (!vk) {
- dasm_put(Dst, 15154, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 15155, LJ_TISNUM, LJ_TISNUM);
} else {
#ifdef LUA_USE_ASSERT
- dasm_put(Dst, 15183, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 15184, LJ_TISNUM, LJ_TISNUM);
#endif
- dasm_put(Dst, 15202);
+ dasm_put(Dst, 15203);
}
- dasm_put(Dst, 15221, LJ_TISNUM);
+ dasm_put(Dst, 15222, LJ_TISNUM);
if (op == BC_FORI) {
- dasm_put(Dst, 15232, -BCBIAS_J*4);
+ dasm_put(Dst, 15233, -BCBIAS_J*4);
} else if (op == BC_JFORI) {
- dasm_put(Dst, 15246, -BCBIAS_J*4, BC_JLOOP);
+ dasm_put(Dst, 15247, -BCBIAS_J*4, BC_JLOOP);
} else if (op == BC_IFORL) {
- dasm_put(Dst, 15264, -BCBIAS_J*4);
+ dasm_put(Dst, 15265, -BCBIAS_J*4);
} else {
- dasm_put(Dst, 15256, BC_JLOOP);
+ dasm_put(Dst, 15257, BC_JLOOP);
}
- dasm_put(Dst, 15278);
+ dasm_put(Dst, 15279);
if (vk) {
- dasm_put(Dst, 15302);
+ dasm_put(Dst, 15303);
}
- dasm_put(Dst, 15221, LJ_TISNUM);
+ dasm_put(Dst, 15222, LJ_TISNUM);
if (op == BC_FORI) {
- dasm_put(Dst, 15311);
+ dasm_put(Dst, 15312);
} else if (op == BC_JFORI) {
- dasm_put(Dst, 15316, -BCBIAS_J*4, BC_JLOOP);
+ dasm_put(Dst, 15317, -BCBIAS_J*4, BC_JLOOP);
} else if (op == BC_IFORL) {
- dasm_put(Dst, 15330);
+ dasm_put(Dst, 15331);
} else {
- dasm_put(Dst, 15326, BC_JLOOP);
+ dasm_put(Dst, 15327, BC_JLOOP);
}
- dasm_put(Dst, 15335);
+ dasm_put(Dst, 15336);
} else if (!vk) {
- dasm_put(Dst, 15342, LJ_TISNUM);
+ dasm_put(Dst, 15343, LJ_TISNUM);
}
if (!vk) {
- dasm_put(Dst, 15348, LJ_TISNUM);
+ dasm_put(Dst, 15349, LJ_TISNUM);
} else {
#ifdef LUA_USE_ASSERT
- dasm_put(Dst, 15362, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 15363, LJ_TISNUM, LJ_TISNUM);
#endif
}
- dasm_put(Dst, 15381);
+ dasm_put(Dst, 15382);
if (!vk) {
- dasm_put(Dst, 15385, LJ_TISNUM);
+ dasm_put(Dst, 15386, LJ_TISNUM);
}
if (sse) {
- dasm_put(Dst, 15394);
+ dasm_put(Dst, 15395);
if (vk) {
- dasm_put(Dst, 15406);
+ dasm_put(Dst, 15407);
} else {
- dasm_put(Dst, 15425);
+ dasm_put(Dst, 15426);
}
- dasm_put(Dst, 15430);
+ dasm_put(Dst, 15431);
} else {
- dasm_put(Dst, 15443);
+ dasm_put(Dst, 15444);
if (vk) {
- dasm_put(Dst, 15449);
+ dasm_put(Dst, 15450);
} else {
- dasm_put(Dst, 15465);
+ dasm_put(Dst, 15466);
}
- dasm_put(Dst, 15473);
+ dasm_put(Dst, 15474);
if (cmov) {
- dasm_put(Dst, 10210);
+ dasm_put(Dst, 10211);
} else {
- dasm_put(Dst, 10216);
+ dasm_put(Dst, 10217);
}
if (!cmov) {
- dasm_put(Dst, 15478);
+ dasm_put(Dst, 15479);
}
}
if (op == BC_FORI) {
if (LJ_DUALNUM) {
- dasm_put(Dst, 15484);
+ dasm_put(Dst, 15485);
} else {
- dasm_put(Dst, 15489, -BCBIAS_J*4);
+ dasm_put(Dst, 15490, -BCBIAS_J*4);
}
} else if (op == BC_JFORI) {
- dasm_put(Dst, 15499, -BCBIAS_J*4, BC_JLOOP);
+ dasm_put(Dst, 15500, -BCBIAS_J*4, BC_JLOOP);
} else if (op == BC_IFORL) {
if (LJ_DUALNUM) {
- dasm_put(Dst, 15513);
+ dasm_put(Dst, 15514);
} else {
- dasm_put(Dst, 15518, -BCBIAS_J*4);
+ dasm_put(Dst, 15519, -BCBIAS_J*4);
}
} else {
- dasm_put(Dst, 15509, BC_JLOOP);
+ dasm_put(Dst, 15510, BC_JLOOP);
}
if (LJ_DUALNUM) {
- dasm_put(Dst, 10139);
+ dasm_put(Dst, 10140);
} else {
- dasm_put(Dst, 10904);
+ dasm_put(Dst, 10905);
}
if (sse) {
- dasm_put(Dst, 15528);
+ dasm_put(Dst, 15529);
}
break;
case BC_ITERL:
#if LJ_HASJIT
- dasm_put(Dst, 15119, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
+ dasm_put(Dst, 15120, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
#endif
break;
@@ -2900,33 +2899,33 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break;
#endif
case BC_IITERL:
- dasm_put(Dst, 15539, LJ_TNIL);
+ dasm_put(Dst, 15540, LJ_TNIL);
if (op == BC_JITERL) {
- dasm_put(Dst, 15554, BC_JLOOP);
+ dasm_put(Dst, 15555, BC_JLOOP);
} else {
- dasm_put(Dst, 15568, -BCBIAS_J*4);
+ dasm_put(Dst, 15569, -BCBIAS_J*4);
}
- dasm_put(Dst, 10253);
+ dasm_put(Dst, 10254);
break;
case BC_LOOP:
#if LJ_HASJIT
- dasm_put(Dst, 15119, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
+ dasm_put(Dst, 15120, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
#endif
break;
case BC_ILOOP:
- dasm_put(Dst, 10255);
+ dasm_put(Dst, 10256);
break;
case BC_JLOOP:
#if LJ_HASJIT
- 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);
+ 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);
#endif
break;
case BC_JMP:
- dasm_put(Dst, 15693, -BCBIAS_J*4);
+ dasm_put(Dst, 15694, -BCBIAS_J*4);
break;
/* -- Function headers -------------------------------------------------- */
@@ -2940,7 +2939,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_FUNCF:
#if LJ_HASJIT
- dasm_put(Dst, 15718, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_CALL);
+ dasm_put(Dst, 15719, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_CALL);
#endif
case BC_FUNCV: /* NYI: compiled vararg functions. */
break;
@@ -2950,13 +2949,13 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break;
#endif
case BC_IFUNCF:
- dasm_put(Dst, 15739, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams));
+ dasm_put(Dst, 15740, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams));
if (op == BC_JFUNCF) {
- dasm_put(Dst, 15769, BC_JLOOP);
+ dasm_put(Dst, 15770, BC_JLOOP);
} else {
- dasm_put(Dst, 10255);
+ dasm_put(Dst, 10256);
}
- dasm_put(Dst, 15778, LJ_TNIL);
+ dasm_put(Dst, 15779, LJ_TNIL);
break;
case BC_JFUNCV:
@@ -2967,30 +2966,30 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; /* NYI: compiled vararg functions. */
case BC_IFUNCV:
- dasm_put(Dst, 15800, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL);
+ dasm_put(Dst, 15801, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL);
if (op == BC_JFUNCV) {
- dasm_put(Dst, 15769, BC_JLOOP);
+ dasm_put(Dst, 15770, BC_JLOOP);
} else {
- dasm_put(Dst, 15891, -4+PC2PROTO(k));
+ dasm_put(Dst, 15892, -4+PC2PROTO(k));
}
- dasm_put(Dst, 15914, LJ_TNIL);
+ dasm_put(Dst, 15915, LJ_TNIL);
break;
case BC_FUNCC:
case BC_FUNCCW:
- dasm_put(Dst, 15936, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top));
+ dasm_put(Dst, 15937, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top));
if (op == BC_FUNCC) {
dasm_put(Dst, 2372);
} else {
- dasm_put(Dst, 15966);
+ dasm_put(Dst, 15967);
}
- dasm_put(Dst, 15974, DISPATCH_GL(vmstate), ~LJ_VMST_C);
+ dasm_put(Dst, 15975, DISPATCH_GL(vmstate), ~LJ_VMST_C);
if (op == BC_FUNCC) {
- dasm_put(Dst, 15983);
+ dasm_put(Dst, 15984);
} else {
- dasm_put(Dst, 15987, DISPATCH_GL(wrapf));
+ dasm_put(Dst, 15988, DISPATCH_GL(wrapf));
}
- dasm_put(Dst, 15992, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top));
+ dasm_put(Dst, 15993, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top));
break;
/* ---------------------------------------------------------------------- */
@@ -3018,7 +3017,7 @@ static int build_backend(BuildCtx *ctx)
build_subroutines(ctx, cmov, sse);
- dasm_put(Dst, 16017);
+ dasm_put(Dst, 16018);
for (op = 0; op < BC__MAX; op++)
build_ins(ctx, (BCOp)op, op, cmov, sse);
@@ -3028,6 +3027,7 @@ static int build_backend(BuildCtx *ctx)
/* Emit pseudo frame-info for all assembler functions. */
static void emit_asm_debug(BuildCtx *ctx)
{
+ int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
#if LJ_64
#define SZPTR "8"
#define BSZPTR "3"
@@ -3061,22 +3061,49 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.long .LEFDE0-.LASFDE0\n"
".LASFDE0:\n"
"\t.long .Lframe0\n"
- "\t.long .Lbegin\n"
- "\t.long %d\n"
- "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
#if LJ_64
+ "\t.quad .Lbegin\n"
+ "\t.quad %d\n"
+ "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
"\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
"\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
"\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
"\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
#else
+ "\t.long .Lbegin\n"
+ "\t.long %d\n"
+ "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
"\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
"\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */
"\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */
"\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
#endif
"\t.align " SZPTR "\n"
- ".LEFDE0:\n\n", (int)ctx->codesz, CFRAME_SIZE);
+ ".LEFDE0:\n\n", fcofs, CFRAME_SIZE);
+#if LJ_HASFFI
+ fprintf(ctx->fp,
+ ".LSFDE1:\n"
+ "\t.long .LEFDE1-.LASFDE1\n"
+ ".LASFDE1:\n"
+ "\t.long .Lframe0\n"
+#if LJ_64
+ "\t.quad lj_vm_ffi_call\n"
+ "\t.quad %d\n"
+ "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
+ "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
+ "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
+#else
+ "\t.long lj_vm_ffi_call\n"
+ "\t.long %d\n"
+ "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
+ "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
+ "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
+#endif
+ "\t.align " SZPTR "\n"
+ ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
+#endif
#if (defined(__sun__) && defined(__svr4__)) || defined(__solaris_)
fprintf(ctx->fp, "\t.section .eh_frame,\"aw\",@progbits\n");
#else
@@ -3101,10 +3128,10 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.align " SZPTR "\n"
".LECIE1:\n\n");
fprintf(ctx->fp,
- ".LSFDE1:\n"
- "\t.long .LEFDE1-.LASFDE1\n"
- ".LASFDE1:\n"
- "\t.long .LASFDE1-.Lframe1\n"
+ ".LSFDE2:\n"
+ "\t.long .LEFDE2-.LASFDE2\n"
+ ".LASFDE2:\n"
+ "\t.long .LASFDE2-.Lframe1\n"
"\t.long .Lbegin-.\n"
"\t.long %d\n"
"\t.uleb128 0\n" /* augmentation length */
@@ -3121,7 +3148,46 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
#endif
"\t.align " SZPTR "\n"
- ".LEFDE1:\n\n", (int)ctx->codesz, CFRAME_SIZE);
+ ".LEFDE2:\n\n", fcofs, CFRAME_SIZE);
+#if LJ_HASFFI
+ fprintf(ctx->fp,
+ ".Lframe2:\n"
+ "\t.long .LECIE2-.LSCIE2\n"
+ ".LSCIE2:\n"
+ "\t.long 0\n"
+ "\t.byte 0x1\n"
+ "\t.string \"zR\"\n"
+ "\t.uleb128 0x1\n"
+ "\t.sleb128 -" SZPTR "\n"
+ "\t.byte " REG_RA "\n"
+ "\t.uleb128 1\n" /* augmentation length */
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.uleb128 " REG_SP "\n\t.uleb128 " SZPTR "\n"
+ "\t.byte 0x80+" REG_RA "\n\t.uleb128 0x1\n"
+ "\t.align " SZPTR "\n"
+ ".LECIE2:\n\n");
+ fprintf(ctx->fp,
+ ".LSFDE3:\n"
+ "\t.long .LEFDE3-.LASFDE3\n"
+ ".LASFDE3:\n"
+ "\t.long .LASFDE3-.Lframe2\n"
+ "\t.long lj_vm_ffi_call-.\n"
+ "\t.long %d\n"
+ "\t.uleb128 0\n" /* augmentation length */
+#if LJ_64
+ "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
+ "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
+ "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
+#else
+ "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
+ "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
+ "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
+#endif
+ "\t.align " SZPTR "\n"
+ ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
+#endif
break;
case BUILD_coffasm:
fprintf(ctx->fp, "\t.section .eh_frame,\"dr\"\n");
@@ -3172,6 +3238,9 @@ static void emit_asm_debug(BuildCtx *ctx)
** Or a linker. Or a plastic case. But I digress.
*/
case BUILD_machasm: {
+#if LJ_HASFFI
+ int fcsize = 0;
+#endif
int i;
fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n");
fprintf(ctx->fp,
@@ -3203,6 +3272,9 @@ static void emit_asm_debug(BuildCtx *ctx)
const char *name = ctx->sym[i].name;
int32_t size = ctx->sym[i+1].ofs - ctx->sym[i].ofs;
if (size == 0) continue;
+#if LJ_HASFFI
+ if (!strcmp(name, "_lj_vm_ffi_call")) { fcsize = size; continue; }
+#endif
fprintf(ctx->fp,
"%s.eh:\n"
"LSFDE%d:\n"
@@ -3212,23 +3284,72 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.long LASFDE%d-EH_frame1\n"
"\t.long %s-.\n"
"\t.long %d\n"
- "\t.byte 0\n" /* augmentation length */
+ "\t.byte 0\n" /* augmentation length */
"\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */
#if LJ_64
- "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
- "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
- "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */
- "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */
+ "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
+ "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
+ "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */
+ "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */
#else
- "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
- "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */
- "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */
- "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */
+ "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
+ "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */
+ "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */
+ "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */
#endif
"\t.align " BSZPTR "\n"
"LEFDE%d:\n\n",
name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i);
}
+#if LJ_HASFFI
+ if (fcsize) {
+ fprintf(ctx->fp,
+ "EH_frame2:\n"
+ "\t.set L$set$y,LECIEY-LSCIEY\n"
+ "\t.long L$set$y\n"
+ "LSCIEY:\n"
+ "\t.long 0\n"
+ "\t.byte 0x1\n"
+ "\t.ascii \"zR\\0\"\n"
+ "\t.byte 0x1\n"
+ "\t.byte 128-" SZPTR "\n"
+ "\t.byte " REG_RA "\n"
+ "\t.byte 1\n" /* augmentation length */
+#if LJ_64
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.byte " REG_SP "\n\t.byte " SZPTR "\n"
+#else
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.byte 0x5\n\t.byte 0x4\n" /* esp=5 on 32 bit MACH. */
+#endif
+ "\t.byte 0x80+" REG_RA "\n\t.byte 0x1\n"
+ "\t.align " BSZPTR "\n"
+ "LECIEY:\n\n");
+ fprintf(ctx->fp,
+ "_lj_vm_ffi_call.eh:\n"
+ "LSFDEY:\n"
+ "\t.set L$set$yy,LEFDEY-LASFDEY\n"
+ "\t.long L$set$yy\n"
+ "LASFDEY:\n"
+ "\t.long LASFDEY-EH_frame2\n"
+ "\t.long _lj_vm_ffi_call-.\n"
+ "\t.long %d\n"
+ "\t.byte 0\n" /* augmentation length */
+#if LJ_64
+ "\t.byte 0xe\n\t.byte 16\n" /* def_cfa_offset */
+ "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
+ "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
+ "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
+#else
+ "\t.byte 0xe\n\t.byte 8\n" /* def_cfa_offset */
+ "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
+ "\t.byte 0xd\n\t.uleb128 0x4\n" /* def_cfa_register ebp */
+ "\t.byte 0x83\n\t.byte 0x3\n" /* offset ebx */
+#endif
+ "\t.align " BSZPTR "\n"
+ "LEFDEY:\n\n", fcsize);
+ }
+#endif
#if LJ_64
fprintf(ctx->fp, "\t.subsections_via_symbols\n");
#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)
|.endif
|
|//-----------------------------------------------------------------------
+ |//-- Assertions ---------------------------------------------------------
+ |//-----------------------------------------------------------------------
+ |
+ |->assert_bad_for_arg_type:
+#ifdef LUA_USE_ASSERT
+ | int3
+#endif
+ | int3
+ |
+ |//-----------------------------------------------------------------------
|//-- FFI helper functions -----------------------------------------------
|//-----------------------------------------------------------------------
|
- |->vm_ffi_call@4:
+ |->vm_ffi_call@4: // Call C function via FFI.
+ | // Caveat: needs special frame unwinding, see below.
#if LJ_HASFFI
|.if X64
| .type CCSTATE, CCallState, rbx
@@ -3786,16 +3797,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
| mov ebx, [ebp-4]; leave; ret
|.endif
#endif
- |
- |//-----------------------------------------------------------------------
- |//-- Assertions ---------------------------------------------------------
- |//-----------------------------------------------------------------------
- |
- |->assert_bad_for_arg_type:
-#ifdef LUA_USE_ASSERT
- | int3
-#endif
- | int3
+ |// Note: vm_ffi_call must be the last function in this object file!
|
|//-----------------------------------------------------------------------
}
@@ -6001,6 +6003,7 @@ static int build_backend(BuildCtx *ctx)
/* Emit pseudo frame-info for all assembler functions. */
static void emit_asm_debug(BuildCtx *ctx)
{
+ int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
#if LJ_64
#define SZPTR "8"
#define BSZPTR "3"
@@ -6034,22 +6037,49 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.long .LEFDE0-.LASFDE0\n"
".LASFDE0:\n"
"\t.long .Lframe0\n"
- "\t.long .Lbegin\n"
- "\t.long %d\n"
- "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
#if LJ_64
+ "\t.quad .Lbegin\n"
+ "\t.quad %d\n"
+ "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
"\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
"\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
"\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
"\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
#else
+ "\t.long .Lbegin\n"
+ "\t.long %d\n"
+ "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
"\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
"\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */
"\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */
"\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
#endif
"\t.align " SZPTR "\n"
- ".LEFDE0:\n\n", (int)ctx->codesz, CFRAME_SIZE);
+ ".LEFDE0:\n\n", fcofs, CFRAME_SIZE);
+#if LJ_HASFFI
+ fprintf(ctx->fp,
+ ".LSFDE1:\n"
+ "\t.long .LEFDE1-.LASFDE1\n"
+ ".LASFDE1:\n"
+ "\t.long .Lframe0\n"
+#if LJ_64
+ "\t.quad lj_vm_ffi_call\n"
+ "\t.quad %d\n"
+ "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
+ "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
+ "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
+#else
+ "\t.long lj_vm_ffi_call\n"
+ "\t.long %d\n"
+ "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
+ "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
+ "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
+#endif
+ "\t.align " SZPTR "\n"
+ ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
+#endif
#if (defined(__sun__) && defined(__svr4__)) || defined(__solaris_)
fprintf(ctx->fp, "\t.section .eh_frame,\"aw\",@progbits\n");
#else
@@ -6074,10 +6104,10 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.align " SZPTR "\n"
".LECIE1:\n\n");
fprintf(ctx->fp,
- ".LSFDE1:\n"
- "\t.long .LEFDE1-.LASFDE1\n"
- ".LASFDE1:\n"
- "\t.long .LASFDE1-.Lframe1\n"
+ ".LSFDE2:\n"
+ "\t.long .LEFDE2-.LASFDE2\n"
+ ".LASFDE2:\n"
+ "\t.long .LASFDE2-.Lframe1\n"
"\t.long .Lbegin-.\n"
"\t.long %d\n"
"\t.uleb128 0\n" /* augmentation length */
@@ -6094,7 +6124,46 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
#endif
"\t.align " SZPTR "\n"
- ".LEFDE1:\n\n", (int)ctx->codesz, CFRAME_SIZE);
+ ".LEFDE2:\n\n", fcofs, CFRAME_SIZE);
+#if LJ_HASFFI
+ fprintf(ctx->fp,
+ ".Lframe2:\n"
+ "\t.long .LECIE2-.LSCIE2\n"
+ ".LSCIE2:\n"
+ "\t.long 0\n"
+ "\t.byte 0x1\n"
+ "\t.string \"zR\"\n"
+ "\t.uleb128 0x1\n"
+ "\t.sleb128 -" SZPTR "\n"
+ "\t.byte " REG_RA "\n"
+ "\t.uleb128 1\n" /* augmentation length */
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.uleb128 " REG_SP "\n\t.uleb128 " SZPTR "\n"
+ "\t.byte 0x80+" REG_RA "\n\t.uleb128 0x1\n"
+ "\t.align " SZPTR "\n"
+ ".LECIE2:\n\n");
+ fprintf(ctx->fp,
+ ".LSFDE3:\n"
+ "\t.long .LEFDE3-.LASFDE3\n"
+ ".LASFDE3:\n"
+ "\t.long .LASFDE3-.Lframe2\n"
+ "\t.long lj_vm_ffi_call-.\n"
+ "\t.long %d\n"
+ "\t.uleb128 0\n" /* augmentation length */
+#if LJ_64
+ "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
+ "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
+ "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
+#else
+ "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
+ "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
+ "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
+#endif
+ "\t.align " SZPTR "\n"
+ ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
+#endif
break;
case BUILD_coffasm:
fprintf(ctx->fp, "\t.section .eh_frame,\"dr\"\n");
@@ -6145,6 +6214,9 @@ static void emit_asm_debug(BuildCtx *ctx)
** Or a linker. Or a plastic case. But I digress.
*/
case BUILD_machasm: {
+#if LJ_HASFFI
+ int fcsize = 0;
+#endif
int i;
fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n");
fprintf(ctx->fp,
@@ -6176,6 +6248,9 @@ static void emit_asm_debug(BuildCtx *ctx)
const char *name = ctx->sym[i].name;
int32_t size = ctx->sym[i+1].ofs - ctx->sym[i].ofs;
if (size == 0) continue;
+#if LJ_HASFFI
+ if (!strcmp(name, "_lj_vm_ffi_call")) { fcsize = size; continue; }
+#endif
fprintf(ctx->fp,
"%s.eh:\n"
"LSFDE%d:\n"
@@ -6185,23 +6260,72 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.long LASFDE%d-EH_frame1\n"
"\t.long %s-.\n"
"\t.long %d\n"
- "\t.byte 0\n" /* augmentation length */
+ "\t.byte 0\n" /* augmentation length */
"\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */
#if LJ_64
- "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
- "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
- "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */
- "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */
+ "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
+ "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
+ "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */
+ "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */
#else
- "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
- "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */
- "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */
- "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */
+ "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
+ "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */
+ "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */
+ "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */
#endif
"\t.align " BSZPTR "\n"
"LEFDE%d:\n\n",
name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i);
}
+#if LJ_HASFFI
+ if (fcsize) {
+ fprintf(ctx->fp,
+ "EH_frame2:\n"
+ "\t.set L$set$y,LECIEY-LSCIEY\n"
+ "\t.long L$set$y\n"
+ "LSCIEY:\n"
+ "\t.long 0\n"
+ "\t.byte 0x1\n"
+ "\t.ascii \"zR\\0\"\n"
+ "\t.byte 0x1\n"
+ "\t.byte 128-" SZPTR "\n"
+ "\t.byte " REG_RA "\n"
+ "\t.byte 1\n" /* augmentation length */
+#if LJ_64
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.byte " REG_SP "\n\t.byte " SZPTR "\n"
+#else
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.byte 0x5\n\t.byte 0x4\n" /* esp=5 on 32 bit MACH. */
+#endif
+ "\t.byte 0x80+" REG_RA "\n\t.byte 0x1\n"
+ "\t.align " BSZPTR "\n"
+ "LECIEY:\n\n");
+ fprintf(ctx->fp,
+ "_lj_vm_ffi_call.eh:\n"
+ "LSFDEY:\n"
+ "\t.set L$set$yy,LEFDEY-LASFDEY\n"
+ "\t.long L$set$yy\n"
+ "LASFDEY:\n"
+ "\t.long LASFDEY-EH_frame2\n"
+ "\t.long _lj_vm_ffi_call-.\n"
+ "\t.long %d\n"
+ "\t.byte 0\n" /* augmentation length */
+#if LJ_64
+ "\t.byte 0xe\n\t.byte 16\n" /* def_cfa_offset */
+ "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
+ "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
+ "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
+#else
+ "\t.byte 0xe\n\t.byte 8\n" /* def_cfa_offset */
+ "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
+ "\t.byte 0xd\n\t.uleb128 0x4\n" /* def_cfa_register ebp */
+ "\t.byte 0x83\n\t.byte 0x3\n" /* offset ebx */
+#endif
+ "\t.align " BSZPTR "\n"
+ "LEFDEY:\n\n", fcsize);
+ }
+#endif
#if LJ_64
fprintf(ctx->fp, "\t.subsections_via_symbols\n");
#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 @@
#define DASM_SECTION_CODE_OP 0
#define DASM_SECTION_CODE_SUB 1
#define DASM_MAXSECTION 2
-static const unsigned char build_actionlist[17111] = {
+static const unsigned char build_actionlist[17112] = {
254,1,248,10,252,247,198,237,15,132,244,11,131,230,252,248,41,252,242,141,
76,49,252,248,139,114,252,252,199,68,10,4,237,248,12,131,192,1,137,68,36,
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] = {
223,224,252,246,196,1,15,133,244,248,217,201,248,2,221,216,195,255,248,163,
156,90,137,209,129,252,242,0,0,32,0,82,157,156,90,49,192,57,209,15,132,244,
247,139,68,36,4,87,83,15,162,139,124,36,16,137,7,137,95,4,137,79,8,137,87,
- 12,91,95,248,1,195,248,164,255,85,137,229,83,137,203,43,163,233,255,137,163,
- 233,255,15,182,139,233,131,252,233,1,15,136,244,248,248,1,139,132,253,139,
- 233,137,4,140,131,252,233,1,15,137,244,1,248,2,139,139,233,139,147,233,252,
- 255,147,233,137,131,233,137,147,233,128,187,233,1,15,130,244,253,15,132,244,
- 252,221,155,233,252,233,244,253,248,6,255,217,155,233,248,7,255,41,163,233,
- 255,139,93,252,252,201,195,255,248,165,255,249,255,129,124,253,202,4,239,
- 15,133,244,253,129,124,253,194,4,239,15,133,244,254,139,44,202,131,198,4,
- 59,44,194,255,15,141,244,255,255,15,140,244,255,255,15,143,244,255,255,15,
- 142,244,255,255,248,6,15,183,70,252,254,141,180,253,134,233,248,9,139,6,15,
- 182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,7,15,135,244,43,
- 129,124,253,194,4,239,15,130,244,247,15,133,244,43,255,252,242,15,42,4,194,
- 252,233,244,248,255,221,4,202,219,4,194,252,233,244,249,255,248,8,15,135,
- 244,43,255,252,242,15,42,12,202,252,242,15,16,4,194,131,198,4,102,15,46,193,
- 255,15,134,244,9,255,15,135,244,9,255,15,130,244,9,255,15,131,244,9,255,252,
- 233,244,6,255,219,4,202,252,233,244,248,255,129,124,253,202,4,239,15,131,
- 244,43,129,124,253,194,4,239,15,131,244,43,255,248,1,252,242,15,16,4,194,
- 248,2,131,198,4,102,15,46,4,202,248,3,255,248,1,221,4,202,248,2,221,4,194,
- 248,3,131,198,4,255,15,134,244,247,255,15,135,244,247,255,15,130,244,247,
- 255,15,131,244,247,255,15,183,70,252,254,141,180,253,134,233,248,1,139,6,
- 15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,139,108,194,
+ 12,91,95,248,1,195,248,164,255,204,248,165,255,85,137,229,83,137,203,43,163,
+ 233,255,137,163,233,255,15,182,139,233,131,252,233,1,15,136,244,248,248,1,
+ 139,132,253,139,233,137,4,140,131,252,233,1,15,137,244,1,248,2,139,139,233,
+ 139,147,233,252,255,147,233,137,131,233,137,147,233,128,187,233,1,15,130,
+ 244,253,15,132,244,252,221,155,233,252,233,244,253,248,6,255,217,155,233,
+ 248,7,255,41,163,233,255,139,93,252,252,201,195,255,249,255,129,124,253,202,
+ 4,239,15,133,244,253,129,124,253,194,4,239,15,133,244,254,139,44,202,131,
+ 198,4,59,44,194,255,15,141,244,255,255,15,140,244,255,255,15,143,244,255,
+ 255,15,142,244,255,255,248,6,15,183,70,252,254,141,180,253,134,233,248,9,
+ 139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,7,15,
+ 135,244,43,129,124,253,194,4,239,15,130,244,247,15,133,244,43,255,252,242,
+ 15,42,4,194,252,233,244,248,255,221,4,202,219,4,194,252,233,244,249,255,248,
+ 8,15,135,244,43,255,252,242,15,42,12,202,252,242,15,16,4,194,131,198,4,102,
+ 15,46,193,255,15,134,244,9,255,15,135,244,9,255,15,130,244,9,255,15,131,244,
+ 9,255,252,233,244,6,255,219,4,202,252,233,244,248,255,129,124,253,202,4,239,
+ 15,131,244,43,129,124,253,194,4,239,15,131,244,43,255,248,1,252,242,15,16,
+ 4,194,248,2,131,198,4,102,15,46,4,202,248,3,255,248,1,221,4,202,248,2,221,
+ 4,194,248,3,131,198,4,255,15,134,244,247,255,15,135,244,247,255,15,130,244,
+ 247,255,15,131,244,247,255,15,183,70,252,254,141,180,253,134,233,248,1,139,
+ 6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,139,108,194,
4,131,198,4,255,129,252,253,239,15,133,244,253,129,124,253,202,4,239,15,133,
244,254,139,44,194,59,44,202,255,15,133,244,255,255,15,132,244,255,255,15,
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] = {
137,252,245,209,252,237,129,229,239,102,129,172,253,43,233,238,15,130,244,
148,255,141,12,202,255,129,121,253,4,239,15,133,244,255,255,129,121,253,12,
239,15,133,244,60,129,121,253,20,239,15,133,244,60,139,41,131,121,16,0,15,
- 140,244,251,255,129,121,253,12,239,15,133,244,165,129,121,253,20,239,15,133,
- 244,165,255,139,105,16,133,252,237,15,136,244,251,3,41,15,128,244,247,137,
+ 140,244,251,255,129,121,253,12,239,15,133,244,164,129,121,253,20,239,15,133,
+ 244,164,255,139,105,16,133,252,237,15,136,244,251,3,41,15,128,244,247,137,
41,255,59,105,8,199,65,28,237,137,105,24,255,15,142,244,253,248,1,248,6,141,
180,253,134,233,255,141,180,253,134,233,15,183,70,252,254,15,142,245,248,
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] = {
15,128,244,1,137,41,255,15,141,244,7,255,141,180,253,134,233,15,183,70,252,
254,15,141,245,255,15,140,244,7,255,252,233,244,6,248,9,255,129,121,253,4,
239,255,15,131,244,60,129,121,253,12,239,15,131,244,60,255,129,121,253,12,
- 239,15,131,244,165,129,121,253,20,239,15,131,244,165,255,139,105,20,255,129,
+ 239,15,131,244,164,129,121,253,20,239,15,131,244,164,255,139,105,20,255,129,
252,253,239,15,131,244,60,255,252,242,15,16,1,252,242,15,16,73,8,255,252,
242,15,88,65,16,252,242,15,17,1,133,252,237,15,136,244,249,255,15,140,244,
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 {
GLOB_vm_foldfpm,
GLOB_vm_foldarith,
GLOB_vm_cpuid,
- GLOB_vm_ffi_call,
GLOB_assert_bad_for_arg_type,
+ GLOB_vm_ffi_call,
GLOB_BC_MODVN_Z,
GLOB_BC_TGETS_Z,
GLOB_BC_TSETS_Z,
@@ -1157,8 +1157,8 @@ static const char *const globnames[] = {
"vm_foldfpm",
"vm_foldarith",
"vm_cpuid",
- "vm_ffi_call@4",
"assert_bad_for_arg_type",
+ "vm_ffi_call@4",
"BC_MODVN_Z",
"BC_TGETS_Z",
"BC_TSETS_Z",
@@ -1972,31 +1972,30 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
dasm_put(Dst, 10434);
}
dasm_put(Dst, 10899);
-#if LJ_HASFFI
-#define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
- dasm_put(Dst, 10955, DtE(->spadj));
-#if LJ_TARGET_WINDOWS
- dasm_put(Dst, 10965, DtE(->spadj));
-#endif
- 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]));
- dasm_put(Dst, 11039, DtE(->fpr[0].f[0]));
-#if LJ_TARGET_WINDOWS
- dasm_put(Dst, 11045, DtE(->spadj));
-#endif
- dasm_put(Dst, 11049);
-#endif
- dasm_put(Dst, 11056);
#ifdef LUA_USE_ASSERT
dasm_put(Dst, 10436);
#endif
- dasm_put(Dst, 10436);
+ dasm_put(Dst, 10955);
+#if LJ_HASFFI
+#define DtE(_V) (int)(ptrdiff_t)&(((CCallState *)0)_V)
+ dasm_put(Dst, 10959, DtE(->spadj));
+#if LJ_TARGET_WINDOWS
+ dasm_put(Dst, 10969, DtE(->spadj));
+#endif
+ 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]));
+ dasm_put(Dst, 11043, DtE(->fpr[0].f[0]));
+#if LJ_TARGET_WINDOWS
+ dasm_put(Dst, 11049, DtE(->spadj));
+#endif
+ dasm_put(Dst, 11053);
+#endif
}
/* Generate the code for a single instruction. */
static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
{
int vk = 0;
- dasm_put(Dst, 11059, defop);
+ dasm_put(Dst, 11060, defop);
switch (op) {
@@ -2007,57 +2006,57 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT:
if (LJ_DUALNUM) {
- dasm_put(Dst, 11061, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 11062, LJ_TISNUM, LJ_TISNUM);
switch (op) {
case BC_ISLT:
- dasm_put(Dst, 11091);
+ dasm_put(Dst, 11092);
break;
case BC_ISGE:
- dasm_put(Dst, 11096);
+ dasm_put(Dst, 11097);
break;
case BC_ISLE:
- dasm_put(Dst, 11101);
+ dasm_put(Dst, 11102);
break;
case BC_ISGT:
- dasm_put(Dst, 11106);
+ dasm_put(Dst, 11107);
break;
default: break; /* Shut up GCC. */
}
- dasm_put(Dst, 11111, -BCBIAS_J*4, LJ_TISNUM);
+ dasm_put(Dst, 11112, -BCBIAS_J*4, LJ_TISNUM);
if (sse) {
- dasm_put(Dst, 11164);
+ dasm_put(Dst, 11165);
} else {
- dasm_put(Dst, 11175);
+ dasm_put(Dst, 11176);
}
- dasm_put(Dst, 11186);
+ dasm_put(Dst, 11187);
if (sse) {
- dasm_put(Dst, 11193);
+ dasm_put(Dst, 11194);
switch (op) {
case BC_ISLT:
- dasm_put(Dst, 11213);
+ dasm_put(Dst, 11214);
break;
case BC_ISGE:
- dasm_put(Dst, 11218);
+ dasm_put(Dst, 11219);
break;
case BC_ISLE:
- dasm_put(Dst, 11223);
+ dasm_put(Dst, 11224);
break;
case BC_ISGT:
- dasm_put(Dst, 11228);
+ dasm_put(Dst, 11229);
break;
default: break; /* Shut up GCC. */
}
- dasm_put(Dst, 11233);
+ dasm_put(Dst, 11234);
} else {
- dasm_put(Dst, 11238);
+ dasm_put(Dst, 11239);
}
} else {
- dasm_put(Dst, 11246, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 11247, LJ_TISNUM, LJ_TISNUM);
}
if (sse) {
- dasm_put(Dst, 11267);
+ dasm_put(Dst, 11268);
} else {
- dasm_put(Dst, 11288);
+ dasm_put(Dst, 11289);
if (cmov) {
dasm_put(Dst, 3944);
} else {
@@ -2067,70 +2066,70 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
if (LJ_DUALNUM) {
switch (op) {
case BC_ISLT:
- dasm_put(Dst, 11213);
+ dasm_put(Dst, 11214);
break;
case BC_ISGE:
- dasm_put(Dst, 11218);
+ dasm_put(Dst, 11219);
break;
case BC_ISLE:
- dasm_put(Dst, 11223);
+ dasm_put(Dst, 11224);
break;
case BC_ISGT:
- dasm_put(Dst, 11228);
+ dasm_put(Dst, 11229);
break;
default: break; /* Shut up GCC. */
}
- dasm_put(Dst, 11233);
+ dasm_put(Dst, 11234);
} else {
switch (op) {
case BC_ISLT:
- dasm_put(Dst, 11304);
+ dasm_put(Dst, 11305);
break;
case BC_ISGE:
- dasm_put(Dst, 11309);
+ dasm_put(Dst, 11310);
break;
case BC_ISLE:
- dasm_put(Dst, 11314);
+ dasm_put(Dst, 11315);
break;
case BC_ISGT:
- dasm_put(Dst, 11319);
+ dasm_put(Dst, 11320);
break;
default: break; /* Shut up GCC. */
}
- dasm_put(Dst, 11324, -BCBIAS_J*4);
+ dasm_put(Dst, 11325, -BCBIAS_J*4);
}
break;
case BC_ISEQV: case BC_ISNEV:
vk = op == BC_ISEQV;
- dasm_put(Dst, 11355);
+ dasm_put(Dst, 11356);
if (LJ_DUALNUM) {
- dasm_put(Dst, 11363, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 11364, LJ_TISNUM, LJ_TISNUM);
if (vk) {
- dasm_put(Dst, 11388);
+ dasm_put(Dst, 11389);
} else {
- dasm_put(Dst, 11393);
+ dasm_put(Dst, 11394);
}
- dasm_put(Dst, 11398, -BCBIAS_J*4, LJ_TISNUM);
+ dasm_put(Dst, 11399, -BCBIAS_J*4, LJ_TISNUM);
if (sse) {
- dasm_put(Dst, 11449);
+ dasm_put(Dst, 11450);
} else {
- dasm_put(Dst, 11456);
+ dasm_put(Dst, 11457);
}
- dasm_put(Dst, 11460);
+ dasm_put(Dst, 11461);
if (sse) {
- dasm_put(Dst, 11471);
+ dasm_put(Dst, 11472);
} else {
- dasm_put(Dst, 11483);
+ dasm_put(Dst, 11484);
}
- dasm_put(Dst, 11490);
+ dasm_put(Dst, 11491);
} else {
- dasm_put(Dst, 11495, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 11496, LJ_TISNUM, LJ_TISNUM);
}
if (sse) {
- dasm_put(Dst, 11514);
+ dasm_put(Dst, 11515);
} else {
- dasm_put(Dst, 11532);
+ dasm_put(Dst, 11533);
if (cmov) {
dasm_put(Dst, 3944);
} else {
@@ -2139,13 +2138,13 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
}
iseqne_fp:
if (vk) {
- dasm_put(Dst, 11545);
+ dasm_put(Dst, 11546);
} else {
- dasm_put(Dst, 11554);
+ dasm_put(Dst, 11555);
}
iseqne_end:
if (vk) {
- dasm_put(Dst, 11563, -BCBIAS_J*4);
+ dasm_put(Dst, 11564, -BCBIAS_J*4);
if (!LJ_HASFFI) {
dasm_put(Dst, 4844);
}
@@ -2153,76 +2152,76 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
if (!LJ_HASFFI) {
dasm_put(Dst, 4844);
}
- dasm_put(Dst, 11578, -BCBIAS_J*4);
+ dasm_put(Dst, 11579, -BCBIAS_J*4);
}
if (LJ_DUALNUM && (op == BC_ISEQV || op == BC_ISNEV ||
op == BC_ISEQN || op == BC_ISNEN)) {
- dasm_put(Dst, 11593);
+ dasm_put(Dst, 11594);
} else {
- dasm_put(Dst, 11336);
+ dasm_put(Dst, 11337);
}
if (op == BC_ISEQV || op == BC_ISNEV) {
- dasm_put(Dst, 11598);
+ dasm_put(Dst, 11599);
if (LJ_HASFFI) {
- dasm_put(Dst, 11601, LJ_TCDATA, LJ_TCDATA);
+ dasm_put(Dst, 11602, LJ_TCDATA, LJ_TCDATA);
}
- dasm_put(Dst, 11620, LJ_TISPRI, LJ_TISTABUD, Dt6(->metatable), Dt6(->nomm), 1<metatable), Dt6(->nomm), 1<len), LJ_TISNUM);
+ dasm_put(Dst, 12227, Dt5(->len), LJ_TISNUM);
} else if (sse) {
- dasm_put(Dst, 12240, Dt5(->len));
+ dasm_put(Dst, 12241, Dt5(->len));
} else {
- dasm_put(Dst, 12258, Dt5(->len));
+ dasm_put(Dst, 12259, Dt5(->len));
}
- dasm_put(Dst, 12267, LJ_TTAB);
+ dasm_put(Dst, 12268, LJ_TTAB);
#ifdef LUAJIT_ENABLE_LUA52COMPAT
- dasm_put(Dst, 12301, Dt6(->metatable));
+ dasm_put(Dst, 12302, Dt6(->metatable));
#endif
- dasm_put(Dst, 12315);
+ dasm_put(Dst, 12316);
if (LJ_DUALNUM) {
} else if (sse) {
- dasm_put(Dst, 12324);
+ dasm_put(Dst, 12325);
} else {
- dasm_put(Dst, 12330);
+ dasm_put(Dst, 12331);
}
- dasm_put(Dst, 12337);
+ dasm_put(Dst, 12338);
#ifdef LUAJIT_ENABLE_LUA52COMPAT
- dasm_put(Dst, 12350, Dt6(->nomm), 1<nomm), 1<base), Dt1(->base));
+ dasm_put(Dst, 13094, Dt1(->base), Dt1(->base));
break;
/* -- Constant ops ------------------------------------------------------ */
case BC_KSTR:
- dasm_put(Dst, 13187, LJ_TSTR);
+ dasm_put(Dst, 13188, LJ_TSTR);
break;
case BC_KCDATA:
#if LJ_HASFFI
- dasm_put(Dst, 13187, LJ_TCDATA);
+ dasm_put(Dst, 13188, LJ_TCDATA);
#endif
break;
case BC_KSHORT:
if (LJ_DUALNUM) {
- dasm_put(Dst, 13220, LJ_TISNUM);
+ dasm_put(Dst, 13221, LJ_TISNUM);
} else if (sse) {
- dasm_put(Dst, 13232);
+ dasm_put(Dst, 13233);
} else {
- dasm_put(Dst, 13247);
+ dasm_put(Dst, 13248);
}
- dasm_put(Dst, 11336);
+ dasm_put(Dst, 11337);
break;
case BC_KNUM:
if (sse) {
- dasm_put(Dst, 13255);
+ dasm_put(Dst, 13256);
} else {
- dasm_put(Dst, 13268);
+ dasm_put(Dst, 13269);
}
- dasm_put(Dst, 11336);
+ dasm_put(Dst, 11337);
break;
case BC_KPRI:
- dasm_put(Dst, 13275);
+ dasm_put(Dst, 13276);
break;
case BC_KNIL:
- dasm_put(Dst, 13301, LJ_TNIL);
+ dasm_put(Dst, 13302, LJ_TNIL);
break;
/* -- Upvalue and function ops ------------------------------------------ */
case BC_UGET:
- dasm_put(Dst, 13347, offsetof(GCfuncL, uvptr), DtA(->v));
+ dasm_put(Dst, 13348, offsetof(GCfuncL, uvptr), DtA(->v));
break;
case BC_USETV:
#define TV2MARKOFS \
((int32_t)offsetof(GCupval, marked)-(int32_t)offsetof(GCupval, tv))
- 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);
- dasm_put(Dst, 13481);
+ 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);
+ dasm_put(Dst, 13482);
break;
#undef TV2MARKOFS
case BC_USETS:
- 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);
+ 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);
break;
case BC_USETN:
- dasm_put(Dst, 13584);
+ dasm_put(Dst, 13585);
if (sse) {
- dasm_put(Dst, 13589);
+ dasm_put(Dst, 13590);
} else {
- dasm_put(Dst, 11846);
+ dasm_put(Dst, 11847);
}
- dasm_put(Dst, 13596, offsetof(GCfuncL, uvptr), DtA(->v));
+ dasm_put(Dst, 13597, offsetof(GCfuncL, uvptr), DtA(->v));
if (sse) {
- dasm_put(Dst, 13605);
+ dasm_put(Dst, 13606);
} else {
- dasm_put(Dst, 13611);
+ dasm_put(Dst, 13612);
}
- dasm_put(Dst, 11336);
+ dasm_put(Dst, 11337);
break;
case BC_USETP:
- dasm_put(Dst, 13614, offsetof(GCfuncL, uvptr), DtA(->v));
+ dasm_put(Dst, 13615, offsetof(GCfuncL, uvptr), DtA(->v));
break;
case BC_UCLO:
- dasm_put(Dst, 13651, -BCBIAS_J*4, Dt1(->openupval), Dt1(->base), Dt1(->base));
+ dasm_put(Dst, 13652, -BCBIAS_J*4, Dt1(->openupval), Dt1(->base), Dt1(->base));
break;
case BC_FNEW:
- dasm_put(Dst, 13705, Dt1(->base), Dt1(->base), LJ_TFUNC);
+ dasm_put(Dst, 13706, Dt1(->base), Dt1(->base), LJ_TFUNC);
break;
/* -- Table ops --------------------------------------------------------- */
case BC_TNEW:
- dasm_put(Dst, 13776, Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), LJ_TTAB);
+ dasm_put(Dst, 13777, Dt1(->base), DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), LJ_TTAB);
break;
case BC_TDUP:
- dasm_put(Dst, 13902, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB);
+ dasm_put(Dst, 13903, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB);
break;
case BC_GGET:
- dasm_put(Dst, 13994, Dt7(->env));
+ dasm_put(Dst, 13995, Dt7(->env));
break;
case BC_GSET:
- dasm_put(Dst, 14012, Dt7(->env));
+ dasm_put(Dst, 14013, Dt7(->env));
break;
case BC_TGETV:
- dasm_put(Dst, 14030, LJ_TTAB);
+ dasm_put(Dst, 14031, LJ_TTAB);
if (LJ_DUALNUM) {
- dasm_put(Dst, 14053, LJ_TISNUM);
+ dasm_put(Dst, 14054, LJ_TISNUM);
} else {
- dasm_put(Dst, 14067, LJ_TISNUM);
+ dasm_put(Dst, 14068, LJ_TISNUM);
if (sse) {
- dasm_put(Dst, 14078);
+ dasm_put(Dst, 14079);
} else {
- dasm_put(Dst, 14099);
+ dasm_put(Dst, 14100);
if (cmov) {
dasm_put(Dst, 3944);
} else {
@@ -2784,30 +2783,30 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
}
dasm_put(Dst, 2680);
}
- dasm_put(Dst, 14109);
+ dasm_put(Dst, 14110);
}
- dasm_put(Dst, 14114, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL);
- dasm_put(Dst, 14315, LJ_TNIL, DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL);
+ dasm_put(Dst, 14316, LJ_TNIL, DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
+ dasm_put(Dst, 14530, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
break;
case BC_TSETS:
- 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);
- dasm_put(Dst, 14745, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<next));
- dasm_put(Dst, 14837, Dt6(->metatable), Dt6(->nomm), 1<base), Dt1(->base), Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
+ 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);
+ dasm_put(Dst, 14746, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<next));
+ dasm_put(Dst, 14838, Dt6(->metatable), Dt6(->nomm), 1<base), Dt1(->base), Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
break;
case BC_TSETB:
- dasm_put(Dst, 14933, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable));
- dasm_put(Dst, 15031, Dt6(->metatable), Dt6(->nomm), 1<marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
+ dasm_put(Dst, 14934, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable));
+ dasm_put(Dst, 15032, Dt6(->metatable), Dt6(->nomm), 1<marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
break;
case BC_TSETM:
- dasm_put(Dst, 15077, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
- dasm_put(Dst, 15226, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
+ dasm_put(Dst, 15078, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
+ dasm_put(Dst, 15227, Dt6(->marked), (uint8_t)~LJ_GC_BLACK, DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
break;
/* -- Calls and vararg handling ----------------------------------------- */
case BC_CALL: case BC_CALLM:
- dasm_put(Dst, 12370);
+ dasm_put(Dst, 12371);
if (op == BC_CALLM) {
- dasm_put(Dst, 15244);
+ dasm_put(Dst, 15245);
}
- dasm_put(Dst, 15249, LJ_TFUNC, Dt7(->pc));
+ dasm_put(Dst, 15250, LJ_TFUNC, Dt7(->pc));
break;
case BC_CALLMT:
- dasm_put(Dst, 15244);
+ dasm_put(Dst, 15245);
break;
case BC_CALLT:
- dasm_put(Dst, 15290, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc));
- dasm_put(Dst, 15408, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG);
+ dasm_put(Dst, 15291, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->pc));
+ dasm_put(Dst, 15409, FRAME_TYPE, Dt7(->pc), PC2PROTO(k), FRAME_VARG, FRAME_TYPEP, FRAME_VARG);
break;
case BC_ITERC:
- dasm_put(Dst, 15478, LJ_TFUNC, 2+1, Dt7(->pc));
+ dasm_put(Dst, 15479, LJ_TFUNC, 2+1, Dt7(->pc));
break;
case BC_ITERN:
#if LJ_HASJIT
#endif
- dasm_put(Dst, 15558, Dt6(->asize), Dt6(->array), LJ_TNIL);
+ dasm_put(Dst, 15559, Dt6(->asize), Dt6(->array), LJ_TNIL);
if (LJ_DUALNUM) {
- dasm_put(Dst, 12231, LJ_TISNUM);
+ dasm_put(Dst, 12232, LJ_TISNUM);
} else if (sse) {
- dasm_put(Dst, 12324);
+ dasm_put(Dst, 12325);
} else {
- dasm_put(Dst, 15604);
+ dasm_put(Dst, 15605);
}
- dasm_put(Dst, 15610);
+ dasm_put(Dst, 15611);
if (LJ_DUALNUM) {
} else if (sse) {
- dasm_put(Dst, 12196);
+ dasm_put(Dst, 12197);
} else {
- dasm_put(Dst, 12208);
+ dasm_put(Dst, 12209);
}
- dasm_put(Dst, 15629, -BCBIAS_J*4);
+ dasm_put(Dst, 15630, -BCBIAS_J*4);
if (!LJ_DUALNUM && !sse) {
- dasm_put(Dst, 15680);
+ dasm_put(Dst, 15681);
}
- 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));
- dasm_put(Dst, 15761);
+ 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));
+ dasm_put(Dst, 15762);
break;
case BC_ISNEXT:
- 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);
+ 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);
break;
case BC_VARG:
- dasm_put(Dst, 15868, (8+FRAME_VARG), LJ_TNIL, Dt1(->maxstack));
- dasm_put(Dst, 16032, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
+ dasm_put(Dst, 15869, (8+FRAME_VARG), LJ_TNIL, Dt1(->maxstack));
+ dasm_put(Dst, 16033, Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
break;
/* -- Returns ----------------------------------------------------------- */
case BC_RETM:
- dasm_put(Dst, 15244);
+ dasm_put(Dst, 15245);
break;
case BC_RET: case BC_RET0: case BC_RET1:
if (op != BC_RET0) {
- dasm_put(Dst, 16103);
+ dasm_put(Dst, 16104);
}
- dasm_put(Dst, 16107, FRAME_TYPE);
+ dasm_put(Dst, 16108, FRAME_TYPE);
switch (op) {
case BC_RET:
- dasm_put(Dst, 16126);
+ dasm_put(Dst, 16127);
break;
case BC_RET1:
- dasm_put(Dst, 16184);
+ dasm_put(Dst, 16185);
/* fallthrough */
case BC_RET0:
- dasm_put(Dst, 16200);
+ dasm_put(Dst, 16201);
default:
break;
}
- dasm_put(Dst, 16211, Dt7(->pc), PC2PROTO(k));
+ dasm_put(Dst, 16212, Dt7(->pc), PC2PROTO(k));
if (op == BC_RET) {
- dasm_put(Dst, 16253, LJ_TNIL);
+ dasm_put(Dst, 16254, LJ_TNIL);
} else {
- dasm_put(Dst, 16262, LJ_TNIL);
+ dasm_put(Dst, 16263, LJ_TNIL);
}
- dasm_put(Dst, 16269, -FRAME_VARG, FRAME_TYPEP);
+ dasm_put(Dst, 16270, -FRAME_VARG, FRAME_TYPEP);
if (op != BC_RET0) {
- dasm_put(Dst, 16293);
+ dasm_put(Dst, 16294);
}
dasm_put(Dst, 4928);
break;
@@ -2933,7 +2932,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_FORL:
#if LJ_HASJIT
- dasm_put(Dst, 16297, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
+ dasm_put(Dst, 16298, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
#endif
break;
@@ -2945,111 +2944,111 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_FORI:
case BC_IFORL:
vk = (op == BC_IFORL || op == BC_JFORL);
- dasm_put(Dst, 16318);
+ dasm_put(Dst, 16319);
if (LJ_DUALNUM) {
- dasm_put(Dst, 16322, LJ_TISNUM);
+ dasm_put(Dst, 16323, LJ_TISNUM);
if (!vk) {
- dasm_put(Dst, 16332, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 16333, LJ_TISNUM, LJ_TISNUM);
} else {
#ifdef LUA_USE_ASSERT
- dasm_put(Dst, 16361, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 16362, LJ_TISNUM, LJ_TISNUM);
#endif
- dasm_put(Dst, 16380);
+ dasm_put(Dst, 16381);
}
- dasm_put(Dst, 16399, LJ_TISNUM);
+ dasm_put(Dst, 16400, LJ_TISNUM);
if (op == BC_FORI) {
- dasm_put(Dst, 16410, -BCBIAS_J*4);
+ dasm_put(Dst, 16411, -BCBIAS_J*4);
} else if (op == BC_JFORI) {
- dasm_put(Dst, 16424, -BCBIAS_J*4, BC_JLOOP);
+ dasm_put(Dst, 16425, -BCBIAS_J*4, BC_JLOOP);
} else if (op == BC_IFORL) {
- dasm_put(Dst, 16442, -BCBIAS_J*4);
+ dasm_put(Dst, 16443, -BCBIAS_J*4);
} else {
- dasm_put(Dst, 16434, BC_JLOOP);
+ dasm_put(Dst, 16435, BC_JLOOP);
}
- dasm_put(Dst, 16456);
+ dasm_put(Dst, 16457);
if (vk) {
- dasm_put(Dst, 16479);
+ dasm_put(Dst, 16480);
}
- dasm_put(Dst, 16399, LJ_TISNUM);
+ dasm_put(Dst, 16400, LJ_TISNUM);
if (op == BC_FORI) {
- dasm_put(Dst, 16488);
+ dasm_put(Dst, 16489);
} else if (op == BC_JFORI) {
- dasm_put(Dst, 16493, -BCBIAS_J*4, BC_JLOOP);
+ dasm_put(Dst, 16494, -BCBIAS_J*4, BC_JLOOP);
} else if (op == BC_IFORL) {
- dasm_put(Dst, 16507);
+ dasm_put(Dst, 16508);
} else {
- dasm_put(Dst, 16503, BC_JLOOP);
+ dasm_put(Dst, 16504, BC_JLOOP);
}
- dasm_put(Dst, 16512);
+ dasm_put(Dst, 16513);
} else if (!vk) {
- dasm_put(Dst, 16519, LJ_TISNUM);
+ dasm_put(Dst, 16520, LJ_TISNUM);
}
if (!vk) {
- dasm_put(Dst, 16525, LJ_TISNUM);
+ dasm_put(Dst, 16526, LJ_TISNUM);
} else {
#ifdef LUA_USE_ASSERT
- dasm_put(Dst, 16539, LJ_TISNUM, LJ_TISNUM);
+ dasm_put(Dst, 16540, LJ_TISNUM, LJ_TISNUM);
#endif
}
- dasm_put(Dst, 16558);
+ dasm_put(Dst, 16559);
if (!vk) {
- dasm_put(Dst, 16562, LJ_TISNUM);
+ dasm_put(Dst, 16563, LJ_TISNUM);
}
if (sse) {
- dasm_put(Dst, 16571);
+ dasm_put(Dst, 16572);
if (vk) {
- dasm_put(Dst, 16583);
+ dasm_put(Dst, 16584);
} else {
- dasm_put(Dst, 16602);
+ dasm_put(Dst, 16603);
}
- dasm_put(Dst, 16607);
+ dasm_put(Dst, 16608);
} else {
- dasm_put(Dst, 16620);
+ dasm_put(Dst, 16621);
if (vk) {
- dasm_put(Dst, 16626);
+ dasm_put(Dst, 16627);
} else {
- dasm_put(Dst, 16642);
+ dasm_put(Dst, 16643);
}
- dasm_put(Dst, 16650);
+ dasm_put(Dst, 16651);
if (cmov) {
dasm_put(Dst, 3944);
} else {
dasm_put(Dst, 3950);
}
if (!cmov) {
- dasm_put(Dst, 16655);
+ dasm_put(Dst, 16656);
}
}
if (op == BC_FORI) {
if (LJ_DUALNUM) {
- dasm_put(Dst, 16661);
+ dasm_put(Dst, 16662);
} else {
- dasm_put(Dst, 16666, -BCBIAS_J*4);
+ dasm_put(Dst, 16667, -BCBIAS_J*4);
}
} else if (op == BC_JFORI) {
- dasm_put(Dst, 16676, -BCBIAS_J*4, BC_JLOOP);
+ dasm_put(Dst, 16677, -BCBIAS_J*4, BC_JLOOP);
} else if (op == BC_IFORL) {
if (LJ_DUALNUM) {
- dasm_put(Dst, 16690);
+ dasm_put(Dst, 16691);
} else {
- dasm_put(Dst, 16695, -BCBIAS_J*4);
+ dasm_put(Dst, 16696, -BCBIAS_J*4);
}
} else {
- dasm_put(Dst, 16686, BC_JLOOP);
+ dasm_put(Dst, 16687, BC_JLOOP);
}
if (LJ_DUALNUM) {
- dasm_put(Dst, 11233);
+ dasm_put(Dst, 11234);
} else {
- dasm_put(Dst, 11974);
+ dasm_put(Dst, 11975);
}
if (sse) {
- dasm_put(Dst, 16705);
+ dasm_put(Dst, 16706);
}
break;
case BC_ITERL:
#if LJ_HASJIT
- dasm_put(Dst, 16297, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
+ dasm_put(Dst, 16298, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
#endif
break;
@@ -3058,33 +3057,33 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break;
#endif
case BC_IITERL:
- dasm_put(Dst, 16716, LJ_TNIL);
+ dasm_put(Dst, 16717, LJ_TNIL);
if (op == BC_JITERL) {
- dasm_put(Dst, 16731, BC_JLOOP);
+ dasm_put(Dst, 16732, BC_JLOOP);
} else {
- dasm_put(Dst, 16745, -BCBIAS_J*4);
+ dasm_put(Dst, 16746, -BCBIAS_J*4);
}
- dasm_put(Dst, 11334);
+ dasm_put(Dst, 11335);
break;
case BC_LOOP:
#if LJ_HASJIT
- dasm_put(Dst, 16297, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
+ dasm_put(Dst, 16298, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_LOOP);
#endif
break;
case BC_ILOOP:
- dasm_put(Dst, 11336);
+ dasm_put(Dst, 11337);
break;
case BC_JLOOP:
#if LJ_HASJIT
- dasm_put(Dst, 16761, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L));
+ dasm_put(Dst, 16762, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L));
#endif
break;
case BC_JMP:
- dasm_put(Dst, 16784, -BCBIAS_J*4);
+ dasm_put(Dst, 16785, -BCBIAS_J*4);
break;
/* -- Function headers -------------------------------------------------- */
@@ -3098,7 +3097,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
case BC_FUNCF:
#if LJ_HASJIT
- dasm_put(Dst, 16808, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_CALL);
+ dasm_put(Dst, 16809, HOTCOUNT_PCMASK, GG_DISP2HOT, HOTCOUNT_CALL);
#endif
case BC_FUNCV: /* NYI: compiled vararg functions. */
break;
@@ -3108,13 +3107,13 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break;
#endif
case BC_IFUNCF:
- dasm_put(Dst, 16829, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams));
+ dasm_put(Dst, 16830, -4+PC2PROTO(k), Dt1(->maxstack), -4+PC2PROTO(numparams));
if (op == BC_JFUNCF) {
- dasm_put(Dst, 16859, BC_JLOOP);
+ dasm_put(Dst, 16860, BC_JLOOP);
} else {
- dasm_put(Dst, 11336);
+ dasm_put(Dst, 11337);
}
- dasm_put(Dst, 16868, LJ_TNIL);
+ dasm_put(Dst, 16869, LJ_TNIL);
break;
case BC_JFUNCV:
@@ -3125,30 +3124,30 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
break; /* NYI: compiled vararg functions. */
case BC_IFUNCV:
- dasm_put(Dst, 16890, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL);
+ dasm_put(Dst, 16891, FRAME_VARG, Dt1(->maxstack), -4+PC2PROTO(numparams), LJ_TNIL);
if (op == BC_JFUNCV) {
- dasm_put(Dst, 16859, BC_JLOOP);
+ dasm_put(Dst, 16860, BC_JLOOP);
} else {
- dasm_put(Dst, 16981, -4+PC2PROTO(k));
+ dasm_put(Dst, 16982, -4+PC2PROTO(k));
}
- dasm_put(Dst, 17003, LJ_TNIL);
+ dasm_put(Dst, 17004, LJ_TNIL);
break;
case BC_FUNCC:
case BC_FUNCCW:
- dasm_put(Dst, 17025, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top));
+ dasm_put(Dst, 17026, Dt8(->f), Dt1(->base), 8*LUA_MINSTACK, Dt1(->maxstack), Dt1(->top));
if (op == BC_FUNCC) {
- dasm_put(Dst, 17054);
+ dasm_put(Dst, 17055);
} else {
- dasm_put(Dst, 17058);
+ dasm_put(Dst, 17059);
}
- dasm_put(Dst, 17066, DISPATCH_GL(vmstate), ~LJ_VMST_C);
+ dasm_put(Dst, 17067, DISPATCH_GL(vmstate), ~LJ_VMST_C);
if (op == BC_FUNCC) {
- dasm_put(Dst, 17075);
+ dasm_put(Dst, 17076);
} else {
- dasm_put(Dst, 17079, DISPATCH_GL(wrapf));
+ dasm_put(Dst, 17080, DISPATCH_GL(wrapf));
}
- dasm_put(Dst, 17084, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top));
+ dasm_put(Dst, 17085, DISPATCH_GL(vmstate), ~LJ_VMST_INTERP, Dt1(->base), Dt1(->top));
break;
/* ---------------------------------------------------------------------- */
@@ -3176,7 +3175,7 @@ static int build_backend(BuildCtx *ctx)
build_subroutines(ctx, cmov, sse);
- dasm_put(Dst, 17109);
+ dasm_put(Dst, 17110);
for (op = 0; op < BC__MAX; op++)
build_ins(ctx, (BCOp)op, op, cmov, sse);
@@ -3186,6 +3185,7 @@ static int build_backend(BuildCtx *ctx)
/* Emit pseudo frame-info for all assembler functions. */
static void emit_asm_debug(BuildCtx *ctx)
{
+ int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
#if LJ_64
#define SZPTR "8"
#define BSZPTR "3"
@@ -3219,22 +3219,49 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.long .LEFDE0-.LASFDE0\n"
".LASFDE0:\n"
"\t.long .Lframe0\n"
- "\t.long .Lbegin\n"
- "\t.long %d\n"
- "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
#if LJ_64
+ "\t.quad .Lbegin\n"
+ "\t.quad %d\n"
+ "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
"\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
"\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
"\t.byte 0x8f\n\t.uleb128 0x4\n" /* offset r15 */
"\t.byte 0x8e\n\t.uleb128 0x5\n" /* offset r14 */
#else
+ "\t.long .Lbegin\n"
+ "\t.long %d\n"
+ "\t.byte 0xe\n\t.uleb128 %d\n" /* def_cfa_offset */
"\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
"\t.byte 0x87\n\t.uleb128 0x3\n" /* offset edi */
"\t.byte 0x86\n\t.uleb128 0x4\n" /* offset esi */
"\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
#endif
"\t.align " SZPTR "\n"
- ".LEFDE0:\n\n", (int)ctx->codesz, CFRAME_SIZE);
+ ".LEFDE0:\n\n", fcofs, CFRAME_SIZE);
+#if LJ_HASFFI
+ fprintf(ctx->fp,
+ ".LSFDE1:\n"
+ "\t.long .LEFDE1-.LASFDE1\n"
+ ".LASFDE1:\n"
+ "\t.long .Lframe0\n"
+#if LJ_64
+ "\t.quad lj_vm_ffi_call\n"
+ "\t.quad %d\n"
+ "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
+ "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
+ "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
+#else
+ "\t.long lj_vm_ffi_call\n"
+ "\t.long %d\n"
+ "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
+ "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
+ "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
+#endif
+ "\t.align " SZPTR "\n"
+ ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
+#endif
#if (defined(__sun__) && defined(__svr4__)) || defined(__solaris_)
fprintf(ctx->fp, "\t.section .eh_frame,\"aw\",@progbits\n");
#else
@@ -3259,10 +3286,10 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.align " SZPTR "\n"
".LECIE1:\n\n");
fprintf(ctx->fp,
- ".LSFDE1:\n"
- "\t.long .LEFDE1-.LASFDE1\n"
- ".LASFDE1:\n"
- "\t.long .LASFDE1-.Lframe1\n"
+ ".LSFDE2:\n"
+ "\t.long .LEFDE2-.LASFDE2\n"
+ ".LASFDE2:\n"
+ "\t.long .LASFDE2-.Lframe1\n"
"\t.long .Lbegin-.\n"
"\t.long %d\n"
"\t.uleb128 0\n" /* augmentation length */
@@ -3279,7 +3306,46 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.byte 0x83\n\t.uleb128 0x5\n" /* offset ebx */
#endif
"\t.align " SZPTR "\n"
- ".LEFDE1:\n\n", (int)ctx->codesz, CFRAME_SIZE);
+ ".LEFDE2:\n\n", fcofs, CFRAME_SIZE);
+#if LJ_HASFFI
+ fprintf(ctx->fp,
+ ".Lframe2:\n"
+ "\t.long .LECIE2-.LSCIE2\n"
+ ".LSCIE2:\n"
+ "\t.long 0\n"
+ "\t.byte 0x1\n"
+ "\t.string \"zR\"\n"
+ "\t.uleb128 0x1\n"
+ "\t.sleb128 -" SZPTR "\n"
+ "\t.byte " REG_RA "\n"
+ "\t.uleb128 1\n" /* augmentation length */
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.uleb128 " REG_SP "\n\t.uleb128 " SZPTR "\n"
+ "\t.byte 0x80+" REG_RA "\n\t.uleb128 0x1\n"
+ "\t.align " SZPTR "\n"
+ ".LECIE2:\n\n");
+ fprintf(ctx->fp,
+ ".LSFDE3:\n"
+ "\t.long .LEFDE3-.LASFDE3\n"
+ ".LASFDE3:\n"
+ "\t.long .LASFDE3-.Lframe2\n"
+ "\t.long lj_vm_ffi_call-.\n"
+ "\t.long %d\n"
+ "\t.uleb128 0\n" /* augmentation length */
+#if LJ_64
+ "\t.byte 0xe\n\t.uleb128 16\n" /* def_cfa_offset */
+ "\t.byte 0x86\n\t.uleb128 0x2\n" /* offset rbp */
+ "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset rbx */
+#else
+ "\t.byte 0xe\n\t.uleb128 8\n" /* def_cfa_offset */
+ "\t.byte 0x85\n\t.uleb128 0x2\n" /* offset ebp */
+ "\t.byte 0xd\n\t.uleb128 0x5\n" /* def_cfa_register ebp */
+ "\t.byte 0x83\n\t.uleb128 0x3\n" /* offset ebx */
+#endif
+ "\t.align " SZPTR "\n"
+ ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
+#endif
break;
case BUILD_coffasm:
fprintf(ctx->fp, "\t.section .eh_frame,\"dr\"\n");
@@ -3330,6 +3396,9 @@ static void emit_asm_debug(BuildCtx *ctx)
** Or a linker. Or a plastic case. But I digress.
*/
case BUILD_machasm: {
+#if LJ_HASFFI
+ int fcsize = 0;
+#endif
int i;
fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n");
fprintf(ctx->fp,
@@ -3361,6 +3430,9 @@ static void emit_asm_debug(BuildCtx *ctx)
const char *name = ctx->sym[i].name;
int32_t size = ctx->sym[i+1].ofs - ctx->sym[i].ofs;
if (size == 0) continue;
+#if LJ_HASFFI
+ if (!strcmp(name, "_lj_vm_ffi_call")) { fcsize = size; continue; }
+#endif
fprintf(ctx->fp,
"%s.eh:\n"
"LSFDE%d:\n"
@@ -3370,23 +3442,72 @@ static void emit_asm_debug(BuildCtx *ctx)
"\t.long LASFDE%d-EH_frame1\n"
"\t.long %s-.\n"
"\t.long %d\n"
- "\t.byte 0\n" /* augmentation length */
+ "\t.byte 0\n" /* augmentation length */
"\t.byte 0xe\n\t.byte %d\n" /* def_cfa_offset */
#if LJ_64
- "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
- "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
- "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */
- "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */
+ "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
+ "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
+ "\t.byte 0x8f\n\t.byte 0x4\n" /* offset r15 */
+ "\t.byte 0x8e\n\t.byte 0x5\n" /* offset r14 */
#else
- "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
- "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */
- "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */
- "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */
+ "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
+ "\t.byte 0x87\n\t.byte 0x3\n" /* offset edi */
+ "\t.byte 0x86\n\t.byte 0x4\n" /* offset esi */
+ "\t.byte 0x83\n\t.byte 0x5\n" /* offset ebx */
#endif
"\t.align " BSZPTR "\n"
"LEFDE%d:\n\n",
name, i, i, i, i, i, i, i, name, size, CFRAME_SIZE, i);
}
+#if LJ_HASFFI
+ if (fcsize) {
+ fprintf(ctx->fp,
+ "EH_frame2:\n"
+ "\t.set L$set$y,LECIEY-LSCIEY\n"
+ "\t.long L$set$y\n"
+ "LSCIEY:\n"
+ "\t.long 0\n"
+ "\t.byte 0x1\n"
+ "\t.ascii \"zR\\0\"\n"
+ "\t.byte 0x1\n"
+ "\t.byte 128-" SZPTR "\n"
+ "\t.byte " REG_RA "\n"
+ "\t.byte 1\n" /* augmentation length */
+#if LJ_64
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.byte " REG_SP "\n\t.byte " SZPTR "\n"
+#else
+ "\t.byte 0x1b\n" /* pcrel|sdata4 */
+ "\t.byte 0xc\n\t.byte 0x5\n\t.byte 0x4\n" /* esp=5 on 32 bit MACH. */
+#endif
+ "\t.byte 0x80+" REG_RA "\n\t.byte 0x1\n"
+ "\t.align " BSZPTR "\n"
+ "LECIEY:\n\n");
+ fprintf(ctx->fp,
+ "_lj_vm_ffi_call.eh:\n"
+ "LSFDEY:\n"
+ "\t.set L$set$yy,LEFDEY-LASFDEY\n"
+ "\t.long L$set$yy\n"
+ "LASFDEY:\n"
+ "\t.long LASFDEY-EH_frame2\n"
+ "\t.long _lj_vm_ffi_call-.\n"
+ "\t.long %d\n"
+ "\t.byte 0\n" /* augmentation length */
+#if LJ_64
+ "\t.byte 0xe\n\t.byte 16\n" /* def_cfa_offset */
+ "\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
+ "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
+ "\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
+#else
+ "\t.byte 0xe\n\t.byte 8\n" /* def_cfa_offset */
+ "\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
+ "\t.byte 0xd\n\t.uleb128 0x4\n" /* def_cfa_register ebp */
+ "\t.byte 0x83\n\t.byte 0x3\n" /* offset ebx */
+#endif
+ "\t.align " BSZPTR "\n"
+ "LEFDEY:\n\n", fcsize);
+ }
+#endif
#if LJ_64
fprintf(ctx->fp, "\t.subsections_via_symbols\n");
#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;
#define CCALL_NARG_FPR 8
#define CCALL_NRET_GPR 4 /* For complex double. */
#define CCALL_NRET_FPR 1
-#define CCALL_SPS_EXTRA 3
-#define CCALL_SPS_FREE 1
+#define CCALL_SPS_EXTRA 4
+#define CCALL_SPS_FREE 0
typedef intptr_t GPRArg;
typedef double FPRArg;