First stab at implementing weak hash tables and vectors. Unable to run the REPL.
authorLudovic Courtes <ludovic.courtes@laas.fr>
Tue, 4 Apr 2006 21:28:13 +0000 (21:28 +0000)
committerLudovic Courtès <ludo@gnu.org>
Thu, 4 Sep 2008 22:46:53 +0000 (00:46 +0200)
commit3a2de079d507b612fb7ada1a957ea539bea29fc5
tree78522c88d314860678b8fc08a20b2b6c8ced83df
parenta82e7953257db9d70cd2f05d0d7cbc98153bd10f
First stab at implementing weak hash tables and vectors.  Unable to run the REPL.

* libguile/hashtab.c (scm_weak_car_cell): New.
  (scm_weak_cdr_cell): New.
  (scm_doubly_weak_cell): New.
  (SCM_WEAK_CELL_WORD_DELETED_P): New.
  (SCM_WEAK_CELL_WORD): New.
  (scm_fixup_weak_alist): New.
  (make_hash_table): Always use non-weak vectors.  Allocate
  `scm_t_hashtable' objects as pointerless.
  (scm_i_rehash): Always make NEW_BUCKETS a non-weak vector.
  (scm_hash_fn_get_handle): Call `scm_fixup_weak_alist ()' on weak
  buckets before calling ASSOC_FN.
  (scm_hash_fn_remove_x): Likewise.
  (scm_hash_fn_create_handle_x): Likewise.  Also, use `scm_.*weak.*cell
  ()' for HANDLE when needed.

* libguile/symbols.c (lookup_interned_symbol): Check for nullified
  pairs.

* libguile/vectors.c (scm_vector_elements): Abort on weak vectors.
  (scm_vector_writable_elements): Likewise.
  (scm_c_vector_ref): Check whether the referenced element has been
  nullified.
  (scm_c_vector_set_x): Use `GC_GENERAL_REGISTER_DISAPPEARING_LINK ()'.
  (scm_i_allocate_weak_vector): Use `scm_gc_malloc_pointerless ()'
  instead of `scm_gc_malloc ()' when allocating room for the vector
  itself.

* libguile/weaks.c (scm_make_weak_key_alist_vector): Use
  `scm_make_vector ()' instead of `scm_i_allocate_weak_vector ()'.
  (scm_make_weak_value_alist_vector): Likewise.
  (scm_make_doubly_weak_alist_vector): Likewise.
  (weak_vectors): Removed.
  (scm_i_init_weak_vectors_for_gc): Removed.
  (scm_i_mark_weak_vector): Removed.
  (scm_i_mark_weak_vector_non_weaks): Removed.
  (scm_i_mark_weak_vectors_non_weaks): Removed.
  (scm_i_remove_weaks_from_weak_vectors): Commented out.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-7
libguile/hashtab.c
libguile/symbols.c
libguile/vectors.c
libguile/weaks.c