Constrain value range of lj_ir_kptr() to unsigned 32 bit pointers.

Thanks to Peter Cawley.
This commit is contained in:
Mike Pall
2016-04-24 17:32:12 +02:00
parent d8ac6230ed
commit ac42037db0
4 changed files with 9 additions and 16 deletions

View File

@@ -104,7 +104,6 @@ static void recff_stitch(jit_State *J)
TValue *base = L->base;
const BCIns *pc = frame_pc(base-1);
TValue *pframe = frame_prevl(base-1);
TRef trcont;
lua_assert(!LJ_FR2); /* TODO_FR2: handle frame shift. */
/* Move func + args up in Lua stack and insert continuation. */
@@ -118,12 +117,7 @@ static void recff_stitch(jit_State *J)
/* Ditto for the IR. */
memmove(&J->base[1], &J->base[-1], sizeof(TRef)*(J->maxslot+1));
#if LJ_64
trcont = lj_ir_kptr(J, (void *)((int64_t)cont-(int64_t)lj_vm_asm_begin));
#else
trcont = lj_ir_kptr(J, (void *)cont);
#endif
J->base[0] = trcont | TREF_CONT;
J->base[0] = lj_ir_kptr(J, contptr(cont)) | TREF_CONT;
J->ktracep = lj_ir_k64_reserve(J);
lua_assert(irt_toitype_(IRT_P64) == LJ_TTRACE);
J->base[-1] = emitir(IRT(IR_XLOAD, IRT_P64), lj_ir_kptr(J, &J->ktracep->gcr), 0);