1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

* struct.c (scm_struct_prehistory): Init scm_i_structs_to_free to

SCM_EOL.
(scm_struct_prehistory): Move scm_free_structs to
scm_before_mark_c_hook.

* gc-card.c (sweep_card): Check that we haven't swept structs on
this card before.  That can happen if scm_i_sweep_all_segments has
been called from some other place than scm_igc.
This commit is contained in:
Mikael Djurfeldt 2003-02-24 19:21:56 +00:00
parent 53af825522
commit b4a1358cfb
3 changed files with 31 additions and 13 deletions

View file

@ -1,13 +1,18 @@
2003-02-24 Mikael Djurfeldt <djurfeldt@nada.kth.se> 2003-02-24 Mikael Djurfeldt <djurfeldt@nada.kth.se>
* struct.c (scm_struct_gc_init): Removed. This fixes a serious GC bug, introduced during the latest
(scm_struct_prehistory): Init scm_i_structs_to_free to SCM_EOL. reorganization of the GC, which disabled freeing of structs and
(This fixes a serious GC bug, introduced during the latest GOOPS objects:
reorganization of the GC, preventing freeing of structs and GOOPS
objects.) * struct.c (scm_struct_prehistory): Init scm_i_structs_to_free to
SCM_EOL.
(scm_struct_prehistory): Move scm_free_structs to (scm_struct_prehistory): Move scm_free_structs to
scm_before_mark_c_hook. scm_before_mark_c_hook.
* gc-card.c (sweep_card): Check that we haven't swept structs on
this card before. That can happen if scm_i_sweep_all_segments has
been called from some other place than scm_igc.
2003-02-19 Mikael Djurfeldt <djurfeldt@nada.kth.se> 2003-02-19 Mikael Djurfeldt <djurfeldt@nada.kth.se>
* environments.c (DEFAULT_OBARRAY_SIZE): Changed from 137 to 31 * environments.c (DEFAULT_OBARRAY_SIZE): Changed from 137 to 31

View file

@ -129,13 +129,17 @@ scm_i_sweep_card (scm_t_cell * p, SCM *free_list, scm_t_heap_segment*seg)
switch (SCM_TYP7 (scmptr)) switch (SCM_TYP7 (scmptr))
{ {
case scm_tcs_struct: case scm_tcs_struct:
{ /* The card can be swept more than once. Check that it's
/* Structs need to be freed in a special order. * the first time!
* This is handled by GC C hooks in struct.c. */
*/ if (!SCM_STRUCT_GC_CHAIN (p))
SCM_SET_STRUCT_GC_CHAIN (p, scm_i_structs_to_free); {
scm_i_structs_to_free = scmptr; /* Structs need to be freed in a special order.
} * This is handled by GC C hooks in struct.c.
*/
SCM_SET_STRUCT_GC_CHAIN (p, scm_i_structs_to_free);
scm_i_structs_to_free = scmptr;
}
continue; continue;
case scm_tcs_cons_imcar: case scm_tcs_cons_imcar:

View file

@ -355,6 +355,15 @@ scm_struct_free_entity (scm_t_bits * vtable SCM_UNUSED, scm_t_bits * data)
scm_gc_free ((void *) data[scm_struct_i_ptr], n, "entity struct"); scm_gc_free ((void *) data[scm_struct_i_ptr], n, "entity struct");
} }
static void *
scm_struct_gc_init (void *dummy1 SCM_UNUSED,
void *dummy2 SCM_UNUSED,
void *dummy3 SCM_UNUSED)
{
scm_i_structs_to_free = SCM_EOL;
return 0;
}
static void * static void *
scm_free_structs (void *dummy1 SCM_UNUSED, scm_free_structs (void *dummy1 SCM_UNUSED,
void *dummy2 SCM_UNUSED, void *dummy2 SCM_UNUSED,
@ -399,7 +408,6 @@ scm_free_structs (void *dummy1 SCM_UNUSED,
} }
} }
while (!SCM_NULLP (newchain)); while (!SCM_NULLP (newchain));
scm_i_structs_to_free = SCM_EOL;
return 0; return 0;
} }
@ -797,6 +805,7 @@ void
scm_struct_prehistory () scm_struct_prehistory ()
{ {
scm_i_structs_to_free = SCM_EOL; scm_i_structs_to_free = SCM_EOL;
scm_c_hook_add (&scm_before_sweep_c_hook, scm_struct_gc_init, 0, 0);
/* With the new lazy sweep GC, the point at which the entire heap is /* With the new lazy sweep GC, the point at which the entire heap is
swept is just before the mark phase. */ swept is just before the mark phase. */
scm_c_hook_add (&scm_before_mark_c_hook, scm_free_structs, 0, 0); scm_c_hook_add (&scm_before_mark_c_hook, scm_free_structs, 0, 0);