summaryrefslogtreecommitdiff
path: root/src/lj_snap.c
diff options
context:
space:
mode:
authorMike Pall <mike>2010-02-23 03:08:49 +0100
committerMike Pall <mike>2010-02-23 03:08:49 +0100
commitc1362dcac98bb73ff308e3453279d52e988a555b (patch)
tree98891212ccb4d8b7f6dc9559fa6c2fb43964758b /src/lj_snap.c
parentf751cd1d6ff2ff1caab338cd2294f69cab34ae04 (diff)
downloadluajit-c1362dcac98bb73ff308e3453279d52e988a555b.tar.gz
luajit-c1362dcac98bb73ff308e3453279d52e988a555b.tar.bz2
luajit-c1362dcac98bb73ff308e3453279d52e988a555b.zip
Don't eliminate SLOAD restores across RETF.
Move restore-elimination logic into snapshot_slots().
Diffstat (limited to 'src/lj_snap.c')
-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;