[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: scm_mark_dependencies & guardians
From: |
Han-Wen Nienhuys |
Subject: |
Re: scm_mark_dependencies & guardians |
Date: |
Fri, 19 Jul 2002 23:03:03 +0200 |
address@hidden writes:
> I don't want to comment on the big picture, just one note: it is
> important that marking is done in a 'tail calling' way. That is, we
> must not recurse when marking the spine of a list, for example. That
> is the reason for the goto in gc_mark.
Sure, otherwise you get stack overflow.
> Hmm, I don't think we should fear goto. Sometimes it is clearer to
> use goto than it is to avoid it. The main spaghetti in gc.c is the
> inclusion in itself. What about moving the marking code into a
> separate file and including it twice? We already do this for
> num2float and num2integral.
I already recoded it without inclusion. You can get around including a
file twice by doing
mark (SCM p)
{
if (marked(p)) return;
set_mark(p);
mark_dependencies (p);
}
mark_dependencies(SCM p)
{
again:
switch (tag(p))
{
.... // lots of cases jumping to mark_next
}
return;
mark_next:
if (marked(p)) return;
set_mark(p);
goto again;
}
--
Han-Wen Nienhuys | address@hidden | http://www.cs.uu.nl/~hanwen/