summaryrefslogtreecommitdiff
path: root/table.c
diff options
context:
space:
mode:
Diffstat (limited to 'table.c')
-rw-r--r--table.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/table.c b/table.c
index 6c77d2e9..31ec0ac1 100644
--- a/table.c
+++ b/table.c
@@ -3,7 +3,7 @@
3** Module to control static tables 3** Module to control static tables
4*/ 4*/
5 5
6char *rcs_table="$Id: table.c,v 2.50 1996/03/21 16:31:32 roberto Exp roberto $"; 6char *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*/
176int 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();