aboutsummaryrefslogtreecommitdiff
path: root/src/lj_gc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_gc.c')
-rw-r--r--src/lj_gc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lj_gc.c b/src/lj_gc.c
index f231b1ce..bc6d843a 100644
--- a/src/lj_gc.c
+++ b/src/lj_gc.c
@@ -32,11 +32,11 @@
32#define GCFINALIZECOST 100 32#define GCFINALIZECOST 100
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 &= cast_byte(~LJ_GC_WHITES)) 35#define white2gray(x) ((x)->gch.marked &= (uint8_t)~LJ_GC_WHITES)
36#define black2gray(x) ((x)->gch.marked &= cast_byte(~LJ_GC_BLACK)) 36#define black2gray(x) ((x)->gch.marked &= (uint8_t)~LJ_GC_BLACK)
37#define gray2black(x) ((x)->gch.marked |= LJ_GC_BLACK) 37#define gray2black(x) ((x)->gch.marked |= LJ_GC_BLACK)
38#define makewhite(g, x) \ 38#define makewhite(g, x) \
39 ((x)->gch.marked = ((x)->gch.marked & cast_byte(~LJ_GC_COLORS)) | curwhite(g)) 39 ((x)->gch.marked = ((x)->gch.marked & (uint8_t)~LJ_GC_COLORS) | curwhite(g))
40#define isfinalized(u) ((u)->marked & LJ_GC_FINALIZED) 40#define isfinalized(u) ((u)->marked & LJ_GC_FINALIZED)
41#define markfinalized(u) ((u)->marked |= LJ_GC_FINALIZED) 41#define markfinalized(u) ((u)->marked |= LJ_GC_FINALIZED)
42 42
@@ -52,7 +52,7 @@
52 { if (iswhite(obj2gco(o))) gc_mark(g, obj2gco(o)); } 52 { if (iswhite(obj2gco(o))) gc_mark(g, obj2gco(o)); }
53 53
54/* Mark a string object. */ 54/* Mark a string object. */
55#define gc_mark_str(s) ((s)->marked &= cast_byte(~LJ_GC_WHITES)) 55#define gc_mark_str(s) ((s)->marked &= (uint8_t)~LJ_GC_WHITES)
56 56
57/* Mark a white GCobj. */ 57/* Mark a white GCobj. */
58static void gc_mark(global_State *g, GCobj *o) 58static void gc_mark(global_State *g, GCobj *o)
@@ -174,7 +174,7 @@ static int gc_traverse_tab(global_State *g, GCtab *t)
174 else if (c == 'K') weak = (int)(~0u & ~LJ_GC_WEAKVAL); 174 else if (c == 'K') weak = (int)(~0u & ~LJ_GC_WEAKVAL);
175 } 175 }
176 if (weak > 0) { /* Weak tables are cleared in the atomic phase. */ 176 if (weak > 0) { /* Weak tables are cleared in the atomic phase. */
177 t->marked = cast_byte((t->marked & ~LJ_GC_WEAK) | weak); 177 t->marked = (uint8_t)((t->marked & ~LJ_GC_WEAK) | weak);
178 setgcrefr(t->gclist, g->gc.weak); 178 setgcrefr(t->gclist, g->gc.weak);
179 setgcref(g->gc.weak, obj2gco(t)); 179 setgcref(g->gc.weak, obj2gco(t));
180 } 180 }
@@ -594,7 +594,7 @@ static void atomic(global_State *g, lua_State *L)
594 gc_clearweak(gcref(g->gc.weak)); 594 gc_clearweak(gcref(g->gc.weak));
595 595
596 /* Prepare for sweep phase. */ 596 /* Prepare for sweep phase. */
597 g->gc.currentwhite = cast_byte(otherwhite(g)); /* Flip current white. */ 597 g->gc.currentwhite = (uint8_t)otherwhite(g); /* Flip current white. */
598 g->strempty.marked = g->gc.currentwhite; 598 g->strempty.marked = g->gc.currentwhite;
599 setmref(g->gc.sweep, &g->gc.root); 599 setmref(g->gc.sweep, &g->gc.root);
600 g->gc.estimate = g->gc.total - (MSize)udsize; /* Initial estimate. */ 600 g->gc.estimate = g->gc.total - (MSize)udsize; /* Initial estimate. */
@@ -772,7 +772,7 @@ void LJ_FASTCALL lj_gc_barrieruv(global_State *g, TValue *tv)
772 if (g->gc.state == GCSpropagate || g->gc.state == GCSatomic) 772 if (g->gc.state == GCSpropagate || g->gc.state == GCSatomic)
773 gc_mark(g, gcV(tv)); 773 gc_mark(g, gcV(tv));
774 else 774 else
775 TV2MARKED(tv) = (TV2MARKED(tv) & cast_byte(~LJ_GC_COLORS)) | curwhite(g); 775 TV2MARKED(tv) = (TV2MARKED(tv) & (uint8_t)~LJ_GC_COLORS) | curwhite(g);
776#undef TV2MARKED 776#undef TV2MARKED
777} 777}
778 778