diff options
author | Mike Pall <mike> | 2010-04-25 13:53:33 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2010-04-25 13:53:33 +0200 |
commit | 2e24770ed3241342a6a5896e05629a382d35262b (patch) | |
tree | fc990e0c403375fe16e8a017da1d2c277ffa2436 /src/lj_record.c | |
parent | 721b73fecbbeda5b5cb76628511c5b3fac41eb4d (diff) | |
download | luajit-2e24770ed3241342a6a5896e05629a382d35262b.tar.gz luajit-2e24770ed3241342a6a5896e05629a382d35262b.tar.bz2 luajit-2e24770ed3241342a6a5896e05629a382d35262b.zip |
Simplify management of current trace. Drop lazy save.
Diffstat (limited to 'src/lj_record.c')
-rw-r--r-- | src/lj_record.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lj_record.c b/src/lj_record.c index a3f5b9c0..c71aa1a4 100644 --- a/src/lj_record.c +++ b/src/lj_record.c | |||
@@ -232,7 +232,7 @@ static void rec_stop(jit_State *J, TraceNo lnk) | |||
232 | lj_trace_end(J); | 232 | lj_trace_end(J); |
233 | J->cur.link = (uint16_t)lnk; | 233 | J->cur.link = (uint16_t)lnk; |
234 | /* Looping back at the same stack level? */ | 234 | /* Looping back at the same stack level? */ |
235 | if (lnk == J->curtrace && J->framedepth + J->retdepth == 0) { | 235 | if (lnk == J->cur.traceno && J->framedepth + J->retdepth == 0) { |
236 | if ((J->flags & JIT_F_OPT_LOOP)) /* Shall we try to create a loop? */ | 236 | if ((J->flags & JIT_F_OPT_LOOP)) /* Shall we try to create a loop? */ |
237 | goto nocanon; /* Do not canonicalize or we lose the narrowing. */ | 237 | goto nocanon; /* Do not canonicalize or we lose the narrowing. */ |
238 | if (J->cur.root) /* Otherwise ensure we always link to the root trace. */ | 238 | if (J->cur.root) /* Otherwise ensure we always link to the root trace. */ |
@@ -442,7 +442,7 @@ static void rec_loop_interp(jit_State *J, const BCIns *pc, LoopEvent ev) | |||
442 | /* Same loop? */ | 442 | /* Same loop? */ |
443 | if (ev == LOOPEV_LEAVE) /* Must loop back to form a root trace. */ | 443 | if (ev == LOOPEV_LEAVE) /* Must loop back to form a root trace. */ |
444 | lj_trace_err(J, LJ_TRERR_LLEAVE); | 444 | lj_trace_err(J, LJ_TRERR_LLEAVE); |
445 | rec_stop(J, J->curtrace); /* Root trace forms a loop. */ | 445 | rec_stop(J, J->cur.traceno); /* Root trace forms a loop. */ |
446 | } else if (ev != LOOPEV_LEAVE) { /* Entering inner loop? */ | 446 | } else if (ev != LOOPEV_LEAVE) { /* Entering inner loop? */ |
447 | /* It's usually better to abort here and wait until the inner loop | 447 | /* It's usually better to abort here and wait until the inner loop |
448 | ** is traced. But if the inner loop repeatedly didn't loop back, | 448 | ** is traced. But if the inner loop repeatedly didn't loop back, |
@@ -472,7 +472,7 @@ static void rec_loop_jit(jit_State *J, TraceNo lnk, LoopEvent ev) | |||
472 | } else if (ev != LOOPEV_LEAVE) { /* Side trace enters a compiled loop. */ | 472 | } else if (ev != LOOPEV_LEAVE) { /* Side trace enters a compiled loop. */ |
473 | J->instunroll = 0; /* Cannot continue across a compiled loop op. */ | 473 | J->instunroll = 0; /* Cannot continue across a compiled loop op. */ |
474 | if (J->pc == J->startpc && J->framedepth + J->retdepth == 0) | 474 | if (J->pc == J->startpc && J->framedepth + J->retdepth == 0) |
475 | lnk = J->curtrace; /* Can form an extra loop. */ | 475 | lnk = J->cur.traceno; /* Can form an extra loop. */ |
476 | rec_stop(J, lnk); /* Link to the loop. */ | 476 | rec_stop(J, lnk); /* Link to the loop. */ |
477 | } /* Side trace continues across a loop that's left or not entered. */ | 477 | } /* Side trace continues across a loop that's left or not entered. */ |
478 | } | 478 | } |
@@ -578,7 +578,7 @@ static void rec_ret(jit_State *J, BCReg rbase, ptrdiff_t gotresults) | |||
578 | if (J->framedepth == 0 && J->pt && frame == J->L->base - 1) { | 578 | if (J->framedepth == 0 && J->pt && frame == J->L->base - 1) { |
579 | if (check_downrec_unroll(J, pt)) { | 579 | if (check_downrec_unroll(J, pt)) { |
580 | J->maxslot = (BCReg)(rbase + nresults); | 580 | J->maxslot = (BCReg)(rbase + nresults); |
581 | rec_stop(J, J->curtrace); /* Down-recursion. */ | 581 | rec_stop(J, J->cur.traceno); /* Down-recursion. */ |
582 | return; | 582 | return; |
583 | } | 583 | } |
584 | lj_snap_add(J); | 584 | lj_snap_add(J); |
@@ -1836,7 +1836,7 @@ static void check_call_unroll(jit_State *J) | |||
1836 | if (J->pc == J->startpc) { | 1836 | if (J->pc == J->startpc) { |
1837 | if (count + J->tailcalled > J->param[JIT_P_recunroll]) { | 1837 | if (count + J->tailcalled > J->param[JIT_P_recunroll]) { |
1838 | J->pc++; | 1838 | J->pc++; |
1839 | rec_stop(J, J->curtrace); /* Up-recursion or tail-recursion. */ | 1839 | rec_stop(J, J->cur.traceno); /* Up-recursion or tail-recursion. */ |
1840 | } | 1840 | } |
1841 | } else { | 1841 | } else { |
1842 | if (count > J->param[JIT_P_callunroll]) | 1842 | if (count > J->param[JIT_P_callunroll]) |
@@ -1874,7 +1874,7 @@ static void rec_func_jit(jit_State *J, TraceNo lnk) | |||
1874 | rec_func_setup(J); | 1874 | rec_func_setup(J); |
1875 | J->instunroll = 0; /* Cannot continue across a compiled function. */ | 1875 | J->instunroll = 0; /* Cannot continue across a compiled function. */ |
1876 | if (J->pc == J->startpc && J->framedepth + J->retdepth == 0) | 1876 | if (J->pc == J->startpc && J->framedepth + J->retdepth == 0) |
1877 | lnk = J->curtrace; /* Can form an extra tail-recursive loop. */ | 1877 | lnk = J->cur.traceno; /* Can form an extra tail-recursive loop. */ |
1878 | rec_stop(J, lnk); /* Link to the function. */ | 1878 | rec_stop(J, lnk); /* Link to the function. */ |
1879 | } | 1879 | } |
1880 | 1880 | ||