diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-06-02 16:07:55 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-06-02 16:07:55 -0300 |
commit | e8d4fe72366dd44e45ffd9fca09d92c3db4f8214 (patch) | |
tree | d9f28bbce22a50c9e1de2f239ee6584934afb510 /ldebug.c | |
parent | b8691f13a8e3e9bb7fbd91d1f099eb517a9d5b35 (diff) | |
download | lua-e8d4fe72366dd44e45ffd9fca09d92c3db4f8214.tar.gz lua-e8d4fe72366dd44e45ffd9fca09d92c3db4f8214.tar.bz2 lua-e8d4fe72366dd44e45ffd9fca09d92c3db4f8214.zip |
new macro `lua_threadyield' + lock stuff in `luaconf.h' + details
Diffstat (limited to 'ldebug.c')
-rw-r--r-- | ldebug.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.c,v 2.4 2004/04/30 20:13:38 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.5 2004/05/31 18:51:50 roberto Exp roberto $ |
3 | ** Debug Interface | 3 | ** Debug Interface |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -35,7 +35,7 @@ static const char *getfuncname (CallInfo *ci, const char **name); | |||
35 | 35 | ||
36 | static int currentpc (CallInfo *ci) { | 36 | static int currentpc (CallInfo *ci) { |
37 | if (!isLua(ci)) return -1; /* function is not a Lua function? */ | 37 | if (!isLua(ci)) return -1; /* function is not a Lua function? */ |
38 | return pcRel(ci->u.l.savedpc, ci_func(ci)->l.p); | 38 | return pcRel(ci->savedpc, ci_func(ci)->l.p); |
39 | } | 39 | } |
40 | 40 | ||
41 | 41 | ||
@@ -86,7 +86,7 @@ LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { | |||
86 | for (ci = L->ci; level > 0 && ci > L->base_ci; ci--) { | 86 | for (ci = L->ci; level > 0 && ci > L->base_ci; ci--) { |
87 | level--; | 87 | level--; |
88 | if (f_isLua(ci)) /* Lua function? */ | 88 | if (f_isLua(ci)) /* Lua function? */ |
89 | level -= ci->u.l.tailcalls; /* skip lost tail calls */ | 89 | level -= ci->tailcalls; /* skip lost tail calls */ |
90 | } | 90 | } |
91 | if (level > 0 || ci == L->base_ci) status = 0; /* there is no such level */ | 91 | if (level > 0 || ci == L->base_ci) status = 0; /* there is no such level */ |
92 | else if (level < 0) { /* level is of a lost tail call */ | 92 | else if (level < 0) { /* level is of a lost tail call */ |
@@ -255,8 +255,9 @@ static int precheck (const Proto *pt) { | |||
255 | } | 255 | } |
256 | 256 | ||
257 | 257 | ||
258 | static int checkopenop (const Proto *pt, int pc) { | 258 | #define checkopenop(pt,pc) luaG_checkopenop((pt)->code[(pc)+1]) |
259 | Instruction i = pt->code[pc+1]; | 259 | |
260 | int luaG_checkopenop (Instruction i) { | ||
260 | switch (GET_OPCODE(i)) { | 261 | switch (GET_OPCODE(i)) { |
261 | case OP_CALL: | 262 | case OP_CALL: |
262 | case OP_TAILCALL: | 263 | case OP_TAILCALL: |
@@ -487,7 +488,7 @@ static const char *getobjname (CallInfo *ci, int stackpos, const char **name) { | |||
487 | 488 | ||
488 | static const char *getfuncname (CallInfo *ci, const char **name) { | 489 | static const char *getfuncname (CallInfo *ci, const char **name) { |
489 | Instruction i; | 490 | Instruction i; |
490 | if ((isLua(ci) && ci->u.l.tailcalls > 0) || !isLua(ci - 1)) | 491 | if ((isLua(ci) && ci->tailcalls > 0) || !isLua(ci - 1)) |
491 | return NULL; /* calling function is not Lua (or is unknown) */ | 492 | return NULL; /* calling function is not Lua (or is unknown) */ |
492 | ci--; /* calling function */ | 493 | ci--; /* calling function */ |
493 | i = ci_func(ci)->l.p->code[currentpc(ci)]; | 494 | i = ci_func(ci)->l.p->code[currentpc(ci)]; |