Browse Source

must call "gc" i.m. for nil after all others.

Roberto Ierusalimschy 28 years ago
parent
commit
c3488f5115
2 changed files with 10 additions and 4 deletions
  1. 1 3
      hash.c
  2. 9 1
      table.c

+ 1 - 3
hash.c

@@ -3,7 +3,7 @@
 ** hash manager for lua
 ** hash manager for lua
 */
 */
 
 
-char *rcs_hash="$Id: hash.c,v 2.35 1997/03/11 18:44:28 roberto Exp roberto $";
+char *rcs_hash="$Id: hash.c,v 2.36 1997/03/19 19:41:10 roberto Exp roberto $";
 
 
 
 
 #include "mem.h"
 #include "mem.h"
@@ -170,8 +170,6 @@ void luaI_hashcallIM (void)
       avalue(&t) = curr_array;
       avalue(&t) = curr_array;
       luaI_gcIM(&t);
       luaI_gcIM(&t);
     }
     }
-  ttype(&t) = LUA_T_NIL;
-  luaI_gcIM(&t);  /* end of list */
 }
 }
 
 
  
  

+ 9 - 1
table.c

@@ -3,7 +3,7 @@
 ** Module to control static tables
 ** Module to control static tables
 */
 */
 
 
-char *rcs_table="$Id: table.c,v 2.60 1997/03/11 18:44:28 roberto Exp roberto $";
+char *rcs_table="$Id: table.c,v 2.62 1997/03/21 18:52:37 roberto Exp $";
 
 
 #include "mem.h"
 #include "mem.h"
 #include "opcode.h"
 #include "opcode.h"
@@ -157,6 +157,13 @@ int luaI_ismarked (Object *o)
 }
 }
 
 
 
 
+static void call_nilIM (void)
+{ /* signals end of garbage collection */
+  Object t;
+  ttype(&t) = LUA_T_NIL;
+  luaI_gcIM(&t);  /* end of list */
+}
+
 /*
 /*
 ** Garbage collection. 
 ** Garbage collection. 
 ** Delete all unused strings and arrays.
 ** Delete all unused strings and arrays.
@@ -170,6 +177,7 @@ Long luaI_collectgarbage (void)
   luaI_travfallbacks(lua_markobject);  /* mark fallbacks */
   luaI_travfallbacks(lua_markobject);  /* mark fallbacks */
   luaI_hashcallIM();
   luaI_hashcallIM();
   luaI_strcallIM();
   luaI_strcallIM();
+  call_nilIM();
   luaI_invalidaterefs();
   luaI_invalidaterefs();
   recovered += lua_strcollector();
   recovered += lua_strcollector();
   recovered += lua_hashcollector();
   recovered += lua_hashcollector();