consolidate scm_i_register_weak_gc_callback, update weak-set to fit
authorAndy Wingo <wingo@pobox.com>
Sun, 20 Jan 2013 10:55:50 +0000 (11:55 +0100)
committerAndy Wingo <wingo@pobox.com>
Sun, 20 Jan 2013 11:37:00 +0000 (12:37 +0100)
commita0551390d5a3dd4e9ca0920be9cf0883f36a941e
tree0e6a3173515bb3ccb0e30b6f4b7f0de3a33c177a
parentd93770763b66990bd989749013b961a1c54c66fd
consolidate scm_i_register_weak_gc_callback, update weak-set to fit

* libguile/finalizers.h:
* libguile/finalizers.c (scm_i_register_weak_gc_callback): New internal
  helper, from weak-set.c.

  Relative to the previous weak-set.c version, prefer the
  finalizer-based implementation.  Fix bug regarding confusion between
  scm_before_gc_c_hook and scm_after_gc_hook.  Fix bug regarding
  referencing weak values outside of the alloc lock.

* libguile/weak-set.c (GC_move_disappearing_link): New stub.
  GC_move_disappearing_link is only available in libgc 7.3.
  (move_weak_entry): Use the new stub instead of ifdeffery.
  (resize_set): Now that we run finalizers from a separate thread or
  async, we can keep the lock while reallocating the set vector.
  (do_vacuum_weak_set): For the same reason, always lock the set.
  Remove implementation of scm_c_register_weak_gc_callback in preference
  of the new copy in finalizers.c.
  (scm_c_make_weak_set): Use the new scm_i_register_weak_gc_callback.
libguile/finalizers.c
libguile/finalizers.h
libguile/weak-set.c