1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
Commit graph

17820 commits

Author SHA1 Message Date
Daniel Llorens
f227a56991 Support typed arrays in some sort functions
* 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.
2016-07-11 09:11:50 +02:00
Daniel Llorens
3320eaa788 Remove uniform-array-read!, uniform-array-write from the manual
These procedures where removed in
fc7bd367ab (2011-05-12).

* doc/ref/api-compound.texi: Ditto.
2016-07-11 09:11:50 +02:00
Daniel Llorens
cbaa6cadcc Remove commented stack version of scm_array_for_each_cell()
* libguile/array-map.c: Ditto.
2016-07-11 09:11:50 +02:00
Daniel Llorens
4a361f2902 Fix pool version of scm_array_for_each_cell by aligning pointers
* libguile/array-map.c (scm_array_for_each_cell): Align all pointers to
  pointer size.
2016-07-11 09:11:50 +02:00
Daniel Llorens
79bf245c7e Fix a corner case with empty arrays in (array-for-each-cell)
* 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.
2016-07-11 09:11:50 +02:00
Daniel Llorens
f6003e8881 Clean up (array-for-each-cell)
* libguile/array-map.c (array-for-each-cell,
  array-for-each-cell-in-order): Moved from libguile/arrays.c. Fix
  argument names. Complete docstring.

* libguile/array-map.h (array-for-each-cell,
  array-for-each-cell-in-order): Declarations moved from
  libguile/arrays.h.

* test-suite/tests/array-map.test: Renamed from
  test-suite/tests/ramap.test, fix module name.

  Add tests for (array-for-each-cell).

* test-suite/Makefile.am: Apply rename array-map.test -> ramap.test.

* doc/ref/api-compound.texi: Minor documentation fixes.
2016-07-11 09:11:50 +02:00
Daniel Llorens
2ce48a3f46 Avoid variable stack use in scm_array_for_each_cell()
* libguile/arrays.c (scm_array_for_each_cell): Allocate all variable
  sized data at the top of the function using
  scm_gc_malloc_pointerless().
2016-07-11 09:11:50 +02:00
Daniel Llorens
b854d0f34a Special case for array-map! with three arguments
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.
2016-07-11 09:11:50 +02:00
Daniel Llorens
ffd949e597 New export (array-for-each-cell-in-order)
* libguile/arrays.h (array-for-each-cell-in-order): Declare.

* libguile/arrays.c (array-for-each-cell-in-order): Define.
2016-07-11 09:11:50 +02:00
Daniel Llorens
a8dd99d0de Draft documentation for (array-for-each-cell)
* 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).
2016-07-11 09:11:50 +02:00
Daniel Llorens
fb4d4d966c Draft of (array-for-each-cell)
* libguile/arrays.c (scm_i_array_rebase, scm_array_for_each_cell): new
  functions. Export scm_array_for_each_cell() as (array-for-each-cell).

* libguile/arrays.h (scm_i_array_rebase, scm_array_for_each_cell):
  prototypes.
2016-07-11 09:11:50 +02:00
Daniel Llorens
da81901c9a Do not use array handles in scm_vector
* 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().
2016-07-11 09:11:50 +02:00
Daniel Llorens
cea5139e65 Remove deprecated and unused generalized-vector functions
* 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.
2016-07-11 09:11:50 +02:00
Daniel Llorens
c17799dda9 Speed up for multi-arg cases of scm_ramap functions
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.
2016-07-11 09:11:50 +02:00
Daniel Llorens
348d8b46b0 Remove deprecated array functions
* libguile/array-map.c (scm_array_fill_int, scm_array_fill_int,
    scm_ra_eqp, scm_ra_lessp scm_ra_leqp, scm_ra_grp, scm_ra_greqp,
    scm_ra_sum, scm_ra_difference, scm_ra_product, scm_ra_divide,
    scm_array_identity): remove deprecated functions.

* libguile/array-map.h: remove declaration of deprecated functions.
2016-07-11 09:11:50 +02:00
Daniel Llorens
fc0e75c50d Fix compilation of rank 0 typed array literals
* 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.
2016-07-11 09:11:50 +02:00
Daniel Llorens
ed6c65507a Don't use array handles in scm_c_array_rank
* 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.
2016-07-11 09:11:50 +02:00
Daniel Llorens
3aafc2c857 Rename array-set-from!, scm_array_set_from_x to array-amend!, scm_array_amend_x 2016-07-11 09:11:50 +02:00
Daniel Llorens
ecb38d4268 Tests & doc for array-from, array-from*, array-set-from!
* test-suite/tests/arrays.test: tests for array-from, array-from*,
  array-set-from!

