GNU bug report logs -
#19180
vacuum_weak_hash_table error
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hi Ricardo,
Ricardo Wurmus <ricardo.wurmus <at> mdc-berlin.de> skribis:
> In language/tree-il/analyze.scm:
> 1053:33 3 Exception thrown while printing backtrace:
> ERROR: In procedure assq: Wrong type argument in position 2 (expecting association list): ((system base pmatch) car . #f)
>
> ice-9/boot-9.scm:760:25: In procedure dispatch-exception:
> ice-9/boot-9.scm:760:25: In procedure assq: Wrong type argument in position 2 (expecting association list): ((system base pmatch) car . #f)
It’s a sign that the weak tables were too weak, this time. :-)
The problem stems from the fact that weak pairs were initialized too
late. Thus, the first calls to ‘scm_weak_car_pair’ were happening
before the weak-car pair GC descriptor had been initialized; they were
therefore using 0 as their descriptor, and ended up not being traced at
all by the GC.
The fix is to initialize weak pairs before symbols, as in 2.0:
[Message part 2 (text/x-patch, inline)]
modified libguile/hashtab.c
@@ -1608,10 +1608,11 @@ scm_c_weak_table_fold (scm_t_hash_fold_fn fn, void *closure,
+/* Initialize weak pairs, used by weak hash tables. This needs to be
+ done early on because it's used by interned symbols etc. */
void
-scm_init_hashtab ()
+scm_init_weak_pairs ()
{
- /* Initialize weak pairs. */
GC_word wcar_pair_bitmap[GC_BITMAP_SIZE (scm_t_cell)] = { 0 };
GC_word wcdr_pair_bitmap[GC_BITMAP_SIZE (scm_t_cell)] = { 0 };
@@ -1627,6 +1628,11 @@ scm_init_hashtab ()
wcdr_pair_descr = GC_make_descriptor (wcdr_pair_bitmap,
GC_WORD_LEN (scm_t_cell));
+}
+
+void
+scm_init_hashtab ()
+{
#include "libguile/hashtab.x"
}
modified libguile/hashtab.h
@@ -174,6 +174,7 @@ SCM_API SCM scm_hash_map_to_list (SCM proc, SCM hash);
SCM_API SCM scm_hash_count (SCM hash, SCM pred);
SCM_INTERNAL void scm_i_hashtable_print (SCM exp, SCM port, scm_print_state *pstate);
SCM_INTERNAL void scm_init_hashtab (void);
+SCM_INTERNAL void scm_init_weak_pairs (void);
/* Guile 2.2.x (x <= 2) weak-table API. */
modified libguile/init.c
@@ -390,7 +390,8 @@ scm_i_init_guile (void *base)
#ifdef GUILE_DEBUG_MALLOC
scm_debug_malloc_prehistory ();
#endif
- scm_symbols_prehistory (); /* requires weak_table_prehistory */
+ scm_init_weak_pairs ();
+ scm_symbols_prehistory (); /* requires weak_pairs */
scm_modules_prehistory ();
scm_init_array_handle ();
[Message part 3 (text/plain, inline)]
I’m attaching updated patches. I’ve let the Guix build run to
completion this time. Let me know if it works for you!
Ludo’.
[0001-Remove-weak-tables-and-revert-to-weak-hash-tables.patch (text/x-patch, attachment)]
[0002-Keep-weak-hash-table-item-count-consistent.patch (text/x-patch, attachment)]
This bug report was last modified 7 years and 209 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.