diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-07-08 17:22:08 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-07-08 17:22:08 -0300 |
| commit | 44752fc9ce2588a9b402d335c87660a9ee28a157 (patch) | |
| tree | 824f78c6256f46d25dbeab117a5bfcca0bbfb67a | |
| parent | 39b2d58c39fd0cd554b27ed071926bc439338964 (diff) | |
| download | lua-44752fc9ce2588a9b402d335c87660a9ee28a157.tar.gz lua-44752fc9ce2588a9b402d335c87660a9ee28a157.tar.bz2 lua-44752fc9ce2588a9b402d335c87660a9ee28a157.zip | |
hook count is quadratic
| -rw-r--r-- | ldblib.c | 4 | ||||
| -rw-r--r-- | ldebug.h | 4 | ||||
| -rw-r--r-- | llimits.h | 6 | ||||
| -rw-r--r-- | lstate.h | 4 | ||||
| -rw-r--r-- | luadebug.h | 5 | ||||
| -rw-r--r-- | lvm.c | 4 |
6 files changed, 15 insertions, 12 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldblib.c,v 1.61 2002/06/25 19:16:44 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.62 2002/07/08 18:21:33 roberto Exp roberto $ |
| 3 | ** Interface from Lua to its debug API | 3 | ** Interface from Lua to its debug API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -132,7 +132,7 @@ static int makemask (const char *smask, int count) { | |||
| 132 | if (strchr(smask, 'c')) mask |= LUA_MASKCALL; | 132 | if (strchr(smask, 'c')) mask |= LUA_MASKCALL; |
| 133 | if (strchr(smask, 'r')) mask |= LUA_MASKRET; | 133 | if (strchr(smask, 'r')) mask |= LUA_MASKRET; |
| 134 | if (strchr(smask, 'l')) mask |= LUA_MASKLINE; | 134 | if (strchr(smask, 'l')) mask |= LUA_MASKLINE; |
| 135 | return mask | lua_maskcount(count); | 135 | return mask | LUA_MASKCOUNT(count); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | 138 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.h,v 1.23 2002/06/24 15:07:21 roberto Exp roberto $ | 2 | ** $Id: ldebug.h,v 1.24 2002/07/08 18:21:33 roberto Exp roberto $ |
| 3 | ** Auxiliary functions from Debug Interface module | 3 | ** Auxiliary functions from Debug Interface module |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -17,7 +17,7 @@ | |||
| 17 | #define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) | 17 | #define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) |
| 18 | 18 | ||
| 19 | #define resethookcount(L) \ | 19 | #define resethookcount(L) \ |
| 20 | (L->hookcount = (1 << lua_getmaskcount(L->hookmask)) >> 1) | 20 | (L->hookcount = lua_getmaskcount(L->hookmask), L->hookcount *= L->hookcount) |
| 21 | 21 | ||
| 22 | #define setallowhook(L,cond) ((L->hookmask) = ((L->hookmask) & ~1) | (cond)) | 22 | #define setallowhook(L,cond) ((L->hookmask) = ((L->hookmask) & ~1) | (cond)) |
| 23 | #define allowhook(L) ((L->hookmask) & 1) | 23 | #define allowhook(L) ((L->hookmask) & 1) |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: llimits.h,v 1.43 2002/04/23 14:59:35 roberto Exp roberto $ | 2 | ** $Id: llimits.h,v 1.44 2002/06/13 13:45:31 roberto Exp roberto $ |
| 3 | ** Limits, basic types, and some other `installation-dependent' definitions | 3 | ** Limits, basic types, and some other `installation-dependent' definitions |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -52,6 +52,10 @@ typedef unsigned long lu_mem; | |||
| 52 | /* an integer big enough to count the number of strings in use */ | 52 | /* an integer big enough to count the number of strings in use */ |
| 53 | typedef long ls_nstr; | 53 | typedef long ls_nstr; |
| 54 | 54 | ||
| 55 | /* an integer big enough to count the number of steps when calling a | ||
| 56 | ** `count' hook */ | ||
| 57 | typedef long ls_count; | ||
| 58 | |||
| 55 | 59 | ||
| 56 | /* chars used as small naturals (so that `char' is reserved for characteres) */ | 60 | /* chars used as small naturals (so that `char' is reserved for characteres) */ |
| 57 | typedef unsigned char lu_byte; | 61 | typedef unsigned char lu_byte; |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstate.h,v 1.86 2002/07/02 16:43:28 roberto Exp roberto $ | 2 | ** $Id: lstate.h,v 1.87 2002/07/08 18:21:33 roberto Exp roberto $ |
| 3 | ** Global State | 3 | ** Global State |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -131,7 +131,7 @@ struct lua_State { | |||
| 131 | CallInfo *base_ci; /* array of CallInfo's */ | 131 | CallInfo *base_ci; /* array of CallInfo's */ |
| 132 | global_State *l_G; | 132 | global_State *l_G; |
| 133 | int hookmask; | 133 | int hookmask; |
| 134 | int hookcount; | 134 | ls_count hookcount; |
| 135 | lua_Hook hook; | 135 | lua_Hook hook; |
| 136 | TObject globs[NUMGLOBS]; /* registry, table of globals, etc. */ | 136 | TObject globs[NUMGLOBS]; /* registry, table of globals, etc. */ |
| 137 | struct lua_longjmp *errorJmp; /* current error recover point */ | 137 | struct lua_longjmp *errorJmp; /* current error recover point */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: luadebug.h,v 1.28 2002/06/18 17:10:43 roberto Exp roberto $ | 2 | ** $Id: luadebug.h,v 1.29 2002/07/08 18:21:33 roberto Exp roberto $ |
| 3 | ** Debugging API | 3 | ** Debugging API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -19,9 +19,8 @@ typedef enum lua_Hookevent { | |||
| 19 | #define LUA_MASKCALL (2 << LUA_HOOKCALL) | 19 | #define LUA_MASKCALL (2 << LUA_HOOKCALL) |
| 20 | #define LUA_MASKRET (2 << LUA_HOOKRET) | 20 | #define LUA_MASKRET (2 << LUA_HOOKRET) |
| 21 | #define LUA_MASKLINE (2 << LUA_HOOKLINE) | 21 | #define LUA_MASKLINE (2 << LUA_HOOKLINE) |
| 22 | #define lua_maskcount(count) ((count) << (LUA_HOOKCOUNT+1)) | 22 | #define LUA_MASKCOUNT(count) ((count) << (LUA_HOOKCOUNT+1)) |
| 23 | #define lua_getmaskcount(mask) ((mask) >> (LUA_HOOKCOUNT+1)) | 23 | #define lua_getmaskcount(mask) ((mask) >> (LUA_HOOKCOUNT+1)) |
| 24 | #define LUA_MASKCOUNT (lua_maskcount(1)) | ||
| 25 | 24 | ||
| 26 | typedef struct lua_Debug lua_Debug; /* activation record */ | 25 | typedef struct lua_Debug lua_Debug; /* activation record */ |
| 27 | 26 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 1.244 2002/07/05 18:27:39 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.245 2002/07/08 18:21:33 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, TObject *obj) { | |||
| 70 | 70 | ||
| 71 | static void traceexec (lua_State *L) { | 71 | static void traceexec (lua_State *L) { |
| 72 | int mask = L->hookmask; | 72 | int mask = L->hookmask; |
| 73 | if (mask >= LUA_MASKCOUNT) { /* instruction hook set? */ | 73 | if (mask > LUA_MASKLINE) { /* instruction hook set? */ |
| 74 | if (L->hookcount == 0) { | 74 | if (L->hookcount == 0) { |
| 75 | luaD_callhook(L, LUA_HOOKCOUNT, -1); | 75 | luaD_callhook(L, LUA_HOOKCOUNT, -1); |
| 76 | resethookcount(L); | 76 | resethookcount(L); |
