* libguile/posix.h:
* libguile/posix.c (scm_c_atfork): New interface.
(scm_fork): Wrap fork calls in atfork pre/post invocations, and
finally a GC_call_with_alloc_lock. It's an attempt to grab the
interesting mutexes in Guile.
* libguile/weak-set.c (make_weak_set):
* libguile/weak-table.c (make_weak_table): Use atfork mechanism to lock
and unlock weak sets and weak tables during a fork(), in such a way
that does not prevent those tables from being gc'd.
* libguile/weak-set.c (resize_set):
* libguile/weak-table.c (resize_table): Drop the set/table lock while
allocating the new vector. Fixes a bug in which a finalizer could
recursively try to grab the port table lock.
* libguile/ports.c (scm_putc, scm_puts):
* libguile/ports.h (scm_putc_unlocked, scm_puts_unlocked): Separate into
_unlocked and locked variants. Change all callers to use the
_unlocked versions.
* libguile/tags.h (SCM_HEAP_OBJECT_BASE): New macro. Given a SCM,
returns a pointer to the start of its memory area on the heap.
* libguile/bytevectors.c:
* libguile/fluids.c:
* libguile/foreign.c:
* libguile/gc.h:
* libguile/guardians.c:
* libguile/numbers.h:
* libguile/ports.c:
* libguile/smob.c:
* libguile/struct.c:
* libguile/weak-set.c:
* libguile/weak-table.c:
* libguile/weak-vector.c: Use it.
* libguile/tags.h (SCM_UNPACK_POINTER, SCM_PACK_POINTER): New macros.
The old SCM2PTR and PTR2SCM were defined in such a way that
round-tripping through a pointer could lose precision, even in the
case in which you weren't interested in actually dereferencing the
pointer, it was simply that you needed to plumb a SCM through APIs
that take pointers. These new macros are more like SCM_PACK and
SCM_UNPACK, but for pointer types. The bit representation of the
pointer should be the same as the scm_t_bits representation.
* libguile/gc.h (PTR2SCM, SCM2PTR): Remove support for (old) UNICOS
pointers. We are going to try tagging the SCM object itself in the
future, and I don't think that keeping this support is worth its
cost. It probably doesn't work anyway.
* libguile/backtrace.c:
* libguile/bytevectors.c:
* libguile/continuations.c:
* libguile/fluids.c:
* libguile/foreign.c:
* libguile/gc.h:
* libguile/guardians.c:
* libguile/hashtab.c:
* libguile/load.c:
* libguile/numbers.c:
* libguile/ports.c:
* libguile/smob.c:
* libguile/strings.c:
* libguile/symbols.c:
* libguile/vm.c:
* libguile/weak-set.c:
* libguile/weak-table.c:
* libguile/weak-vector.c: Update many sites to use the new macros.
* libguile/hashtab.c:
* libguile/hashtab.h: Reimplement the weak hash table implementation in
terms of weak tables. All is well except for the horrific hack for
hashx tables.
* libguile/weak-table.h:
* libguile/weak-table.c (scm_make_weak_key_hash_table)
(scm_make_weak_value_hash_table, scm_make_doubly_weak_hash_table)
(scm_weak_key_hash_table_p, scm_weak_value_hash_table_p)
(scm_doubly_weak_hash_table_p): Move these definitions here.
* libguile/weak-table.c:
* libguile/weak-table.h: New files, implementing open-addressed weak
hash tables, similar to the implementation of weak sets. This will
let us remove weak pairs.
* libguile.h:
* libguile/Makefile.am:
* libguile/evalext.c:
* libguile/gc.c:
* libguile/init.c:
* libguile/print.c:
* libguile/tags.h: Update all the pieces for the new files and tc7.