diff options
author | Mike Pall <mike> | 2017-03-08 23:04:46 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2017-03-08 23:04:46 +0100 |
commit | d3e36e7920c641410dfcdf1fc6c10069fd3192a6 (patch) | |
tree | 04ae8ac89a49d1017171f293eff8e4bfbd2a547b /src/lj_gc.c | |
parent | a25c0b99b84558887887b8e298409dcf8605e5e3 (diff) | |
parent | f50bf7585a32738c4fb719cb8fc59d02231fc8c3 (diff) | |
download | luajit-d3e36e7920c641410dfcdf1fc6c10069fd3192a6.tar.gz luajit-d3e36e7920c641410dfcdf1fc6c10069fd3192a6.tar.bz2 luajit-d3e36e7920c641410dfcdf1fc6c10069fd3192a6.zip |
Merge branch 'master' into v2.1
Diffstat (limited to 'src/lj_gc.c')
-rw-r--r-- | src/lj_gc.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lj_gc.c b/src/lj_gc.c index c82af662..2aaf5b2c 100644 --- a/src/lj_gc.c +++ b/src/lj_gc.c | |||
@@ -169,12 +169,19 @@ static int gc_traverse_tab(global_State *g, GCtab *t) | |||
169 | while ((c = *modestr++)) { | 169 | while ((c = *modestr++)) { |
170 | if (c == 'k') weak |= LJ_GC_WEAKKEY; | 170 | if (c == 'k') weak |= LJ_GC_WEAKKEY; |
171 | else if (c == 'v') weak |= LJ_GC_WEAKVAL; | 171 | else if (c == 'v') weak |= LJ_GC_WEAKVAL; |
172 | else if (c == 'K') weak = (int)(~0u & ~LJ_GC_WEAKVAL); | ||
173 | } | 172 | } |
174 | if (weak > 0) { /* Weak tables are cleared in the atomic phase. */ | 173 | if (weak) { /* Weak tables are cleared in the atomic phase. */ |
175 | t->marked = (uint8_t)((t->marked & ~LJ_GC_WEAK) | weak); | 174 | #if LJ_HASFFI |
176 | setgcrefr(t->gclist, g->gc.weak); | 175 | CTState *cts = ctype_ctsG(g); |
177 | setgcref(g->gc.weak, obj2gco(t)); | 176 | if (cts && cts->finalizer == t) { |
177 | weak = (int)(~0u & ~LJ_GC_WEAKVAL); | ||
178 | } else | ||
179 | #endif | ||
180 | { | ||
181 | t->marked = (uint8_t)((t->marked & ~LJ_GC_WEAK) | weak); | ||
182 | setgcrefr(t->gclist, g->gc.weak); | ||
183 | setgcref(g->gc.weak, obj2gco(t)); | ||
184 | } | ||
178 | } | 185 | } |
179 | } | 186 | } |
180 | if (weak == LJ_GC_WEAK) /* Nothing to mark if both keys/values are weak. */ | 187 | if (weak == LJ_GC_WEAK) /* Nothing to mark if both keys/values are weak. */ |