diff options
Diffstat (limited to 'src/lj_record.c')
-rw-r--r-- | src/lj_record.c | 60 |
1 files changed, 2 insertions, 58 deletions
diff --git a/src/lj_record.c b/src/lj_record.c index 837f61f4..2ce8564c 100644 --- a/src/lj_record.c +++ b/src/lj_record.c | |||
@@ -2066,63 +2066,6 @@ static const BCIns *rec_setup_root(jit_State *J) | |||
2066 | return pc; | 2066 | return pc; |
2067 | } | 2067 | } |
2068 | 2068 | ||
2069 | /* Setup recording for a side trace. */ | ||
2070 | static void rec_setup_side(jit_State *J, GCtrace *T) | ||
2071 | { | ||
2072 | SnapShot *snap = &T->snap[J->exitno]; | ||
2073 | SnapEntry *map = &T->snapmap[snap->mapofs]; | ||
2074 | MSize n, nent = snap->nent; | ||
2075 | BloomFilter seen = 0; | ||
2076 | J->framedepth = 0; | ||
2077 | /* Emit IR for slots inherited from parent snapshot. */ | ||
2078 | for (n = 0; n < nent; n++) { | ||
2079 | SnapEntry sn = map[n]; | ||
2080 | IRRef ref = snap_ref(sn); | ||
2081 | BCReg s = snap_slot(sn); | ||
2082 | IRIns *ir = &T->ir[ref]; | ||
2083 | IRType t = irt_type(ir->t); | ||
2084 | TRef tr; | ||
2085 | /* The bloom filter avoids O(nent^2) overhead for de-duping slots. */ | ||
2086 | if (bloomtest(seen, ref)) { | ||
2087 | MSize j; | ||
2088 | for (j = 0; j < n; j++) | ||
2089 | if (snap_ref(map[j]) == ref) { | ||
2090 | tr = J->slot[snap_slot(map[j])]; | ||
2091 | goto setslot; | ||
2092 | } | ||
2093 | } | ||
2094 | bloomset(seen, ref); | ||
2095 | switch ((IROp)ir->o) { | ||
2096 | /* Only have to deal with constants that can occur in stack slots. */ | ||
2097 | case IR_KPRI: tr = TREF_PRI(t); break; | ||
2098 | case IR_KINT: tr = lj_ir_kint(J, ir->i); break; | ||
2099 | case IR_KGC: tr = lj_ir_kgc(J, ir_kgc(ir), irt_t(ir->t)); break; | ||
2100 | case IR_KNUM: tr = lj_ir_k64(J, IR_KNUM, ir_knum(ir)); break; | ||
2101 | case IR_KINT64: tr = lj_ir_k64(J, IR_KINT64, ir_kint64(ir)); break; | ||
2102 | case IR_KPTR: tr = lj_ir_kptr(J, ir_kptr(ir)); break; /* Continuation. */ | ||
2103 | /* Inherited SLOADs don't need a guard or type check. */ | ||
2104 | case IR_SLOAD: | ||
2105 | if (LJ_SOFTFP && (sn & SNAP_SOFTFPNUM)) t = IRT_NUM; | ||
2106 | tr = emitir_raw(IRT(IR_SLOAD, t), s, | ||
2107 | (ir->op2&IRSLOAD_READONLY) | IRSLOAD_INHERIT|IRSLOAD_PARENT); | ||
2108 | break; | ||
2109 | /* Parent refs are already typed and don't need a guard. */ | ||
2110 | default: | ||
2111 | if (LJ_SOFTFP && (sn & SNAP_SOFTFPNUM)) t = IRT_NUM; | ||
2112 | tr = emitir_raw(IRT(IR_SLOAD, t), s, IRSLOAD_INHERIT|IRSLOAD_PARENT); | ||
2113 | break; | ||
2114 | } | ||
2115 | setslot: | ||
2116 | J->slot[s] = tr | (sn&(SNAP_CONT|SNAP_FRAME)); /* Same as TREF_* flags. */ | ||
2117 | J->framedepth += ((sn & (SNAP_CONT|SNAP_FRAME)) && s); | ||
2118 | if ((sn & SNAP_FRAME)) | ||
2119 | J->baseslot = s+1; | ||
2120 | } | ||
2121 | J->base = J->slot + J->baseslot; | ||
2122 | J->maxslot = snap->nslots - J->baseslot; | ||
2123 | lj_snap_add(J); | ||
2124 | } | ||
2125 | |||
2126 | /* Setup for recording a new trace. */ | 2069 | /* Setup for recording a new trace. */ |
2127 | void lj_record_setup(jit_State *J) | 2070 | void lj_record_setup(jit_State *J) |
2128 | { | 2071 | { |
@@ -2178,7 +2121,8 @@ void lj_record_setup(jit_State *J) | |||
2178 | } else { | 2121 | } else { |
2179 | J->startpc = NULL; /* Prevent forming an extra loop. */ | 2122 | J->startpc = NULL; /* Prevent forming an extra loop. */ |
2180 | } | 2123 | } |
2181 | rec_setup_side(J, T); | 2124 | lj_snap_replay(J, T); |
2125 | lj_snap_add(J); | ||
2182 | sidecheck: | 2126 | sidecheck: |
2183 | if (traceref(J, J->cur.root)->nchild >= J->param[JIT_P_maxside] || | 2127 | if (traceref(J, J->cur.root)->nchild >= J->param[JIT_P_maxside] || |
2184 | T->snap[J->exitno].count >= J->param[JIT_P_hotexit] + | 2128 | T->snap[J->exitno].count >= J->param[JIT_P_hotexit] + |