summaryrefslogtreecommitdiff
path: root/src/lj_gc.c
diff options
context:
space:
mode:
authorMike Pall <mike>2017-03-08 22:03:17 +0100
committerMike Pall <mike>2017-03-08 22:03:17 +0100
commit3ab9f5a18da06b06ebf1e4487997c25e32210dfe (patch)
tree730950bc84c1d336b3b844434c1f24cf9d6eafcb /src/lj_gc.c
parenteef77a6d775147a1b581b06c296e9f2b3ebc9d2b (diff)
downloadluajit-3ab9f5a18da06b06ebf1e4487997c25e32210dfe.tar.gz
luajit-3ab9f5a18da06b06ebf1e4487997c25e32210dfe.tar.bz2
luajit-3ab9f5a18da06b06ebf1e4487997c25e32210dfe.zip
Remove internal __mode = "K" and replace with safe check.
Diffstat (limited to 'src/lj_gc.c')
-rw-r--r--src/lj_gc.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lj_gc.c b/src/lj_gc.c
index aa243d13..a5d32ea3 100644
--- a/src/lj_gc.c
+++ b/src/lj_gc.c
@@ -168,12 +168,19 @@ static int gc_traverse_tab(global_State *g, GCtab *t)
168 while ((c = *modestr++)) { 168 while ((c = *modestr++)) {
169 if (c == 'k') weak |= LJ_GC_WEAKKEY; 169 if (c == 'k') weak |= LJ_GC_WEAKKEY;
170 else if (c == 'v') weak |= LJ_GC_WEAKVAL; 170 else if (c == 'v') weak |= LJ_GC_WEAKVAL;
171 else if (c == 'K') weak = (int)(~0u & ~LJ_GC_WEAKVAL);
172 } 171 }
173 if (weak > 0) { /* Weak tables are cleared in the atomic phase. */ 172 if (weak) { /* Weak tables are cleared in the atomic phase. */
174 t->marked = (uint8_t)((t->marked & ~LJ_GC_WEAK) | weak); 173#if LJ_HASFFI
175 setgcrefr(t->gclist, g->gc.weak); 174 CTState *cts = ctype_ctsG(g);
176 setgcref(g->gc.weak, obj2gco(t)); 175 if (cts && cts->finalizer == t) {
176 weak = (int)(~0u & ~LJ_GC_WEAKVAL);
177 } else
178#endif
179 {
180 t->marked = (uint8_t)((t->marked & ~LJ_GC_WEAK) | weak);
181 setgcrefr(t->gclist, g->gc.weak);
182 setgcref(g->gc.weak, obj2gco(t));
183 }
177 } 184 }
178 } 185 }
179 if (weak == LJ_GC_WEAK) /* Nothing to mark if both keys/values are weak. */ 186 if (weak == LJ_GC_WEAK) /* Nothing to mark if both keys/values are weak. */