1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Fixed `scm_gc_register_finalizer ()' to avoid bootstrap problem.

* libguile/gc.c (finalizer_trampoline): Don't use `scm_call_2 ()' to
  invoke the finalizer: directly call the C function instead.
  (scm_gc_register_finalizer): Don't create a real subr with
  `scm_c_make_gsubr ()': simply convert the C function pointer to an
  `SCM' object instead.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-24
This commit is contained in:
Ludovic Courtes 2006-05-23 21:59:14 +00:00 committed by Ludovic Courtès
parent febd2677c9
commit 53cc0209fa

View file

@ -690,9 +690,11 @@ finalizer_trampoline (GC_PTR ptr, GC_PTR data)
scm_is_pair (finalizers);
finalizers = SCM_CDR (finalizers))
{
SCM (* finalize) (SCM, SCM);
SCM f = SCM_CAR (finalizers);
scm_call_2 (SCM_CAR (f), obj, SCM_CDR (f));
finalize = (SCM (*) (SCM, SCM)) SCM2PTR (SCM_CAR (f));
finalize (obj, SCM_CDR (f));
}
}
@ -717,8 +719,10 @@ scm_gc_register_finalizer (SCM obj, SCM (*finalizer) (SCM, SCM),
GC_finalization_proc old_finalizer;
GC_PTR old_finalization_data;
finalization_subr = scm_c_make_gsubr ("%%finalizer", 2, 0, 0,
finalizer);
/* XXX: We don't use real `subrs' here because (i) it would add unnecessary
overhead and (ii) it creates a bootstrap problem (because SMOBs may rely
on this, and SMOBs are initialized before `gsubrs'). */
finalization_subr = PTR2SCM (finalizer);
finalization_data = scm_cons (scm_cons (finalization_subr, data),
SCM_EOL);
if (ordered)