diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-05-24 14:53:03 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-05-24 14:53:03 -0300 |
commit | 995775e1cb2ffeec96a07be93c22a7710b3ae41c (patch) | |
tree | 27564cc23d93b6535b4b2cc01556d64e2c9accf5 | |
parent | abfc885079aef8cecf0235265ff173db22172ea5 (diff) | |
download | lua-995775e1cb2ffeec96a07be93c22a7710b3ae41c.tar.gz lua-995775e1cb2ffeec96a07be93c22a7710b3ae41c.tar.bz2 lua-995775e1cb2ffeec96a07be93c22a7710b3ae41c.zip |
tighter control on the stack when debugging
-rw-r--r-- | ldo.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 1.41 1999/03/11 18:59:19 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.42 1999/05/10 13:54:01 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -37,6 +37,12 @@ | |||
37 | #define STACK_UNIT 128 | 37 | #define STACK_UNIT 128 |
38 | 38 | ||
39 | 39 | ||
40 | #ifdef DEBUG | ||
41 | #undef STACK_UNIT | ||
42 | #define STACK_UNIT 2 | ||
43 | #endif | ||
44 | |||
45 | |||
40 | void luaD_init (void) { | 46 | void luaD_init (void) { |
41 | L->stack.stack = luaM_newvector(STACK_UNIT, TObject); | 47 | L->stack.stack = luaM_newvector(STACK_UNIT, TObject); |
42 | L->stack.top = L->stack.stack; | 48 | L->stack.top = L->stack.stack; |
@@ -80,16 +86,14 @@ void luaD_adjusttop (StkId newtop) { | |||
80 | /* | 86 | /* |
81 | ** Open a hole below "nelems" from the L->stack.top. | 87 | ** Open a hole below "nelems" from the L->stack.top. |
82 | */ | 88 | */ |
83 | void luaD_openstack (int nelems) | 89 | void luaD_openstack (int nelems) { |
84 | { | ||
85 | luaO_memup(L->stack.top-nelems+1, L->stack.top-nelems, | 90 | luaO_memup(L->stack.top-nelems+1, L->stack.top-nelems, |
86 | nelems*sizeof(TObject)); | 91 | nelems*sizeof(TObject)); |
87 | incr_top; | 92 | incr_top; |
88 | } | 93 | } |
89 | 94 | ||
90 | 95 | ||
91 | void luaD_lineHook (int line) | 96 | void luaD_lineHook (int line) { |
92 | { | ||
93 | struct C_Lua_Stack oldCLS = L->Cstack; | 97 | struct C_Lua_Stack oldCLS = L->Cstack; |
94 | StkId old_top = L->Cstack.lua2C = L->Cstack.base = L->stack.top-L->stack.stack; | 98 | StkId old_top = L->Cstack.lua2C = L->Cstack.base = L->stack.top-L->stack.stack; |
95 | L->Cstack.num = 0; | 99 | L->Cstack.num = 0; |
@@ -99,8 +103,7 @@ void luaD_lineHook (int line) | |||
99 | } | 103 | } |
100 | 104 | ||
101 | 105 | ||
102 | void luaD_callHook (StkId base, TProtoFunc *tf, int isreturn) | 106 | void luaD_callHook (StkId base, TProtoFunc *tf, int isreturn) { |
103 | { | ||
104 | struct C_Lua_Stack oldCLS = L->Cstack; | 107 | struct C_Lua_Stack oldCLS = L->Cstack; |
105 | StkId old_top = L->Cstack.lua2C = L->Cstack.base = L->stack.top-L->stack.stack; | 108 | StkId old_top = L->Cstack.lua2C = L->Cstack.base = L->stack.top-L->stack.stack; |
106 | L->Cstack.num = 0; | 109 | L->Cstack.num = 0; |