More tuning of loop unrolling heuristics.

This commit is contained in:
Mike Pall 2011-05-04 23:21:46 +02:00
parent b4006ba9a8
commit fb8b87e818

View File

@ -422,7 +422,8 @@ static LoopEvent rec_for(jit_State *J, const BCIns *fori, int isforl)
} else { /* Handle FORI/JFORI opcodes. */ } else { /* Handle FORI/JFORI opcodes. */
BCReg i; BCReg i;
lj_meta_for(J->L, tv); lj_meta_for(J->L, tv);
t = lj_opt_narrow_forl(J, tv); t = (LJ_DUALNUM || tref_isint(tr[FORL_IDX])) ? lj_opt_narrow_forl(J, tv) :
IRT_NUM;
for (i = FORL_IDX; i <= FORL_STEP; i++) { for (i = FORL_IDX; i <= FORL_STEP; i++) {
lua_assert(tref_isnumber_str(tr[i])); lua_assert(tref_isnumber_str(tr[i]));
if (tref_isstr(tr[i])) if (tref_isstr(tr[i]))
@ -521,9 +522,7 @@ static void rec_loop_interp(jit_State *J, const BCIns *pc, LoopEvent ev)
*/ */
if (!innerloopleft(J, pc)) if (!innerloopleft(J, pc))
lj_trace_err(J, LJ_TRERR_LINNER); /* Root trace hit an inner loop. */ lj_trace_err(J, LJ_TRERR_LINNER); /* Root trace hit an inner loop. */
if ((J->loopref && J->cur.nins - J->loopref > if ((J->loopref && J->cur.nins - J->loopref > 24) || --J->loopunroll < 0)
((IRRef)J->param[JIT_P_maxrecord] >> 5)) ||
--J->loopunroll < 0)
lj_trace_err(J, LJ_TRERR_LUNROLL); /* Limit loop unrolling. */ lj_trace_err(J, LJ_TRERR_LUNROLL); /* Limit loop unrolling. */
J->loopref = J->cur.nins; J->loopref = J->cur.nins;
} }