* configure.ac:
* Makefile.am (SUBDIRS): Replace bootstrap/ with stage0, stage1, and
stage2.
* am/bootstrap.am: Include all files and all rules.
* meta/build-env.in (GUILE_AUTO_COMPILE): Always turn off
auto-compilation. Take a GUILE_BOOTSTRAP_STAGE argument, which can be
stage0, stage1, stage2, or unset. Adapt the load-compiled path
accordingly.
* meta/uninstalled-env.in: Include .go files from stage2.
* module/Makefile.am: Rework to use boostrap.am.
* module/system/base/optimize.scm (available-optimizations): Punt the
inlinable-exports machinery to -O2.
* stage0/Makefile.am:
* stage1/Makefile.am:
* stage2/Makefile.am: New files.
* configure.ac: Check if the compiler supports link-time optimization.
If it does, turn it on. Saves around 15% off libguile binary size.
Controllable via --enable-lto configure option.
* module/language/tree-il/peval.scm (peval): The intention was for
resolve-interface to return an interface only if it exists, but actually
it throws if the interface isn't know. Fix to do what we intended to
do.
* module/language/tree-il/inlinable-exports.scm (compute-decoder): Fix
bug in which inlinable exports in a pure module would have a missing
make-struct/no-tail binding.
* libguile/numbers.c (log_of_shifted_double, scm_log10): Avoid complex
extension when the argument is a real nan.
* test-suite/tests/numbers.test: Tests for nans of either sign.
* libguile/numbers.c (scm_abs): As stated. When x is a nan with the sign bit
set, this changes the behavior of (magnitude x) back to what it was in 3.0.7,
to clear that bit.
* libguile/integers.c (scm_integer_abs_z): Just call
scm_integer_negate_z if negation is needed.
(scm_integer_sub_zz): Use mpz_sub instead of cloning bignum.
Calling out to Scheme was a performance regression.
* libguile/integers.h:
* libguile/integers.c (scm_integer_expt_ii, scm_integer_expt_zi): New
internal functions.
* libguile/numbers.c (scm_integer_expt): Go back to C. But, include
fast cases for inums and doubles.
* module/ice-9/boot-9.scm: Revert addition of integer-expt.
* 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.
* libguile/integers.c (scm_integer_to_double_z): Doubles that can't be
exactly represented as integers should round.
(bignum_frexp_z): New helper.
(scm_integer_from_mpz, scm_integer_from_double): New internal functions.
* libguile/numbers.h:
* libguile/numbers.c (scm_i_bigcmp, scm_i_dbl2big, scm_i_dbl2num):
Remove unused internal functions.
(scm_inexact_to_exact): Rework to avoid scm_i_dbl2big.
(scm_bigequal): Move here, from eq.c.
(scm_integer_to_double_z): Use the new helper.
(scm_i_big2dbl): Use scm_integer_to_double_z.
* libguile/numbers.c: We require IEEE infinities and NaN so there is no
case in which ALLOW_DIVIDE_BY_ZERO would not be defined.
(scm_divide, scm_tan, scm_tanh, scm_log, scm_log10): Always throw on
overflow for divide by exact zero, never throw for divide by inexact
zero.
* libguile/numbers.c (scm_product): Remove need for s_product defines.
Call out to product, as appropriate.
(product): New helper.
* libguile/integers.h:
* libguile/integers.c (scm_integer_mul_ii):
(scm_integer_mul_zi):
(scm_integer_mul_zz): New internal functions.
* libguile/numbers.c (scm_sum): Remove need for s_sum defines.
(negate, difference): New helpers.
(scm_difference): Call out to difference or negate, as appropriate.
* libguile/integers.h:
* libguile/integers.c (scm_integer_negate_i):
(scm_integer_negate_z):
(scm_integer_sub_ii):
(scm_integer_sub_iz):
(scm_integer_sub_zi):
(scm_integer_sub_zz): New internal functions.
* libguile/integers.h:
* libguile/integers.c (scm_integer_to_double_z):
(scm_integer_add_ii, scm_integer_add_zi, scm_integer_add_zz): New
internal functions.
* libguile/numbers.c (sum): New helper for scm_sum. Clean up to avoid
repetition. The dispatch is less optimal but the code is shorter and
more maintainable; in any case if speed is important, the compiler needs
to be involved.
(scm_sum): Adapt.