diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1995-10-04 14:13:02 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1995-10-04 14:13:02 -0300 |
commit | 68f337dfa617732646a4a974eb33b25daf45a1e2 (patch) | |
tree | 81e72eaf0ada8a2246c6cf1af2d96ddaef41d117 /table.c | |
parent | f132ac03bcaf0163f1f86b5114c93a753e17f28b (diff) | |
download | lua-68f337dfa617732646a4a974eb33b25daf45a1e2.tar.gz lua-68f337dfa617732646a4a974eb33b25daf45a1e2.tar.bz2 lua-68f337dfa617732646a4a974eb33b25daf45a1e2.zip |
Garbage collection of functions + header structure for functions
Diffstat (limited to 'table.c')
-rw-r--r-- | table.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -3,7 +3,7 @@ | |||
3 | ** Module to control static tables | 3 | ** Module to control static tables |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_table="$Id: table.c,v 2.31 1995/05/16 19:23:55 celes Exp roberto $"; | 6 | char *rcs_table="$Id: table.c,v 2.32 1995/09/15 20:47:53 roberto Exp $"; |
7 | 7 | ||
8 | #include <string.h> | 8 | #include <string.h> |
9 | 9 | ||
@@ -166,6 +166,8 @@ void lua_markobject (Object *o) | |||
166 | tsvalue(o)->marked = 1; | 166 | tsvalue(o)->marked = 1; |
167 | else if (tag(o) == LUA_T_ARRAY) | 167 | else if (tag(o) == LUA_T_ARRAY) |
168 | lua_hashmark (avalue(o)); | 168 | lua_hashmark (avalue(o)); |
169 | else if (o->tag == LUA_T_FUNCTION && !o->value.tf->marked) | ||
170 | o->value.tf->marked = 1; | ||
169 | } | 171 | } |
170 | 172 | ||
171 | 173 | ||
@@ -182,8 +184,10 @@ void lua_pack (void) | |||
182 | lua_travstack(lua_markobject); /* mark stack objects */ | 184 | lua_travstack(lua_markobject); /* mark stack objects */ |
183 | lua_travsymbol(lua_markobject); /* mark symbol table objects */ | 185 | lua_travsymbol(lua_markobject); /* mark symbol table objects */ |
184 | luaI_travlock(lua_markobject); /* mark locked objects */ | 186 | luaI_travlock(lua_markobject); /* mark locked objects */ |
187 | luaI_travfallbacks(lua_markobject); /* mark fallbacks */ | ||
185 | recovered += lua_strcollector(); | 188 | recovered += lua_strcollector(); |
186 | recovered += lua_hashcollector(); | 189 | recovered += lua_hashcollector(); |
190 | recovered += luaI_funccollector(); | ||
187 | nentity = 0; /* reset counter */ | 191 | nentity = 0; /* reset counter */ |
188 | block=(16*block-7*recovered)/12; /* adapt block size */ | 192 | block=(16*block-7*recovered)/12; /* adapt block size */ |
189 | if (block < MIN_GARBAGE_BLOCK) block = MIN_GARBAGE_BLOCK; | 193 | if (block < MIN_GARBAGE_BLOCK) block = MIN_GARBAGE_BLOCK; |