[bugfix] gc may enter an infinite loop

This commit is contained in:
Yuichi Nishiwaki
2013-11-15 16:11:54 +09:00
parent a2f022df4e
commit 93e5758e4c
+15 -12
View File
@@ -156,12 +156,27 @@ gc_mark_block(pic_state *pic, struct pic_block *blk)
}
}
static bool
is_marked(union header *p)
{
return p->s.mark == PIC_GC_MARK;
}
static void
gc_unmark(union header *p)
{
p->s.mark = PIC_GC_UNMARK;
}
static void
gc_mark_object(pic_state *pic, struct pic_object *obj)
{
union header *p;
p = (union header *)obj - 1;
if (is_marked(p))
return;
p->s.mark = PIC_GC_MARK;
switch (obj->tt) {
@@ -301,18 +316,6 @@ gc_mark_phase(pic_state *pic)
}
}
static bool
is_marked(union header *p)
{
return p->s.mark == PIC_GC_MARK;
}
static void
gc_unmark(union header *p)
{
p->s.mark = PIC_GC_UNMARK;
}
static void
gc_finalize_object(pic_state *pic, struct pic_object *obj)
{