diff options
author | Andy Wingo <wingo@pobox.com> | 2012-03-18 20:04:28 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2012-03-18 20:21:49 +0100 |
commit | c05805a4ea764dec5a0559edefcdfb9761191d07 (patch) | |
tree | 3925d77d81c82be61e407abf36f17634ee18b462 /libguile/vm-i-system.c | |
parent | 89d45e850725e232ae685803ee476da5b046c2b0 (diff) | |
download | guile-c05805a4ea764dec5a0559edefcdfb9761191d07.tar.gz |
make applicable smob calls cheaper, and fix a memory leak
* libguile/vm.c (prepare_smob_call): New helper. Now, instead of making
a per-smob trampoline, we will shuffle the smob into the args and use
a gsubr. This prevents a memory leak in which the trampolines, which
were values in a weak-key table, were preventing the smobs from being
collected.
* libguile/vm-i-system.c (call, tail-call, mv-call): Adapt to new smob
application mechanism.
(smob-call): Remove this instruction.
* libguile/smob.h (scm_smob_descriptor): Rename apply_trampoline_objcode
to apply_trampoline.
* libguile/smob.c: Remove our own objcode trampolines in favor of using
scm_c_make_gsubr.
(scm_smob_prehistory): No more trampoline weak map.
* libguile/procprop.c (scm_i_procedure_arity): Adapt to applicable smob
representation change.
Diffstat (limited to 'libguile/vm-i-system.c')
-rw-r--r-- | libguile/vm-i-system.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c index 474fe7883..21fa5a195 100644 --- a/libguile/vm-i-system.c +++ b/libguile/vm-i-system.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001,2008,2009,2010,2011 Free Software Foundation, Inc. +/* Copyright (C) 2001,2008,2009,2010,2011,2012 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -790,8 +790,8 @@ VM_DEFINE_INSTRUCTION (53, call, "call", 1, -1, 1) else if (SCM_NIMP (program) && SCM_TYP7 (program) == scm_tc7_smob && SCM_SMOB_APPLICABLE_P (program)) { - SYNC_REGISTER (); - sp[-nargs] = scm_i_smob_apply_trampoline (program); + PUSH (program); + prepare_smob_call (sp, ++nargs, program); goto vm_call; } else @@ -838,8 +838,8 @@ VM_DEFINE_INSTRUCTION (54, tail_call, "tail-call", 1, -1, 1) else if (SCM_NIMP (program) && SCM_TYP7 (program) == scm_tc7_smob && SCM_SMOB_APPLICABLE_P (program)) { - SYNC_REGISTER (); - sp[-nargs] = scm_i_smob_apply_trampoline (program); + PUSH (program); + prepare_smob_call (sp, ++nargs, program); goto vm_tail_call; } else @@ -1099,8 +1099,8 @@ VM_DEFINE_INSTRUCTION (62, mv_call, "mv-call", 4, -1, 1) else if (SCM_NIMP (program) && SCM_TYP7 (program) == scm_tc7_smob && SCM_SMOB_APPLICABLE_P (program)) { - SYNC_REGISTER (); - sp[-nargs] = scm_i_smob_apply_trampoline (program); + PUSH (program); + prepare_smob_call (sp, ++nargs, program); goto vm_mv_call; } else |