]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Disable table allocation bump optimization (for now).
authorMike Pall <mike>
Fri, 12 Jun 2015 22:42:38 +0000 (00:42 +0200)
committerMike Pall <mike>
Fri, 12 Jun 2015 22:42:38 +0000 (00:42 +0200)
src/lj_jit.h
src/lj_record.c

index 6965656895402965b548389d2f8a87d4adaa485a..1df56cae55ec6e5f700c2a1d341351b417f6ddb4 100644 (file)
@@ -393,7 +393,9 @@ typedef struct jit_State {
   uint32_t penaltyslot;        /* Round-robin index into penalty slots. */
   uint32_t prngstate;  /* PRNG state. */
 
+#ifdef LUAJIT_ENABLE_TABLE_BUMP
   RBCHashEntry rbchash[RBCHASH_SLOTS];  /* Reverse bytecode map. */
+#endif
 
   BPropEntry bpropcache[BPROP_SLOTS];  /* Backpropagation cache slots. */
   uint32_t bpropslot;  /* Round-robin index into bpropcache slots. */
index 9480448f91cf8bffbf583f3dbed75a1926a8b60e..dc5f2d547ae4fa262ecdd6096dc246320b8b4935 100644 (file)
@@ -235,8 +235,10 @@ static void canonicalize_slots(jit_State *J)
 /* Stop recording. */
 void lj_record_stop(jit_State *J, TraceLink linktype, TraceNo lnk)
 {
+#ifdef LUAJIT_ENABLE_TABLE_BUMP
   if (J->retryrec)
     lj_trace_err(J, LJ_TRERR_RETRY);
+#endif
   lj_trace_end(J);
   J->cur.linktype = (uint8_t)linktype;
   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 ------------------------------------------------------ */
 
+#ifdef LUAJIT_ENABLE_TABLE_BUMP
 /* Bump table allocations in bytecode when they grow during recording. */
 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. */
 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);
        xref = emitir(IRT(IR_NEWREF, IRT_P32), ix->tab, key);
        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. */
          rec_idx_bump(J, ix);
+#endif
       }
     } else if (!lj_opt_fwd_wasnonnil(J, loadop, tref_ref(xref))) {
       /* 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);
   ix.tab = getslot(J, ra-1);
   ix.idxchain = 0;
+#ifdef LUAJIT_ENABLE_TABLE_BUMP
   if ((J->flags & JIT_F_OPT_SINK)) {
     if (t->asize < i+rn-ra)
       lj_tab_reasize(J->L, t, i+rn-ra);
     setnilV(&ix.keyv);
     rec_idx_bump(J, &ix);
   }
+#endif
   for (; ra < rn; i++, ra++) {
     setintV(&ix.keyv, i);
     ix.key = lj_ir_kint(J, i);
@@ -1790,9 +1798,11 @@ static TRef rec_tnew(jit_State *J, uint32_t ah)
   TRef tr;
   if (asize == 0x7ff) asize = 0x801;
   tr = emitir(IRTG(IR_TNEW, IRT_TAB), asize, hbits);
+#ifdef LUAJIT_ENABLE_TABLE_BUMP
   J->rbchash[(tr & (RBCHASH_SLOTS-1))].ref = tref_ref(tr);
   setmref(J->rbchash[(tr & (RBCHASH_SLOTS-1))].pc, J->pc);
   setgcref(J->rbchash[(tr & (RBCHASH_SLOTS-1))].pt, obj2gco(J->pt));
+#endif
   return tr;
 }
 
@@ -2219,9 +2229,11 @@ void lj_record_ins(jit_State *J)
   case BC_TDUP:
     rc = emitir(IRTG(IR_TDUP, IRT_TAB),
                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);
     setmref(J->rbchash[(rc & (RBCHASH_SLOTS-1))].pc, pc);
     setgcref(J->rbchash[(rc & (RBCHASH_SLOTS-1))].pt, obj2gco(J->pt));
+#endif
     break;
 
   /* -- Calls and vararg handling ----------------------------------------- */
@@ -2435,7 +2447,9 @@ void lj_record_setup(jit_State *J)
   /* Initialize state related to current trace. */
   memset(J->slot, 0, sizeof(J->slot));
   memset(J->chain, 0, sizeof(J->chain));
+#ifdef LUAJIT_ENABLE_TABLE_BUMP
   memset(J->rbchash, 0, sizeof(J->rbchash));
+#endif
   memset(J->bpropcache, 0, sizeof(J->bpropcache));
   J->scev.idx = REF_NIL;
   setmref(J->scev.pc, NULL);