summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtes <ludovic.courtes@laas.fr>2006-05-23 21:59:14 +0000
committerLudovic Courtès <ludo@gnu.org>2008-09-05 09:33:38 +0200
commit53cc0209fad717f4a72f42dfd5ab4d71889d0ccb (patch)
tree41e1a844d484fcdda3d2e20bfc7715e2d3313ac5
parentfebd2677c9b1028bc3cd30401672ccc7e3314199 (diff)
downloadguile-53cc0209fad717f4a72f42dfd5ab4d71889d0ccb.tar.gz
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
-rw-r--r--libguile/gc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libguile/gc.c b/libguile/gc.c
index 2223c004a..809e43d56 100644
--- a/libguile/gc.c
+++ b/libguile/gc.c
@@ -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)