diff options
author | Mike Pall <mike> | 2011-04-10 20:45:36 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2011-04-10 20:45:36 +0200 |
commit | efcaef22bd5e7dc54c87e8f1a23b514fbda97d29 (patch) | |
tree | 4151c8e65bc929107a024ab65dbed8c16f382666 /src | |
parent | d85b7e636e076f10ce7a4ad9a7d2cf00d760956e (diff) | |
download | luajit-efcaef22bd5e7dc54c87e8f1a23b514fbda97d29.tar.gz luajit-efcaef22bd5e7dc54c87e8f1a23b514fbda97d29.tar.bz2 luajit-efcaef22bd5e7dc54c87e8f1a23b514fbda97d29.zip |
Inline lj_gc_barrierback().
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_gc.c | 12 | ||||
-rw-r--r-- | src/lj_gc.h | 15 |
2 files changed, 13 insertions, 14 deletions
diff --git a/src/lj_gc.c b/src/lj_gc.c index 5d795596..aba19d3f 100644 --- a/src/lj_gc.c +++ b/src/lj_gc.c | |||
@@ -33,7 +33,6 @@ | |||
33 | 33 | ||
34 | /* Macros to set GCobj colors and flags. */ | 34 | /* Macros to set GCobj colors and flags. */ |
35 | #define white2gray(x) ((x)->gch.marked &= (uint8_t)~LJ_GC_WHITES) | 35 | #define white2gray(x) ((x)->gch.marked &= (uint8_t)~LJ_GC_WHITES) |
36 | #define black2gray(x) ((x)->gch.marked &= (uint8_t)~LJ_GC_BLACK) | ||
37 | #define gray2black(x) ((x)->gch.marked |= LJ_GC_BLACK) | 36 | #define gray2black(x) ((x)->gch.marked |= LJ_GC_BLACK) |
38 | #define makewhite(g, x) \ | 37 | #define makewhite(g, x) \ |
39 | ((x)->gch.marked = ((x)->gch.marked & (uint8_t)~LJ_GC_COLORS) | curwhite(g)) | 38 | ((x)->gch.marked = ((x)->gch.marked & (uint8_t)~LJ_GC_COLORS) | curwhite(g)) |
@@ -740,17 +739,6 @@ void lj_gc_fullgc(lua_State *L) | |||
740 | 739 | ||
741 | /* -- Write barriers ------------------------------------------------------ */ | 740 | /* -- Write barriers ------------------------------------------------------ */ |
742 | 741 | ||
743 | /* Move the GC propagation frontier back for tables (make it gray again). */ | ||
744 | void lj_gc_barrierback(global_State *g, GCtab *t) | ||
745 | { | ||
746 | GCobj *o = obj2gco(t); | ||
747 | lua_assert(isblack(o) && !isdead(g, o)); | ||
748 | lua_assert(g->gc.state != GCSfinalize && g->gc.state != GCSpause); | ||
749 | black2gray(o); | ||
750 | setgcrefr(t->gclist, g->gc.grayagain); | ||
751 | setgcref(g->gc.grayagain, o); | ||
752 | } | ||
753 | |||
754 | /* Move the GC propagation frontier forward. */ | 742 | /* Move the GC propagation frontier forward. */ |
755 | void lj_gc_barrierf(global_State *g, GCobj *o, GCobj *v) | 743 | void lj_gc_barrierf(global_State *g, GCobj *o, GCobj *v) |
756 | { | 744 | { |
diff --git a/src/lj_gc.h b/src/lj_gc.h index e3973d8e..ec1a9643 100644 --- a/src/lj_gc.h +++ b/src/lj_gc.h | |||
@@ -39,6 +39,7 @@ enum { | |||
39 | #define curwhite(g) ((g)->gc.currentwhite & LJ_GC_WHITES) | 39 | #define curwhite(g) ((g)->gc.currentwhite & LJ_GC_WHITES) |
40 | #define newwhite(g, x) (obj2gco(x)->gch.marked = (uint8_t)curwhite(g)) | 40 | #define newwhite(g, x) (obj2gco(x)->gch.marked = (uint8_t)curwhite(g)) |
41 | #define flipwhite(x) ((x)->gch.marked ^= LJ_GC_WHITES) | 41 | #define flipwhite(x) ((x)->gch.marked ^= LJ_GC_WHITES) |
42 | #define black2gray(x) ((x)->gch.marked &= (uint8_t)~LJ_GC_BLACK) | ||
42 | #define fixstring(s) ((s)->marked |= LJ_GC_FIXED) | 43 | #define fixstring(s) ((s)->marked |= LJ_GC_FIXED) |
43 | 44 | ||
44 | /* Collector. */ | 45 | /* Collector. */ |
@@ -66,7 +67,6 @@ LJ_FUNC void lj_gc_fullgc(lua_State *L); | |||
66 | lj_gc_step_fixtop(L); } | 67 | lj_gc_step_fixtop(L); } |
67 | 68 | ||
68 | /* Write barriers. */ | 69 | /* Write barriers. */ |
69 | LJ_FUNC void lj_gc_barrierback(global_State *g, GCtab *t); | ||
70 | LJ_FUNC void lj_gc_barrierf(global_State *g, GCobj *o, GCobj *v); | 70 | LJ_FUNC void lj_gc_barrierf(global_State *g, GCobj *o, GCobj *v); |
71 | LJ_FUNCA void LJ_FASTCALL lj_gc_barrieruv(global_State *g, TValue *tv); | 71 | LJ_FUNCA void LJ_FASTCALL lj_gc_barrieruv(global_State *g, TValue *tv); |
72 | LJ_FUNC void lj_gc_closeuv(global_State *g, GCupval *uv); | 72 | 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); | |||
74 | LJ_FUNC void lj_gc_barriertrace(global_State *g, uint32_t traceno); | 74 | LJ_FUNC void lj_gc_barriertrace(global_State *g, uint32_t traceno); |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | /* Move the GC propagation frontier back for tables (make it gray again). */ | ||
78 | static LJ_AINLINE void lj_gc_barrierback(global_State *g, GCtab *t) | ||
79 | { | ||
80 | GCobj *o = obj2gco(t); | ||
81 | lua_assert(isblack(o) && !isdead(g, o)); | ||
82 | lua_assert(g->gc.state != GCSfinalize && g->gc.state != GCSpause); | ||
83 | black2gray(o); | ||
84 | setgcrefr(t->gclist, g->gc.grayagain); | ||
85 | setgcref(g->gc.grayagain, o); | ||
86 | } | ||
87 | |||
77 | /* Barrier for stores to table objects. TValue and GCobj variant. */ | 88 | /* Barrier for stores to table objects. TValue and GCobj variant. */ |
78 | #define lj_gc_anybarriert(L, t) \ | 89 | #define lj_gc_anybarriert(L, t) \ |
79 | { if (isblack(obj2gco(t))) lj_gc_barrierback(G(L), (t)); } | 90 | { if (LJ_UNLIKELY(isblack(obj2gco(t)))) lj_gc_barrierback(G(L), (t)); } |
80 | #define lj_gc_barriert(L, t, tv) \ | 91 | #define lj_gc_barriert(L, t, tv) \ |
81 | { if (tviswhite(tv) && isblack(obj2gco(t))) \ | 92 | { if (tviswhite(tv) && isblack(obj2gco(t))) \ |
82 | lj_gc_barrierback(G(L), (t)); } | 93 | lj_gc_barrierback(G(L), (t)); } |