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

1986 commits

Author SHA1 Message Date
Andy Wingo
9de674e6e6 Rewrite boot-9 map to be recursive and pure
* module/ice-9/boot-9.scm (map): Rewrite to be recursive and pure
  instead of iterative and effectful.  At best this is faster; at worst
  it is slower.  In any case it resolves continuation-related issues.

* module/srfi/srfi-1.scm (fold): Specialize the two-arg case.
  (map): Rewrite to be recursive.

* test-suite/tests/r5rs_pitfall.test (8.3): Update for new expected map
  behavior.
2014-05-01 21:17:28 +02:00
Andy Wingo
d7a67c3e91 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	.gitignore
	doc/example-smob/Makefile
	doc/ref/api-smobs.texi
	doc/ref/libguile-concepts.texi
	doc/ref/libguile-smobs.texi
	libguile.h
	libguile/finalizers.c
	libguile/finalizers.h
	libguile/goops.c
	module/language/tree-il/compile-glil.scm
	module/oop/goops.scm
2014-04-28 18:51:21 +02:00
Andy Wingo
48ad85fb56 Fix foreign slot initialization and access
* libguile/goops.c (scm_sys_initialize_object): Refactor initialization
  so that we don't ref uninitialized slots before initializing them.
  This allows foreign slots, whose initial value is 0, to be initialized
  via #:init-form.

* module/oop/goops.scm (@slot-ref, @slot-set!): Remove definitions.
  Change callers to use struct-ref and struct-set!.  slot-ref and
  slot-set! were only marginally more efficient and were much more
  dangerous.  This change allows the standard accessors to work on
  foreign slots; that was not the case before, as the 'u' fields of the
  struct were read as if they were 'p' slots.
* module/language/tree-il/compile-glil.scm (lambda): Remove support for
  compiling @slot-ref/@slot-set!.  These were private to GOOPS.

* test-suite/tests/goops.test ("active-slot"): Update to not expect a
  ref before initialization.
  ("foreign slots"): Add tests.
2014-04-27 11:02:35 +02:00
Mark H Weaver
475772ea57 Merge branch 'stable-2.0'
Conflicts:
	GUILE-VERSION
	NEWS
	guile-readline/ice-9/readline.scm
	libguile/async.c
	libguile/backtrace.c
	libguile/deprecated.h
	libguile/gc-malloc.c
	libguile/gdbint.c
	libguile/init.c
	libguile/ioext.c
	libguile/mallocs.c
	libguile/print.c
	libguile/rw.c
	libguile/scmsigs.c
	libguile/script.c
	libguile/simpos.c
	libguile/snarf.h
	libguile/strports.c
	libguile/threads.c
	libguile/vm-i-scheme.c
	libguile/vm-i-system.c
	module/srfi/srfi-18.scm
	test-suite/Makefile.am
	test-suite/standalone/test-num2integral.c
2014-04-25 02:06:01 -04:00
Mark H Weaver
e0da53b4fe Support weak vectors, arrays, and bitvectors in (system base types).
* module/system/base/types.scm (%tc7-wvect, %tc7-array, %tc7-bitvector):
  New variables.
  (cell->object): Add cases for weak vectors, arrays, and bitvectors.
2014-04-24 18:22:04 -04:00
Andy Wingo
d38ca16e2c Add make-vector opcode
* libguile/vm-engine.c (make-vector): New opcode.
* module/language/cps/compile-bytecode.scm (compile-fun):
* module/system/vm/assembler.scm (system): Support the new opcode.
  (*bytecode-minor-version*): Bump.

* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump.

* test-suite/tests/compiler.test ("limits"): Add vector test.
2014-04-21 22:47:33 +02:00
Andy Wingo
d4b3a36d42 Operations on 8-bit and 12-bit operands shuffle args into range
* module/language/cps/slot-allocation.scm (allocate-slots): Avoid
  allocating locals in the range [253,255].

