[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-devel] tc16_allocated (was: guile/guile-core/libguile init.c)

From: Michael Livshin
Subject: [Guile-devel] tc16_allocated (was: guile/guile-core/libguile init.c)
Date: 02 Sep 2000 16:54:55 +0300
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (20 Minutes to Nikko)

Mikael Djurfeldt <address@hidden> writes:

> In the old GC scheme, a cell has three phases in its life: first it is
> a free cell, then an allocated cell, and, thirdly, a real cell.  Each
> phase requires at least one store to memory.  And, since we now have
> multiple freelists, the free phase can actually be repeated, so
> there's a waste of at least one (+ repeated free phases) store to
> memory per cell used.
> Also, the allocated phase is entered too late to work in pre-emptive
> multithreading, because a thread might be interrupted just before
> storing scm_tc16_allocated into a cell, and next thread might trigger
> GC.
> I now suggest the following change to be applied to the new GC scheme:
> * Remove the scm_tc16_allocated phase.  If a cell isn't "real", it is
>   scm_tc_free_cell.

good goal.

> * Don't collect free cells during the sweep, just let them stay in
>   their freelist or in their cluster.

bad idea.  after several GC's you'll end up with a freelist that jumps 
all over the place.  *not* good.

it also makes implementing lazy sweep harder.

so, I have two ideas for improving the situation:

0) the simple-minded idea.

   currently, `scm_mark_locations' doesn't mark free cells for fear of 
   false positives.

   I think it's worthwhile to let them be marked, and see if false
   positives really are problematic (I think not, but people with real 
   applications should try and see).

   if we let free cells be marked, then the "allocated" phase isn't
   needed at all.

1) the slightly more sophisticated idea.

   we let `scm_mark_locations' mark a free cell only if it's close to
   the top of the stack, and not mark it otherwise.

   the idea is that cells should be initialized "as soon as" they are
   SCM_NEWCELL'ed, i.e. in the same C stack frame.  I think it's
   reasonable to require that if the cell isn't initialized in the
   same C function in which SCM_NEWCELL was called, then the cell may
   be GC'ed.

   [ determining the precise meaning of "close to the top of the
     stack" looks problematic, though.  ideas welcome. ]

This program posts news to billions of machines throughout the galaxy.  Your
message will cost the net enough to bankrupt your entire planet.  As a result
your species will be sold into slavery.  Be sure you know what you are doing.
Are you absolutely sure you want to do this? [yn] y

reply via email to

[Prev in Thread] Current Thread [Next in Thread]