mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
LJ_GC64: Always snapshot functions for non-base frames.
Reported by Arseny Vakhrushev. Analysis and fix contributed by Peter Cawley.
This commit is contained in:
parent
94d4abcca9
commit
ff1e72acea
@ -211,6 +211,7 @@ static TRef getcurrf(jit_State *J)
|
|||||||
{
|
{
|
||||||
if (J->base[-1-LJ_FR2])
|
if (J->base[-1-LJ_FR2])
|
||||||
return J->base[-1-LJ_FR2];
|
return J->base[-1-LJ_FR2];
|
||||||
|
/* Non-base frame functions ought to be loaded already. */
|
||||||
lj_assertJ(J->baseslot == 1+LJ_FR2, "bad baseslot");
|
lj_assertJ(J->baseslot == 1+LJ_FR2, "bad baseslot");
|
||||||
return sloadt(J, -1-LJ_FR2, IRT_FUNC, IRSLOAD_READONLY);
|
return sloadt(J, -1-LJ_FR2, IRT_FUNC, IRSLOAD_READONLY);
|
||||||
}
|
}
|
||||||
|
@ -85,8 +85,13 @@ static MSize snapshot_slots(jit_State *J, SnapEntry *map, BCReg nslots)
|
|||||||
IRIns *ir = &J->cur.ir[ref];
|
IRIns *ir = &J->cur.ir[ref];
|
||||||
if ((LJ_FR2 || !(sn & (SNAP_CONT|SNAP_FRAME))) &&
|
if ((LJ_FR2 || !(sn & (SNAP_CONT|SNAP_FRAME))) &&
|
||||||
ir->o == IR_SLOAD && ir->op1 == s && ref > retf) {
|
ir->o == IR_SLOAD && ir->op1 == s && ref > retf) {
|
||||||
/* No need to snapshot unmodified non-inherited slots. */
|
/*
|
||||||
if (!(ir->op2 & IRSLOAD_INHERIT))
|
** No need to snapshot unmodified non-inherited slots.
|
||||||
|
** But always snapshot the function below a frame in LJ_FR2 mode.
|
||||||
|
*/
|
||||||
|
if (!(ir->op2 & IRSLOAD_INHERIT) &&
|
||||||
|
(!LJ_FR2 || s == 0 || s+1 == nslots ||
|
||||||
|
!(J->slot[s+1] & (TREF_CONT|TREF_FRAME))))
|
||||||
continue;
|
continue;
|
||||||
/* No need to restore readonly slots and unmodified non-parent slots. */
|
/* No need to restore readonly slots and unmodified non-parent slots. */
|
||||||
if (!(LJ_DUALNUM && (ir->op2 & IRSLOAD_CONVERT)) &&
|
if (!(LJ_DUALNUM && (ir->op2 & IRSLOAD_CONVERT)) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user