Add region selection for up-recursion and tail-recursion.

This commit is contained in:
Mike Pall 2010-02-22 14:35:47 +01:00
parent e76bcd2914
commit 19af483166
3 changed files with 5 additions and 4 deletions

View File

@ -76,7 +76,7 @@
_(\012, instunroll, 4) /* Max. unroll for instable loops. */ \
_(\012, loopunroll, 7) /* Max. unroll for loop ops in side traces. */ \
_(\012, callunroll, 3) /* Max. unroll for recursive calls. */ \
_(\011, recunroll, 0) /* Max. unroll for true recursion. */ \
_(\011, recunroll, 2) /* Max. unroll for true recursion. */ \
\
/* Size of each machine code area (in KBytes). */ \
_(\011, sizemcode, JIT_P_sizemcode_DEFAULT) \

View File

@ -1726,8 +1726,10 @@ static void check_call_unroll(jit_State *J)
if ((J->slot[s] & TREF_FRAME) && tref_ref(J->slot[s]) == fref)
count++;
if (J->pc == J->startpc) {
if (count + (int32_t)(J->tailcalled & 0xff) > J->param[JIT_P_recunroll])
lj_trace_err(J, LJ_TRERR_NYIRECU);
if (count + (int32_t)(J->tailcalled & 0xff) > J->param[JIT_P_recunroll]) {
J->pc++;
rec_stop(J, J->curtrace); /* Up-recursion or tail-recursion. */
}
} else {
if (count > J->param[JIT_P_callunroll])
lj_trace_err(J, LJ_TRERR_CUNROLL);

View File

@ -22,7 +22,6 @@ TREDEF(LBLACKL, "blacklisted loop")
TREDEF(BADTYPE, "bad argument type")
TREDEF(CJITOFF, "call to JIT-disabled function")
TREDEF(CUNROLL, "call unroll limit reached")
TREDEF(NYIRECU, "NYI: recursive calls")
TREDEF(NYIVF, "NYI: vararg function")
TREDEF(NYICF, "NYI: C function %p")
TREDEF(NYIFF, "NYI: FastFunc %s")