aboutsummaryrefslogtreecommitdiff
path: root/src/lj_snap.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lj_snap.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lj_snap.c b/src/lj_snap.c
index 1353e90f..2b82e672 100644
--- a/src/lj_snap.c
+++ b/src/lj_snap.c
@@ -53,16 +53,24 @@ void lj_snap_grow_map_(jit_State *J, MSize need)
53/* Add all modified slots to the snapshot. */ 53/* Add all modified slots to the snapshot. */
54static MSize snapshot_slots(jit_State *J, SnapEntry *map, BCReg nslots) 54static MSize snapshot_slots(jit_State *J, SnapEntry *map, BCReg nslots)
55{ 55{
56 IRRef retf = J->chain[IR_RETF]; /* Limits SLOAD restore elimination. */
56 BCReg s; 57 BCReg s;
57 MSize n = 0; 58 MSize n = 0;
58 for (s = 0; s < nslots; s++) { 59 for (s = 0; s < nslots; s++) {
59 TRef tr = J->slot[s]; 60 TRef tr = J->slot[s];
60 IRRef ref = tref_ref(tr); 61 IRRef ref = tref_ref(tr);
61 if (ref) { 62 if (ref) {
63 SnapEntry sn = SNAP_TR(s, tr);
62 IRIns *ir = IR(ref); 64 IRIns *ir = IR(ref);
63 if (!(ir->o == IR_SLOAD && ir->op1 == s && 65 if (ir->o == IR_SLOAD && ir->op1 == s && ref > retf) {
64 !(ir->op2 & IRSLOAD_INHERIT))) 66 /* No need to snapshot unmodified non-inherited slots. */
65 map[n++] = SNAP_TR(s, tr); 67 if (!(ir->op2 & IRSLOAD_INHERIT))
68 continue;
69 /* No need to restore readonly slots and unmodified non-parent slots. */
70 if ((ir->op2 & (IRSLOAD_READONLY|IRSLOAD_PARENT)) != IRSLOAD_PARENT)
71 sn |= SNAP_NORESTORE;
72 }
73 map[n++] = sn;
66 } 74 }
67 } 75 }
68 return n; 76 return n;