mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Inline lj_gc_barrierback().
This commit is contained in:
parent
d85b7e636e
commit
efcaef22bd
12
src/lj_gc.c
12
src/lj_gc.c
@ -33,7 +33,6 @@
|
||||
|
||||
/* Macros to set GCobj colors and flags. */
|
||||
#define white2gray(x) ((x)->gch.marked &= (uint8_t)~LJ_GC_WHITES)
|
||||
#define black2gray(x) ((x)->gch.marked &= (uint8_t)~LJ_GC_BLACK)
|
||||
#define gray2black(x) ((x)->gch.marked |= LJ_GC_BLACK)
|
||||
#define makewhite(g, x) \
|
||||
((x)->gch.marked = ((x)->gch.marked & (uint8_t)~LJ_GC_COLORS) | curwhite(g))
|
||||
@ -740,17 +739,6 @@ void lj_gc_fullgc(lua_State *L)
|
||||
|
||||
/* -- Write barriers ------------------------------------------------------ */
|
||||
|
||||
/* Move the GC propagation frontier back for tables (make it gray again). */
|
||||
void lj_gc_barrierback(global_State *g, GCtab *t)
|
||||
{
|
||||
GCobj *o = obj2gco(t);
|
||||
lua_assert(isblack(o) && !isdead(g, o));
|
||||
lua_assert(g->gc.state != GCSfinalize && g->gc.state != GCSpause);
|
||||
black2gray(o);
|
||||
setgcrefr(t->gclist, g->gc.grayagain);
|
||||
setgcref(g->gc.grayagain, o);
|
||||
}
|
||||
|
||||
/* Move the GC propagation frontier forward. */
|
||||
void lj_gc_barrierf(global_State *g, GCobj *o, GCobj *v)
|
||||
{
|
||||
|
15
src/lj_gc.h
15
src/lj_gc.h
@ -39,6 +39,7 @@ enum {
|
||||
#define curwhite(g) ((g)->gc.currentwhite & LJ_GC_WHITES)
|
||||
#define newwhite(g, x) (obj2gco(x)->gch.marked = (uint8_t)curwhite(g))
|
||||
#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)
|
||||
|
||||
/* Collector. */
|
||||
@ -66,7 +67,6 @@ LJ_FUNC void lj_gc_fullgc(lua_State *L);
|
||||
lj_gc_step_fixtop(L); }
|
||||
|
||||
/* Write barriers. */
|
||||
LJ_FUNC void lj_gc_barrierback(global_State *g, GCtab *t);
|
||||
LJ_FUNC void lj_gc_barrierf(global_State *g, GCobj *o, GCobj *v);
|
||||
LJ_FUNCA void LJ_FASTCALL lj_gc_barrieruv(global_State *g, TValue *tv);
|
||||
LJ_FUNC void lj_gc_closeuv(global_State *g, GCupval *uv);
|
||||
@ -74,9 +74,20 @@ LJ_FUNC void lj_gc_closeuv(global_State *g, GCupval *uv);
|
||||
LJ_FUNC void lj_gc_barriertrace(global_State *g, uint32_t traceno);
|
||||
#endif
|
||||
|
||||
/* Move the GC propagation frontier back for tables (make it gray again). */
|
||||
static LJ_AINLINE void lj_gc_barrierback(global_State *g, GCtab *t)
|
||||
{
|
||||
GCobj *o = obj2gco(t);
|
||||
lua_assert(isblack(o) && !isdead(g, o));
|
||||
lua_assert(g->gc.state != GCSfinalize && g->gc.state != GCSpause);
|
||||
black2gray(o);
|
||||
setgcrefr(t->gclist, g->gc.grayagain);
|
||||
setgcref(g->gc.grayagain, o);
|
||||
}
|
||||
|
||||
/* Barrier for stores to table objects. TValue and GCobj variant. */
|
||||
#define lj_gc_anybarriert(L, t) \
|
||||
{ if (isblack(obj2gco(t))) lj_gc_barrierback(G(L), (t)); }
|
||||
{ if (LJ_UNLIKELY(isblack(obj2gco(t)))) lj_gc_barrierback(G(L), (t)); }
|
||||
#define lj_gc_barriert(L, t, tv) \
|
||||
{ if (tviswhite(tv) && isblack(obj2gco(t))) \
|
||||
lj_gc_barrierback(G(L), (t)); }
|
||||
|
Loading…
Reference in New Issue
Block a user