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.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lj_gc.c b/src/lj_gc.c
index 79f8b720..5c665786 100644
--- a/src/lj_gc.c
+++ b/src/lj_gc.c
@@ -501,6 +501,7 @@ static void gc_finalize(lua_State *L)
501 setcdataV(L, &tmp, gco2cd(o)); 501 setcdataV(L, &tmp, gco2cd(o));
502 tv = lj_tab_set(L, ctype_ctsG(g)->finalizer, &tmp); 502 tv = lj_tab_set(L, ctype_ctsG(g)->finalizer, &tmp);
503 if (!tvisnil(tv)) { 503 if (!tvisnil(tv)) {
504 g->gc.nocdatafin = 0;
504 copyTV(L, &tmp, tv); 505 copyTV(L, &tmp, tv);
505 setnilV(tv); /* Clear entry in finalizer table. */ 506 setnilV(tv); /* Clear entry in finalizer table. */
506 gc_call_finalizer(g, L, &tmp, o); 507 gc_call_finalizer(g, L, &tmp, o);
@@ -634,6 +635,9 @@ static size_t gc_onestep(lua_State *L)
634 gc_shrink(g, L); 635 gc_shrink(g, L);
635 if (gcref(g->gc.mmudata)) { /* Need any finalizations? */ 636 if (gcref(g->gc.mmudata)) { /* Need any finalizations? */
636 g->gc.state = GCSfinalize; 637 g->gc.state = GCSfinalize;
638#if LJ_HASFFI
639 g->gc.nocdatafin = 1;
640#endif
637 } else { /* Otherwise skip this phase to help the JIT. */ 641 } else { /* Otherwise skip this phase to help the JIT. */
638 g->gc.state = GCSpause; /* End of GC cycle. */ 642 g->gc.state = GCSpause; /* End of GC cycle. */
639 g->gc.debt = 0; 643 g->gc.debt = 0;
@@ -652,6 +656,9 @@ static size_t gc_onestep(lua_State *L)
652 g->gc.estimate -= GCFINALIZECOST; 656 g->gc.estimate -= GCFINALIZECOST;
653 return GCFINALIZECOST; 657 return GCFINALIZECOST;
654 } 658 }
659#if LJ_HASFFI
660 if (!g->gc.nocdatafin) lj_tab_rehash(L, ctype_ctsG(g)->finalizer);
661#endif
655 g->gc.state = GCSpause; /* End of GC cycle. */ 662 g->gc.state = GCSpause; /* End of GC cycle. */
656 g->gc.debt = 0; 663 g->gc.debt = 0;
657 return 0; 664 return 0;