diff --git a/src/lib_ffi.c b/src/lib_ffi.c index 2295cf15..1b1fa389 100644 --- a/src/lib_ffi.c +++ b/src/lib_ffi.c @@ -776,7 +776,7 @@ LJLIB_CF(ffi_metatype) if (!(ctype_isstruct(ct->info) || ctype_iscomplex(ct->info) || ctype_isvector(ct->info))) lj_err_arg(L, 1, LJ_ERR_FFI_INVTYPE); - tv = lj_tab_setinth(L, t, -(int32_t)id); + tv = lj_tab_setinth(L, t, -(int32_t)ctype_typeid(cts, ct)); if (!tvisnil(tv)) lj_err_caller(L, LJ_ERR_PROTMT); settabV(L, tv, mt); diff --git a/src/lj_asm.c b/src/lj_asm.c index 6f5e0c45..0fcd8485 100644 --- a/src/lj_asm.c +++ b/src/lj_asm.c @@ -1888,6 +1888,7 @@ static void asm_head_side(ASMState *as) IRRef1 sloadins[RID_MAX]; RegSet allow = RSET_ALL; /* Inverse of all coalesced registers. */ RegSet live = RSET_EMPTY; /* Live parent registers. */ + RegSet pallow = RSET_GPR; /* Registers needed by the parent stack check. */ IRIns *irp = &as->parent->ir[REF_BASE]; /* Parent base. */ int32_t spadj, spdelta; int pass2 = 0; @@ -1928,6 +1929,7 @@ static void asm_head_side(ASMState *as) sloadins[rs] = (IRRef1)i; rset_set(live, rs); /* Block live parent register. */ } + if (!ra_hasspill(regsp_spill(rs))) rset_clear(pallow, regsp_reg(rs)); } /* Calculate stack frame adjustment. */ @@ -2044,7 +2046,7 @@ static void asm_head_side(ASMState *as) ExitNo exitno = as->J->exitno; #endif as->T->topslot = (uint8_t)as->topslot; /* Remember for child traces. */ - asm_stack_check(as, as->topslot, irp, allow & RSET_GPR, exitno); + asm_stack_check(as, as->topslot, irp, pallow, exitno); } } diff --git a/src/lj_record.c b/src/lj_record.c index b2639cbc..8e685a10 100644 --- a/src/lj_record.c +++ b/src/lj_record.c @@ -1976,8 +1976,7 @@ static void rec_varg(jit_State *J, BCReg dst, ptrdiff_t nresults) } for (i = nvararg; i < nresults; i++) J->base[dst+i] = TREF_NIL; - if (dst + (BCReg)nresults > J->maxslot) - J->maxslot = dst + (BCReg)nresults; + J->maxslot = dst + (BCReg)nresults; } else if (select_detect(J)) { /* y = select(x, ...) */ TRef tridx = J->base[dst-1]; TRef tr = TREF_NIL;