* module/system/vm/assembler.scm: List exports explicitly.  For
  operations with limited-range operands, export wrapper assemblers that
  handle shuffling their operands into and out of their range.
  (define-assembler): Get rid of enclosing begin.
  (shuffling-assembler, define-shuffling-assembler): New helpers to
  define shuffling wrapper assemblers.
  (emit-mov*, emit-receive*): New functions.
  (shuffle-up-args): New helper.
  (standard-prelude, opt-prelude, kw-prelude): Call shuffle-up-args
  after finishing.

* test-suite/tests/compiler.test ("limits"): Add test cases.
2014-04-21 22:47:28 +02:00
Andy Wingo
a285f38fda More robust coverage tests
* test-suite/tests/coverage.test ("line-execution-counts"): Allow zero
  or one count on the loop head.
2014-04-16 19:13:49 +02:00
Andy Wingo
37d574b378 Change some make-stack tests to use frame-call-representation
* test-suite/tests/eval.test ("stacks"): Use frame-call-representation.
2014-04-16 19:13:09 +02:00
Andy Wingo
4cbe4d72aa Fix rtl tests
* module/system/vm/assembler.scm (write-arities): Add a diagnostic.

* test-suite/tests/rtl.test: Fix tests to emit "definition"
  instructions.
2014-04-15 22:00:30 +02:00
Andy Wingo
c271065e54 Fix frame-call-representation for primitive applications
* module/system/vm/frame.scm (frame-call-representation): Fix to work
  for primitives.

* test-suite/tests/eval.test ("stacks"): Update expected result for
  substring.
2014-04-15 21:47:46 +02:00
Andy Wingo
1e91d95704 Remove tests for old Tree-IL CSE module
* test-suite/tests/cse.test: Remove.
* test-suite/Makefile.am:
2014-04-10 09:25:38 +02:00
Andy Wingo
5e8f5ebaf3 Fix coverage expectations
* test-suite/tests/coverage.test ("line-execution-counts"): Update
  expectations.  Since there's nothing to do at the loop header and the
  renaming of X happens at the end of the loops, the compiled code only
  sees the loop header once.
2014-04-04 16:49:59 +02:00
Andy Wingo
ecc7987427 Sloppier matching in setitimer tests
* test-suite/tests/signals.test: Update setitimer tests to sloppily
  match both times -- it seems that the interval can also be sloppy on
  some platforms, sadly.
2014-03-26 10:47:40 +01:00
Nathaniel Alderson
8d124d2077 Calculate usecs correctly in thread-sleep!
* module/srfi/srfi-18.scm (thread-sleep!): Correctly compute
  microseconds.

* test-suite/tests/srfi-18.test: Add test.
2014-03-23 21:58:54 +01:00
Ludovic Courtès
f2c3d29fd2 tests: Check 'simple-format' with closed current-output-port.
This is a follow-up to e26ab06.

* libguile/print.c (scm_simple_format): Pass 1 to
  SCM_VALIDATE_OPORT_VALUE, for 'destination'.
* test-suite/tests/format.test ("simple-format"): Add test.
2014-03-20 09:40:42 +01:00
Andy Wingo
b7faf399c1 Fix newline preservation in @example with lines beginning with @
* module/texinfo.scm (read-char-data): Preserve newlines in @example and
  similar environments in the case when the next line starts with an @.

* test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add a test.
2014-03-17 21:49:16 +01:00
Andy Wingo
f57d4316c2 Add call-with-stack-overflow-handler tests
* test-suite/tests/eval.test ("stack overflow handlers"): Add
  call-with-stack-overflow-handler tests, replacing the old stack
  overflow test.
2014-03-15 19:41:03 +01:00
David Thompson
c6a2691fff Test for deleted weak pairs in hash-for-each.
* libguile/hashtab.c (scm_internal_hash_for_each_handle): Test for
  deleted weak pairs.
* test-suite/tests/hash.test: Add test case.
2014-03-12 02:36:35 -04:00
Mark H Weaver
7f8ad91b99 SRFI-60: Reimplement 'rotate-bit-field' on inums to be more portable.
* libguile/srfi-60.c (scm_srfi60_rotate_bit_field): Avoid division by
  zero in the (start == end) case.  Rewrite inum case to work with
  unsigned integers in two's complement format.

