mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 07:04:08 +00:00
FFI: Drop finalizer table rehash after GC cycle.
Reported by Sergey Kaplun. #1247
This commit is contained in:
parent
fb5e1c9f0d
commit
fb22d0f80f
@ -554,7 +554,6 @@ static void gc_finalize(lua_State *L)
|
||||
setcdataV(L, &tmp, gco2cd(o));
|
||||
tv = lj_tab_set(L, tabref(g->gcroot[GCROOT_FFI_FIN]), &tmp);
|
||||
if (!tvisnil(tv)) {
|
||||
g->gc.nocdatafin = 0;
|
||||
copyTV(L, &tmp, tv);
|
||||
setnilV(tv); /* Clear entry in finalizer table. */
|
||||
gc_call_finalizer(g, L, &tmp, o);
|
||||
@ -689,9 +688,6 @@ static size_t gc_onestep(lua_State *L)
|
||||
lj_str_resize(L, g->str.mask >> 1); /* Shrink string table. */
|
||||
if (gcref(g->gc.mmudata)) { /* Need any finalizations? */
|
||||
g->gc.state = GCSfinalize;
|
||||
#if LJ_HASFFI
|
||||
g->gc.nocdatafin = 1;
|
||||
#endif
|
||||
} else { /* Otherwise skip this phase to help the JIT. */
|
||||
g->gc.state = GCSpause; /* End of GC cycle. */
|
||||
g->gc.debt = 0;
|
||||
@ -711,9 +707,6 @@ static size_t gc_onestep(lua_State *L)
|
||||
g->gc.estimate -= GCFINALIZECOST;
|
||||
return GCFINALIZECOST;
|
||||
}
|
||||
#if LJ_HASFFI
|
||||
if (!g->gc.nocdatafin) lj_tab_rehash(L, tabref(g->gcroot[GCROOT_FFI_FIN]));
|
||||
#endif
|
||||
g->gc.state = GCSpause; /* End of GC cycle. */
|
||||
g->gc.debt = 0;
|
||||
return 0;
|
||||
|
@ -595,7 +595,7 @@ typedef struct GCState {
|
||||
GCSize threshold; /* Memory threshold. */
|
||||
uint8_t currentwhite; /* Current white color. */
|
||||
uint8_t state; /* GC state. */
|
||||
uint8_t nocdatafin; /* No cdata finalizer called. */
|
||||
uint8_t unused0;
|
||||
#if LJ_64
|
||||
uint8_t lightudnum; /* Number of lightuserdata segments - 1. */
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user