* doc/ref/api-compound.texi: document array-from, array-from*,
  array-set-from!.
2016-07-11 09:11:50 +02:00
Daniel Llorens
7d7ada39d0 New functions array-from, array-from*, array-set-from!
* libguile/arrays.h (scm_array_from, scm_array_from_s,
  scm_array_set_from_x): new declarations.

* libguile/arrays.c (scm_array_from, scm_array_from_s,
  scm_array_set_from_x): new functions, export as array-from,
  array-from*, array-set-from!.
2016-07-11 09:11:50 +02:00
Daniel Llorens
839dec6325 Compile in C99 mode
* configure.ac: Require C99 flags. Remove -Wdeclaration-after-statement.
2016-07-11 09:11:50 +02:00
Daniel Llorens
b9cbf3b6de Reuse SCM_BYTEVECTOR_TYPED_LENGTH in scm_array_get_handle
* libguile/bytevectors.h (SCM_BYTEVECTOR_TYPE_SIZE,
  SCM_BYTEVECTOR_TYPED_LENGTH): moved from libguile/bytevectors.c.

* libguile/array-handle.c (scm_array_get_handle): reuse
  SCM_BYTEVECTOR_TYPED_LENGTH.
2016-07-11 09:11:50 +02:00
Daniel Llorens
212c5b0f29 Unuse array 'contiguous' flag
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.
2016-07-11 09:11:50 +02:00
Daniel Llorens
c557ff68ec Remove scm_from_contiguous_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.
2016-07-11 09:11:50 +02:00
Daniel Llorens
655494c65b Avoid unneeded internal use of array handles
* 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.
2016-07-11 09:11:50 +02:00
Andy Wingo
38f23e75a5 Add meta/build-env
* meta/build-env.in: New file which sets up an environment that does not
  inherit GUILE_LOAD_PATH / GUILE_LOAD_COMPILED_PATH (unless
  cross-compiling).
