mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 03:30:27 +02:00
support for new GC_move_disappearing_link
* configure.ac: Check for GC_move_disappearing_link. * libguile/weak-set.c (move_weak_entry): * libguile/weak-table.c (move_disappearing_links): (move_weak_entry): Use GC_move_disappearing_link if available.
This commit is contained in:
parent
686022e84e
commit
3dc9f41900
3 changed files with 35 additions and 5 deletions
|
@ -1259,7 +1259,7 @@ save_LIBS="$LIBS"
|
|||
LIBS="$BDW_GC_LIBS $LIBS"
|
||||
CFLAGS="$BDW_GC_CFLAGS $CFLAGS"
|
||||
|
||||
AC_CHECK_FUNCS([GC_do_blocking GC_call_with_gc_active GC_pthread_exit GC_pthread_cancel GC_allow_register_threads GC_pthread_sigmask GC_set_start_callback GC_get_suspend_signal])
|
||||
AC_CHECK_FUNCS([GC_do_blocking GC_call_with_gc_active GC_pthread_exit GC_pthread_cancel GC_allow_register_threads GC_pthread_sigmask GC_set_start_callback GC_get_suspend_signal GC_move_disappearing_link])
|
||||
|
||||
# Though the `GC_do_blocking ()' symbol is present in GC 7.1, it is not
|
||||
# declared, and has a different type (returning void instead of
|
||||
|
|
|
@ -173,9 +173,13 @@ move_weak_entry (scm_t_weak_entry *from, scm_t_weak_entry *to)
|
|||
|
||||
if (copy.key && SCM_HEAP_OBJECT_P (SCM_PACK (copy.key)))
|
||||
{
|
||||
#ifdef HAVE_GC_MOVE_DISAPPEARING_LINK
|
||||
GC_move_disappearing_link ((GC_PTR) &from->key, (GC_PTR) &to->key);
|
||||
#else
|
||||
GC_unregister_disappearing_link ((GC_PTR) &from->key);
|
||||
SCM_I_REGISTER_DISAPPEARING_LINK ((GC_PTR) &to->key,
|
||||
(GC_PTR) to->key);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -151,6 +151,33 @@ unregister_disappearing_links (scm_t_weak_entry *entry,
|
|||
GC_unregister_disappearing_link ((GC_PTR) &entry->value);
|
||||
}
|
||||
|
||||
static void
|
||||
move_disappearing_links (scm_t_weak_entry *from, scm_t_weak_entry *to,
|
||||
SCM key, SCM value, scm_t_weak_table_kind kind)
|
||||
{
|
||||
if ((kind == SCM_WEAK_TABLE_KIND_KEY || kind == SCM_WEAK_TABLE_KIND_BOTH)
|
||||
&& SCM_HEAP_OBJECT_P (key))
|
||||
{
|
||||
#ifdef HAVE_GC_MOVE_DISAPPEARING_LINK
|
||||
GC_move_disappearing_link ((GC_PTR) &from->key, (GC_PTR) &to->key);
|
||||
#else
|
||||
GC_unregister_disappearing_link (&from->key);
|
||||
SCM_I_REGISTER_DISAPPEARING_LINK (&to->key, SCM_HEAP_OBJECT_BASE (key));
|
||||
#endif
|
||||
}
|
||||
|
||||
if ((kind == SCM_WEAK_TABLE_KIND_VALUE || kind == SCM_WEAK_TABLE_KIND_BOTH)
|
||||
&& SCM_HEAP_OBJECT_P (value))
|
||||
{
|
||||
#ifdef HAVE_GC_MOVE_DISAPPEARING_LINK
|
||||
GC_move_disappearing_link ((GC_PTR) &from->value, (GC_PTR) &to->value);
|
||||
#else
|
||||
GC_unregister_disappearing_link (&from->value);
|
||||
SCM_I_REGISTER_DISAPPEARING_LINK (&to->value, SCM_HEAP_OBJECT_BASE (value));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
move_weak_entry (scm_t_weak_entry *from, scm_t_weak_entry *to,
|
||||
scm_t_weak_table_kind kind)
|
||||
|
@ -164,10 +191,9 @@ move_weak_entry (scm_t_weak_entry *from, scm_t_weak_entry *to,
|
|||
to->key = copy.key;
|
||||
to->value = copy.value;
|
||||
|
||||
unregister_disappearing_links (from, kind);
|
||||
register_disappearing_links (to,
|
||||
SCM_PACK (copy.key), SCM_PACK (copy.value),
|
||||
kind);
|
||||
move_disappearing_links (from, to,
|
||||
SCM_PACK (copy.key), SCM_PACK (copy.value),
|
||||
kind);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue