Loop formation test must check for return to lower frame.

This commit is contained in:
Mike Pall 2010-01-29 15:07:40 +01:00
parent 8681b7330f
commit 96e8a56260

View File

@ -368,7 +368,8 @@ static int innerloopleft(jit_State *J, const BCIns *pc)
static void rec_loop_interp(jit_State *J, const BCIns *pc, LoopEvent ev)
{
if (J->parent == 0) {
if (pc == J->startpc && J->framedepth == 0) { /* Same loop? */
if (pc == J->startpc && J->framedepth == 0 && !J->chain[IR_RETF]) {
/* Same loop? */
if (ev == LOOPEV_LEAVE) /* Must loop back to form a root trace. */
lj_trace_err(J, LJ_TRERR_LLEAVE);
rec_stop(J, J->curtrace); /* Root trace forms a loop. */