From: Mike Pall Date: Mon, 12 Oct 2020 13:51:31 +0000 (+0200) Subject: Merge branch 'master' into v2.1 X-Git-Tag: v2.1.ROLLING~221 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=675e08cf069725a004284b4e1e67fbf0e8fcb4dd;p=thirdparty%2FLuaJIT.git Merge branch 'master' into v2.1 --- 675e08cf069725a004284b4e1e67fbf0e8fcb4dd diff --cc src/lj_snap.c index f1358cf2,bcd03038..45e2008f --- a/src/lj_snap.c +++ b/src/lj_snap.c @@@ -107,37 -90,27 +107,40 @@@ static MSize snapshot_slots(jit_State * } /* Add frame links at the end of the snapshot. */ -static BCReg snapshot_framelinks(jit_State *J, SnapEntry *map) +static MSize snapshot_framelinks(jit_State *J, SnapEntry *map, uint8_t *topslot) { cTValue *frame = J->L->base - 1; - cTValue *lim = J->L->base - J->baseslot; - cTValue *ftop = frame + funcproto(frame_func(frame))->framesize; + cTValue *lim = J->L->base - J->baseslot + LJ_FR2; + GCfunc *fn = frame_func(frame); + cTValue *ftop = isluafunc(fn) ? (frame+funcproto(fn)->framesize) : J->L->top; +#if LJ_FR2 + uint64_t pcbase = (u64ptr(J->pc) << 8) | (J->baseslot - 2); + lj_assertJ(2 <= J->baseslot && J->baseslot <= 257, "bad baseslot"); + memcpy(map, &pcbase, sizeof(uint64_t)); +#else MSize f = 0; map[f++] = SNAP_MKPC(J->pc); /* The current PC is always the first entry. */ - lua_assert(!J->pt || +#endif ++ lj_assertJ(!J->pt || + (J->pc >= proto_bc(J->pt) && - J->pc < proto_bc(J->pt) + J->pt->sizebc)); ++ J->pc < proto_bc(J->pt) + J->pt->sizebc), "bad snapshot PC"); while (frame > lim) { /* Backwards traversal of all frames above base. */ if (frame_islua(frame)) { +#if !LJ_FR2 map[f++] = SNAP_MKPC(frame_pc(frame)); +#endif frame = frame_prevl(frame); } else if (frame_iscont(frame)) { +#if !LJ_FR2 map[f++] = SNAP_MKFTSZ(frame_ftsz(frame)); map[f++] = SNAP_MKPC(frame_contpc(frame)); +#endif frame = frame_prevd(frame); } else { - lua_assert(!frame_isc(frame)); + lj_assertJ(!frame_isc(frame), "broken frame chain"); +#if !LJ_FR2 map[f++] = SNAP_MKFTSZ(frame_ftsz(frame)); +#endif frame = frame_prevd(frame); continue; }