mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Move a GC macro.
This commit is contained in:
parent
fcddd5a3a0
commit
b66ab96a62
@ -56,7 +56,7 @@ void LJ_FASTCALL lj_cdata_free(global_State *g, GCcdata *cd)
|
||||
if (LJ_UNLIKELY(cd->marked & LJ_GC_CDATA_FIN)) {
|
||||
GCobj *root;
|
||||
makewhite(g, obj2gco(cd));
|
||||
obj2gco(cd)->gch.marked |= LJ_GC_FINALIZED;
|
||||
markfinalized(obj2gco(cd));
|
||||
if ((root = gcref(g->gc.mmudata)) != NULL) {
|
||||
setgcrefr(cd->nextgc, root->gch.nextgc);
|
||||
setgcref(root->gch.nextgc, obj2gco(cd));
|
||||
|
@ -35,7 +35,6 @@
|
||||
#define white2gray(x) ((x)->gch.marked &= (uint8_t)~LJ_GC_WHITES)
|
||||
#define gray2black(x) ((x)->gch.marked |= LJ_GC_BLACK)
|
||||
#define isfinalized(u) ((u)->marked & LJ_GC_FINALIZED)
|
||||
#define markfinalized(u) ((u)->marked |= LJ_GC_FINALIZED)
|
||||
|
||||
/* -- Mark phase ---------------------------------------------------------- */
|
||||
|
||||
@ -122,7 +121,7 @@ static void gc_mark_mmudata(global_State *g)
|
||||
}
|
||||
}
|
||||
|
||||
/* Separate userdata which which needs finalization to mmudata list. */
|
||||
/* Separate userdata objects to be finalized to mmudata list. */
|
||||
size_t lj_gc_separateudata(global_State *g, int all)
|
||||
{
|
||||
size_t m = 0;
|
||||
@ -132,11 +131,11 @@ size_t lj_gc_separateudata(global_State *g, int all)
|
||||
if (!(iswhite(o) || all) || isfinalized(gco2ud(o))) {
|
||||
p = &o->gch.nextgc; /* Nothing to do. */
|
||||
} else if (!lj_meta_fastg(g, tabref(gco2ud(o)->metatable), MM_gc)) {
|
||||
markfinalized(gco2ud(o)); /* Done, as there's no __gc metamethod. */
|
||||
markfinalized(o); /* Done, as there's no __gc metamethod. */
|
||||
p = &o->gch.nextgc;
|
||||
} else { /* Otherwise move userdata to be finalized to mmudata list. */
|
||||
m += sizeudata(gco2ud(o));
|
||||
markfinalized(gco2ud(o));
|
||||
markfinalized(o);
|
||||
*p = o->gch.nextgc;
|
||||
if (gcref(g->gc.mmudata)) { /* Link to end of mmudata list. */
|
||||
GCobj *root = gcref(g->gc.mmudata);
|
||||
|
@ -43,6 +43,7 @@ enum {
|
||||
#define flipwhite(x) ((x)->gch.marked ^= LJ_GC_WHITES)
|
||||
#define black2gray(x) ((x)->gch.marked &= (uint8_t)~LJ_GC_BLACK)
|
||||
#define fixstring(s) ((s)->marked |= LJ_GC_FIXED)
|
||||
#define markfinalized(x) ((x)->gch.marked |= LJ_GC_FINALIZED)
|
||||
|
||||
/* Collector. */
|
||||
LJ_FUNC size_t lj_gc_separateudata(global_State *g, int all);
|
||||
|
Loading…
Reference in New Issue
Block a user