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

Fixed garbage collection of ports: basics work (no SMOBs, no guardians, no WHT).

* libguile/gc.c (scm_init_storage): Do not initialize SCM_I_PORT_TABLE
  here: this is done in `scm_ports_prehistory ()'.  This fixes the bug
  mentioned in the previous patch log.

* libguile/ports.c (scm_new_port_table_entry): Slightly clarified the
  code.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-4
This commit is contained in:
Ludovic Courtes 2006-04-02 21:05:34 +00:00 committed by Ludovic Courtès
parent fca4388748
commit 6a4be32986
2 changed files with 3 additions and 9 deletions

View file

@ -720,12 +720,6 @@ scm_init_storage ()
j = SCM_HEAP_SEG_SIZE; j = SCM_HEAP_SEG_SIZE;
/* Initialise the list of ports. */
scm_i_port_table = (scm_t_port **)
malloc (sizeof (scm_t_port *) * scm_i_port_table_room);
if (!scm_i_port_table)
return 1;
#if 0 #if 0
/* We can't have a cleanup handler since we have no thread to run it /* We can't have a cleanup handler since we have no thread to run it
in. */ in. */

View file

@ -500,13 +500,13 @@ scm_new_port_table_entry (scm_t_bits tag)
/* initial malloc is in gc.c. this doesn't use scm_gc_malloc etc., /* initial malloc is in gc.c. this doesn't use scm_gc_malloc etc.,
since it can never be freed during gc. */ since it can never be freed during gc. */
/* XXX (Ludo): Why not do it actually? */ /* XXX (Ludo): Why not do it actually? */
size_t new_size = scm_i_port_table_room * 2;
void *newt = scm_gc_realloc ((char *) scm_i_port_table, void *newt = scm_gc_realloc ((char *) scm_i_port_table,
scm_i_port_table_room * sizeof (scm_t_port *), scm_i_port_table_room * sizeof (scm_t_port *),
(size_t) (sizeof (scm_t_port *) new_size * sizeof (scm_t_port *),
* scm_i_port_table_room * 2),
"port-table"); "port-table");
scm_i_port_table = (scm_t_port **) newt; scm_i_port_table = (scm_t_port **) newt;
scm_i_port_table_room *= 2; scm_i_port_table_room = new_size;
} }
entry->entry = scm_i_port_table_size; entry->entry = scm_i_port_table_size;