diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-03-29 17:45:49 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-03-29 17:45:49 -0300 |
commit | 9eb832de5478fc8ac45bdc542178f49b390980b8 (patch) | |
tree | 0f26a9d296b5f3445073ce0c9e3d6ec5127ccf00 | |
parent | 82a1f5d35462f26269b22ad72ef771e870c1417d (diff) | |
download | lua-9eb832de5478fc8ac45bdc542178f49b390980b8.tar.gz lua-9eb832de5478fc8ac45bdc542178f49b390980b8.tar.bz2 lua-9eb832de5478fc8ac45bdc542178f49b390980b8.zip |
work related to hooks moved from 'luaV_execute' to 'traceexec'
-rw-r--r-- | lvm.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.106 2010/03/12 19:14:06 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.107 2010/03/26 20:58: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 | */ |
@@ -74,6 +74,10 @@ static void traceexec (lua_State *L) { | |||
74 | luaD_hook(L, LUA_HOOKLINE, newline); | 74 | luaD_hook(L, LUA_HOOKLINE, newline); |
75 | } | 75 | } |
76 | L->oldpc = ci->u.l.savedpc; | 76 | L->oldpc = ci->u.l.savedpc; |
77 | if (L->status == LUA_YIELD) { /* did hook yield? */ | ||
78 | ci->u.l.savedpc--; /* undo increment (resume will increment it again) */ | ||
79 | luaD_throw(L, LUA_YIELD); | ||
80 | } | ||
77 | } | 81 | } |
78 | 82 | ||
79 | 83 | ||
@@ -460,10 +464,6 @@ void luaV_execute (lua_State *L) { | |||
460 | if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) && | 464 | if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) && |
461 | (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) { | 465 | (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) { |
462 | traceexec(L); | 466 | traceexec(L); |
463 | if (L->status == LUA_YIELD) { /* did hook yield? */ | ||
464 | ci->u.l.savedpc--; /* undo increment */ | ||
465 | luaD_throw(L, LUA_YIELD); | ||
466 | } | ||
467 | base = ci->u.l.base; | 467 | base = ci->u.l.base; |
468 | } | 468 | } |
469 | /* warning!! several calls may realloc the stack and invalidate `ra' */ | 469 | /* warning!! several calls may realloc the stack and invalidate `ra' */ |