From 9eb832de5478fc8ac45bdc542178f49b390980b8 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 29 Mar 2010 17:45:49 -0300 Subject: work related to hooks moved from 'luaV_execute' to 'traceexec' --- lvm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lvm.c') diff --git a/lvm.c b/lvm.c index bcb4318f..8db185b3 100644 --- a/lvm.c +++ b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 2.106 2010/03/12 19:14:06 roberto Exp roberto $ +** $Id: lvm.c,v 2.107 2010/03/26 20:58:11 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -74,6 +74,10 @@ static void traceexec (lua_State *L) { luaD_hook(L, LUA_HOOKLINE, newline); } L->oldpc = ci->u.l.savedpc; + if (L->status == LUA_YIELD) { /* did hook yield? */ + ci->u.l.savedpc--; /* undo increment (resume will increment it again) */ + luaD_throw(L, LUA_YIELD); + } } @@ -460,10 +464,6 @@ void luaV_execute (lua_State *L) { if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) && (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) { traceexec(L); - if (L->status == LUA_YIELD) { /* did hook yield? */ - ci->u.l.savedpc--; /* undo increment */ - luaD_throw(L, LUA_YIELD); - } base = ci->u.l.base; } /* warning!! several calls may realloc the stack and invalidate `ra' */ -- cgit v1.2.3-55-g6feb