diff options
author | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 2003-02-19 15:04:51 +0000 |
---|---|---|
committer | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 2003-02-19 15:04:51 +0000 |
commit | c35738c1ae80f3ed9ae7c54532f6477cf7cc8bde (patch) | |
tree | ce2a3e148d68ca7c3f108894fd55e1fb2539da83 /libguile/gc.c | |
parent | 0a4c1355501a17924b3aa4dfed0c8d8121fa378f (diff) | |
download | guile-c35738c1ae80f3ed9ae7c54532f6477cf7cc8bde.tar.gz |
* hooks.c (scm_c_hook_add): Fixed bug in append mode.
* environments.c (obarray_enter, obarray_retrieve, obarray_remove,
leaf_environment_fold, obarray_remove_all): Use hashtable
accessors.
* gc.c (scm_init_storage): Moved hook initialization to
scm_storage_prehistory.
(scm_storage_prehistory): New function.
(scm_igc): Added commentary about placement of
scm_after_sweep_c_hook.
* gc-mark.c (scm_mark_all): Use hashtable accessors.
(scm_gc_mark_dependencies): Use SCM_WVECT_WEAK_KEY_P and
SCM_WVECT_WEAK_VALUE_P.
* hashtab.c, hashtab.h (scm_hash_for_each, scm_hash_map): New
functions.
(scm_vector_to_hash_table, scm_c_make_resizing_hash_table):
Removed.
(scm_make_weak_key_hash_table, scm_make_weak_value_hash_table,
scm_make_doubly_weak_hash_table): Moved here from weaks.c.
* init.c (scm_init_guile_1): Removed call to scm_init_weaks; Added
calls to scm_storage_prehistory and scm_hashtab_prehistory.
* modules.c (module-reverse-lookup): Use hashtable accessors.
* symbols.c, symbols.h (scm_i_hash_symbol): New function.
* weaks.c, weaks.h (scm_make_weak_key_alist_vector,
scm_make_weak_value_alist_vector,
scm_make_doubly_weak_alist_vector): New functions.
* weaks.c (scm_init_weaks_builtins): New function.
* weaks.h (SCM_WVECTF_WEAK_KEY, SCM_WVECTF_WEAK_VALUE,
SCM_WVECTF_NOSCAN, SCM_WVECT_WEAK_KEY_P, SCM_WVECT_WEAK_VALUE_P,
SCM_WVECT_NOSCAN_P): New macros.
* weaks.c (scm_scan_weak_vectors): Use SCM_WVECT_WEAK_KEY_P
and SCM_WVECT_WEAK_VALUE_P.
* weaks.c, weaks.h (scm_i_allocate_weak_vector): Renamed from
allocate_weak_vector and exported.
* Makefile.am (ice9_sources): Added weak-vector.scm.
* weak-vector.scm: New file.
* boot-9.scm (module-clear!): Use hash-clear!.
(module-for-each): Use hash-for-each.
(module-map): Use hash-map.
Diffstat (limited to 'libguile/gc.c')
-rw-r--r-- | libguile/gc.c | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/libguile/gc.c b/libguile/gc.c index ba43df315..e912beaa6 100644 --- a/libguile/gc.c +++ b/libguile/gc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -608,6 +608,25 @@ scm_igc (const char *what) /* TODO: this hook should probably be moved to just before the mark, since that's where the sweep is finished in lazy sweeping. + + MDJ 030219 <djurfeldt@nada.kth.se>: No, probably not. The + original meaning implied at least two things: that it would be + called when + + 1. the freelist is re-initialized (no evaluation possible, though) + + and + + 2. the heap is "fresh" + (it is well-defined what data is used and what is not) + + Neither of these conditions would hold just before the mark phase. + + Of course, the lazy sweeping has muddled the distinction between + scm_before_sweep_c_hook and scm_after_sweep_c_hook, but even if + there were no difference, it would still be useful to have two + distinct classes of hook functions since this can prevent some + bad interference when several modules adds gc hooks. */ scm_c_hook_run (&scm_after_sweep_c_hook, 0); gc_end_stats (); @@ -873,6 +892,15 @@ scm_getenv_int (const char *var, int def) return res; } +void +scm_storage_prehistory () +{ + scm_c_hook_init (&scm_before_gc_c_hook, 0, SCM_C_HOOK_NORMAL); + scm_c_hook_init (&scm_before_mark_c_hook, 0, SCM_C_HOOK_NORMAL); + scm_c_hook_init (&scm_before_sweep_c_hook, 0, SCM_C_HOOK_NORMAL); + scm_c_hook_init (&scm_after_sweep_c_hook, 0, SCM_C_HOOK_NORMAL); + scm_c_hook_init (&scm_after_gc_c_hook, 0, SCM_C_HOOK_NORMAL); +} int scm_init_storage () @@ -893,13 +921,6 @@ scm_init_storage () j = SCM_HEAP_SEG_SIZE; - - scm_c_hook_init (&scm_before_gc_c_hook, 0, SCM_C_HOOK_NORMAL); - scm_c_hook_init (&scm_before_mark_c_hook, 0, SCM_C_HOOK_NORMAL); - scm_c_hook_init (&scm_before_sweep_c_hook, 0, SCM_C_HOOK_NORMAL); - scm_c_hook_init (&scm_after_sweep_c_hook, 0, SCM_C_HOOK_NORMAL); - scm_c_hook_init (&scm_after_gc_c_hook, 0, SCM_C_HOOK_NORMAL); - /* Initialise the list of ports. */ scm_i_port_table = (scm_t_port **) malloc (sizeof (scm_t_port *) * scm_i_port_table_room); |