1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-25 20:50:31 +02:00

Bignums avoid both custom GMP allocator and finalizers

* libguile/deprecated.c (make_bignum): Move here from numbers.c, to
support scm_i_long2big etc.
(scm_i_big2dbl):
(scm_i_long2big):
(scm_i_ulong2big):
(scm_i_clonebig):
(scm_i_normbig): Deprecate.
(scm_install_gmp_memory_functions): Deprecate, happily!  SCM bignums now
have digits allocated inline with the bignum itself, so they are
completely transparent to the GC already.  The price is that if GMP ever
allocates digits via the MPZ API, those digits then have to be copied
back into managed memory.  But we avoid having to install finalizers and
we avoid having to muck with GMP's allocator.
* libguile/numbers.c (scm_from_mpz): Use scm_integer_from_mpz.
(scm_init_numbers): Never muck with GMP's allocators.
* doc/ref/guile-invoke.texi (Environment Variables): Remove note about
GUILE_INSTALL_GMP_MEMORY_FUNCTIONS.
* meta/build-env.in: No need to set GUILE_INSTALL_GMP_MEMORY_FUNCTIONS.
This commit is contained in:
Andy Wingo 2022-01-07 14:01:52 +01:00
parent a0765f564a
commit aa5455ea98
6 changed files with 113 additions and 201 deletions

View file

@ -1,6 +1,6 @@
@c -*-texinfo-*-
@c This is part of the GNU Guile Reference Manual.
@c Copyright (C) 1996-1997,2000-2005,2010-2011,2013-2014,2016,2019,2021
@c Copyright (C) 1996-1997,2000-2005,2010-2011,2013-2014,2016,2019,2021-2022
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
@ -424,19 +424,6 @@ Guile uses the environment variable @env{HOME}, the name of your home
directory, to locate various files, such as @file{.guile} or
@file{.guile_history}.
@item GUILE_INSTALL_GMP_MEMORY_FUNCTIONS
@vindex GUILE_INSTALL_GMP_MEMORY_FUNCTIONS
Guile uses the GNU multi-precision (GMP) library to implement its bigint
support. It can use an included minimal version of GMP, or the system
version, which may be more optimal. If Guile is the sole user of GMP in
the process, Guile can tell GMP to allocate its digits using
garbage-collected memory. This can be significantly faster. However
this approach is unsafe if there are other libraries loaded that use
libgmp, such as the GnuTLS library. The default is for Guile to do the
fastest safe thing: use the garbage collector for GMP when using the
included ``mini-GMP'', but not otherwise. Set this variable to nonzero
to force GMP to use garbage-collected memory, even when using system GC.
@item GUILE_JIT_THRESHOLD
@vindex GUILE_JIT_THRESHOLD
Guile has a just-in-time (JIT) code generator that makes running Guile