summaryrefslogtreecommitdiff
path: root/src/lj_snap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_snap.c')
-rw-r--r--src/lj_snap.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lj_snap.c b/src/lj_snap.c
index d22c90a4..731b8f92 100644
--- a/src/lj_snap.c
+++ b/src/lj_snap.c
@@ -50,20 +50,19 @@ void lj_snap_grow_map_(jit_State *J, MSize need)
50 50
51/* -- Snapshot generation ------------------------------------------------- */ 51/* -- Snapshot generation ------------------------------------------------- */
52 52
53/* NYI: IR_FRAME should be eliminated, too. */
54
55/* Add all modified slots to the snapshot. */ 53/* Add all modified slots to the snapshot. */
56static MSize snapshot_slots(jit_State *J, SnapEntry *map, BCReg nslots) 54static MSize snapshot_slots(jit_State *J, SnapEntry *map, BCReg nslots)
57{ 55{
58 BCReg s; 56 BCReg s;
59 MSize n = 0; 57 MSize n = 0;
60 for (s = 0; s < nslots; s++) { 58 for (s = 0; s < nslots; s++) {
61 IRRef ref = tref_ref(J->slot[s]); 59 TRef tr = J->slot[s];
60 IRRef ref = tref_ref(tr);
62 if (ref) { 61 if (ref) {
63 IRIns *ir = IR(ref); 62 IRIns *ir = IR(ref);
64 if (!(ir->o == IR_SLOAD && ir->op1 == s && 63 if (!(ir->o == IR_SLOAD && ir->op1 == s &&
65 !(ir->op2 & IRSLOAD_INHERIT))) 64 !(ir->op2 & IRSLOAD_INHERIT)))
66 map[n++] = SNAP(s, ir->o == IR_FRAME ? SNAP_FRAME : 0, ref); 65 map[n++] = SNAP_TR(s, tr);
67 } 66 }
68 } 67 }
69 return n; 68 return n;
@@ -226,8 +225,9 @@ void lj_snap_restore(jit_State *J, void *exptr)
226 /* Fill stack slots with data from the registers and spill slots. */ 225 /* Fill stack slots with data from the registers and spill slots. */
227 frame = L->base-1; 226 frame = L->base-1;
228 for (n = 0; n < nent; n++) { 227 for (n = 0; n < nent; n++) {
229 IRRef ref = snap_ref(map[n]); 228 SnapEntry sn = map[n];
230 BCReg s = snap_slot(map[n]); 229 IRRef ref = snap_ref(sn);
230 BCReg s = snap_slot(sn);
231 TValue *o = &frame[s]; /* Stack slots are relative to start frame. */ 231 TValue *o = &frame[s]; /* Stack slots are relative to start frame. */
232 IRIns *ir = &T->ir[ref]; 232 IRIns *ir = &T->ir[ref];
233 if (irref_isk(ref)) { /* Restore constant slot. */ 233 if (irref_isk(ref)) { /* Restore constant slot. */
@@ -260,6 +260,7 @@ void lj_snap_restore(jit_State *J, void *exptr)
260 setitype(o, irt_toitype(t)); 260 setitype(o, irt_toitype(t));
261 } 261 }
262 } else { /* Restore frame slot. */ 262 } else { /* Restore frame slot. */
263 lua_assert((sn & (SNAP_CONT|SNAP_FRAME)));
263 lua_assert(ir->o == IR_FRAME); 264 lua_assert(ir->o == IR_FRAME);
264 /* This works for both PTR and FUNC IR_FRAME. */ 265 /* This works for both PTR and FUNC IR_FRAME. */
265 setgcrefp(o->fr.func, mref(T->ir[ir->op2].ptr, void)); 266 setgcrefp(o->fr.func, mref(T->ir[ir->op2].ptr, void));