]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Merge branch 'master' into v2.1
authorMike Pall <mike>
Mon, 12 Oct 2020 13:51:31 +0000 (15:51 +0200)
committerMike Pall <mike>
Mon, 12 Oct 2020 13:51:31 +0000 (15:51 +0200)
1  2 
src/lj_record.c
src/lj_snap.c

diff --cc src/lj_record.c
Simple merge
diff --cc src/lj_snap.c
index f1358cf29b5c71aacb4da5f728d796ad150d1706,bcd0303811f6ba9670d5edae8a3ec37e1ce6d665..45e2008fef80920ef5167ee13e09dd74cce14777
@@@ -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;
      }