summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Arrays are not an array implementationra0Daniel Llorens2014-02-073-13/+11
| | | | | | | | | | * libguile/bitvectors.c: match other uses of SCM_ARRAY_IMPLEMENTATION. * libguile/generalized-arrays.c (scm_is_array): don't use scm_i_array_implementation_for_obj on arrays. (scm_is_typed_array): idem. Use impl->get_handle instead of scm_array_get_handle to avoid calling scm_i_array_implementation_for_obj twice. * libguile/arrays.c: remove SCM_ARRAY_IMPLEMENTATION on scm_tc7_array type.
* array-contents returns root for empty arrays with empty rootDaniel Llorens2014-02-072-3/+7
| | | | | | | | | | | | 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.
* Fix compilation bugs with some kinds of typed arraysDaniel Llorens2014-02-071-1/+9
| | | | | | | * module/language/glil/compile-assembly.scm: pass (array-contents x) to uniform-array->bytevector instead of x, when x is a typed array. * test-suite/tests/arrays.test: test an instance of the above that failed in Guile 2.0.9.
* Preallocate index list in scm_array_index_map_xDaniel Llorens2014-02-072-18/+26
| | | | | | | * 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.
* Rename scm_t_array_handle.array to .rootDaniel Llorens2014-02-079-19/+19
| | | | Globally rename this field (after shared-array-root), since it's not an array.
* Match types used in arrays.c to struct field typesDaniel Llorens2014-02-071-22/+24
| | | | | | | | | | | | | * libguile/arrays.c - scm_shared_array_root: check for SCM_I_ARRAYP first. - scm_i_shap2ra: * check valid bounds in the '(lbnd ubnd) case. This makes (make-array 0 '(4 -3)) fail with a 'bad dimension' instead of with a 'wrong index' error. * use ssize_t for lbnd/ubnd/inc, not long. - scm_make_shared_array: use ssize_t for indices, not long. - scm_transpose_array: use size_t for ndim, not ulong. - scm_i_print_array: idem.
* Bounds error in vector_handle_ref/set is implementation errorDaniel Llorens2014-02-073-9/+5
| | | | | | * libguile/vectors.c: bounds are already checked unless impl is called directly, so don't check again. * libguile/strings.c, libguile/bitvectors.c: fix comments.
* Don't use ASET in scm_array_index_map_xDaniel Llorens2014-02-071-4/+5
| | | | | * libguile/array-map.c: (scm_array_index_map_x): replace ASET by direct use of handle->impl.
* In scm_ramapc, only check unrolled axes for emptinessDaniel Llorens2014-02-071-69/+50
| | | | | | | | * libguile/array-map.c: (scm_ramapc) - Don't check emptiness while preparing ra0, but only after kroll is known, and only before kroll. len = 0 will be caught by the unrolled loop. - Use ra0 axis length in unroll check depth for rest args, not ra1's. - Recover early exit feature when cproc returns 0.
* Fix scm_ramapc bugs with 0-inc arraysDaniel Llorens2014-02-072-24/+35
| | | | | | | * libguile/array-map.c: (scm_ramapc): Cannot flag empty on the product inc * dim * dim ... Check every dim. * test-suite/tests/ramap.test: Tests the 0-inc, non empty case for both array-map! and array-copy!.
* Fix corner cases of scm_ramapcDaniel Llorens2014-02-072-207/+210
| | | | | | | | | | | | | | | | | | | | * 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!.
* Rewrite scm_ramapc()Daniel Llorens2014-02-072-124/+134
| | | | | | | | | | | | | | | | * 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.
* Check more cases of array-contentsDaniel Llorens2014-02-072-3/+13
| | | | | | * libguile/arrays.c: (scm_array_contents): fix comment. * test-suite/tests/arrays.test: add cases that depend on correct setting of CONTIGUOUS_FLAG.
* Check the documented matching behavior of array-map!/copy!Daniel Llorens2014-02-072-45/+67
| | | | | | * 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.
* Simplify ASET in array-map.cDaniel Llorens2014-02-071-0/+1
| | | | | * libguile/array-map.c: (ASET): this is only ever used with a true vector type, so remove use of inc/base/lbnd.
* Inline ASET in array-index-map! for rank 1 argumentsDaniel Llorens2014-02-071-2/+2
| | | | | * libguile/array-map.c: (scm_array_index_map_x): branch to special case on rank 1, instead of !SCM_I_ARRAYP (ra). Inline ASET in this case.
* Fix compilation errors when reading arrays at the replDaniel Llorens2014-02-072-22/+83
| | | | | | | | | | | | | | * compile-assembly.scm - vector-fold2: handle rank 1 arrays, since this is called with the result of array-contents which need not be a vector. - dump-constants: fix uses of vector-fold2. Replace vector-length on result of array-contents by array-length. * 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 - tests for array-contents.
* Factor out make1array() in scm_ramapc()Daniel Llorens2014-02-071-96/+93
| | | | | * libguile/array-map.c: (scm_ramapc): factor out vector->array conversion to aux function make1array.
* Raw pointer loop in array-copy! for vector/vector caseDaniel Llorens2014-02-071-5/+16
| | | | | | | | | | | | | | | This special case improves (define a (make-array 1. 1000000 10)) (define b (make-array *unspecified* 1000000 10)) (define c (transpose-array (make-array *unspecified* 10 1000000) 1 0)) ,time (array-copy! a b) ,time (array-copy! a c) from 0.041598s / 0.072561 to 0.012164s / 0.041886s on a i7-3930K. * libguile/array-map.c: (racp): if both src and dst are on vectors, use the element pointers to do the copy.
* Have array impl->vref, vset take SCM, not handlesDaniel Llorens2014-02-076-61/+60
| | | | | | | | | | | | | | | | | | | | | | * libguile/array-handle.h - scm_i_t_array_ref, scm_i_t_array_set take SCM. - scm_array_handle_ref, scm_array_handle_set: pass h->array. * libguile/array-map.c - AREF, ASET, rafill, racp, ramap, rafe: pass storage vector SCM instead of handle. * libguile/bitvector.c - bitvector_handle_ref, bitvector_handle_set_x: take bitvector arg. * libguile/bytevectors.c - bv_handle_ref, bv_handle_set_x: take bytevector arg. - scm_i_print_bytevectors: don't use array handles. * libguile/deprecated.c - scm_generalized_vector_to_list: pass h.array. * libguile/strings.c - string_handle_ref, string_handle_set: take string arg. * libguile/uniform.c - scm_c_uniform_vector_ref, scm_c_uniform_vector_set_x: pass h.array. * libguile/vectors.c - vector_handle_ref, vector_handle_set: take vector arg.
* Fix array map functions with empty argumentsDaniel Llorens2014-02-072-85/+101
| | | | | | | | | | * 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.
* Fix empty array bug in array-index-map!Daniel Llorens2014-02-072-11/+34
| | | | | | | * 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.
* Avoid using array_handle fields in impl->vref/vsetDaniel Llorens2014-02-072-6/+6
| | | | | | | * libguile/bytevectors.c: (bv_handle_set_x, bv_handle_ref): get length and element type fields from the bytevector, not from the handle. * libguile/vectors.c: (vector_handle_set, vector_handle_ref): get length from the vector, not from the handle.
* Remove undocumented casting behavior in srfi4 vector_elementsDaniel Llorens2014-02-071-21/+1
| | | | | * libguile/srfi-4.c: scm_##tag##vector_writable_elements: if the argument's type doesn't match the tag, throw type error.
* Test that typed-array? returns #f with non-array argumentDaniel Llorens2014-02-071-1/+7
| | | | * test-suite/tests/arrays.test: ditto.
* Avoid array API in make-srfi-4-vectorDaniel Llorens2014-02-073-26/+23
| | | | | | | | * libguile/bytevector.h: publish SCM_BYTEVECTOR_TYPE_SIZE, bytevector_ref_fns and bytevector_set_fns from libguile/bytevector.c. * libguile/bytevector.c: bv_handle_ref, bv_handle_set: prefer SCM_BYTEVECTOR_TYPE_SIZE to scm_array_handle_uniform_element_size. * libguile/srfi-4.c: scm_make_srfi_4_vector: don't use array handles.
* Replace SCM_IMP in array-map.cDaniel Llorens2014-02-071-1/+2
| | | | | * libguile/array-map.c - scm_ramapc: check scm_array_contents with scm_is_false.
* Fix comment in scm_array_get_handleDaniel Llorens2014-02-071-9/+5
| | | | libguile/array-handle.c: (scm_array_get_handle): comment applies to either branch.
* Don't bother with array handle in scm_c_array_rankDaniel Llorens2014-02-071-8/+7
| | | | | * libguile/generalized-arrays.c: (scm_c_array_rank): compute rank directly from object.
* Use underlying vector implementation directly in array handlesDaniel Llorens2014-02-077-49/+34
| | | | | | | | | | | | | * libguile/array-handle.c - scm_array_get_handle: if the object is an array, point impl to the underlying vector instead of array impl, then fix the axes. Avoid calling scm_i_array_implementation_for_obj twice. * libguile/arrays.c - array_handle_ref, array_handle_set, array_get_handle: remove. * libguile/bitvectors.c, libguile/bytevectors.c, libguile/strings.c, libguile/vectors.c: fix base = 0 in the array handle. * libguile/vectors.c: (vector_handle_set, vector_handle_ref): do not use h->dims.
* Match uniform_vector_elements with vector_elementsDaniel Llorens2014-02-072-56/+31
| | | | | | | | | | | | * libguile/vectors.c - (scm_vector_writable_elements): allow any non-uniform rank 1 array, after the doc. Match the implementation with scm_uniform_vector_elements. - (scm_vector_elements): after the above. * libguile/uniform.c - (scm_uniform_vector_writable_elements): ditto for uniform rank 1 arrays. * libguile/sort.c - revert the changes in 7a6fd9, except for the argument type test; allow what scm_vector_(writable_)elements allows.
* Online documentation for vector-ref, vector-set!Daniel Llorens2014-02-071-53/+35
| | | | | * libguile/vectors.c: (scm_vector_ref, scm_vector_set!): embed the comments as documentation.
* vector-length rejects non vector? argDaniel Llorens2014-02-071-17/+15
| | | | | | * libguile/vectors.c - scm_c_vector_length: error if SCM_I_IS_VECTOR (v) fails. - scm_vector_length: Documentation for vector-length.
* vector-ref, vector-set! reject non vector? argsDaniel Llorens2014-02-071-29/+1
| | | | | * libguile/vectors.c: (scm_c_vector_ref, scm_c_vector_set_x): throw type error if v is not vector?.
* Identify scm_is_vector with scm_is_simple_vectorDaniel Llorens2014-02-0710-47/+103
| | | | | | | | | | | | | | | | | | | | | This patch fixes the bug (vector-ref #1@1(1 2 3) 1) => 2. * libguile/vectors.c: (scm_is_vector): just as scm_is_simple_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_restricted_vector_sort_x: use scm_array_handle_writable_elements instead of scm_vector_writable_elements, to work with non-vector rank-1 array objects. - scm_sort_x: check for scm_is_array instead of scm_is_vector. Rank check is in restricted_vector_sort_x. - scm_sort: ditto. - scm_stable_sort_x: like scm_restricted_vector_sort_x. - scm_stable_sort: like scm_sort. * 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.
* For uniform vectors SCM_I_ARRAYP can't be trueDaniel Llorens2014-02-072-25/+38
| | | | | | | | | | | | | | | This fixes an inconsistency where uniform-vector? of a shared array could be true but -ref operations failed to account correctly for lbnd. * libguile/uniform.c - scm_is_uniform_vector: SCM_I_ARRAYP disqualifies obj as uniform vector. - scm_c_uniform_vector_length: lbnd is known 0, so don't use it. - scm_c_uniform_vector_ref: lbnd/base/inc are known to be 0/0/1. - scm_c_uniform_vector_set_x!: idem. - scm_uniform_vector_writable_elements: check uvec's type. * test-suite/tests/arrays.test - group the exception types at the top. - check that uniform-vector functions do not accept general arrays.
* Merge commit '9b5da400dde6e6bc8fd0e318e7ca1feffa5870db'Andy Wingo2014-02-073-38/+30
|\ | | | | | | | | | | Conflicts: libguile/vectors.c test-suite/tests/weaks.test
| * Deprecate vector-ref, vector-length, vector-set! on weak vectorsAndy Wingo2014-02-073-43/+59
| | | | | | | | | | | | | | | | | | * libguile/vectors.c (scm_vector_length, scm_c_vector_length): (scm_c_vector_ref, scm_c_vector_set_x): Deprecate the use of these procedures on weak vectors. * test-suite/tests/guardians.test: * test-suite/tests/weaks.test: Adapt test suites.
* | Merge commit '1e3fd6a0c81bb3e9900a93a9d1923cc788de0f99'Andy Wingo2014-02-071-1/+12
|\ \ | |/ | | | | | | | | | | | | Conflicts: doc/ref/api-memory.texi libguile/weaks.c libguile/weaks.h module/ice-9/weak-vector.scm
| * Add weak-vector-length, weak-vector-ref, weak-vector-set!Andy Wingo2014-02-074-5/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | * libguile/weaks.c (scm_is_weak_vector, scm_c_weak_vector_length): (scm_c_weak_vector_ref, scm_c_weak_vector_set_x): New interfaces for dealing with weak vectors from C. (scm_weak_vector_length, scm_weak_vector_ref, scm_weak_vector_set_x): New Scheme interfaces to weak vectors; to be used instead of vector-length, vector-ref, etc. * module/ice-9/weak-vector.scm: Export the new interfaces. * doc/ref/api-memory.texi (Weak vectors): Document them.
* | Merge commit '40a723a92236fe4e58feb89057b4182b1fc76810'Andy Wingo2014-02-073-23/+13
|\ \ | |/
| * Remove outdated documentation of LTDL_LIBRARY_PATH.Mark H Weaver2014-02-051-8/+0
| | | | | | | | | | * doc/ref/guile-invoke.texi (Environment Variables): Remove documentation of 'LTDL_LIBRARY_PATH'.
| * Document 'equal?' in list of R6RS incompatibilities.Mark H Weaver2014-02-051-2/+6
| | | | | | | | | | * doc/ref/r6rs.texi (R6RS Incompatibilities): Mention that 'equal?' may not terminate when applied to cyclic datums.
| * REPL Server: Remove unneeded error case in 'run-server'.Mark H Weaver2014-02-041-4/+0
| | | | | | | | | | | | | | * module/system/repl/server.scm (run-server): Remove case that handled 'interrupt' exceptions specially. It is no longer needed since e6c8e6047ed2e772cc4e1fb5ad4d389e5c616feb (REPL Server: Don't establish a SIGINT handler.)
| * REPL Server: Redirect warnings to client socket.Mark H Weaver2014-02-041-9/+7
| | | | | | | | | | * module/system/repl/server.scm (serve-client): Use parameterize. Redirect warnings to client socket.
* | Merge commit 'c8e839cfeb647aca034b9bcd5a321d419dedca1f'Andy Wingo2014-02-071-1/+1
|\ \ | |/
| * Don't check HAVE_ALARM, which no longer exists.Mark H Weaver2014-02-031-1/+1
| | | | | | | | | | * libguile/scmsigs.c (scm_alarm): Remove check for HAVE_ALARM. Conditionalize only on HAVE_DECL_ALARM.
* | Merge commit '5e69ceb7a667377a61cb0c31d7ac20e245b3fafd'Andy Wingo2014-02-07381-736/+3887
|\ \ | |/
| * Update Gnulib to v0.1-77-gd9361daMark H Weaver2014-02-03381-736/+3887
| |
* | Merge commit '866af5da3d11ac4a9df44ee8c5b1781a0073c288'Andy Wingo2014-02-073-2/+257
|\ \ | |/ | | | | | | Removes the special arity handler, and instead relies on the procedure returning the correct number of values.