[bugfix] gc may enter an infinite loop
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user