GitHub

Original file line numberDiff line numberDiff line change

@@ -11,7 +11,7 @@

1111

struct RClass *c; \

1212

struct RBasic *gcnext; \

1313

enum mrb_vtype tt:8; \

14-

uint32_t color:3; \

14+

uint32_t gccolor:3; \

1515

uint32_t flags:21

1616
1717

#define MRB_FLAG_TEST(obj, flag) ((obj)->flags & (flag))

Original file line numberDiff line numberDiff line change

@@ -759,7 +759,7 @@ mrb_define_method_raw(mrb_state *mrb, struct RClass *c, mrb_sym mid, mrb_method_

759759
760760

ptr.proc = p;

761761

if (p) {

762-

if (p->color != MRB_GC_RED) {

762+

if (p->gccolor != MRB_GC_RED) {

763763

p->flags |= MRB_PROC_SCOPE;

764764

p->c = NULL;

765765

mrb_field_write_barrier(mrb, (struct RBasic*)c, (struct RBasic*)p);

Original file line numberDiff line numberDiff line change

@@ -170,17 +170,17 @@ typedef struct mrb_heap_page {

170170

#define GC_COLOR_MASK 7

171171

mrb_static_assert(MRB_GC_RED <= GC_COLOR_MASK);

172172
173-

#define paint_gray(o) ((o)->color = GC_GRAY)

174-

#define paint_black(o) ((o)->color = GC_BLACK)

175-

#define paint_white(o) ((o)->color = GC_WHITES)

176-

#define paint_partial_white(s, o) ((o)->color = (s)->current_white_part)

177-

#define is_gray(o) ((o)->color == GC_GRAY)

178-

#define is_white(o) ((o)->color & GC_WHITES)

179-

#define is_black(o) ((o)->color == GC_BLACK)

180-

#define is_red(o) ((o)->color == GC_RED)

173+

#define paint_gray(o) ((o)->gccolor = GC_GRAY)

174+

#define paint_black(o) ((o)->gccolor = GC_BLACK)

175+

#define paint_white(o) ((o)->gccolor = GC_WHITES)

176+

#define paint_partial_white(s, o) ((o)->gccolor = (s)->current_white_part)

177+

#define is_gray(o) ((o)->gccolor == GC_GRAY)

178+

#define is_white(o) ((o)->gccolor & GC_WHITES)

179+

#define is_black(o) ((o)->gccolor == GC_BLACK)

180+

#define is_red(o) ((o)->gccolor == GC_RED)

181181

#define flip_white_part(s) ((s)->current_white_part = other_white_part(s))

182182

#define other_white_part(s) ((s)->current_white_part ^ GC_WHITES)

183-

#define is_dead(s, o) (((o)->color & other_white_part(s) & GC_WHITES) || (o)->tt == MRB_TT_FREE)

183+

#define is_dead(s, o) (((o)->gccolor & other_white_part(s) & GC_WHITES) || (o)->tt == MRB_TT_FREE)

184184
185185

mrb_noreturn void mrb_raise_nomemory(mrb_state *mrb);

186186

Read the original on github.com ↗