summaryrefslogtreecommitdiff
path: root/src/lj_record.c
diff options
context:
space:
mode:
authorMike Pall <mike>2010-02-22 16:57:59 +0100
committerMike Pall <mike>2010-02-22 16:57:59 +0100
commit86494c783df79c59d8b92c8ffe110dd9189534e2 (patch)
tree80d11db4d74fab967ed906cd361e02be99333fef /src/lj_record.c
parent19af48316655fac73f6a75a03d65fc6c9a4c7c1a (diff)
downloadluajit-86494c783df79c59d8b92c8ffe110dd9189534e2.tar.gz
luajit-86494c783df79c59d8b92c8ffe110dd9189534e2.tar.bz2
luajit-86494c783df79c59d8b92c8ffe110dd9189534e2.zip
Back out history buffer for tailcall counts.
Use an aggregate counter independent of frame depth.
Diffstat (limited to 'src/lj_record.c')
-rw-r--r--src/lj_record.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/lj_record.c b/src/lj_record.c
index 45a8ef5f..83d0918f 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -505,7 +505,6 @@ static void rec_call(jit_State *J, BCReg func, ptrdiff_t nargs)
505 rec_call_setup(J, func, nargs); 505 rec_call_setup(J, func, nargs);
506 /* Bump frame. */ 506 /* Bump frame. */
507 J->framedepth++; 507 J->framedepth++;
508 J->tailcalled <<= 8; /* NYI: tail call history overflow is ignored. */
509 J->base += func+1; 508 J->base += func+1;
510 J->baseslot += func+1; 509 J->baseslot += func+1;
511} 510}
@@ -518,7 +517,7 @@ static void rec_tailcall(jit_State *J, BCReg func, ptrdiff_t nargs)
518 memmove(&J->base[-1], &J->base[func], sizeof(TRef)*(J->maxslot+1)); 517 memmove(&J->base[-1], &J->base[func], sizeof(TRef)*(J->maxslot+1));
519 /* Note: the new TREF_FRAME is now at J->base[-1] (even for slot #0). */ 518 /* Note: the new TREF_FRAME is now at J->base[-1] (even for slot #0). */
520 /* Tailcalls can form a loop, so count towards the loop unroll limit. */ 519 /* Tailcalls can form a loop, so count towards the loop unroll limit. */
521 if ((int32_t)(++J->tailcalled & 0xff) > J->loopunroll) 520 if (++J->tailcalled > J->loopunroll)
522 lj_trace_err(J, LJ_TRERR_LUNROLL); 521 lj_trace_err(J, LJ_TRERR_LUNROLL);
523} 522}
524 523
@@ -527,7 +526,6 @@ static void rec_ret(jit_State *J, BCReg rbase, ptrdiff_t gotresults)
527{ 526{
528 TValue *frame = J->L->base - 1; 527 TValue *frame = J->L->base - 1;
529 ptrdiff_t i; 528 ptrdiff_t i;
530 J->tailcalled >>= 8;
531 for (i = 0; i < gotresults; i++) 529 for (i = 0; i < gotresults; i++)
532 getslot(J, rbase+i); /* Ensure all results have a reference. */ 530 getslot(J, rbase+i); /* Ensure all results have a reference. */
533 while (frame_ispcall(frame)) { /* Immediately resolve pcall() returns. */ 531 while (frame_ispcall(frame)) { /* Immediately resolve pcall() returns. */
@@ -1726,7 +1724,7 @@ static void check_call_unroll(jit_State *J)
1726 if ((J->slot[s] & TREF_FRAME) && tref_ref(J->slot[s]) == fref) 1724 if ((J->slot[s] & TREF_FRAME) && tref_ref(J->slot[s]) == fref)
1727 count++; 1725 count++;
1728 if (J->pc == J->startpc) { 1726 if (J->pc == J->startpc) {
1729 if (count + (int32_t)(J->tailcalled & 0xff) > J->param[JIT_P_recunroll]) { 1727 if (count + J->tailcalled > J->param[JIT_P_recunroll]) {
1730 J->pc++; 1728 J->pc++;
1731 rec_stop(J, J->curtrace); /* Up-recursion or tail-recursion. */ 1729 rec_stop(J, J->curtrace); /* Up-recursion or tail-recursion. */
1732 } 1730 }