Disable table allocation bump optimization (for now).

This commit is contained in:
Mike Pall 2015-06-13 00:42:38 +02:00
parent 26b95a90f5
commit fe565222a1
2 changed files with 16 additions and 0 deletions

View File

@ -393,7 +393,9 @@ typedef struct jit_State {
uint32_t penaltyslot; /* Round-robin index into penalty slots. */ uint32_t penaltyslot; /* Round-robin index into penalty slots. */
uint32_t prngstate; /* PRNG state. */ uint32_t prngstate; /* PRNG state. */
#ifdef LUAJIT_ENABLE_TABLE_BUMP
RBCHashEntry rbchash[RBCHASH_SLOTS]; /* Reverse bytecode map. */ RBCHashEntry rbchash[RBCHASH_SLOTS]; /* Reverse bytecode map. */
#endif
BPropEntry bpropcache[BPROP_SLOTS]; /* Backpropagation cache slots. */ BPropEntry bpropcache[BPROP_SLOTS]; /* Backpropagation cache slots. */
uint32_t bpropslot; /* Round-robin index into bpropcache slots. */ uint32_t bpropslot; /* Round-robin index into bpropcache slots. */

View File

@ -235,8 +235,10 @@ static void canonicalize_slots(jit_State *J)
/* Stop recording. */ /* Stop recording. */
void lj_record_stop(jit_State *J, TraceLink linktype, TraceNo lnk) void lj_record_stop(jit_State *J, TraceLink linktype, TraceNo lnk)
{ {
#ifdef LUAJIT_ENABLE_TABLE_BUMP
if (J->retryrec) if (J->retryrec)
lj_trace_err(J, LJ_TRERR_RETRY); lj_trace_err(J, LJ_TRERR_RETRY);
#endif
lj_trace_end(J); lj_trace_end(J);
J->cur.linktype = (uint8_t)linktype; J->cur.linktype = (uint8_t)linktype;
J->cur.link = (uint16_t)lnk; J->cur.link = (uint16_t)lnk;
@ -1129,6 +1131,7 @@ static void rec_mm_comp_cdata(jit_State *J, RecordIndex *ix, int op, MMS mm)
/* -- Indexed access ------------------------------------------------------ */ /* -- Indexed access ------------------------------------------------------ */
#ifdef LUAJIT_ENABLE_TABLE_BUMP
/* Bump table allocations in bytecode when they grow during recording. */ /* Bump table allocations in bytecode when they grow during recording. */
static void rec_idx_bump(jit_State *J, RecordIndex *ix) static void rec_idx_bump(jit_State *J, RecordIndex *ix)
{ {
@ -1192,6 +1195,7 @@ static void rec_idx_bump(jit_State *J, RecordIndex *ix)
} }
} }
} }
#endif
/* Record bounds-check. */ /* Record bounds-check. */
static void rec_idx_abc(jit_State *J, TRef asizeref, TRef ikey, uint32_t asize) static void rec_idx_abc(jit_State *J, TRef asizeref, TRef ikey, uint32_t asize)
@ -1418,8 +1422,10 @@ TRef lj_record_idx(jit_State *J, RecordIndex *ix)
key = emitir(IRTN(IR_CONV), key, IRCONV_NUM_INT); key = emitir(IRTN(IR_CONV), key, IRCONV_NUM_INT);
xref = emitir(IRT(IR_NEWREF, IRT_P32), ix->tab, key); xref = emitir(IRT(IR_NEWREF, IRT_P32), ix->tab, key);
keybarrier = 0; /* NEWREF already takes care of the key barrier. */ keybarrier = 0; /* NEWREF already takes care of the key barrier. */
#ifdef LUAJIT_ENABLE_TABLE_BUMP
if ((J->flags & JIT_F_OPT_SINK)) /* Avoid a separate flag. */ if ((J->flags & JIT_F_OPT_SINK)) /* Avoid a separate flag. */
rec_idx_bump(J, ix); rec_idx_bump(J, ix);
#endif
} }
} else if (!lj_opt_fwd_wasnonnil(J, loadop, tref_ref(xref))) { } else if (!lj_opt_fwd_wasnonnil(J, loadop, tref_ref(xref))) {
/* Cannot derive that the previous value was non-nil, must do checks. */ /* Cannot derive that the previous value was non-nil, must do checks. */
@ -1462,12 +1468,14 @@ static void rec_tsetm(jit_State *J, BCReg ra, BCReg rn, int32_t i)
settabV(J->L, &ix.tabv, t); settabV(J->L, &ix.tabv, t);
ix.tab = getslot(J, ra-1); ix.tab = getslot(J, ra-1);
ix.idxchain = 0; ix.idxchain = 0;
#ifdef LUAJIT_ENABLE_TABLE_BUMP
if ((J->flags & JIT_F_OPT_SINK)) { if ((J->flags & JIT_F_OPT_SINK)) {
if (t->asize < i+rn-ra) if (t->asize < i+rn-ra)
lj_tab_reasize(J->L, t, i+rn-ra); lj_tab_reasize(J->L, t, i+rn-ra);
setnilV(&ix.keyv); setnilV(&ix.keyv);
rec_idx_bump(J, &ix); rec_idx_bump(J, &ix);
} }
#endif
for (; ra < rn; i++, ra++) { for (; ra < rn; i++, ra++) {
setintV(&ix.keyv, i); setintV(&ix.keyv, i);
ix.key = lj_ir_kint(J, i); ix.key = lj_ir_kint(J, i);
@ -1790,9 +1798,11 @@ static TRef rec_tnew(jit_State *J, uint32_t ah)
TRef tr; TRef tr;
if (asize == 0x7ff) asize = 0x801; if (asize == 0x7ff) asize = 0x801;
tr = emitir(IRTG(IR_TNEW, IRT_TAB), asize, hbits); tr = emitir(IRTG(IR_TNEW, IRT_TAB), asize, hbits);
#ifdef LUAJIT_ENABLE_TABLE_BUMP
J->rbchash[(tr & (RBCHASH_SLOTS-1))].ref = tref_ref(tr); J->rbchash[(tr & (RBCHASH_SLOTS-1))].ref = tref_ref(tr);
setmref(J->rbchash[(tr & (RBCHASH_SLOTS-1))].pc, J->pc); setmref(J->rbchash[(tr & (RBCHASH_SLOTS-1))].pc, J->pc);
setgcref(J->rbchash[(tr & (RBCHASH_SLOTS-1))].pt, obj2gco(J->pt)); setgcref(J->rbchash[(tr & (RBCHASH_SLOTS-1))].pt, obj2gco(J->pt));
#endif
return tr; return tr;
} }
@ -2219,9 +2229,11 @@ void lj_record_ins(jit_State *J)
case BC_TDUP: case BC_TDUP:
rc = emitir(IRTG(IR_TDUP, IRT_TAB), rc = emitir(IRTG(IR_TDUP, IRT_TAB),
lj_ir_ktab(J, gco2tab(proto_kgc(J->pt, ~(ptrdiff_t)rc))), 0); lj_ir_ktab(J, gco2tab(proto_kgc(J->pt, ~(ptrdiff_t)rc))), 0);
#ifdef LUAJIT_ENABLE_TABLE_BUMP
J->rbchash[(rc & (RBCHASH_SLOTS-1))].ref = tref_ref(rc); J->rbchash[(rc & (RBCHASH_SLOTS-1))].ref = tref_ref(rc);
setmref(J->rbchash[(rc & (RBCHASH_SLOTS-1))].pc, pc); setmref(J->rbchash[(rc & (RBCHASH_SLOTS-1))].pc, pc);
setgcref(J->rbchash[(rc & (RBCHASH_SLOTS-1))].pt, obj2gco(J->pt)); setgcref(J->rbchash[(rc & (RBCHASH_SLOTS-1))].pt, obj2gco(J->pt));
#endif
break; break;
/* -- Calls and vararg handling ----------------------------------------- */ /* -- Calls and vararg handling ----------------------------------------- */
@ -2435,7 +2447,9 @@ void lj_record_setup(jit_State *J)
/* Initialize state related to current trace. */ /* Initialize state related to current trace. */
memset(J->slot, 0, sizeof(J->slot)); memset(J->slot, 0, sizeof(J->slot));
memset(J->chain, 0, sizeof(J->chain)); memset(J->chain, 0, sizeof(J->chain));
#ifdef LUAJIT_ENABLE_TABLE_BUMP
memset(J->rbchash, 0, sizeof(J->rbchash)); memset(J->rbchash, 0, sizeof(J->rbchash));
#endif
memset(J->bpropcache, 0, sizeof(J->bpropcache)); memset(J->bpropcache, 0, sizeof(J->bpropcache));
J->scev.idx = REF_NIL; J->scev.idx = REF_NIL;
setmref(J->scev.pc, NULL); setmref(J->scev.pc, NULL);