diff options
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.20 2005/03/28 17:17:53 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.21 2005/03/29 16:20:48 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -253,6 +253,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) { | |||
253 | func = tryfuncTM(L, func); /* check the `function' tag method */ | 253 | func = tryfuncTM(L, func); /* check the `function' tag method */ |
254 | funcr = savestack(L, func); | 254 | funcr = savestack(L, func); |
255 | cl = &clvalue(func)->l; | 255 | cl = &clvalue(func)->l; |
256 | L->ci->savedpc = L->savedpc; | ||
256 | if (!cl->isC) { /* Lua function? prepare its call */ | 257 | if (!cl->isC) { /* Lua function? prepare its call */ |
257 | CallInfo *ci; | 258 | CallInfo *ci; |
258 | StkId st, base; | 259 | StkId st, base; |
@@ -273,7 +274,7 @@ int luaD_precall (lua_State *L, StkId func, int nresults) { | |||
273 | L->base = ci->base = base; | 274 | L->base = ci->base = base; |
274 | ci->top = L->base + p->maxstacksize; | 275 | ci->top = L->base + p->maxstacksize; |
275 | lua_assert(ci->top <= L->stack_last); | 276 | lua_assert(ci->top <= L->stack_last); |
276 | ci->savedpc = p->code; /* starting point */ | 277 | L->savedpc = p->code; /* starting point */ |
277 | ci->tailcalls = 0; | 278 | ci->tailcalls = 0; |
278 | ci->nresults = nresults; | 279 | ci->nresults = nresults; |
279 | for (st = L->top; st < ci->top; st++) | 280 | for (st = L->top; st < ci->top; st++) |
@@ -325,6 +326,7 @@ void luaD_poscall (lua_State *L, int wanted, StkId firstResult) { | |||
325 | res = L->ci->func; /* res == final position of 1st result */ | 326 | res = L->ci->func; /* res == final position of 1st result */ |
326 | L->ci--; | 327 | L->ci--; |
327 | L->base = L->ci->base; /* restore base */ | 328 | L->base = L->ci->base; /* restore base */ |
329 | L->savedpc = L->ci->savedpc; /* restore savedpc */ | ||
328 | /* move results to correct place */ | 330 | /* move results to correct place */ |
329 | while (wanted != 0 && firstResult < L->top) { | 331 | while (wanted != 0 && firstResult < L->top) { |
330 | setobjs2s(L, res++, firstResult++); | 332 | setobjs2s(L, res++, firstResult++); |
@@ -451,6 +453,7 @@ int luaD_pcall (lua_State *L, Pfunc func, void *u, | |||
451 | L->nCcalls = oldnCcalls; | 453 | L->nCcalls = oldnCcalls; |
452 | L->ci = restoreci(L, old_ci); | 454 | L->ci = restoreci(L, old_ci); |
453 | L->base = L->ci->base; | 455 | L->base = L->ci->base; |
456 | L->savedpc = L->ci->savedpc; | ||
454 | L->allowhook = old_allowhooks; | 457 | L->allowhook = old_allowhooks; |
455 | restore_stack_limit(L); | 458 | restore_stack_limit(L); |
456 | } | 459 | } |