summaryrefslogtreecommitdiff
path: root/libguile/symbols.c
diff options
context:
space:
mode:
authorLudovic Courtes <ludovic.courtes@laas.fr>2006-04-04 21:28:13 +0000
committerLudovic Courtès <ludo@gnu.org>2008-09-05 00:46:53 +0200
commit3a2de079d507b612fb7ada1a957ea539bea29fc5 (patch)
tree78522c88d314860678b8fc08a20b2b6c8ced83df /libguile/symbols.c
parenta82e7953257db9d70cd2f05d0d7cbc98153bd10f (diff)
downloadguile-3a2de079d507b612fb7ada1a957ea539bea29fc5.tar.gz
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
Diffstat (limited to 'libguile/symbols.c')
-rw-r--r--libguile/symbols.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libguile/symbols.c b/libguile/symbols.c
index c8b901706..1f07f1aad 100644
--- a/libguile/symbols.c
+++ b/libguile/symbols.c
@@ -96,7 +96,18 @@ lookup_interned_symbol (const char *name, size_t len,
!scm_is_null (l);
l = SCM_CDR (l))
{
- SCM sym = SCM_CAAR (l);
+ SCM pair, sym;
+
+ pair = SCM_CAR (l);
+ if (!scm_is_pair (pair))
+ abort ();
+ if (SCM_UNPACK (SCM_CAR (pair)) == NULL)
+ /* Weak pointer. Ignore it. */
+ /* FIXME: Should we as well remove it, as in `scm_fixup_weak_alist'? */
+ continue;
+
+ sym = SCM_CAR (pair);
+
if (scm_i_symbol_hash (sym) == raw_hash
&& scm_i_symbol_length (sym) == len)
{