mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-04 22:40:25 +02:00
* guardians.c (scm_guardian_zombify): mark all zombies in a
separate loop after processing all the currently known live guardians, so as to not introduce order dependencies (thanks to Gary Houston). also, make another outer loop to process zombified guardians (which are uncovered while marking zombies).
This commit is contained in:
parent
54778cd312
commit
50fecba92d
2 changed files with 70 additions and 51 deletions
|
@ -1,3 +1,11 @@
|
|||
2000-04-03 Michael Livshin <mlivshin@bigfoot.com>
|
||||
|
||||
* guardians.c (scm_guardian_zombify): mark all zombies in a
|
||||
separate loop after processing all the currently known live
|
||||
guardians, so as to not introduce order dependencies (thanks to
|
||||
Gary Houston). also, make another outer loop to process zombified
|
||||
guardians (which are uncovered while marking zombies).
|
||||
|
||||
2000-04-03 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||
|
||||
* evalext.c (scm_definedp, scm_m_undefine), gc.c
|
||||
|
@ -531,22 +539,22 @@
|
|||
|
||||
2000-03-18 Michael Livshin <mlivshin@bigfoot.com>
|
||||
|
||||
* tags.h: (SCM_DOUBLE_CELLP, SCM_NDOUBLE_CELLP): new macros.
|
||||
* tags.h: (SCM_DOUBLE_CELLP, SCM_NDOUBLE_CELLP): new macros (bad
|
||||
names, anyone got any better ones?)
|
||||
|
||||
* gc.h: (typedef struct scm_freelist_t) remove from here.
|
||||
|
||||
* gc.c: (CELL_UP, CELL_DN) make these macros take additional
|
||||
* gc.c: (CELL_UP, CELL_DN) made these macros take additional
|
||||
parameter (the span).
|
||||
(CLUSTER_SIZE_IN_BYTES, ALIGNMENT_SLACK) new macros.
|
||||
(typedef struct scm_freelist_t) move here from gc.h, it had no
|
||||
(typedef struct scm_freelist_t) moved here from gc.h, it had no
|
||||
business being externally visible.
|
||||
(typedef struct scm_heap_seg_data_t) renamed from
|
||||
scm_heap_seg_data, to be style-compliant.
|
||||
(scm_mark_locations) if the possible pointer points to a
|
||||
multy-cell, check that it's properly aligned.
|
||||
(init_heap_seg) alighn multy-cells properly, work with the
|
||||
assumption that the segment size divides cleanly by cluster size
|
||||
(so that there's no spill).
|
||||
double-cell, check that it's properly aligned.
|
||||
(init_heap_seg) align double-cells properly, work with the
|
||||
assumption that the segment size divides cleanly by cluster size.
|
||||
(round_to_cluster_size) new function.
|
||||
(alloc_some_heap, make_initial_segment) use round_to_cluster_size
|
||||
to satisfy the new init_heap_seg invariant.
|
||||
|
|
|
@ -232,7 +232,8 @@ g_mark (SCM ptr)
|
|||
its live list (tconc) to its zombie list (tconc). */
|
||||
void scm_guardian_zombify (void)
|
||||
{
|
||||
guardian_t *g;
|
||||
guardian_t *first_guardian;
|
||||
guardian_t **link_field = &first_live_guardian;
|
||||
|
||||
/* Note that new guardians may be stuck on the end of the live
|
||||
guardian list as we run this loop. As we move unmarked objects
|
||||
|
@ -240,7 +241,16 @@ void scm_guardian_zombify (void)
|
|||
guardians. The guardian mark function will stick them on the end
|
||||
of this list, so they'll be processed properly. */
|
||||
|
||||
for (g = first_live_guardian; g; g = g->next)
|
||||
do {
|
||||
guardian_t *g;
|
||||
|
||||
first_guardian = *link_field;
|
||||
link_field = current_link_field;
|
||||
|
||||
/* first, scan all the guardians that are currently known to be live
|
||||
and move their unmarked objects to zombie lists. */
|
||||
|
||||
for (g = first_guardian; g; g = g->next)
|
||||
{
|
||||
SCM tconc_tail = g->live.tail;
|
||||
SCM *prev_ptr = &g->live.head;
|
||||
|
@ -271,28 +281,29 @@ void scm_guardian_zombify (void)
|
|||
cars, since we know they are already marked). */
|
||||
for (pair = g->live.head; SCM_NIMP (pair); pair = SCM_GCCDR (pair))
|
||||
SCM_SETGCMARK (pair);
|
||||
}
|
||||
|
||||
/* ghouston: Doesn't it seem a bit disturbing that if a zombie
|
||||
is returned to full life after getting returned from the
|
||||
guardian procedure, it may reference objects which are in a
|
||||
guardian's zombie list? Is it not necessary to move such
|
||||
zombies back to the live list, to avoid allowing the
|
||||
guardian procedure to return an object which is referenced,
|
||||
so not collectable? The paper doesn't give this
|
||||
impression.
|
||||
|
||||
cmm: the paper does explicitly say that an object that is
|
||||
guarded more than once should be returned more than once.
|
||||
I believe this covers the above scenario. */
|
||||
|
||||
/* Preserve the zombies in their undead state, by marking to
|
||||
prevent collection. */
|
||||
|
||||
/* ghouston: possible bug: this may mark objects which are
|
||||
protected by other guardians, but which have no references
|
||||
from outside of the guardian system. section 3 of the paper
|
||||
mentions shared and cyclic objects and it seems that all
|
||||
parts should be made available for collection. Currently the
|
||||
behaviour depends on the order in which guardians are
|
||||
scanned.
|
||||
|
||||
Doesn't it seem a bit disturbing that if a zombie is returned
|
||||
to full life after getting returned from the guardian
|
||||
procedure, it may reference objects which are in a guardian's
|
||||
zombie list? Is it not necessary to move such zombies back
|
||||
to the live list, to avoid allowing the guardian procedure to
|
||||
return an object which is referenced, so not collectable?
|
||||
The paper doesn't give this impression. */
|
||||
prevent collection. Note that this may uncover zombified
|
||||
guardians -- if so, they'll be processed in the next loop. */
|
||||
|
||||
for (g = first_guardian; g && (!*link_field || g != *link_field); g = g->next)
|
||||
scm_gc_mark (g->zombies.head);
|
||||
}
|
||||
|
||||
} while (current_link_field != link_field);
|
||||
}
|
||||
|
||||
/* not generally used, since guardian smob is wrapped in a closure.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue