diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-04-22 15:00:37 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-04-22 15:00:37 -0300 |
commit | 0ef5cf22891c9d34a88ccc5d89eb0ed82b004471 (patch) | |
tree | 1a095acefa978d5a41f32ff7d0fef58a642aa66c /table.c | |
parent | fed9408ab51a4be5ff84450ad47d1e0cdaed97bc (diff) | |
download | lua-0ef5cf22891c9d34a88ccc5d89eb0ed82b004471.tar.gz lua-0ef5cf22891c9d34a88ccc5d89eb0ed82b004471.tar.bz2 lua-0ef5cf22891c9d34a88ccc5d89eb0ed82b004471.zip |
lock mechanism seperseded by the REFERENCE mechanism.
Diffstat (limited to 'table.c')
-rw-r--r-- | table.c | 21 |
1 files changed, 20 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.50 1996/03/21 16:31:32 roberto Exp roberto $"; | 6 | char *rcs_table="$Id: table.c,v 2.51 1996/03/21 18:54:29 roberto Exp roberto $"; |
7 | 7 | ||
8 | #include "mem.h" | 8 | #include "mem.h" |
9 | #include "opcode.h" | 9 | #include "opcode.h" |
@@ -170,6 +170,24 @@ int lua_markobject (Object *o) | |||
170 | return 0; | 170 | return 0; |
171 | } | 171 | } |
172 | 172 | ||
173 | /* | ||
174 | * returns 0 if the object is going to be (garbage) collected | ||
175 | */ | ||
176 | int luaI_ismarked (Object *o) | ||
177 | { | ||
178 | switch (o->tag) | ||
179 | { | ||
180 | case LUA_T_STRING: | ||
181 | return o->value.ts->marked; | ||
182 | case LUA_T_FUNCTION: | ||
183 | return o->value.tf->marked; | ||
184 | case LUA_T_ARRAY: | ||
185 | return o->value.a->mark; | ||
186 | default: /* nil, number, cfunction, or user data */ | ||
187 | return 1; | ||
188 | } | ||
189 | } | ||
190 | |||
173 | 191 | ||
174 | /* | 192 | /* |
175 | ** Garbage collection. | 193 | ** Garbage collection. |
@@ -182,6 +200,7 @@ Long luaI_collectgarbage (void) | |||
182 | lua_travsymbol(lua_markobject); /* mark symbol table objects */ | 200 | lua_travsymbol(lua_markobject); /* mark symbol table objects */ |
183 | luaI_travlock(lua_markobject); /* mark locked objects */ | 201 | luaI_travlock(lua_markobject); /* mark locked objects */ |
184 | luaI_travfallbacks(lua_markobject); /* mark fallbacks */ | 202 | luaI_travfallbacks(lua_markobject); /* mark fallbacks */ |
203 | luaI_invalidaterefs(); | ||
185 | recovered += lua_strcollector(); | 204 | recovered += lua_strcollector(); |
186 | recovered += lua_hashcollector(); | 205 | recovered += lua_hashcollector(); |
187 | recovered += luaI_funccollector(); | 206 | recovered += luaI_funccollector(); |