* libguile/sort.c (sort!, sort, restricted-vector-sort!, sorted?):
Support arrays of rank 1, whatever the type.
* libguile/quicksort.i.c: Fix accessors to handle typed arrays.
* test-suite/tests/sort.test: Test also with typed arrays.
* libguile/array-map.c (scm_array_for_each_cell): Bail out early if any
of the sizes is zero. Pack ais at the end of the fake stack.
* test-suite/tests/array-map.test: Add regression test.
Benchmark:
(define type #t)
(define A (make-typed-array 's32 0 10000 1000))
(define B (make-typed-array 's32 0 10000 1000))
(define C (make-typed-array 's32 0 10000 1000))
before:
scheme@(guile-user)> ,time (array-map! C + A B)
;; 0.792653s real time, 0.790970s run time. 0.000000s spent in GC.
after:
scheme@(guile-user)> ,time (array-map! C + A B)
;; 0.598513s real time, 0.597146s run time. 0.000000s spent in GC.
* libguile/array-map.c (ramap): Add special case with 3 arguments.
* doc/ref/api-compound.texi: New section 'Arrays as arrays of
arrays'. Move the documentation for (array-from), (array-from*) and
(array-amend!) in here. Add documentation for (array-for-each-cell).
* libguile/vectors.c (scm_vector): Use SCM_I_VECTOR_WELTS on new vector
instead of generic scm_vector_elements; cf. scm_vector_copy().
(scm_vector_elements): Forward to scm_vector_writable_elements().
(scm_vector_writable_elements): Remove special error message for weak
vector arg.
* libguile/generalized-vectors.c (SCM_VALIDATE_VECTOR_WITH_HANDLE):
Remove unused macro.
* libguile/array-handle.c (scm_array_handle_elements): Forward to
scm_array_handle_writable_elements().
* libguile/generalized-vectors.h, libguile/generalized-vectors.c
(scm_is_generalized_vector, scm_c_generalized_vector_length,
scm_c_generalized_vector_ref, scm_c_generalized_vector_set_x): These
functions were deprecated in 2.0.9. Remove.
This patch results in a 20%-40% speedup in the > 1 argument cases of
the following microbenchmarks:
(define A (make-shared-array #0(1) (const '()) #e1e7))
; 1, 2, 3 arguments.
(define a 0) ,time (array-for-each (lambda (b) (set! a (+ a b))) A)
(define a 0) ,time (array-for-each (lambda (b c) (set! a (+ a b c))) A A)
(define a 0) ,time (array-for-each (lambda (b c d) (set! a (+ a b c d))) A A A)
(define A (make-shared-array (make-array 1) (const '()) #e1e7))
(define B (make-shared-array #0(1) (const '()) #e1e7))
; 1, 2, 3 arguments.
,time (array-map! A + B)
,time (array-map! A + B B)
,time (array-map! A + B B B)
* libguile/array-map.c (scm_ramap): note on cproc arguments.
(rafill): assume that dst's lbnd is 0.
(racp): assume that src's lbnd is 0.
(ramap): assume that ra0's lbnd is 0. When there're more than two
arguments, compute the array handles before the loop. Allocate the arg
list once and reuse it in the loop.
(rafe): like rafe, when there's more than one argument.
(AREF, ASET): remove.
* module/system/vm/assembler.scm (simple-uniform-vector?): array-length
fails for rank 0 arrays; fix the shape condition.
* test-suite/tests/arrays.test: test reading of #0f64(x) in compilation
context.
* libguile/arrays.c (scm_c_array_rank): moved from
libguile/generalized-arrays.c. Don't use array handles, but follow the
same type check sequence as the other array functions
(shared-array-root, etc).
(scm_array_rank): moved from libguile/generalized-arrays.h.
* libguile/arrays.h: move prototypes here.
SCM_I_ARRAY_FLAG_CONTIGUOUS (arrays.h) was set by all array-creating
functions (make-typed-array, transpose-array, make-shared-array) but it
was only used by array-contents, which needed to traverse the dimensions
anyway.
* libguile/arrays.c (scm_make_typed_array,
scm_from_contiguous_typed_array): don't set the contiguous flag.
(scm_transpose_array, scm_make_shared_array): don't call
scm_i_ra_set_contp.
(scm_array_contents): inline scm_i_ra_set_contp() here. Adopt uniform
type check order. Remove redundant comments.
(scm_i_ra_set_contp): remove.
* libguile/arrays.h: note.
* test-suite/tests/arrays.test: test array-contents with rank 0 array.
This function is undocumented, unused within Guile, and can be trivially
replaced by make-array + array-copy without requiring contiguity.
* libguile/arrays.h (scm_from_contiguous_array): remove declaration.
* libguile/arrays.c (scm_from_contiguous_array): remove.
* libguile/arrays.c (scm_shared_array_root): adopt uniform check order.
(scm_shared_array_offset, scm_shared_array_increments): use the array
fields directly just as scm_shared_array_root does.
* test-suite/tests/arrays.test: tests for shared-array-offset,
shared-array-increments.
* meta/uninstalled-env.in (top_builddir): Fix bug whereby
meta/uninstalled-env run within meta-uninstalled-env, as happens
sometimes, would move the prebuilt dir to the front.
* meta/guile.m4: Fixing GUILE_PROGS versioning checks were wrong and
incomplete, leading to false errors like: "... checking for Guile
version >= 2.0.11... configure: error: Guile 2.0.11 required, but
2.1.3 found".
thanks to Colomban Wendling, aka b4n, who also suggested this fix
during a chat on #autotools while helping me wrt another autotool
related problem I was nvestigating.
* doc/ref/api-control.texi (Prompt Primitives): Remove mention of
one-shot continuations, as it's possible to invoke them multiple times
if the continuation is re-entered through other means.
Based on a patch by Andy Stormont <astormont@racktopsystems.com>.
* configure.ac: Check for strtod_l.
* libguile/i18n.c (scm_locale_string_to_integer): Fix style.
(scm_locale_string_to_inexact): Check for strtod_l.
On Darwin, setrlimit is ignored, and these tests do not terminate. There
doesn't seem to be another way to limit the memory allocated by a
process.
* test-suite/standalone/test-stack-overflow: Skip this test on Darwin.
* test-suite/standalone/test-out-of-memory: Skip this test on Darwin.
* module/texinfo/html.scm (itemize, acronym, tag-replacements, rules):
Fix HTML serialization of @itemize and @acronym. Fixes#21772.
* test-suite/tests/texinfo.html.test: New file.
* test-suite/Makefile.am: Add new file.
* libguile/programs.c (try_parse_arity): New helper, to parse bytecode
to determine the minimum arity of a function in a cheaper way than
grovelling through the debug info. Should speed up all thunk? checks
and similar.
(scm_i_program_arity): Simplify.
* libguile/gsubr.h:
* libguile/gsubr.c (scm_i_primitive_arity):
* libguile/foreign.h:
* libguile/foreign.c (scm_i_foreign_arity):
* module/ice-9/psyntax.scm (include-from-path): Canonicalize result of
%search-load-path. Otherwise a relative path passed to `include'
would be treated as relative to the directory of the file that
contains the `include-from-path'. Fixes#21347.
* module/ice-9/psyntax-pp.scm: Regenerate.