* doc/ref/Makefile.am (autoconf-macros.texi):
* libguile/Makefile.am (snarf2checkedtexi):
* module/Makefile.am (ice-9/psyntax-pp.go):
* test-suite/standalone/Makefile.am (GUILE_INSTALL_LOCALE):
* am/bootstrap.am (.scm.go):
* am/guilec (.scm.go): Use build-env.
* configure.ac: Create build-env.
2016-07-10 14:10:26 +02:00
Andy Wingo
b05b67b2b3 Avoid Gnulib unistr/* modules
(unistr/base, unistr/u8-mbtouc, unistr/u8-mbtouc-unsafe)
(unistr/u8-mbtoucr, unistr/u8-prev unistr/u8-uctomb, unitypes): --avoid
these modules.
2016-07-10 12:44:35 +02:00
Andy Wingo
d484bfbace Update Gnulib to 68b6ade.
Also add --conditional-dependencies to the flags.  See:
https://lists.gnu.org/archive/html/guile-devel/2016-07/msg00012.html
2016-07-07 14:05:53 +02:00
Andy Wingo
0d191d1394 Update git-version-gen.diff for current gnulib
* gnulib-local/build-aux/git-version-gen.diff: Update.
2016-07-07 14:02:25 +02:00
Andy Wingo
85faf8eccb Update NEWS
* NEWS: Add 2.0.12 NEWS.  Fold 2.1.3 NEWS into main 2.2.0 NEWS.
2016-06-29 22:25:56 +02:00
Jan Nieuwenhuizen
516f70f9e9 tests-suite: resurrect invoking check-guile --coverage.
* test-suite/guile-test (main): remove (the-vm) from with-code-coverage call.
2016-06-28 18:21:56 +02:00
Andy Wingo
a62d46ffff psyntax can trace expand-time changes to the current module
* module/ice-9/psyntax.scm (expand-top-sequence): Support expand-time
  changes to the current module.
* module/ice-9/psyntax-pp.scm: Regenerate.
2016-06-27 22:54:04 +02:00
Andy Wingo
e264117e1b Fix uninstalled-env bug that put prebuilt/ in front
* 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.
2016-06-27 22:47:06 +02:00
David Pirotte
ed39782c2a Fixing GUILE_PROGS wrong versioning checks
* 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.
2016-06-27 10:07:13 +02:00
David Pirotte
cce3ea2b59 Do not track some test-suite files
* .gitignore:  Adding test-smob-mark-race to the list of the test-suite
  files we do not track.
2016-06-27 09:35:23 +02:00
Taylan Ulrich Bayırlı/Kammer
d5d7e30348 Fix 'monitor' macro.
* module/ice-9/threads.scm (monitor-mutex-table)
(monitor-mutex-table-mutex, monitor-mutex-with-id): New variables.
(monitor): Fix it.
2016-06-27 09:32:30 +02:00
Andy Wingo
3e719e0a35 Add -Wmacro-use-before-definition
* module/ice-9/boot-9.scm (%auto-compilation-options):
* am/guilec (GUILE_WARNINGS): Add -Wmacro-use-before-definition.
* module/language/tree-il/analyze.scm (unbound-variable-analysis): Use
  match-lambda.
  (<macro-use-info>, macro-use-before-definition-analysis): New
  analysis.
* module/system/base/message.scm (%warning-types): Add
  macro-use-before-definition warning type.
* module/language/tree-il/compile-cps.scm (%warning-passes): Add
  support for macro-use-before-definition.
2016-06-25 18:08:28 +02:00
Andy Wingo
31c76f16c6 Fix duplicate case in peval
* module/language/tree-il/peval.scm (singly-valued-expression?): Fix
  duplicate case.  Spotted by "mejja" on IRC.
2016-06-25 15:34:11 +02:00
Andy Wingo
73714b87aa Add documentation pointer from getopt-long to SRFI-37.
* doc/ref/mod-getopt-long.texi (getopt-long): Point to SRFI-37.
2016-06-25 10:06:15 +02:00
Andy Wingo
5f9134c32d Favor "escape continuation" over "one-shot continuation" in manual
* 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.
2016-06-24 18:18:46 +02:00
Andy Wingo
6a5b44de68 Check for strtod_l before using it.
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.
2016-06-24 17:52:30 +02:00
Andy Wingo
229d062f83 Constant-folding eq? and eqv? uses deduplication
* test-suite/tests/peval.test ("partial evaluation"): Add tests.
* module/language/tree-il/peval.scm (peval): Constant-fold eq? and eqv?
  using equal?, anticipating deduplication.
2016-06-24 17:37:51 +02:00
Andy Wingo
ff5cafc77d Prevent (@ (ice-9 boot-9) x)
* module/ice-9/boot-9.scm: Prevent re-loading, perhaps via (@ (ice-9
  boot-9) foo).  (ice-9 boot-9) isn't a module.  Fixes #21801.
2016-06-24 17:24:08 +02:00
Daniel Llorens
9687334ff5 On Darwin, skip tests that depend on setrlimit
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.
2016-06-24 17:17:13 +02:00
Andy Wingo
bd65845497 Fix texinfo->html for @acronym, @itemize
* 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.
2016-06-24 17:09:39 +02:00
Andy Wingo
d848af9a16 Parse bytecode to determine minimum arity
* 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):
2016-06-24 14:15:38 +02:00
Andy Wingo
5ca24b6ba1 Fix include-from-path when file found in relative path
* 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.
2016-06-24 10:40:09 +02:00
Daniel Llorens
395582b218 Avoid stifling readline history when looking up options
With this patch, history is never stifled unless (readline-set!) is used.

* src/guile-readline/readline.c (scm_readline_options)
2016-06-24 10:20:32 +02:00
Andy Wingo
cab7167849 Fix typo about `keywords' read option
* doc/ref/api-data.texi (Keyword Read Syntax): Fix typo.  Thanks to
  Glenn Michaels for the report and fix.
2016-06-24 09:55:28 +02:00
Andy Wingo
7d550c4ea0 Fix ,profile in pure modules
* libguile/scmsigs.c (close_1): Make the async closure in an environment
  where `lambda' has its usual meaning.  Fixes #21013.
2016-06-24 09:50:23 +02:00