diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-11-18 09:01:55 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-11-18 09:01:55 -0200 |
| commit | 43013b39cc28e873e18207e8e7259b6b90fed06b (patch) | |
| tree | 3c2a9c520a01086df28c8f0d1ef6d9b5069fa451 /lvm.c | |
| parent | 94912d99fcdf61c1fc6dc8897c9d2b0e042e0d63 (diff) | |
| download | lua-43013b39cc28e873e18207e8e7259b6b90fed06b.tar.gz lua-43013b39cc28e873e18207e8e7259b6b90fed06b.tar.bz2 lua-43013b39cc28e873e18207e8e7259b6b90fed06b.zip | |
new representation for hooks (to allow asynchronous calls to sethook)
Diffstat (limited to 'lvm.c')
| -rw-r--r-- | lvm.c | 8 |
1 files changed, 6 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 1.260 2002/11/07 15:37:10 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.261 2002/11/14 16:15:53 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 | */ |
| @@ -70,7 +70,7 @@ int luaV_tostring (lua_State *L, StkId obj) { | |||
| 70 | 70 | ||
| 71 | 71 | ||
| 72 | static void traceexec (lua_State *L) { | 72 | static void traceexec (lua_State *L) { |
| 73 | unsigned long mask = L->hookmask; | 73 | lu_byte mask = L->hookmask; |
| 74 | if (mask > LUA_MASKLINE) { /* instruction-hook set? */ | 74 | if (mask > LUA_MASKLINE) { /* instruction-hook set? */ |
| 75 | if (L->hookcount == 0) { | 75 | if (L->hookcount == 0) { |
| 76 | luaD_callhook(L, LUA_HOOKCOUNT, -1); | 76 | luaD_callhook(L, LUA_HOOKCOUNT, -1); |
| @@ -82,6 +82,10 @@ static void traceexec (lua_State *L) { | |||
| 82 | CallInfo *ci = L->ci; | 82 | CallInfo *ci = L->ci; |
| 83 | Proto *p = ci_func(ci)->l.p; | 83 | Proto *p = ci_func(ci)->l.p; |
| 84 | int newline = getline(p, pcRel(*ci->u.l.pc, p)); | 84 | int newline = getline(p, pcRel(*ci->u.l.pc, p)); |
| 85 | if (!L->hookinit) { | ||
| 86 | luaG_inithooks(L); | ||
| 87 | return; | ||
| 88 | } | ||
| 85 | lua_assert(ci->state & CI_HASFRAME); | 89 | lua_assert(ci->state & CI_HASFRAME); |
| 86 | if (pcRel(*ci->u.l.pc, p) == 0) /* tracing may be starting now? */ | 90 | if (pcRel(*ci->u.l.pc, p) == 0) /* tracing may be starting now? */ |
| 87 | ci->u.l.savedpc = *ci->u.l.pc; /* initialize `savedpc' */ | 91 | ci->u.l.savedpc = *ci->u.l.pc; /* initialize `savedpc' */ |
