diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-11-19 06:50:56 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-11-19 06:50:56 -0200 |
| commit | 642af82e81bbc54b634649f197c62a35e156c096 (patch) | |
| tree | f50dbd4b21ec4742e189a064ba773b07340a27bb | |
| parent | 636c629e563262e7f0d02606abbe3605b7e0747a (diff) | |
| download | lua-642af82e81bbc54b634649f197c62a35e156c096.tar.gz lua-642af82e81bbc54b634649f197c62a35e156c096.tar.bz2 lua-642af82e81bbc54b634649f197c62a35e156c096.zip | |
small bugs (state could keep its CI_HASFRAME attribute after returning)
| -rw-r--r-- | lvm.c | 13 |
1 files changed, 8 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 1.262 2002/11/18 11:01:55 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.263 2002/11/18 15:24:11 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 | */ |
| @@ -382,7 +382,8 @@ StkId luaV_execute (lua_State *L) { | |||
| 382 | if (L->hookmask & LUA_MASKCALL) | 382 | if (L->hookmask & LUA_MASKCALL) |
| 383 | luaD_callhook(L, LUA_HOOKCALL, -1); | 383 | luaD_callhook(L, LUA_HOOKCALL, -1); |
| 384 | retentry: /* entry point when returning to old functions */ | 384 | retentry: /* entry point when returning to old functions */ |
| 385 | lua_assert(L->ci->state & CI_SAVEDPC); | 385 | lua_assert(L->ci->state == CI_SAVEDPC || |
| 386 | L->ci->state == (CI_SAVEDPC | CI_CALLING)); | ||
| 386 | L->ci->state = CI_HASFRAME; /* activate frame */ | 387 | L->ci->state = CI_HASFRAME; /* activate frame */ |
| 387 | pc = L->ci->u.l.savedpc; | 388 | pc = L->ci->u.l.savedpc; |
| 388 | base = L->ci->base; | 389 | base = L->ci->base; |
| @@ -397,11 +398,12 @@ StkId luaV_execute (lua_State *L) { | |||
| 397 | traceexec(L); | 398 | traceexec(L); |
| 398 | if (L->ci->state & CI_YIELD) { /* did hook yield? */ | 399 | if (L->ci->state & CI_YIELD) { /* did hook yield? */ |
| 399 | L->ci->u.l.savedpc = pc - 1; | 400 | L->ci->u.l.savedpc = pc - 1; |
| 400 | L->ci->state |= CI_SAVEDPC; | 401 | L->ci->state = CI_YIELD | CI_SAVEDPC; |
| 401 | return NULL; | 402 | return NULL; |
| 402 | } | 403 | } |
| 403 | } | 404 | } |
| 404 | /* warning!! several calls may realloc the stack and invalidate `ra' */ | 405 | /* warning!! several calls may realloc the stack and invalidate `ra' */ |
| 406 | lua_assert((L->ci->state & CI_HASFRAME) && base == L->ci->base); | ||
| 405 | ra = RA(i); | 407 | ra = RA(i); |
| 406 | lua_assert(L->top <= L->stack + L->stacksize && L->top >= L->ci->base); | 408 | lua_assert(L->top <= L->stack + L->stacksize && L->top >= L->ci->base); |
| 407 | lua_assert(L->top == L->ci->top || | 409 | lua_assert(L->top == L->ci->top || |
| @@ -600,8 +602,9 @@ StkId luaV_execute (lua_State *L) { | |||
| 600 | firstResult = luaD_precall(L, ra); | 602 | firstResult = luaD_precall(L, ra); |
| 601 | if (firstResult) { | 603 | if (firstResult) { |
| 602 | if (firstResult > L->top) { /* yield? */ | 604 | if (firstResult > L->top) { /* yield? */ |
| 605 | lua_assert(L->ci->state == (CI_C | CI_YIELD)); | ||
| 603 | (L->ci - 1)->u.l.savedpc = pc; | 606 | (L->ci - 1)->u.l.savedpc = pc; |
| 604 | (L->ci - 1)->state |= CI_SAVEDPC; | 607 | (L->ci - 1)->state = CI_SAVEDPC; |
| 605 | return NULL; | 608 | return NULL; |
| 606 | } | 609 | } |
| 607 | /* it was a C function (`precall' called it); adjust results */ | 610 | /* it was a C function (`precall' called it); adjust results */ |
| @@ -623,7 +626,7 @@ StkId luaV_execute (lua_State *L) { | |||
| 623 | lua_assert(L->ci->state & CI_SAVEDPC); | 626 | lua_assert(L->ci->state & CI_SAVEDPC); |
| 624 | (L->ci - 1)->u.l.savedpc = L->ci->u.l.savedpc; | 627 | (L->ci - 1)->u.l.savedpc = L->ci->u.l.savedpc; |
| 625 | (L->ci - 1)->state = CI_SAVEDPC; | 628 | (L->ci - 1)->state = CI_SAVEDPC; |
| 626 | L->ci--; /* remove previous frame */ | 629 | L->ci--; /* remove new frame */ |
| 627 | } | 630 | } |
| 628 | goto callentry; | 631 | goto callentry; |
| 629 | } | 632 | } |
