aboutsummaryrefslogtreecommitdiff
path: root/src/lj_snap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_snap.c')
-rw-r--r--src/lj_snap.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/lj_snap.c b/src/lj_snap.c
index d2e4d95e..3371375a 100644
--- a/src/lj_snap.c
+++ b/src/lj_snap.c
@@ -318,27 +318,37 @@ static RegSP snap_renameref(GCtrace *T, SnapNo lim, IRRef ref, RegSP rs)
318 return rs; 318 return rs;
319} 319}
320 320
321/* Convert a snapshot into a linear slot -> RegSP map. 321/* Copy RegSP from parent snapshot to the parent links of the IR. */
322** Note: unused slots are not initialized! 322IRIns *lj_snap_regspmap(GCtrace *T, SnapNo snapno, IRIns *ir)
323*/
324void lj_snap_regspmap(uint16_t *rsmap, GCtrace *T, SnapNo snapno, int hi)
325{ 323{
326 SnapShot *snap = &T->snap[snapno]; 324 SnapShot *snap = &T->snap[snapno];
327 MSize n, nent = snap->nent;
328 SnapEntry *map = &T->snapmap[snap->mapofs]; 325 SnapEntry *map = &T->snapmap[snap->mapofs];
329 BloomFilter rfilt = snap_renamefilter(T, snapno); 326 BloomFilter rfilt = snap_renamefilter(T, snapno);
330 for (n = 0; n < nent; n++) { 327 MSize n = 0;
331 SnapEntry sn = map[n]; 328 IRRef ref = 0;
332 IRRef ref = snap_ref(sn); 329 for ( ; ; ir++) {
333 if (!irref_isk(ref) && 330 uint32_t rs;
334 ((LJ_SOFTFP && hi) ? (ref++, (sn & SNAP_SOFTFPNUM)) : 1)) { 331 if (ir->o == IR_SLOAD) {
335 IRIns *ir = &T->ir[ref]; 332 if (!(ir->op2 & IRSLOAD_PARENT)) break;
336 uint32_t rs = ir->prev; 333 for ( ; ; n++) {
337 if (bloomtest(rfilt, ref)) 334 lua_assert(n < snap->nent);
338 rs = snap_renameref(T, snapno, ref, rs); 335 if (snap_slot(map[n]) == ir->op1) {
339 rsmap[snap_slot(sn)] = (uint16_t)rs; 336 ref = snap_ref(map[n++]);
337 break;
338 }
339 }
340 } else if (LJ_SOFTFP && ir->o == IR_HIOP) {
341 ref++;
342 } else {
343 break;
340 } 344 }
345 rs = T->ir[ref].prev;
346 if (bloomtest(rfilt, ref))
347 rs = snap_renameref(T, snapno, ref, rs);
348 ir->prev = (uint16_t)rs;
349 lua_assert(regsp_used(rs));
341 } 350 }
351 return ir;
342} 352}
343 353
344/* Restore a value from the trace exit state. */ 354/* Restore a value from the trace exit state. */