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 bc10822f..572e4710 100644
--- a/src/lj_gc.c
+++ b/src/lj_gc.c
@@ -493,6 +493,7 @@ static void gc_finalize(lua_State *L)
493 setcdataV(L, &tmp, gco2cd(o)); 493 setcdataV(L, &tmp, gco2cd(o));
494 tv = lj_tab_set(L, ctype_ctsG(g)->finalizer, &tmp); 494 tv = lj_tab_set(L, ctype_ctsG(g)->finalizer, &tmp);
495 if (!tvisnil(tv)) { 495 if (!tvisnil(tv)) {
496 g->gc.nocdatafin = 0;
496 copyTV(L, &tmp, tv); 497 copyTV(L, &tmp, tv);
497 setnilV(tv); /* Clear entry in finalizer table. */ 498 setnilV(tv); /* Clear entry in finalizer table. */
498 gc_call_finalizer(g, L, &tmp, o); 499 gc_call_finalizer(g, L, &tmp, o);
@@ -629,6 +630,9 @@ static size_t gc_onestep(lua_State *L)
629 lj_str_resize(L, g->strmask >> 1); /* Shrink string table. */ 630 lj_str_resize(L, g->strmask >> 1); /* Shrink string table. */
630 if (gcref(g->gc.mmudata)) { /* Need any finalizations? */ 631 if (gcref(g->gc.mmudata)) { /* Need any finalizations? */
631 g->gc.state = GCSfinalize; 632 g->gc.state = GCSfinalize;
633#if LJ_HASFFI
634 g->gc.nocdatafin = 1;
635#endif
632 } else { /* Otherwise skip this phase to help the JIT. */ 636 } else { /* Otherwise skip this phase to help the JIT. */
633 g->gc.state = GCSpause; /* End of GC cycle. */ 637 g->gc.state = GCSpause; /* End of GC cycle. */
634 g->gc.debt = 0; 638 g->gc.debt = 0;
@@ -647,6 +651,9 @@ static size_t gc_onestep(lua_State *L)
647 g->gc.estimate -= GCFINALIZECOST; 651 g->gc.estimate -= GCFINALIZECOST;
648 return GCFINALIZECOST; 652 return GCFINALIZECOST;
649 } 653 }
654#if LJ_HASFFI
655 if (!g->gc.nocdatafin) lj_tab_rehash(L, ctype_ctsG(g)->finalizer);
656#endif
650 g->gc.state = GCSpause; /* End of GC cycle. */ 657 g->gc.state = GCSpause; /* End of GC cycle. */
651 g->gc.debt = 0; 658 g->gc.debt = 0;
652 return 0; 659 return 0;