aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lgc.c b/lgc.c
index 8db5fb0d..3d3736f8 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 2.30 2005/03/16 17:00:21 roberto Exp roberto $ 2** $Id: lgc.c,v 2.31 2005/03/22 16:04:29 roberto Exp roberto $
3** Garbage Collector 3** Garbage Collector
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -493,6 +493,13 @@ void luaC_freeall (lua_State *L) {
493} 493}
494 494
495 495
496static void markmt (global_State *g) {
497 int i;
498 for (i=0; i<NUM_TAGS; i++)
499 if (g->mt[i]) markobject(g, g->mt[i]);
500}
501
502
496/* mark root set */ 503/* mark root set */
497static void markroot (lua_State *L) { 504static void markroot (lua_State *L) {
498 global_State *g = G(L); 505 global_State *g = G(L);
@@ -503,6 +510,7 @@ static void markroot (lua_State *L) {
503 /* make global table be traversed before main stack */ 510 /* make global table be traversed before main stack */
504 markvalue(g, gt(g->mainthread)); 511 markvalue(g, gt(g->mainthread));
505 markvalue(g, registry(L)); 512 markvalue(g, registry(L));
513 markmt(g);
506 g->gcstate = GCSpropagate; 514 g->gcstate = GCSpropagate;
507} 515}
508 516
@@ -529,6 +537,7 @@ static void atomic (lua_State *L) {
529 g->weak = NULL; 537 g->weak = NULL;
530 lua_assert(!iswhite(obj2gco(g->mainthread))); 538 lua_assert(!iswhite(obj2gco(g->mainthread)));
531 markobject(g, L); /* mark running thread */ 539 markobject(g, L); /* mark running thread */
540 markmt(g); /* mark basic metatables (again) */
532 propagateall(g); 541 propagateall(g);
533 /* remark gray again */ 542 /* remark gray again */
534 g->gray = g->grayagain; 543 g->gray = g->grayagain;