aboutsummaryrefslogtreecommitdiff
path: root/src/lj_gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_gc.c')
-rw-r--r--src/lj_gc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lj_gc.c b/src/lj_gc.c
index 7999e31f..e65f7ffa 100644
--- a/src/lj_gc.c
+++ b/src/lj_gc.c
@@ -34,8 +34,6 @@
34/* Macros to set GCobj colors and flags. */ 34/* Macros to set GCobj colors and flags. */
35#define white2gray(x) ((x)->gch.marked &= (uint8_t)~LJ_GC_WHITES) 35#define white2gray(x) ((x)->gch.marked &= (uint8_t)~LJ_GC_WHITES)
36#define gray2black(x) ((x)->gch.marked |= LJ_GC_BLACK) 36#define gray2black(x) ((x)->gch.marked |= LJ_GC_BLACK)
37#define makewhite(g, x) \
38 ((x)->gch.marked = ((x)->gch.marked & (uint8_t)~LJ_GC_COLORS) | curwhite(g))
39#define isfinalized(u) ((u)->marked & LJ_GC_FINALIZED) 37#define isfinalized(u) ((u)->marked & LJ_GC_FINALIZED)
40#define markfinalized(u) ((u)->marked |= LJ_GC_FINALIZED) 38#define markfinalized(u) ((u)->marked |= LJ_GC_FINALIZED)
41 39
@@ -500,7 +498,8 @@ static void gc_finalize(lua_State *L)
500 /* Add cdata back to the GC list and make it white. */ 498 /* Add cdata back to the GC list and make it white. */
501 setgcrefr(o->gch.nextgc, g->gc.root); 499 setgcrefr(o->gch.nextgc, g->gc.root);
502 setgcref(g->gc.root, o); 500 setgcref(g->gc.root, o);
503 o->gch.marked = curwhite(g); 501 makewhite(g, o);
502 o->gch.marked &= (uint8_t)~LJ_GC_CDATA_FIN;
504 /* Resolve finalizer. */ 503 /* Resolve finalizer. */
505 setcdataV(L, &tmp, gco2cd(o)); 504 setcdataV(L, &tmp, gco2cd(o));
506 tv = lj_tab_set(L, ctype_ctsG(g)->finalizer, &tmp); 505 tv = lj_tab_set(L, ctype_ctsG(g)->finalizer, &tmp);
@@ -544,7 +543,8 @@ void lj_gc_finalize_cdata(lua_State *L)
544 if (!tvisnil(&node[i].val) && tviscdata(&node[i].key)) { 543 if (!tvisnil(&node[i].val) && tviscdata(&node[i].key)) {
545 GCobj *o = gcV(&node[i].key); 544 GCobj *o = gcV(&node[i].key);
546 TValue tmp; 545 TValue tmp;
547 o->gch.marked = curwhite(g); 546 makewhite(g, o);
547 o->gch.marked &= (uint8_t)~LJ_GC_CDATA_FIN;
548 copyTV(L, &tmp, &node[i].val); 548 copyTV(L, &tmp, &node[i].val);
549 setnilV(&node[i].val); 549 setnilV(&node[i].val);
550 gc_call_finalizer(g, L, &tmp, o); 550 gc_call_finalizer(g, L, &tmp, o);