diff options
Diffstat (limited to 'src/lj_cdata.c')
-rw-r--r-- | src/lj_cdata.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/lj_cdata.c b/src/lj_cdata.c index 80dcf4e5..aa3bd1a5 100644 --- a/src/lj_cdata.c +++ b/src/lj_cdata.c | |||
@@ -75,21 +75,20 @@ void LJ_FASTCALL lj_cdata_free(global_State *g, GCcdata *cd) | |||
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | TValue * LJ_FASTCALL lj_cdata_setfin(lua_State *L, GCcdata *cd) | 78 | void lj_cdata_setfin(lua_State *L, GCcdata *cd, GCobj *obj, uint32_t it) |
79 | { | 79 | { |
80 | global_State *g = G(L); | 80 | GCtab *t = ctype_ctsG(G(L))->finalizer; |
81 | GCtab *t = ctype_ctsG(g)->finalizer; | ||
82 | if (gcref(t->metatable)) { | 81 | if (gcref(t->metatable)) { |
83 | /* Add cdata to finalizer table, if still enabled. */ | 82 | /* Add cdata to finalizer table, if still enabled. */ |
84 | TValue *tv, tmp; | 83 | TValue *tv, tmp; |
85 | setcdataV(L, &tmp, cd); | 84 | setcdataV(L, &tmp, cd); |
86 | lj_gc_anybarriert(L, t); | 85 | lj_gc_anybarriert(L, t); |
87 | tv = lj_tab_set(L, t, &tmp); | 86 | tv = lj_tab_set(L, t, &tmp); |
88 | cd->marked |= LJ_GC_CDATA_FIN; | 87 | setgcV(L, tv, obj, it); |
89 | return tv; | 88 | if (!tvisnil(tv)) |
90 | } else { | 89 | cd->marked |= LJ_GC_CDATA_FIN; |
91 | /* Otherwise return dummy TValue. */ | 90 | else |
92 | return &g->tmptv; | 91 | cd->marked &= ~LJ_GC_CDATA_FIN; |
93 | } | 92 | } |
94 | } | 93 | } |
95 | 94 | ||