diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-12-29 14:31:15 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-12-29 14:31:15 -0200 |
commit | 298d0abff7f292fa4bfbdb40979f41bc8f80f9c2 (patch) | |
tree | 457d98c07a17f99a6fee012d49d5191c4c4bf665 /lvm.c | |
parent | 4fbe775154ff281bf9c04cf92d68824a82593402 (diff) | |
download | lua-298d0abff7f292fa4bfbdb40979f41bc8f80f9c2.tar.gz lua-298d0abff7f292fa4bfbdb40979f41bc8f80f9c2.tar.bz2 lua-298d0abff7f292fa4bfbdb40979f41bc8f80f9c2.zip |
first version of extra debug information (NAME)
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 38 |
1 files changed, 25 insertions, 13 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 1.75 1999/12/23 18:19:57 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.76 1999/12/27 17:33:22 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 | */ |
@@ -12,6 +12,7 @@ | |||
12 | #define LUA_REENTRANT | 12 | #define LUA_REENTRANT |
13 | 13 | ||
14 | #include "lauxlib.h" | 14 | #include "lauxlib.h" |
15 | #include "ldebug.h" | ||
15 | #include "ldo.h" | 16 | #include "ldo.h" |
16 | #include "lfunc.h" | 17 | #include "lfunc.h" |
17 | #include "lgc.h" | 18 | #include "lgc.h" |
@@ -33,7 +34,7 @@ | |||
33 | 34 | ||
34 | 35 | ||
35 | /* Extra stack size to run a function: LUA_T_LINE(1), TM calls(2), ... */ | 36 | /* Extra stack size to run a function: LUA_T_LINE(1), TM calls(2), ... */ |
36 | #define EXTRA_STACK 5 | 37 | #define EXTRA_STACK 6 |
37 | 38 | ||
38 | 39 | ||
39 | 40 | ||
@@ -105,7 +106,7 @@ void luaV_gettable (lua_State *L) { | |||
105 | if (ttype(table) != LUA_T_ARRAY) { /* not a table, get gettable method */ | 106 | if (ttype(table) != LUA_T_ARRAY) { /* not a table, get gettable method */ |
106 | im = luaT_getimbyObj(L, table, IM_GETTABLE); | 107 | im = luaT_getimbyObj(L, table, IM_GETTABLE); |
107 | if (ttype(im) == LUA_T_NIL) | 108 | if (ttype(im) == LUA_T_NIL) |
108 | lua_error(L, "indexed expression not a table"); | 109 | luaG_indexerror(L, table); |
109 | } | 110 | } |
110 | else { /* object is a table... */ | 111 | else { /* object is a table... */ |
111 | int tg = table->value.a->htag; | 112 | int tg = table->value.a->htag; |
@@ -138,7 +139,7 @@ void luaV_settable (lua_State *L, StkId t) { | |||
138 | if (ttype(t) != LUA_T_ARRAY) { /* not a table, get `settable' method */ | 139 | if (ttype(t) != LUA_T_ARRAY) { /* not a table, get `settable' method */ |
139 | im = luaT_getimbyObj(L, t, IM_SETTABLE); | 140 | im = luaT_getimbyObj(L, t, IM_SETTABLE); |
140 | if (ttype(im) == LUA_T_NIL) | 141 | if (ttype(im) == LUA_T_NIL) |
141 | lua_error(L, "indexed expression not a table"); | 142 | luaG_indexerror(L, t); |
142 | } | 143 | } |
143 | else { /* object is a table... */ | 144 | else { /* object is a table... */ |
144 | im = luaT_getim(L, avalue(t)->htag, IM_SETTABLE); | 145 | im = luaT_getim(L, avalue(t)->htag, IM_SETTABLE); |
@@ -587,17 +588,28 @@ StkId luaV_execute (lua_State *L, const Closure *cl, const TProtoFunc *tf, | |||
587 | 588 | ||
588 | case SETLINEW: aux += highbyte(L, *pc++); | 589 | case SETLINEW: aux += highbyte(L, *pc++); |
589 | case SETLINE: aux += *pc++; | 590 | case SETLINE: aux += *pc++; |
590 | L->top = top; | 591 | if ((base-2)->ttype != LUA_T_LINE) { |
591 | if ((base-1)->ttype != LUA_T_LINE) { | 592 | /* open space for LINE and NAME values */ |
592 | /* open space for LINE value */ | 593 | int i = top-base; |
593 | luaD_openstack(L, base); | 594 | while (i--) base[i+2] = base[i]; |
594 | base->ttype = LUA_T_LINE; | 595 | base += 2; |
595 | base++; | 596 | top += 2; |
596 | top++; | 597 | (base-1)->ttype = LUA_T_NIL; /* initial value for NAME */ |
598 | (base-2)->ttype = LUA_T_LINE; | ||
597 | } | 599 | } |
598 | (base-1)->value.i = aux; | 600 | (base-2)->value.i = aux; |
599 | if (L->linehook) | 601 | if (L->linehook) { |
602 | L->top = top; | ||
600 | luaD_lineHook(L, aux); | 603 | luaD_lineHook(L, aux); |
604 | } | ||
605 | break; | ||
606 | |||
607 | case SETNAMEW: aux += highbyte(L, *pc++); | ||
608 | case SETNAME: aux += *pc++; | ||
609 | if ((base-2)->ttype == LUA_T_LINE) { /* function has debug info? */ | ||
610 | (base-1)->ttype = -(*pc++); | ||
611 | (base-1)->value.i = aux; | ||
612 | } | ||
601 | break; | 613 | break; |
602 | 614 | ||
603 | case LONGARGW: aux += highbyte(L, *pc++); | 615 | case LONGARGW: aux += highbyte(L, *pc++); |