LJ_FR2: Fix slot 1 handling.

Contributed by Peter Cawley.
This commit is contained in:
Mike Pall
2016-10-16 21:04:38 +02:00
parent 3f43f09413
commit 6a25014c1c
3 changed files with 16 additions and 6 deletions

View File

@@ -105,7 +105,7 @@ static void rec_check_slots(jit_State *J)
lua_assert(tref_isfunc(tr));
#if LJ_FR2
} else if (s == 1) {
lua_assert(0);
lua_assert((tr & ~TREF_FRAME) == 0);
#endif
} else if ((tr & TREF_FRAME)) {
GCfunc *fn = gco2func(frame_gc(tv));
@@ -747,7 +747,7 @@ void lj_record_tailcall(jit_State *J, BCReg func, ptrdiff_t nargs)
}
/* Move func + args down. */
if (LJ_FR2 && J->baseslot == 2)
J->base[func+1] = 0;
J->base[func+1] = TREF_FRAME;
memmove(&J->base[-1-LJ_FR2], &J->base[func], sizeof(TRef)*(J->maxslot+1+LJ_FR2));
/* Note: the new TREF_FRAME is now at J->base[-1] (even for slot #0). */
/* Tailcalls can form a loop, so count towards the loop unroll limit. */