summaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-09-29 09:42:13 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-09-29 09:42:13 -0300
commitdad808a73a98a23729614b8814728d76b4e5d577 (patch)
tree945fabce1906c5f08fe6512476d7ca3d84017bca /ldo.c
parentca7fd50a4ec2f1b41292f859ba0d5e52a2b22a5c (diff)
downloadlua-dad808a73a98a23729614b8814728d76b4e5d577.tar.gz
lua-dad808a73a98a23729614b8814728d76b4e5d577.tar.bz2
lua-dad808a73a98a23729614b8814728d76b4e5d577.zip
new way to count `nblocks' for GC (try to count bytes).
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ldo.c b/ldo.c
index 8f49b595..283c3cdf 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.96 2000/09/12 13:47:39 roberto Exp roberto $ 2** $Id: ldo.c,v 1.97 2000/09/25 16:22:42 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*/
@@ -33,6 +33,7 @@
33 33
34void luaD_init (lua_State *L, int stacksize) { 34void luaD_init (lua_State *L, int stacksize) {
35 L->stack = luaM_newvector(L, stacksize+EXTRA_STACK, TObject); 35 L->stack = luaM_newvector(L, stacksize+EXTRA_STACK, TObject);
36 L->nblocks += stacksize*sizeof(TObject);
36 L->stack_last = L->stack+(stacksize-1); 37 L->stack_last = L->stack+(stacksize-1);
37 L->stacksize = stacksize; 38 L->stacksize = stacksize;
38 L->Cbase = L->top = L->stack; 39 L->Cbase = L->top = L->stack;
@@ -248,10 +249,12 @@ static int protectedparser (lua_State *L, ZIO *z, int bin) {
248 luaC_checkGC(L); 249 luaC_checkGC(L);
249 old_blocks = L->nblocks; 250 old_blocks = L->nblocks;
250 status = luaD_runprotected(L, f_parser, &p); 251 status = luaD_runprotected(L, f_parser, &p);
251 if (status == LUA_ERRRUN) /* an error occurred: correct error code */ 252 if (status == 0) {
253 /* add new memory to threshould (as it probably will stay) */
254 L->GCthreshold += (L->nblocks - old_blocks);
255 }
256 else if (status == LUA_ERRRUN) /* an error occurred: correct error code */
252 status = LUA_ERRSYNTAX; 257 status = LUA_ERRSYNTAX;
253 /* add new memory to threshould (as it probably will stay) */
254 L->GCthreshold += (L->nblocks - old_blocks);
255 return status; 258 return status;
256} 259}
257 260