aboutsummaryrefslogtreecommitdiff
path: root/ldebug.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-03-29 17:19:20 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-03-29 17:19:20 -0300
commita69356e9e0a7525b1cebadc928a0efcce8c39b46 (patch)
treec676ee2997c699d3e0b036323ecbafa7ea0d786f /ldebug.c
parentb53dc0c4853c56694dda727793e5f6188de39dd8 (diff)
downloadlua-a69356e9e0a7525b1cebadc928a0efcce8c39b46.tar.gz
lua-a69356e9e0a7525b1cebadc928a0efcce8c39b46.tar.bz2
lua-a69356e9e0a7525b1cebadc928a0efcce8c39b46.zip
no more special cases for closures with 0 upvalues (performance is the same,
memory use a little higher, code much simpler).
Diffstat (limited to 'ldebug.c')
-rw-r--r--ldebug.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/ldebug.c b/ldebug.c
index 33823257..40bcb6e6 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldebug.c,v 1.12 2000/03/20 19:14:54 roberto Exp roberto $ 2** $Id: ldebug.c,v 1.13 2000/03/27 20:10:21 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*/
@@ -24,10 +24,8 @@
24 24
25static const lua_Type normtype[] = { /* ORDER LUA_T */ 25static const lua_Type normtype[] = { /* ORDER LUA_T */
26 TAG_USERDATA, TAG_NUMBER, TAG_STRING, TAG_TABLE, 26 TAG_USERDATA, TAG_NUMBER, TAG_STRING, TAG_TABLE,
27 TAG_LPROTO, TAG_CPROTO, TAG_NIL, 27 TAG_LCLOSURE, TAG_CCLOSURE, TAG_NIL,
28 TAG_LCLOSURE, TAG_CCLOSURE, 28 TAG_LCLOSURE, TAG_CCLOSURE /* TAG_LCLMARK, TAG_CCLMARK */
29 TAG_LCLOSURE, TAG_CCLOSURE, /* TAG_LCLMARK, TAG_CCLMARK */
30 TAG_LPROTO, TAG_CPROTO /* TAG_LMARK, TAG_CMARK */
31}; 29};
32 30
33 31
@@ -104,11 +102,7 @@ static int lua_currentline (lua_State *L, StkId f) {
104 102
105 103
106static Proto *getluaproto (StkId f) { 104static Proto *getluaproto (StkId f) {
107 if (ttype(f) == TAG_LMARK) 105 return (ttype(f) == TAG_LCLMARK) ? clvalue(f)->f.l : NULL;
108 return f->value.tf;
109 else if (ttype(f) == TAG_LCLMARK)
110 return protovalue(f)->value.tf;
111 else return NULL;
112} 106}
113 107
114 108
@@ -141,20 +135,18 @@ int lua_setlocal (lua_State *L, const lua_Dbgactreg *ar, lua_Dbglocvar *v) {
141static void lua_funcinfo (lua_Dbgactreg *ar) { 135static void lua_funcinfo (lua_Dbgactreg *ar) {
142 StkId func = ar->_func; 136 StkId func = ar->_func;
143 switch (ttype(func)) { 137 switch (ttype(func)) {
144 case TAG_LPROTO: case TAG_LMARK:
145 ar->source = tfvalue(func)->source->str;
146 ar->linedefined = tfvalue(func)->lineDefined;
147 ar->what = "Lua";
148 break;
149 case TAG_LCLOSURE: case TAG_LCLMARK: 138 case TAG_LCLOSURE: case TAG_LCLMARK:
150 ar->source = tfvalue(protovalue(func))->source->str; 139 ar->source = clvalue(func)->f.l->source->str;
151 ar->linedefined = tfvalue(protovalue(func))->lineDefined; 140 ar->linedefined = clvalue(func)->f.l->lineDefined;
152 ar->what = "Lua"; 141 ar->what = "Lua";
153 break; 142 break;
154 default: 143 case TAG_CCLOSURE: case TAG_CCLMARK:
155 ar->source = "(C)"; 144 ar->source = "(C)";
156 ar->linedefined = -1; 145 ar->linedefined = -1;
157 ar->what = "C"; 146 ar->what = "C";
147 break;
148 default:
149 LUA_INTERNALERROR(L, "invalid `func' value");
158 } 150 }
159 if (ar->linedefined == 0) 151 if (ar->linedefined == 0)
160 ar->what = "main"; 152 ar->what = "main";