summaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-10-23 14:26:37 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-10-23 14:26:37 -0200
commit907368ead5978b689a97118b75e89a2095122530 (patch)
treeed428793e87ab4a3c8de49be5586878af54c8d34 /ldo.c
parent81489beea1a201b58dba964b6bbfd263f3683f25 (diff)
downloadlua-907368ead5978b689a97118b75e89a2095122530.tar.gz
lua-907368ead5978b689a97118b75e89a2095122530.tar.bz2
lua-907368ead5978b689a97118b75e89a2095122530.zip
GC now considers an "estimate" of object size, instead of just the number
of objects.
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ldo.c b/ldo.c
index f10d614c..8bf43215 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.2 1997/09/26 15:02:26 roberto Exp roberto $ 2** $Id: ldo.c,v 1.3 1997/10/16 10:59:34 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*/
@@ -140,7 +140,7 @@ void luaD_callHook (StkId base, lua_Type type, int isreturn)
140 140
141 141
142/* 142/*
143** Call a C function. luaD_Cstack.base will point to the luaD_stack.top of the luaD_stack.stack, 143** Call a C function. luaD_Cstack.base will point to the top of the stack,
144** and luaD_Cstack.num is the number of parameters. Returns an index 144** and luaD_Cstack.num is the number of parameters. Returns an index
145** to the first result from C. 145** to the first result from C.
146*/ 146*/
@@ -151,7 +151,7 @@ static StkId callC (lua_CFunction func, StkId base)
151 luaD_Cstack.num = (luaD_stack.top-luaD_stack.stack) - base; 151 luaD_Cstack.num = (luaD_stack.top-luaD_stack.stack) - base;
152 /* incorporate parameters on the luaD_stack.stack */ 152 /* incorporate parameters on the luaD_stack.stack */
153 luaD_Cstack.lua2C = base; 153 luaD_Cstack.lua2C = base;
154 luaD_Cstack.base = base+luaD_Cstack.num; /* == luaD_stack.top-luaD_stack.stack */ 154 luaD_Cstack.base = base+luaD_Cstack.num; /* == top-stack */
155 if (lua_callhook) 155 if (lua_callhook)
156 luaD_callHook(base, LUA_T_CMARK, 0); 156 luaD_callHook(base, LUA_T_CMARK, 0);
157 (*func)(); 157 (*func)();
@@ -347,12 +347,12 @@ static int do_main (ZIO *z, char *chunkname, int bin)
347{ 347{
348 int status; 348 int status;
349 do { 349 do {
350 long old_entities = (luaC_checkGC(), luaO_nentities); 350 long old_blocks = (luaC_checkGC(), luaO_nblocks);
351 status = protectedparser(z, chunkname, bin); 351 status = protectedparser(z, chunkname, bin);
352 if (status == 1) return 1; /* error */ 352 if (status == 1) return 1; /* error */
353 else if (status == 2) return 0; /* 'natural' end */ 353 else if (status == 2) return 0; /* 'natural' end */
354 else { 354 else {
355 long newelems2 = 2*(luaO_nentities-old_entities); 355 unsigned long newelems2 = 2*(luaO_nblocks-old_blocks);
356 luaC_threshold += newelems2; 356 luaC_threshold += newelems2;
357 status = luaD_protectedrun(MULT_RET); 357 status = luaD_protectedrun(MULT_RET);
358 luaC_threshold -= newelems2; 358 luaC_threshold -= newelems2;