Age | Commit message (Collapse) | Author | Files | Lines |
|
* libguile/integers.c (scm_integer_gcd_ii)
(scm_integer_gcd_zi, scm_integer_gcd_zz): New internal functions.
* libguile/integers.h: Declare internal functions.
* libguile/numbers.c (scm_gcd): Use the new functions.
|
|
* libguile/integers.c (scm_integer_round_divide_ii)
(scm_integer_round_divide_iz, scm_integer_round_divide_zi)
(scm_integer_round_divide_zz): New internal functions.
(integer_round_divide_zz): New helper.
* libguile/integers.h: Declare internal functions.
* libguile/numbers.c (scm_round_divide): Use the new functions.
(scm_i_bigint_round_divide): Remove unused helper.
|
|
* libguile/integers.c (scm_integer_round_remainder_ii)
(scm_integer_round_remainder_iz, scm_integer_round_remainder_zi)
(scm_integer_round_remainder_zz): New internal functions.
(integer_round_remainder_zz): New helper.
(long_sign, bignum_cmp_long): New helpers.
* libguile/integers.h: Declare internal functions.
* libguile/numbers.c (scm_round_remainder): Use the new functions.
(scm_i_bigint_round_remainder): Remove unused helper.
|
|
* libguile/integers.c (scm_integer_round_quotient_ii)
(scm_integer_round_quotient_iz, scm_integer_round_quotient_zi)
(scm_integer_round_quotient_zz): New internal functions.
(integer_round_quotient_zz): New helper.
(long_sign, bignum_cmp_long): New helpers.
* libguile/integers.h: Declare internal functions.
* libguile/numbers.c (scm_round_quotient): Use the new functions.
(scm_i_bigint_round_quotient): Remove unused helper.
|
|
* libguile/integers.c (scm_integer_centered_divide_ii)
(scm_integer_centered_divide_iz, scm_integer_centered_divide_zi)
(scm_integer_centered_divide_zz): New internal functions.
(integer_centered_divide_zz): New helper.
* libguile/integers.h: Declare internal functions.
* libguile/numbers.c (scm_centered_divide): Use the new functions.
(scm_i_bigint_centered_divide): Remove unused helper.
|
|
* libguile/integers.c (scm_integer_centered_remainder_ii)
(scm_integer_centered_remainder_iz, scm_integer_centered_remainder_zi)
(scm_integer_centered_remainder_zz): New internal functions.
* libguile/integers.h: Declare internal functions.
* libguile/numbers.c (scm_centered_remainder): Use the new functions.
(scm_i_bigint_centered_remainder): Remove helper.
|
|
* libguile/integers.c (scm_integer_centered_quotient_ii)
(scm_integer_centered_quotient_iz, scm_integer_centered_quotient_zi)
(scm_integer_centered_quotient_zz): New internal functions.
* libguile/integers.h: Declare internal functions.
* libguile/numbers.c (scm_centered_quotient): Use the new functions.
(scm_i_bigint_centered_quotient): Remove unused helper.
|
|
* libguile/integers.c (scm_integer_truncate_divide_ii)
(scm_integer_truncate_divide_iz, scm_integer_truncate_divide_zi)
(scm_integer_truncate_divide_zz): New internal functions.
* libguile/integers.h: Declare internal functions.
* libguile/numbers.c (scm_truncate_divide): Use the new functions.
|
|
* libguile/integers.c (scm_integer_truncate_remainder_ii)
(scm_integer_truncate_remainder_iz, scm_integer_truncate_remainder_zi)
(scm_integer_truncate_remainder_zz): New internal functions.
* libguile/integers.h: Declare internal functions.
* libguile/numbers.c (scm_truncate_remainder): Use the new functions.
|
|
* libguile/integers.c (scm_integer_truncate_quotient_ii)
(scm_integer_truncate_quotient_iz, scm_integer_truncate_quotient_zi)
(scm_integer_truncate_quotient_zz): New internal functions.
* libguile/integers.h: Declare internal functions.
* libguile/numbers.c (scm_truncate_quotient): Use the new functions.
|
|
* libguile/integers.c (scm_integer_ceiling_divide_ii)
(scm_integer_ceiling_divide_iz, scm_integer_ceiling_divide_zi)
(scm_integer_ceiling_divide_zz): New internal functions.
* libguile/integers.h: Declare internal functions.
* libguile/numbers.c (scm_ceiling_divide): Use the new functions.
|
|
* libguile/integers.c (scm_integer_ceiling_remainder_ii)
(scm_integer_ceiling_remainder_iz, scm_integer_ceiling_remainder_zi)
(scm_integer_ceiling_remainder_zz): New internal functions.
(bignum_is_positive): New helper.
* libguile/integers.h: Declare internal functions.
* libguile/numbers.c (scm_ceiling_remainder): Use the new functions.
|
|
* libguile/integers.c (scm_integer_ceiling_quotient_ii)
(scm_integer_ceiling_quotient_iz, scm_integer_ceiling_quotient_zi)
(scm_integer_ceiling_quotient_zz): New internal functions.
(take_bignum_from_mpz): Change to also normalize the mpz, as all callers
required.
(long_sign, bignum_cmp_long): New helpers.
* libguile/integers.h: Declare internal functions.
* libguile/numbers.c (scm_ceiling_quotient): Use the new functions.
|
|
* libguile/integers.c (scm_integer_floor_divide_ii)
(scm_integer_floor_divide_iz, scm_integer_floor_divide_zi)
(scm_integer_floor_divide_zz): New internal functions.
* libguile/integers.h: Declare internal functions.
* libguile/numbers.c (scm_floor_divide): Use the new functions.
|
|
* libguile/integers.c (scm_integer_floor_remainder_ii)
(scm_integer_floor_remainder_iz, scm_integer_floor_remainder_zi)
(scm_integer_floor_remainder_zz): New internal functions.
* libguile/integers.h: Declare internal functions.
* libguile/numbers.c (scm_floor_remainder): Use the new functions.
|
|
* libguile/integers.c (scm_integer_floor_quotient_ii)
(scm_integer_floor_quotient_iz, scm_integer_floor_quotient_zi)
(scm_integer_floor_quotient_zz): New internal functions.
(long_to_scm, ulong_to_scm, take_bignum_from_mpz): New helpers.
* libguile/integers.h: Declare internal functions.
* libguile/numbers.c (scm_floor_quotient): Use the new functions.
|
|
* libguile/integers.c (scm_integer_abs_i, scm_integer_abs_z): New
internal functions.
* libguile/integers.h: Declare internal functions.
* libguile/numbers.c (scm_abs): Use the new functions.
|
|
* libguile/integers.c (scm_is_integer_odd_i):
(scm_is_integer_odd_z): New internal functions. Add a number of
internal support routines.
* libguile/integers.h: Declare internal functions.
* libguile/numbers.c (scm_odd_p, scm_even_p): Use the new functions.
|
|
The goal is to factor out some fixnum/bignum code here from
numbers.[ch].
* libguile/Makefile.am: Add new files.
* libguile/integers.c:
* libguile/integers.h: New files
|
|
When heap-numbers-equal? is called from eqv?, we have already ensured
that the both objects have the same heap type. However when called by
the VM, the precondition is just that both are heap numbers -- not
necessarily of the same type. Fix to add an additional check in
heap-numbers-equal?. Could cause crashers!
* libguile/eq.c (scm_i_heap_numbers_equal_p): Add additional check.
|
|
* libguile/bitvectors.h:
* libguile/bitvectors.c: As stated.
* test-suite/tests/bitvectors.test: Tests.
* doc/ref/api-data.texi: Update "Bit vectors" section.
* NEWS: Update.
|
|
This patch removes the undocumented function make-srfi-4-vector from
(guile). That function is still exported from (srfi srfi-4 gnu).
* libguile/srfi-4.h (scm_init_srfi_4): Split into scm_bootstrap_srfi_4()
and scm_init_srfi_4(), after the pattern of scm_init_bytevectors() and
scm_bootstrap_bytevectors().
* libguile/init.c: Replace scm_init_srfi_4() call by scm_bootstrap_srfi_4().
* module/srfi/srfi-4.scm: Load newly defined srfi-4 extension. This
provides undocumented make-srfi-4-vector.
* module/srfi/srfi-4/gnu.scm: Export srfi-4-vector-type-size.
* doc/ref/srfi-modules.texi: Document srfi-4-vector-type-size.
|
|
* libguile/foreign.h (SCM_FOREIGN_TYPE_COMPLEX_FLOAT,
SCM_FOREIGN_TYPE_COMPLEX_DOUBLE): New enums.
* module/system/foreign.scm (complex-float, complex-double): Export new types.
(make-c-struct, parse-c-struct): Support the new types.
* libguile/foreign.c (complex-float, complex-double): Define new types.
(alignof, sizeof, pack, unpack): Support the new types.
* test-suite/tests/foreign.test: Test.
|
|
|
|
This avoids gmp aborting e.g. with (ash 1 (expt 2 37)). The new limit is
such that (ash 1 (expt 30)) is accepted but (ash 1 (expt 31)) throws.
Fixes https://bugs.gnu.org/48150
* libguile/numbers.c (ash, round-ash): As stated.
* test-suite/tests/numbers.test: Test a case known to make gmp abort before.
|
|
Closes https://debbugs.gnu.org/cgi/bugreport.cgi?bug=45595.
NB: Amended by the committer to allow an empty range.
* libguile/socket.c: As stated.
|
|
Closes https://debbugs.gnu.org/cgi/bugreport.cgi?bug=43987
|
|
These use the argument conventions of vector-copy!, string-copy!,
etc. and not that of bytevector-copy! (which is from r6rs).
* module/srfi/srfi-4/gnu.scm: As stated.
* test-suite/tests/srfi-4.test: Tests.
* doc/ref/srfi-modules.texi: Documentation.
* libguile/bytevectors.c (bytevector-copy!): Add overlap note to
docstring.
* libguile/vectors.c (vector-copy!): Reuse text for the overlap note.
|
|
* libguile/frames.c (enum stack_item_representation):
(scm_to_stack_item_representation):
(scm_frame_local_ref):
(scm_frame_local_set_x): Add support for "ptr" representations.
|
|
To avoid breaking ABI.
* libguile/arrays.h (SCM_I_ARRAY_DIM, scm_i_raw_array): As stated.
* module/system/vm/assembler.scm: As stated.
|
|
* libguile/bytevectors.c (bytevector-fill!): As stated.
(scm_bytevector_fill_x): Stub to avoid changing the C API.
* doc/ref/api-data.texi: Documentation.
* libguile/vectors.c (vector-fill!): Less confusing variable names.
* test-suite/tests/bytevectors.test: Test partial fill cases for
bytevector-fill!.
|
|
|
|
This flag was set, but never used in Guile, and there was no documented
API to access it.
To check if an array is contiguous, use (array-contents <> #t).
* libguile/arrays.h (scm_i_raw_array): New function.
SCM_I_ARRAY_CONTIGUOUS, SCM_SET_ARRAY_CONTIGUOUS_FLAG,
SCM_CLR_ARRAY_CONTIGUOUS_FLAG, SCM_I_ARRAY_CONTP: Remove.
scm_t_array_dim: Declare here, not in array-handle.h.
SCM_I_ARRAY_NDIM: Shift by one bit since the contp flag isn't there
anymore.
* module/syste/vm/assembler.scm: Match removal of contp flag.
* libguile/arrays.c (scm_i_make_array): Reuse scm_i_raw_array.
(scm_i_ra_set_contp): Remove.
(scm_transpose_array): Don't set or clear the contp flag.
(scm_make_shared_array): Don't set or clear the contp flag.
(scm_make_typed_array): Don't set the contp flag.
* libguile/array-map.c (scm_i_array_rebase): Reuse scm_i_raw_array.
|
|
This was never documented and it's not used in Guile itself, either.
|
|
* Deprecate scm_is_simple_vector.
* libguile/vectors.c (scm_vector_elements,
scm_vector_writable_elements): These functions take an array; reword
to make this clear.
* libguile/print.h: Remove reference to 'simple vector'.
* doc/ref/api-data.texi: Remove documentation for scm_is_simple_vector.
Remove references to 'simple vector'.
Fix documentation for scm_vector_elements,
scm_vector_writable_elements.
* test-suite/tests/arrays.test:
* test-suite/tests/vectors.test: Remove references to 'simple vector'.
|
|
This is up to 20%-30% faster than the previous versions in (scheme base) or
(srfi srfi-43) that used vector-move-left!/vector-move-right!.
* libguile/vectors.h:
* libguile/vectors.c: As stated.
* doc/ref/api-data.texi (vector-copy!): Document the new function.
(vector-fill!): Document optional arguments.
(vector-copy): Document optional arguments.
* module/scheme/base.scm: Reuse core vector-copy!.
* module/srfi/srfi-43.scm: Reuse core vector-copy!.
|
|
* libguile/vectors.h: Declare scm_vector_copy_partial.
* libguile/vectors.c (scm_vector_copy_partial): As stated.
(scm_vector_copy): Reuse scm_vector_copy_partial.
* module/scheme/base.scm: Reuse core vector-copy.
* module/srfi/srfi-43: Reuse core vector-copy.
* test-suite/tests/vectors.test: Test vector-copy.
|
|
These functions weren't advertised to work on non-vector arrays. They
did try to, but only incorrectly. For example:
(define a (vector 1 2 3 4 5))
(define b (make-array 0 '(1 5)))
(vector-move-right! a 0 2 b 2)
b
=> #1@1(0 0 1 2 0)
instead of the correct result #1@1(0 1 2 0 0).
* libguile/vectors.c (vector-move-left!, vector-move-right!): As stated.
|
|
* libguile/vectors.c (vector-copy, vector->list): As stated. Provide
array free implementation for the supported case.
|
|
* libguile/arrays.h:
* libguile/arrays.c: As stated.
* libguile/init.c: Remove call to scm_init_generalized_arrays().
Elsewhere fix references to generalized-arrays.*.
|
|
* libguile/loader.h (SCM_OBJCODE_MINOR_VERSION):
* module/system/vm/assembler.scm (*bytecode-minor-version*): Bump, as
we're going to start adding inlinable exports.
|
|
Partly fixes <https://bugs.gnu.org/41948>.
Previously, the child process could end up using the same 'sleep_pipe'
as its parent, leading to a race condition handling signals.
* libguile/posix.c (do_fork): New function.
(scm_fork): Call 'do_fork' via 'scm_without_guile'.
* test-suite/standalone/test-signal-fork: New test.
* test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add it.
|
|
Partly fixes <https://bugs.gnu.org/41948>.
Reported by Mathieu Othacehe <othacehe@gnu.org>.
Previously, after 'fork', the child process could end up sharing the
finalization thread with its parent.
* libguile/finalizers.c (finalization_pipe): Initialize.
(reset_finalization_pipe): Factored out.
(start_finalization_thread): Create the pipe immediately before
launching the thread. Ensure the pipe is cleaned up if thread creation
fails. Update the finalizer callback if thread creation succeeds.
(stop_finalization_thread): Clean up the pipe after stopping the thread.
(spawn_finalizer_thread): Remove finalizer callback logic.
(scm_set_automatic_finalization_enabled): Remove pipe management.
(scm_init_finalizer_thread): Remove pipe management.
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
|
|
* libguile/filesys.c (scm_init_filesys): Define ‘O_IGNORE_CTTY’,
‘O_NOLINK’, ‘O_NOFOLLOW’, ‘O_PATH’, ‘O_TMPFILE’, ‘O_SHLOCK’,
‘O_EXLOCK’, ‘O_ASYNC’, ‘O_NOATIME’, ‘O_DIRECTORY’, ‘O_CLOEXEC’
and ‘O_DIRECT’ when available.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
|
|
* libguile/mini-gmp.c: Add config.h include. Handles the case in which
gnulib provides some part of the standard library of mini-gmp, as is
apparently the case on FreeBSD for example. Thanks to RhodiumToad for
the report and fix.
|
|
* NEWS (GUILE_INSTALL_GMP_MEMORY_FUNCTIONS): Update
* libguile/numbers.c: Add needed include.
* meta/build-env.in (GUILE_INSTALL_GMP_MEMORY_FUNCTIONS): Set when
building Guile.
|
|
* doc/ref/guile-invoke.texi (Environment Variables): Document
GUILE_INSTALL_GMP_MEMORY_FUNCTIONS.
* libguile/numbers.c (scm_init_numbers): Use environment variable.
|
|
* libguile/loader.h (SCM_OBJCODE_MINOR_VERSION): Bump.
* module/system/vm/assembler.scm (*bytecode-minor-version*): Bump.
|
|
* libguile/intrinsics.c (less_p): scm_nan_p raises an error if arg is
not a real; guard.
|
|
* libguile/intrinsics.h:
* libguile/intrinsics.c (lookup_bound_public, lookup_bound_private): Two
new intrinsics.
(scm_bootstrap_intrinsics): Wire them up.
* libguile/jit.c (compile_call_scm_from_scmn_scmn):
(compile_call_scm_from_scmn_scmn_slow):
(COMPILE_X8_S24__N32__N32__C32): Add JIT support for new instruction
kind.
* libguile/vm-engine.c (call-scm<-scmn-scmn): New instruction, takes
arguments as non-immediate offsets, to avoid needless loads and register
pressure.
* module/language/cps/effects-analysis.scm: Add cases for new
primcalls.
* module/language/cps/compile-bytecode.scm (compile-function): Add new
primcalls.
* module/language/cps/reify-primitives.scm (cached-module-box): If the
variable is bound, call lookup-bound-public / lookup-bound-private as
appropriate instead of separately resolving the module, name, and doing
the bound check.
* module/language/tree-il/compile-bytecode.scm (emit-cached-module-box):
Use new instructions.
* module/system/vm/assembler.scm (define-scm<-scmn-scmn-intrinsic):
(lookup-bound-public, lookup-bound-private): Add assembler support.
|