Handle OOM error during trace stitching.
Thanks to Sergey Kaplun. #1502
This commit is contained in:
parent
941ddb5c96
commit
c55691087e
@ -118,16 +118,7 @@ static void recff_stitch(jit_State *J)
|
|||||||
TValue *pframe = frame_prevl(base-1);
|
TValue *pframe = frame_prevl(base-1);
|
||||||
int errcode;
|
int errcode;
|
||||||
|
|
||||||
/* Move func + args up in Lua stack and insert continuation. */
|
/* Move func + args up in IR slots and insert continuation. */
|
||||||
memmove(&base[1], &base[-1-LJ_FR2], sizeof(TValue)*nslot);
|
|
||||||
setframe_ftsz(nframe, ((char *)nframe - (char *)pframe) + FRAME_CONT);
|
|
||||||
setcont(base-LJ_FR2, cont);
|
|
||||||
setframe_pc(base, pc);
|
|
||||||
setnilV(base-1-LJ_FR2); /* Incorrect, but rec_check_slots() won't run anymore. */
|
|
||||||
L->base += 2 + LJ_FR2;
|
|
||||||
L->top += 2 + LJ_FR2;
|
|
||||||
|
|
||||||
/* Ditto for the IR. */
|
|
||||||
memmove(&J->base[1], &J->base[-1-LJ_FR2], sizeof(TRef)*nslot);
|
memmove(&J->base[1], &J->base[-1-LJ_FR2], sizeof(TRef)*nslot);
|
||||||
#if LJ_FR2
|
#if LJ_FR2
|
||||||
J->base[2] = TREF_FRAME;
|
J->base[2] = TREF_FRAME;
|
||||||
@ -141,6 +132,15 @@ static void recff_stitch(jit_State *J)
|
|||||||
J->baseslot += 2 + LJ_FR2;
|
J->baseslot += 2 + LJ_FR2;
|
||||||
J->framedepth++;
|
J->framedepth++;
|
||||||
|
|
||||||
|
/* Ditto for the Lua stack. */
|
||||||
|
memmove(&base[1], &base[-1-LJ_FR2], sizeof(TValue)*nslot);
|
||||||
|
setframe_ftsz(nframe, ((char *)nframe - (char *)pframe) + FRAME_CONT);
|
||||||
|
setcont(base-LJ_FR2, cont);
|
||||||
|
setframe_pc(base, pc);
|
||||||
|
setnilV(base-1-LJ_FR2); /* Incorrect, but rec_check_slots() won't run anymore. */
|
||||||
|
L->base += 2 + LJ_FR2;
|
||||||
|
L->top += 2 + LJ_FR2;
|
||||||
|
|
||||||
errcode = lj_vm_cpcall(L, NULL, J, rec_stop_stitch_cp);
|
errcode = lj_vm_cpcall(L, NULL, J, rec_stop_stitch_cp);
|
||||||
|
|
||||||
/* Undo Lua stack changes. */
|
/* Undo Lua stack changes. */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user