* test-suite/tests/srfi-60.test ("rotate-bit-field"): Add more tests.
2014-03-11 21:39:26 -04:00
Andy Wingo
1a95246a39 Fix for-each bug detecting not-a-list
* module/ice-9/boot-9.scm (for-each): Fix detection of not-a-list in the
  unrolled one-argument case.

* test-suite/tests/eval.test ("for-each"): Add a test.
2014-03-02 12:04:18 +01:00
Andy Wingo
9603919177 Improve statprof test
* test-suite/tests/statprof.test ("statistical sample counts within
  expected range"): Increase number of calls, as the computer speed
  increases and VM/compiler speed increases have meant that we get fewer
  samples than before.  Also, compare the maximum deviation to the
  square root of the expected value.  I don't actually know what the
  right statistical check is here, but this is closer to an "all points
  fall within a standard deviation" than our previous 30% check.  Print
  a nicer warning when the check fails.
2014-02-28 17:18:19 +01:00
Andy Wingo
966d4bdd70 Fix setitimer documentation. Allow microseconds >= 1e6.
* doc/ref/posix.texi (Signals): Fix the documentation for setitimer; it
  was wrong.

* libguile/scmsigs.c (pack_tv): New helper.  Allow usecs >= 1e6.
  (unpack_tv): New helper.
  (scm_setitimer): Use the new helpers.

* test-suite/tests/signals.test: Add setitimer tests.
2014-02-28 10:31:12 +01:00
Andy Wingo
fc2b8f6c6d Fix newline preservation in @example with lines beginning with @
* module/texinfo.scm (read-char-data): Preserve newlines in @example and
  similar environments in the case when the next line starts with an @.

* test-suite/tests/texinfo.test ("test-texinfo->stexinfo"): Add a test.
2014-02-27 17:16:29 +01:00
Ludovic Courtès
5f4b817df9 Add (system base types).
* module/system/base/types.scm, test-suite/tests/types.test: New files.
* module/Makefile.am (SYSTEM_BASE_SOURCES): Add system/base/types.scm.
* test-suite/Makefile.am (SCM_TESTS): Add tests/types.test.
2014-02-18 23:04:30 +01:00
Andy Wingo
82490a665c Don't peval-penalize let-bound lambdas only referenced once
* module/language/tree-il/peval.scm (peval): When going to peval a call
  whose operator isn't just a lambda but is a let-bound lambda, as one
  bound via define-inlinable, don't create a new counter if the lambda
  is only referenced once in the source.  Avoids needless failure to
  inline once-referenced procedures.

* test-suite/tests/peval.test ("partial evaluation"): Wheeeee
2014-02-17 22:23:40 +01:00
Daniel Llorens
2c1ccb02c5 array-contents returns root for empty arrays with empty root
This fixes a compiler issue where (uniform-array->bytevector #2f64())
failed because of the stricter definition of uniform-vector? on this branch.

Perhaps it would be better if uniform-array->bytevector didn't require
a contiguous argument.

* libguile/arrays.c: (scm_array_contents): return the root regardless of
  the value of SCM_I_ARRAY_DIMS (ra)->inc.
* test-suite/tests/arrays.test: check.
2014-02-10 21:58:28 +01:00
Daniel Llorens
c6eaad9757 Add tests for more kinds of typed arrays.
* test-suite/tests/arrays.test: Add more type array tests.
2014-02-10 21:58:28 +01:00
Daniel Llorens
b98e2f47aa Preallocate index list in scm_array_index_map_x
* libguile/array-map.c
  - (scm_array_index_map_x): preallocate the index list instead of
    constructing it on each rank-1 iteration.
  - (ramap, rafe): use SCM_I_ARRAY_V just once.
2014-02-10 21:58:28 +01:00
Daniel Llorens
f26eae9a9a Fix corner cases of scm_ramapc
* libguile/array-map.c
  - (scm_ramapc): mismatched axes limit unrollk (kroll). Reorganize
    the function to do all checking as we go.
  - (scm_ra_matchp): unused; remove.
  - (find_unrollk): inlined in scm_ramapc; remove.
  - (klen): inlined in scm_ramapc; remove.
  - (rafill): n is size_t.
  - (racp): n is size_t. Use n and not i0end to bound the loop.
  - (ramap): Use n and not i0end to bound the loop. This is needed for the rank
    0 case to work with the new scm_ramapc, as inc may be set to 0 in that case.
  - (rafe): idem.

* test-suite/tests/ramap.test
  - check that size mismatch prevents unrolling (matching behavior III) with
    both array-copy! and array-map!.
  - check that non-contiguous stride in non-ref args prevents unrolling
    (rank 2, discontinuous) with both array-copy! and array-map!.
  - check rank 0 cases with array-for-each, array-map!.
  - Test the 0-inc, non empty case for both array-map! and array-copy!.
2014-02-10 21:58:01 +01:00
Daniel Llorens
4cde4f63ee Rewrite scm_ramapc()
* libguile/array-map.c
  - (cind): replace by cindk, that operates only on the unrolled index set.
  - (klen): new function.
  - (make1array): take extra inc argument.
  - (scm_ramapc): rewrite to unroll as many axes as possible instead of just all
    or one.
  - (AREF): lbnd is known to be 0: remove.
  - (ASET): v is known to come from SCM_I_ARRAY_V; assume base, inc, lbnd.
  - (racp): use ssize_t instead of long for the indices.
  - (scm_array_index_map_x): build the index list at the last-but-one axis, then
    set the car of the last element, instead of building the list at the last axis.
* test-suite/tests/ramap.test
  - add array-map! test with offset arguments.
2014-02-10 21:26:55 +01:00
Daniel Llorens
35f45ed6d0 Check more cases of array-contents
* libguile/arrays.c: (scm_array_contents): fix comment.
* test-suite/tests/arrays.test: add cases that depend on correct
  setting of CONTIGUOUS_FLAG.
2014-02-10 21:25:42 +01:00
Daniel Llorens
c545f7164a Refactor array-contents
* libguile/arrays.c (scm_array_contents): Branch cases not on
  scm_is_generalized_vector but on SCM_I_ARRAYP. Thus lbnd!=0, which
  could happen with scm_is_generalized_vector, never appears in the
  output.
* test-suite/tests/arrays.test: Test array-contents.
2014-02-10 21:18:48 +01:00
Daniel Llorens
dd60e9348e Check the documented matching behavior of array-map!/copy!
* test-suite/tests/arrays.test: move array-copy! tests to ramap.test.
* test-suite/tests/ramap.test: check the dissimilar matching behavior of
  array-copy! and array-map! with arguments of different size.
2014-02-10 21:09:23 +01:00
Daniel Llorens
d41d5bf05e Test that typed-array? returns #f with non-array argument
* test-suite/tests/arrays.test: ditto.
2014-02-09 12:55:49 +01:00
Daniel Llorens
8269f0be18 Fix array map functions with empty arguments
* libguile/array-map.c
  - scm_ra_matchp: look for empty axes and return new case 5 if so. Use
    array handles to remove the SCM_I_ARRAYP / not branch.
  - scm_ramapc: Heed case 5.
* test-suite/tests/ramap.test
  - test empty arguments for array-copy! and array-for-each. Note those
    that failed in 2.0.9.
2014-02-09 12:48:21 +01:00
Daniel Llorens
b0d9b0744a Fix empty array bug in array-index-map!
* libguile/array-map.c: (scm_array_index_map_x): bail out if any one of the
  axes is empty.
* test-suite/tests/ramap.test: add tests for empty array-case of
  array-index-map!. The 'f64 case with not-last emtpy axis is broken in 2.0.9.
2014-02-09 12:48:19 +01:00
Daniel Llorens
d747313100 Change uses of scm_is_simple_vector to scm_is_vector
* libguile/filesys.c, libguile/random.c, libguile/stime.c, libguile/trees.c,
  libguile/validate.h: use scm_is_vector instead of scm_is_simple_vector.
* libguile/sort.c (scm_sort_x, scm_sort, scm_stable_sort_x)
  (scm_stable_sort): Remove scm_is_vector check; scm_is_array is
  sufficient.
* test-suite/tests/arrays.test: Fix header.
* test-suite/tests/random.test: New coverage test covering
  random:normal-vector!.
* test-suite/Makefile.am: Include random.test in make check.
2014-02-08 18:26:49 +01:00
Andy Wingo
8051cf2304 Merge commit 'fb7dd00169'
This commit also renames uniform-vector-element-type-code to
array-type-code.

Conflicts:
	libguile/uniform.c
	libguile/uniform.h
	test-suite/tests/arrays.test
2014-02-08 15:31:37 +01:00
Andy Wingo
c8b7b0dad3 Merge commit 'b9b88351ea'
Conflicts:
	libguile/deprecated.h
	test-suite/tests/00-socket.test
2014-02-08 14:55:16 +01:00
Andy Wingo
12b8487d5d Merge commit '0ce224594a' 2014-02-08 14:48:56 +01:00
Andy Wingo
fb7dd00169 Deprecate general "uniform-vector" interface
* libguile/uniform.h:
* libguile/uniform.c (scm_is_uniform_vector, scm_uniform_vector_p)
  (scm_c_uniform_vector_length, scm_uniform_vector_length)
  (scm_uniform_vector_element_type, scm_uniform_vector_element_size)
  (scm_c_uniform_vector_ref, scm_uniform_vector_ref):
  (scm_c_uniform_vector_set_x, scm_uniform_vector_set_x):
  (scm_uniform_vector_to_list)
  (scm_uniform_vector_elements, scm_uniform_vector_writable_elements):
  Deprecate.  This interface lacked both generality and specificity.
  The general replacement is array-length, array-ref, and friends on the
  scheme side, or the array handle interface on the C side.  On the
  specific side of things, there are the specific bytevector, srfi-4,
  and bitvector interfaces.

* test-suite/tests/arrays.test:
* test-suite/tests/bitvectors.test:
* test-suite/tests/ports.test:
* test-suite/tests/srfi-4.test: Update to use array interfaces.

* doc/ref/api-foreign.texi (Void Pointers and Byte Access):
* doc/ref/srfi-modules.texi (SRFI-4): Update.
2014-02-08 14:28:07 +01:00
Andy Wingo
b9b88351ea Deprecate htons, htonl, ntohs, ntohl
* libguile/sockets.h:
* libguile/sockets.c:
* libguile/deprecated.h:
* libguile/deprecated.c (scm_htons, scm_htonl, scm_ntohs, scm_ntohl):
  Deprecate.  Bytevectors adequately subsume their functionality.

* doc/ref/posix.texi:
* test-suite/tests/00-socket.test: Update.
2014-02-08 14:28:07 +01:00
Mark H Weaver
0ce224594a Improve handling of locales in the test suite.
* test-suite/guile-test (run-tests): Load each test file within
  (with-locale "C" ...).

* test-suite/tests/encoding-iso88591.test:
* test-suite/tests/encoding-iso88597.test:
* test-suite/tests/encoding-utf8.test:
* test-suite/tests/srfi-14.test: Remove broken code to save and restore
  the previous locale.

* test-suite/tests/bytevectors.test:
* test-suite/tests/format.test:
* test-suite/tests/regexp.test:
* test-suite/tests/srfi-19.test:
* test-suite/tests/tree-il.test: Make sure 'setlocale' is defined before
  calling it.
2014-02-07 21:49:35 -05:00
Andy Wingo
9db57a19e1 Merge commit '9b5da400dd'
Conflicts:
	libguile/vectors.c
	test-suite/tests/weaks.test
2014-02-07 15:36:06 +01:00
Andy Wingo
b00c9b2214 Merge commit '866af5da3d'
Removes the special arity handler, and instead relies on the procedure
returning the correct number of values.
2014-02-07 15:24:43 +01:00
Andy Wingo
cd36c69619 Merge commit '34e8987734'
Conflicts:
	module/Makefile.am
2014-02-07 15:13:22 +01:00
Andy Wingo
ae7f13be4b Merge commit 'ca5e0414e9'
Conflicts:
	module/language/tree-il/primitives.scm
2014-02-07 15:05:55 +01:00
Andy Wingo
0dbc5e571a Merge commit '45a28515c1' 2014-02-07 14:43:42 +01:00
Andy Wingo
7d484bfa15 Merge commit 'a5cbbaa66a' 2014-02-07 14:43:23 +01:00