mirror of
https://github.com/love2d/megasource.git
synced 2026-08-19 12:14:41 +02:00
Update LuaJIT to 2.0.5
This commit is contained in:
+14
-7
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
** Garbage collector.
|
||||
** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
||||
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
|
||||
**
|
||||
** Major portions taken verbatim or adapted from the Lua interpreter.
|
||||
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
|
||||
@@ -168,12 +168,19 @@ static int gc_traverse_tab(global_State *g, GCtab *t)
|
||||
while ((c = *modestr++)) {
|
||||
if (c == 'k') weak |= LJ_GC_WEAKKEY;
|
||||
else if (c == 'v') weak |= LJ_GC_WEAKVAL;
|
||||
else if (c == 'K') weak = (int)(~0u & ~LJ_GC_WEAKVAL);
|
||||
}
|
||||
if (weak > 0) { /* Weak tables are cleared in the atomic phase. */
|
||||
t->marked = (uint8_t)((t->marked & ~LJ_GC_WEAK) | weak);
|
||||
setgcrefr(t->gclist, g->gc.weak);
|
||||
setgcref(g->gc.weak, obj2gco(t));
|
||||
if (weak) { /* Weak tables are cleared in the atomic phase. */
|
||||
#if LJ_HASFFI
|
||||
CTState *cts = ctype_ctsG(g);
|
||||
if (cts && cts->finalizer == t) {
|
||||
weak = (int)(~0u & ~LJ_GC_WEAKVAL);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
t->marked = (uint8_t)((t->marked & ~LJ_GC_WEAK) | weak);
|
||||
setgcrefr(t->gclist, g->gc.weak);
|
||||
setgcref(g->gc.weak, obj2gco(t));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (weak == LJ_GC_WEAK) /* Nothing to mark if both keys/values are weak. */
|
||||
@@ -307,7 +314,7 @@ static size_t propagatemark(global_State *g)
|
||||
if (gc_traverse_tab(g, t) > 0)
|
||||
black2gray(o); /* Keep weak tables gray. */
|
||||
return sizeof(GCtab) + sizeof(TValue) * t->asize +
|
||||
sizeof(Node) * (t->hmask + 1);
|
||||
(t->hmask ? sizeof(Node) * (t->hmask + 1) : 0);
|
||||
} else if (LJ_LIKELY(gct == ~LJ_TFUNC)) {
|
||||
GCfunc *fn = gco2func(o);
|
||||
gc_traverse_func(g, fn);
|
||||
|
||||
Reference in New Issue
Block a user