aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2015-06-13 00:42:38 +0200
committerMike Pall <mike>2015-06-13 00:42:38 +0200
commitfe565222a1cbf28fbae266da35c8a703fdcfa0dd (patch)
treec5c6ef8d8db3c842d35ef314d5dba50d3835cdff
parent26b95a90f5f76f8a726ad0954f29781bec8ccc05 (diff)
downloadluajit-fe565222a1cbf28fbae266da35c8a703fdcfa0dd.tar.gz
luajit-fe565222a1cbf28fbae266da35c8a703fdcfa0dd.tar.bz2
luajit-fe565222a1cbf28fbae266da35c8a703fdcfa0dd.zip
Disable table allocation bump optimization (for now).
-rw-r--r--src/lj_jit.h2
-rw-r--r--src/lj_record.c14
2 files changed, 16 insertions, 0 deletions
diff --git a/src/lj_jit.h b/src/lj_jit.h
index 69656568..1df56cae 100644
--- a/src/lj_jit.h
+++ b/src/lj_jit.h
@@ -393,7 +393,9 @@ typedef struct jit_State {
393 uint32_t penaltyslot; /* Round-robin index into penalty slots. */ 393 uint32_t penaltyslot; /* Round-robin index into penalty slots. */
394 uint32_t prngstate; /* PRNG state. */ 394 uint32_t prngstate; /* PRNG state. */
395 395
396#ifdef LUAJIT_ENABLE_TABLE_BUMP
396 RBCHashEntry rbchash[RBCHASH_SLOTS]; /* Reverse bytecode map. */ 397 RBCHashEntry rbchash[RBCHASH_SLOTS]; /* Reverse bytecode map. */
398#endif
397 399
398 BPropEntry bpropcache[BPROP_SLOTS]; /* Backpropagation cache slots. */ 400 BPropEntry bpropcache[BPROP_SLOTS]; /* Backpropagation cache slots. */
399 uint32_t bpropslot; /* Round-robin index into bpropcache slots. */ 401 uint32_t bpropslot; /* Round-robin index into bpropcache slots. */
diff --git a/src/lj_record.c b/src/lj_record.c
index 9480448f..dc5f2d54 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -235,8 +235,10 @@ static void canonicalize_slots(jit_State *J)
235/* Stop recording. */ 235/* Stop recording. */
236void lj_record_stop(jit_State *J, TraceLink linktype, TraceNo lnk) 236void lj_record_stop(jit_State *J, TraceLink linktype, TraceNo lnk)
237{ 237{
238#ifdef LUAJIT_ENABLE_TABLE_BUMP
238 if (J->retryrec) 239 if (J->retryrec)
239 lj_trace_err(J, LJ_TRERR_RETRY); 240 lj_trace_err(J, LJ_TRERR_RETRY);
241#endif
240 lj_trace_end(J); 242 lj_trace_end(J);
241 J->cur.linktype = (uint8_t)linktype; 243 J->cur.linktype = (uint8_t)linktype;
242 J->cur.link = (uint16_t)lnk; 244 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)
1129 1131
1130/* -- Indexed access ------------------------------------------------------ */ 1132/* -- Indexed access ------------------------------------------------------ */
1131 1133
1134#ifdef LUAJIT_ENABLE_TABLE_BUMP
1132/* Bump table allocations in bytecode when they grow during recording. */ 1135/* Bump table allocations in bytecode when they grow during recording. */
1133static void rec_idx_bump(jit_State *J, RecordIndex *ix) 1136static void rec_idx_bump(jit_State *J, RecordIndex *ix)
1134{ 1137{
@@ -1192,6 +1195,7 @@ static void rec_idx_bump(jit_State *J, RecordIndex *ix)
1192 } 1195 }
1193 } 1196 }
1194} 1197}
1198#endif
1195 1199
1196/* Record bounds-check. */ 1200/* Record bounds-check. */
1197static void rec_idx_abc(jit_State *J, TRef asizeref, TRef ikey, uint32_t asize) 1201static 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)
1418 key = emitir(IRTN(IR_CONV), key, IRCONV_NUM_INT); 1422 key = emitir(IRTN(IR_CONV), key, IRCONV_NUM_INT);
1419 xref = emitir(IRT(IR_NEWREF, IRT_P32), ix->tab, key); 1423 xref = emitir(IRT(IR_NEWREF, IRT_P32), ix->tab, key);
1420 keybarrier = 0; /* NEWREF already takes care of the key barrier. */ 1424 keybarrier = 0; /* NEWREF already takes care of the key barrier. */
1425#ifdef LUAJIT_ENABLE_TABLE_BUMP
1421 if ((J->flags & JIT_F_OPT_SINK)) /* Avoid a separate flag. */ 1426 if ((J->flags & JIT_F_OPT_SINK)) /* Avoid a separate flag. */
1422 rec_idx_bump(J, ix); 1427 rec_idx_bump(J, ix);
1428#endif
1423 } 1429 }
1424 } else if (!lj_opt_fwd_wasnonnil(J, loadop, tref_ref(xref))) { 1430 } else if (!lj_opt_fwd_wasnonnil(J, loadop, tref_ref(xref))) {
1425 /* Cannot derive that the previous value was non-nil, must do checks. */ 1431 /* 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)
1462 settabV(J->L, &ix.tabv, t); 1468 settabV(J->L, &ix.tabv, t);
1463 ix.tab = getslot(J, ra-1); 1469 ix.tab = getslot(J, ra-1);
1464 ix.idxchain = 0; 1470 ix.idxchain = 0;
1471#ifdef LUAJIT_ENABLE_TABLE_BUMP
1465 if ((J->flags & JIT_F_OPT_SINK)) { 1472 if ((J->flags & JIT_F_OPT_SINK)) {
1466 if (t->asize < i+rn-ra) 1473 if (t->asize < i+rn-ra)
1467 lj_tab_reasize(J->L, t, i+rn-ra); 1474 lj_tab_reasize(J->L, t, i+rn-ra);
1468 setnilV(&ix.keyv); 1475 setnilV(&ix.keyv);
1469 rec_idx_bump(J, &ix); 1476 rec_idx_bump(J, &ix);
1470 } 1477 }
1478#endif
1471 for (; ra < rn; i++, ra++) { 1479 for (; ra < rn; i++, ra++) {
1472 setintV(&ix.keyv, i); 1480 setintV(&ix.keyv, i);
1473 ix.key = lj_ir_kint(J, i); 1481 ix.key = lj_ir_kint(J, i);
@@ -1790,9 +1798,11 @@ static TRef rec_tnew(jit_State *J, uint32_t ah)
1790 TRef tr; 1798 TRef tr;
1791 if (asize == 0x7ff) asize = 0x801; 1799 if (asize == 0x7ff) asize = 0x801;
1792 tr = emitir(IRTG(IR_TNEW, IRT_TAB), asize, hbits); 1800 tr = emitir(IRTG(IR_TNEW, IRT_TAB), asize, hbits);
1801#ifdef LUAJIT_ENABLE_TABLE_BUMP
1793 J->rbchash[(tr & (RBCHASH_SLOTS-1))].ref = tref_ref(tr); 1802 J->rbchash[(tr & (RBCHASH_SLOTS-1))].ref = tref_ref(tr);
1794 setmref(J->rbchash[(tr & (RBCHASH_SLOTS-1))].pc, J->pc); 1803 setmref(J->rbchash[(tr & (RBCHASH_SLOTS-1))].pc, J->pc);
1795 setgcref(J->rbchash[(tr & (RBCHASH_SLOTS-1))].pt, obj2gco(J->pt)); 1804 setgcref(J->rbchash[(tr & (RBCHASH_SLOTS-1))].pt, obj2gco(J->pt));
1805#endif
1796 return tr; 1806 return tr;
1797} 1807}
1798 1808
@@ -2219,9 +2229,11 @@ void lj_record_ins(jit_State *J)
2219 case BC_TDUP: 2229 case BC_TDUP:
2220 rc = emitir(IRTG(IR_TDUP, IRT_TAB), 2230 rc = emitir(IRTG(IR_TDUP, IRT_TAB),
2221 lj_ir_ktab(J, gco2tab(proto_kgc(J->pt, ~(ptrdiff_t)rc))), 0); 2231 lj_ir_ktab(J, gco2tab(proto_kgc(J->pt, ~(ptrdiff_t)rc))), 0);
2232#ifdef LUAJIT_ENABLE_TABLE_BUMP
2222 J->rbchash[(rc & (RBCHASH_SLOTS-1))].ref = tref_ref(rc); 2233 J->rbchash[(rc & (RBCHASH_SLOTS-1))].ref = tref_ref(rc);
2223 setmref(J->rbchash[(rc & (RBCHASH_SLOTS-1))].pc, pc); 2234 setmref(J->rbchash[(rc & (RBCHASH_SLOTS-1))].pc, pc);
2224 setgcref(J->rbchash[(rc & (RBCHASH_SLOTS-1))].pt, obj2gco(J->pt)); 2235 setgcref(J->rbchash[(rc & (RBCHASH_SLOTS-1))].pt, obj2gco(J->pt));
2236#endif
2225 break; 2237 break;
2226 2238
2227 /* -- Calls and vararg handling ----------------------------------------- */ 2239 /* -- Calls and vararg handling ----------------------------------------- */
@@ -2435,7 +2447,9 @@ void lj_record_setup(jit_State *J)
2435 /* Initialize state related to current trace. */ 2447 /* Initialize state related to current trace. */
2436 memset(J->slot, 0, sizeof(J->slot)); 2448 memset(J->slot, 0, sizeof(J->slot));
2437 memset(J->chain, 0, sizeof(J->chain)); 2449 memset(J->chain, 0, sizeof(J->chain));
2450#ifdef LUAJIT_ENABLE_TABLE_BUMP
2438 memset(J->rbchash, 0, sizeof(J->rbchash)); 2451 memset(J->rbchash, 0, sizeof(J->rbchash));
2452#endif
2439 memset(J->bpropcache, 0, sizeof(J->bpropcache)); 2453 memset(J->bpropcache, 0, sizeof(J->bpropcache));
2440 J->scev.idx = REF_NIL; 2454 J->scev.idx = REF_NIL;
2441 setmref(J->scev.pc, NULL); 2455 setmref(J->scev.pc, NULL);