Clean up frame depth checks and loop detection.

This commit is contained in:
Mike Pall
2010-02-03 14:55:56 +01:00
parent c1c9abeab7
commit 318e86c7eb
3 changed files with 12 additions and 6 deletions

View File

@@ -491,7 +491,8 @@ static TValue *trace_state(lua_State *L, lua_CFunction dummy, void *ud)
case LJ_TRACE_END:
J->loopref = 0;
if ((J->flags & JIT_F_OPT_LOOP) && J->cur.link == J->curtrace) {
if ((J->flags & JIT_F_OPT_LOOP) &&
J->cur.link == J->curtrace && J->framedepth + J->retdepth == 0) {
setvmstate(J2G(J), OPT);
lj_opt_dce(J);
if (lj_opt_loop(J)) { /* Loop optimization failed? */