diff options
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.83 2009/03/04 13:32:29 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.84 2009/03/10 17:14:37 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -663,19 +663,19 @@ void luaV_execute (lua_State *L) { | |||
663 | } | 663 | } |
664 | else { | 664 | else { |
665 | /* tail call: put new frame in place of previous one */ | 665 | /* tail call: put new frame in place of previous one */ |
666 | CallInfo *ci = L->ci - 1; /* previous frame */ | 666 | StkId pfunc = L->ci->func; /* called function index */ |
667 | int aux; | 667 | CallInfo *ci = L->ci->previous; /* caller frame */ |
668 | StkId func = ci->func; | 668 | StkId func = ci->func; |
669 | StkId pfunc = (ci+1)->func; /* previous function index */ | 669 | int aux; |
670 | if (cl->p->sizep > 0) luaF_close(L, ci->base); | 670 | if (cl->p->sizep > 0) luaF_close(L, ci->base); |
671 | L->base = ci->base = ci->func + ((ci+1)->base - pfunc); | 671 | L->base = ci->base = ci->func + (L->ci->base - pfunc); |
672 | for (aux = 0; pfunc+aux < L->top; aux++) /* move frame down */ | 672 | for (aux = 0; pfunc+aux < L->top; aux++) /* move frame down */ |
673 | setobjs2s(L, func+aux, pfunc+aux); | 673 | setobjs2s(L, func+aux, pfunc+aux); |
674 | ci->top = L->top = func+aux; /* correct top */ | 674 | ci->top = L->top = func+aux; /* correct top */ |
675 | lua_assert(L->top == L->base + clvalue(func)->l.p->maxstacksize); | 675 | lua_assert(L->top == L->base + clvalue(func)->l.p->maxstacksize); |
676 | ci->savedpc = L->savedpc; | 676 | ci->savedpc = L->savedpc; |
677 | ci->u.l.tailcalls++; /* one more call lost */ | 677 | ci->u.l.tailcalls++; /* one more call lost */ |
678 | L->ci--; /* remove new frame */ | 678 | L->ci = ci; /* remove new frame */ |
679 | goto reentry; | 679 | goto reentry; |
680 | } | 680 | } |
681 | } | 681 | } |
@@ -684,7 +684,7 @@ void luaV_execute (lua_State *L) { | |||
684 | if (b != 0) L->top = ra+b-1; | 684 | if (b != 0) L->top = ra+b-1; |
685 | if (cl->p->sizep > 0) luaF_close(L, base); | 685 | if (cl->p->sizep > 0) luaF_close(L, base); |
686 | b = luaD_poscall(L, ra); | 686 | b = luaD_poscall(L, ra); |
687 | if (!((L->ci + 1)->callstatus & CIST_REENTRY)) | 687 | if (!(L->ci->next->callstatus & CIST_REENTRY)) |
688 | return; /* external invocation: return */ | 688 | return; /* external invocation: return */ |
689 | else { /* invocation via reentry: continue execution */ | 689 | else { /* invocation via reentry: continue execution */ |
690 | if (b) L->top = L->ci->top; | 690 | if (b) L->top = L->ci->top; |