Andy Wingo [Wed, 19 Feb 2014 10:11:46 +0000 (11:11 +0100)]
Default stack size is one page.
* libguile/vm.c (initialize_default_stack_size): Initial stack size is
one page.
Andy Wingo [Wed, 19 Feb 2014 10:01:39 +0000 (11:01 +0100)]
More robust stack expansion and contraction
* libguile/vm.c (allocate_stack, expand_stack): Return NULL on
allocation failure instead of throwing an exception. Throwing an
exception is tricky to get right, and we need more context to do it
correctly.
(return_unused_stack_to_os): Try again if madvise returns -EAGAIN. If
madvise fails, print an error message.
(vm_expand_stack): Abort if stack expansion fails. We'll fix this in
a future patch.
(make_vm): Abort if we can't mmap a single page.
Andy Wingo [Mon, 17 Feb 2014 21:23:40 +0000 (22:23 +0100)]
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
Andy Wingo [Mon, 17 Feb 2014 13:15:30 +0000 (14:15 +0100)]
PT_DYNAMIC inside some other PT_LOAD segment
* libguile/loader.c (load_thunk_from_memory): Only load PT_LOAD
segments, as libc does. The PT_DYNAMIC segment should be inside some
other PT_LOAD segment.
* module/system/vm/linker.scm (segment-kind): Give the .dynamic segment
PT_LOAD kind, so that it is written in a PT_LOAD segment.
(count-segments): Add one if there is a SHT_DYNAMIC segment.
(allocate-segment): Set the paddr to the addr, as binutils do.
(record-special-segments): New routine, to write out special segments
like PT_DYNAMIC.
(allocate-elf): Call record-special-segments.
Andy Wingo [Sun, 16 Feb 2014 14:58:44 +0000 (15:58 +0100)]
Add elf-symbol-value-offset, for properly relocating symtab entries
* module/system/vm/elf.scm (elf-symbol-value-offset): New export.
Andy Wingo [Sun, 16 Feb 2014 11:18:44 +0000 (12:18 +0100)]
ELF linker can produce objects with native ABI
* module/system/vm/elf.scm: Define more ABI types and ELF object types.
Export the ABI, object type, and machine type values.
* module/system/vm/linker.scm (<linker-reloc>, process-reloc): Allow
rel32/1 relocs.
(add-elf-objects, allocate-elf, link-elf): Allow the user to set an
ABI, type, and machine-type.
Andy Wingo [Fri, 14 Feb 2014 09:49:45 +0000 (10:49 +0100)]
bytevector-length reifies to correct module
* module/language/cps/reify-primitives.scm (primitive-module): Whoops,
bytevector-length is needs to map to the (rnrs bytevectors) module.
Andy Wingo [Thu, 13 Feb 2014 16:51:11 +0000 (17:51 +0100)]
bytevector-length is an interesting primitive.
* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
(*effect-free-primitives*):
* module/language/cps/effects-analysis.scm: bytevector-length is an
interesting primitive.
Andy Wingo [Thu, 13 Feb 2014 10:04:55 +0000 (11:04 +0100)]
sqrt and abs are interesting primitives
* module/language/cps/effects-analysis.scm:
* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
(*effect-free-primitives*): Add sqrt and abs.
Andy Wingo [Thu, 13 Feb 2014 08:30:39 +0000 (09:30 +0100)]
Add prune-top-level-scopes pass
* module/language/cps/prune-top-level-scopes.scm: New pass, to prune
unneeded "cache-current-module!" forms.
* module/language/cps/compile-bytecode.scm:
* module/Makefile.am: Add the new pass to the build and enable by
default.
Andy Wingo [Tue, 11 Feb 2014 20:54:05 +0000 (21:54 +0100)]
Bytevector f32 an f64 ops actually map to VM primitives
* module/language/cps/primitives.scm (*instruction-aliases*): Whoops!
Fix mapping of f32 and f64 instructions to VM primitives.
Andy Wingo [Tue, 11 Feb 2014 19:59:38 +0000 (20:59 +0100)]
guile.m4 tweaks
* meta/guile.m4 (GUILE_PKG): Don't print "checking for guile 2.0" if
we've already found 2.2. Print the correct effective version at the
end.
(GUILE_PROGS): Allow prereleases, whose micro version does not yet
match the effective version. Default to the already-chosen effective
version.
Daniel Llorens [Wed, 8 May 2013 14:06:40 +0000 (16:06 +0200)]
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.
Daniel Llorens [Thu, 2 May 2013 09:43:31 +0000 (11:43 +0200)]
Add tests for more kinds of typed arrays.
* test-suite/tests/arrays.test: Add more type array tests.
Daniel Llorens [Tue, 30 Apr 2013 14:11:07 +0000 (16:11 +0200)]
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.
Daniel Llorens [Mon, 29 Apr 2013 12:19:52 +0000 (14:19 +0200)]
Match types used in arrays.c to struct field types
* 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.
Daniel Llorens [Fri, 26 Apr 2013 11:02:38 +0000 (13:02 +0200)]
Don't use ASET in scm_array_index_map_x
* libguile/array-map.c: (scm_array_index_map_x): replace ASET by direct
use of handle->impl.
Daniel Llorens [Fri, 26 Apr 2013 00:05:22 +0000 (02:05 +0200)]
In scm_ramapc, only check unrolled axes for emptiness
* 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.
Daniel Llorens [Thu, 25 Apr 2013 13:18:05 +0000 (15:18 +0200)]
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!.
Daniel Llorens [Wed, 24 Apr 2013 21:29:48 +0000 (23:29 +0200)]
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.
Daniel Llorens [Fri, 19 Apr 2013 14:44:48 +0000 (16:44 +0200)]
Factor out make1array() in scm_ramapc()
* libguile/array-map.c: (scm_ramapc): factor out vector->array conversion
to aux function make1array.
Daniel Llorens [Wed, 24 Apr 2013 15:13:56 +0000 (17:13 +0200)]
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.
Daniel Llorens [Fri, 19 Apr 2013 23:27:42 +0000 (01:27 +0200)]
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.
Daniel Llorens [Wed, 24 Apr 2013 14:34:31 +0000 (16:34 +0200)]
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.
Andy Wingo [Sun, 9 Feb 2014 20:11:08 +0000 (21:11 +0100)]
Reindent scm_ramapc
* libguile/array-map.c (scm_ramapc): Reindent.
Daniel Llorens [Fri, 19 Apr 2013 12:53:34 +0000 (14:53 +0200)]
Raw pointer loop in array-copy! for vector/vector case
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.
Andy Wingo [Sun, 9 Feb 2014 19:56:55 +0000 (20:56 +0100)]
Simplify scm_array_get_handle for tc7-arrays
* libguile/array-handle.c (scm_array_get_handle): Simplify for the array
case, as suggested by Daniel Llorens.
Daniel Llorens [Wed, 17 Apr 2013 12:33:40 +0000 (14:33 +0200)]
Test that typed-array? returns #f with non-array argument
* test-suite/tests/arrays.test: ditto.
Daniel Llorens [Wed, 17 Apr 2013 08:19:26 +0000 (10:19 +0200)]
Replace SCM_IMP in array-map.c
* libguile/array-map.c
- scm_ramapc: check scm_array_contents with scm_is_false.
Andy Wingo [Sun, 9 Feb 2014 11:31:59 +0000 (12:31 +0100)]
Remove array impl. registry; instead, hard-code array handle creation
* libguile/array-handle.h (scm_t_vector_ref, scm_t_vector_set): Rename
from scm_t_array_ref, scm_t_array_set. These were named
scm_i_t_array_ref and scm_i_t_array_set in 1.8 and 2.0. Change to
take the vector directly, instead of the array handle. In this way,
generic array handles are layered on top of specific implementations
of backing stores.
Remove scm_t_array_implementation, introduced in 2.0 but never
documented. It was a failed attempt to layer the array implementation
that actually introduced too many layers, as it prevented the "vref"
and "vset" members of scm_t_array_handle (called "ref" and "set" in
1.8, not present in 2.0) from specializing on array backing stores.
(scm_i_register_array_implementation) (scm_i_array_implementation_for_obj):
Remove these internal interfaces.
(scm_t_array_handle): Adapt to scm_t_vector_ref / scm_t_vector_set
change.
(scm_array_handle_ref, scm_array_handle_set): Adapt to change in
vref/vset prototype.
* libguile/array-handle.c (scm_array_get_handle): Inline all the
necessary initializations here for all specific array types.
* libguile/array-map.c (rafill, racp, ramap, rafe, array_index_map_1):
* libguile/arrays.c: Remove array implementation code.
* libguile/bitvectors.h:
* libguile/bitvectors.c: Remove array implementation code.
(scm_i_bitvector_bits): New internal interface.
* libguile/bytevectors.c: Remove array implementation code.
* libguile/srfi-4.h: Remove declarations for internal procedures that
don't exist (!).
* libguile/strings.c: Remove array implementation code.
* libguile/vectors.c: Remove array implementation code.
Daniel Llorens [Fri, 19 Apr 2013 10:57:13 +0000 (12:57 +0200)]
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.
Daniel Llorens [Fri, 19 Apr 2013 08:42:40 +0000 (10:42 +0200)]
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.
Andy Wingo [Sat, 8 Feb 2014 21:11:36 +0000 (22:11 +0100)]
Add "vector" member to scm_t_array_handle
* libguile/array-handle.h (scm_t_array_handle): Add "vector" member.
* libguile/array-handle.c (scm_array_get_handle): Initialize the vector
member.
Andy Wingo [Sat, 8 Feb 2014 20:51:52 +0000 (21:51 +0100)]
Remove "impl" member of array handles.
* libguile/array-handle.h (scm_t_array_handle): Remove "impl" member.
* libguile/array-handle.c (scm_array_get_handle): Adapt.
Andy Wingo [Sat, 8 Feb 2014 20:42:53 +0000 (21:42 +0100)]
Inline scm_i_array_implementation_for_obj in scm_i_array
* libguile/generalized-arrays.c (scm_is_array, scm_is_typed_array): In
preparation for removing the registry of array implementations, remove
a couple uss of scm_i_array_implementation_for_obj.
Andy Wingo [Sat, 8 Feb 2014 20:02:48 +0000 (21:02 +0100)]
vref, vset members of scm_t_array_handle
* libguile/array-handle.h (scm_t_array_ref, scm_t_array_set): Rename
from scm_i_t_array_ref, scm_i_t_array_set.
(scm_t_array_handle): Copy vref and vset from impl to handle.
(scm_array_handle_ref, scm_array_handle_set):
* libguile/array-map.c (racp, ramap, rafe, rafill, array_index_map_1):
* libguile/array-handle.c (scm_array_get_handle): Adapt.
Daniel Llorens [Thu, 11 Apr 2013 16:11:35 +0000 (18:11 +0200)]
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.
Andy Wingo [Sat, 8 Feb 2014 16:14:47 +0000 (17:14 +0100)]
SCM_I_IS_VECTOR only true for tc7_vector, not weak vectors
* libguile/tags.h (SCM_TYP7S, SCM_HAS_TYP7S): Remove these, as we no
longer do the differs-by-one-bit thing for vectors and weak vectors.
* libguile/vectors.h (SCM_I_IS_VECTOR): Use SCM_HAS_TYP7.
(SCM_I_IS_NONWEAK_VECTOR): Remove.
* libguile/vm-engine.c (vector-length, vector-ref, vector-set!)
(vector-ref/immediate, vector-set!/immediate): We can inline these
instructions completely now.
* libguile/vm.c (vm_error_not_a_vector, vm_error_out_of_range): New
error conditions.
Andy Wingo [Sat, 8 Feb 2014 16:00:32 +0000 (17:00 +0100)]
Merge commit '
24cac6554073bb6e691605cd6ac6196f3c0851a3'
Conflicts:
libguile/vectors.c
Andy Wingo [Sat, 8 Feb 2014 15:54:01 +0000 (16:54 +0100)]
Merge commit '
5cfeff11cc58148c58a85a879fd7a3e7cfbbe8e2'
Conflicts:
libguile/vectors.c
Andy Wingo [Sat, 8 Feb 2014 15:13:54 +0000 (16:13 +0100)]
Deprecate the use of the vector interface on arrays
* libguile/vectors.c (scm_is_vector): Deprecate use on weak vectors and
arrays.
(scm_is_simple_vector): Deprecate use on weak vectors.
(scm_vector_length, scm_c_vector_ref, scm_c_vector_set_x): Deprecate
use on arrays.
* libguile/sort.c: Adapt to check explicitly for arrays.
Andy Wingo [Sat, 8 Feb 2014 15:02:59 +0000 (16:02 +0100)]
Deprecate use of vector-length, vector-ref, vector-set! as primitive-generics
* libguile/vectors.c (scm_vector_length, scm_c_vector_ref):
(scm_c_vector_set_x): Deprecate the use of vector-length, vector-ref,
and vector-set! as primitive generics.
Andy Wingo [Sat, 8 Feb 2014 14:31:37 +0000 (15:31 +0100)]
Merge commit '
fb7dd00169304a5922838e4d2f25253640a35def'
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
Andy Wingo [Sat, 8 Feb 2014 13:56:16 +0000 (14:56 +0100)]
Merge commit '
dc65b88d839c326889618112c4870ad3a64e9446'
Conflicts:
libguile/srfi-4.c
Andy Wingo [Sat, 8 Feb 2014 13:55:16 +0000 (14:55 +0100)]
Merge commit '
b9b88351ea2c4b43a6f90938554dc5693b17e328'
Conflicts:
libguile/deprecated.h
test-suite/tests/00-socket.test
Andy Wingo [Sat, 8 Feb 2014 13:48:56 +0000 (14:48 +0100)]
Andy Wingo [Sat, 8 Feb 2014 13:48:48 +0000 (14:48 +0100)]
Merge commit '
495cea0c931de23f074892b3f32808e676712a18'
Conflicts:
libguile/weaks.c
Andy Wingo [Sat, 8 Feb 2014 13:46:31 +0000 (14:46 +0100)]
Merge commit '
b86069c1308a6ca36f3a3bc56134b3f8fd693592'
Conflicts:
libguile/hashtab.c
Andy Wingo [Sat, 8 Feb 2014 13:44:23 +0000 (14:44 +0100)]
Andy Wingo [Sat, 8 Feb 2014 13:44:11 +0000 (14:44 +0100)]
Merge commit '
2f3b7e9a41677bfe802e8a1ee851827297384c58'
Conflicts:
module/ice-9/pretty-print.scm
Andy Wingo [Sat, 8 Feb 2014 13:31:42 +0000 (14:31 +0100)]
Andy Wingo [Sat, 8 Feb 2014 13:18:40 +0000 (14:18 +0100)]
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.
Andy Wingo [Sat, 8 Feb 2014 12:52:21 +0000 (13:52 +0100)]
Simplify srfi-4 C implementation
* libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): In the raw element
accessors (e.g scm_u32vector_writable_elements), only permit
bytevectors, as the constructors will only make bytevectors. This
harmonizes with the Scheme interfaces as well, which expect packed
bytevectors.
(scm_make_srfi_4_vector): Knowing that the new value is a bytevector
with base 0 and inc 1, simplify initialization.
Andy Wingo [Sat, 8 Feb 2014 13:27:49 +0000 (14:27 +0100)]
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.
Mark H Weaver [Sat, 8 Feb 2014 02:42:28 +0000 (21:42 -0500)]
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.
Mark H Weaver [Sat, 8 Feb 2014 01:05:17 +0000 (20:05 -0500)]
Avoid using 'eval-when' with 'expand' in (oop goops).
* module/oop/goops.scm: Avoid using 'eval-when' with 'expand'.
Mark H Weaver [Fri, 7 Feb 2014 21:53:48 +0000 (16:53 -0500)]
Better error reporting in 'weak-vector-ref' and 'weak-vector-set!'.
* libguile/weaks.c (scm_c_weak_vector_ref, scm_c_weak_vector_set_x):
Pass procedure name to 'scm_out_of_range'.
Mark H Weaver [Fri, 7 Feb 2014 21:38:58 +0000 (16:38 -0500)]
Make size argument optional to 'make-doubly-weak-hash-table'; fix docs.
* libguile/hashtab.c (scm_make_doubly_weak_hash_table): Make 'size'
argument optional, like the weak hash table constructors.
* doc/ref/api-memory.texi (Weak hash tables): Document that 'size'
argument is optional for the weak hash table constructors.
Mark H Weaver [Fri, 7 Feb 2014 21:26:38 +0000 (16:26 -0500)]
Fix 'weak-vector?' doc: Weak hash tables are not weak vectors.
* doc/ref/api-memory.texi (Weak vectors): In 'weak-vector?' entry, don't
claim that weak hash tables are weak vectors. Remove statement that
weak vectors are mainly useful for implementing weak hash tables.
Andy Wingo [Fri, 7 Feb 2014 17:04:20 +0000 (18:04 +0100)]
Fix truncated-print for uniform vectors
* module/ice-9/pretty-print.scm (truncated-print): Use bytevector?
instead of uniform-vector?; the latter could be true for shared arrays
with non-zero lower bounds.
Andy Wingo [Fri, 7 Feb 2014 17:00:04 +0000 (18:00 +0100)]
(srfi srfi-4 gnu) uses private define-bytevector-type from (srfi srfi-4)
* module/srfi/srfi-4/gnu.scm: Re-use implementation of
define-bytevector-type from srfi-4.
Andy Wingo [Fri, 7 Feb 2014 16:57:30 +0000 (17:57 +0100)]
Remove private unused duplicate c32/c64vector definitions
* module/srfi/srfi-4.scm: Remove vestigial definitions for c32vectors
and c64vectors. Those are defined in (srfi srfi-4 gnu).
Andy Wingo [Fri, 7 Feb 2014 16:53:01 +0000 (17:53 +0100)]
SRFI-4 predicates, length accessors only accept bytevectors (not arrays)
* module/srfi/srfi-4.scm (define-bytevector-type): For the predicates
and length accessors, only accept bytevectors. Since arrays don't
work for u32vector-ref et al, they shouldn't pass u32vector?.
Andy Wingo [Fri, 7 Feb 2014 14:36:06 +0000 (15:36 +0100)]
Merge commit '
9b5da400dde6e6bc8fd0e318e7ca1feffa5870db'
Conflicts:
libguile/vectors.c
test-suite/tests/weaks.test
Andy Wingo [Fri, 7 Feb 2014 14:27:28 +0000 (15:27 +0100)]
Merge commit '
1e3fd6a0c81bb3e9900a93a9d1923cc788de0f99'
Conflicts:
doc/ref/api-memory.texi
libguile/weaks.c
libguile/weaks.h
module/ice-9/weak-vector.scm
Andy Wingo [Fri, 7 Feb 2014 14:26:18 +0000 (15:26 +0100)]
Andy Wingo [Fri, 7 Feb 2014 14:26:02 +0000 (15:26 +0100)]
Andy Wingo [Fri, 7 Feb 2014 14:25:49 +0000 (15:25 +0100)]
Andy Wingo [Fri, 7 Feb 2014 14:15:08 +0000 (15:15 +0100)]
Merge commit '
866af5da3d11ac4a9df44ee8c5b1781a0073c288'
Removes the special arity handler, and instead relies on the procedure
returning the correct number of values.
Andy Wingo [Fri, 7 Feb 2014 14:13:22 +0000 (15:13 +0100)]
Merge commit '
34e89877342f20fdb8a531ad78dab34cfd2b0843'
Conflicts:
module/Makefile.am
Andy Wingo [Fri, 7 Feb 2014 14:07:14 +0000 (15:07 +0100)]
Andy Wingo [Fri, 7 Feb 2014 14:06:26 +0000 (15:06 +0100)]
Andy Wingo [Fri, 7 Feb 2014 14:05:55 +0000 (15:05 +0100)]
Merge commit '
ca5e0414e96886177d883a249edd957d2331db65'
Conflicts:
module/language/tree-il/primitives.scm
Andy Wingo [Fri, 7 Feb 2014 14:01:33 +0000 (15:01 +0100)]
Merge commit '
60617d819d77a1b92ed6c557a0b49b8e9a8e97b9'
Conflicts:
libguile/continuations.c
libguile/eval.c
libguile/goops.c
libguile/instructions.c
Andy Wingo [Fri, 7 Feb 2014 13:51:42 +0000 (14:51 +0100)]
Merge commit '
f6ddf827f8f192af7a8cd255bd8374a0d38bbb74'
Conflicts:
module/ice-9/boot-9.scm
module/oop/goops.scm
Andy Wingo [Fri, 7 Feb 2014 13:43:42 +0000 (14:43 +0100)]
Andy Wingo [Fri, 7 Feb 2014 13:43:23 +0000 (14:43 +0100)]
Andy Wingo [Fri, 7 Feb 2014 13:42:40 +0000 (14:42 +0100)]
Merge commit '
8ca97482b01cf1a6aa538cc5a2d1f71fb60f080c'
Conflicts:
libguile/r6rs-ports.c
Andy Wingo [Fri, 7 Feb 2014 13:39:01 +0000 (14:39 +0100)]
Merge commit '
122f24cc8a3637ed42d7792ad1ff8ec0c49c58df'
Conflicts:
libguile/fports.c
libguile/ports.c
Andy Wingo [Fri, 7 Feb 2014 12:00:12 +0000 (13:00 +0100)]
Add weak-vector-length, weak-vector-ref, weak-vector-set!
* libguile/weak-vectors.h:
* libguile/weak-vectors.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.
Andy Wingo [Fri, 7 Feb 2014 11:42:44 +0000 (12:42 +0100)]
Deprecate vector-ref, vector-length, vector-set! on weak vectors
* 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.
Andy Wingo [Fri, 7 Feb 2014 11:25:05 +0000 (12:25 +0100)]
Add weak-vector-length, weak-vector-ref, weak-vector-set!
* 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.
Daniel Llorens [Thu, 11 Apr 2013 11:03:45 +0000 (13:03 +0200)]
Fix bad uses of base and lbnd on rank 1 arrays
* libguile/array-map.c
- rafill, ramap, rafe, racp: object from SCM_I_ARRAY_V always
has base 0, lbnd 0 and inc 1; make use of this.
* libguile/arrays.c
- array_handle_ref, array_handle_set: idem.
- array_get_handle: sanity check.
* libguile/generalized-vectors.c
- scm_c_generalized_vector_ref, scm_c_generalized_vector_set_x:
pos should be base when idx is lbnd. Furthermore, pos should be signed and
have its overflow checked; do this by handling the job to
scm_c_array_ref_1, scm_c_array_set_1_x.
* libguile/generalized-vectors.h
- fix prototypes.
Daniel Llorens [Wed, 10 Apr 2013 13:28:52 +0000 (15:28 +0200)]
Reorder arrays.test
* test-suite/tests/arrays.test: dependence reordering: first sanity, then
make-array, then array-equal?, then make-shared-array, shared-array-root,
then the rest, many of which use make-shared-array.
Daniel Llorens [Wed, 10 Apr 2013 13:11:33 +0000 (15:11 +0200)]
Don't use scm_is_generalized_vector in transpose-array
* libguile/arrays.c (scm_transpose_array)
- Use scm_c_array_rank(), which contains an implicit is_array test.
- Handle the rank 0 case.
* test-suite/tests/arrays.test
- Add test for rank 0 case.
- Add failure test for non array argument.
Daniel Llorens [Wed, 10 Apr 2013 12:53:10 +0000 (14:53 +0200)]
Tests for transpose-array
* test-suite/tests/arrays.test: test transpose-array for ranks 1, 2, 3.
Daniel Llorens [Wed, 10 Apr 2013 11:48:13 +0000 (13:48 +0200)]
Don't use scm_is_generalized_vector in shared-array-root
* libguile/arrays.c: (scm_shared_array_root): replace check for
scm_is_generalized_vector.
Daniel Llorens [Wed, 10 Apr 2013 11:45:05 +0000 (13:45 +0200)]
Tests for shared-array-root
* test-suite/tests/arrays.test: check shared-array-root against
make-shared-array, array-contents.
Daniel Llorens [Tue, 9 Apr 2013 23:07:02 +0000 (01:07 +0200)]
Remove unnecessary conditions in array constructors
* libguile/arrays.c: (scm_make_type_array, scm_from_contigous_typed_array,
scm_from_contigous_array): Remove conditions known to be true.
Daniel Llorens [Tue, 9 Apr 2013 16:27:29 +0000 (18:27 +0200)]
Remove generalized-vectors.h includes
* libguile/srfi-4.c, libguile/uniform.h: ditto.
Andy Wingo [Thu, 6 Feb 2014 20:34:14 +0000 (21:34 +0100)]
Fix array-index-map refactor
* libguile/ramap.c (array_index_map_1): Fix to use array handle
properly.
Andy Wingo [Thu, 6 Feb 2014 10:43:39 +0000 (11:43 +0100)]
Array-map refactors
* libguile/array-map.c (scm_ra_matchp): Refactor logic a bit.
(array_index_map_1, array_index_map_n)
(scm_array_index_map_x): Internally refactor array-index-map! to use
separate implementations for rank 1 versus rank >1 arrays.
Daniel Llorens [Tue, 7 May 2013 23:54:29 +0000 (01:54 +0200)]
Don't use generalized-vector in array-map.c (II)
* libguile/array-map.c
- replace scm_is_generalized_vector by scm_is_array && !SCM_I_ARRAY_P.
- replace scm_c_generalized_vector_length by scm_c_array_length.
- remove header.
Daniel Llorens [Mon, 8 Apr 2013 11:34:41 +0000 (13:34 +0200)]
Don't use generalized-vector in array-map.c (I)
* array-map.c: (AREF, ASET): Rename from GVREF, GVSET and use rank-1
array accessors.
Daniel Llorens [Thu, 6 Feb 2014 10:17:47 +0000 (11:17 +0100)]
Don't use generalized-vector functions in uniform.c
* libguile/uniform.c (scm_is_uniform_vector): Replace
scm_is_generalized_vector and scm_generalized_vector_get_handle by
scm_is_array and manual rank check.
(scm_c_uniform_vector_length): Use scm_c_array_length.
(scm_c_uniform_vector_ref): Use scm_c_array_ref_1.
(scm_c_uniform_vector_set): Use scm_c_array_set_1_x.
(scm_uniform_vector_writable_elements): Use scm_array_get_handle, and
assert that the rank is 1.
* test-suite/test/arrays.test: Rename the uniform-vector-ref block to
uniform-vector. Exercise uniform-vector-length and shared arrays
remaining uniform.
Modifications by Andy Wingo <wingo@pobox.com>.
Andy Wingo [Thu, 6 Feb 2014 10:02:20 +0000 (11:02 +0100)]
Replace generalized-vector calls in array_handle_ref/set
* libguile/arrays.c: (array-handle-ref, array-handle-set): Use the
rank-1 array accessors.
Daniel Llorens [Tue, 9 Apr 2013 16:17:21 +0000 (18:17 +0200)]
Replace scm_c_generalized_vector_length in arrays.c
* libguile/arrays.c: (scm_array_contents, scm_make_shared_array):
arrays are known of rank 1 so replace by scm_c_array_length.
Daniel Llorens [Tue, 9 Apr 2013 16:09:49 +0000 (18:09 +0200)]
Replace scm_c_generalized_vector_length in random.c
* libguile/random.c: (random:solid-sphere!): array is of known
rank 1, so use scm_c_array_length() instead.
Daniel Llorens [Thu, 18 Apr 2013 13:10:29 +0000 (15:10 +0200)]
Tests for array-copy!, empty case
* test-suite/tests/ramap.test: test array-copy! with empty destination.
Fix uses of constant array as destination.
Mark H Weaver [Thu, 6 Feb 2014 04:40:25 +0000 (23:40 -0500)]
Remove outdated documentation of LTDL_LIBRARY_PATH.
* doc/ref/guile-invoke.texi (Environment Variables): Remove
documentation of 'LTDL_LIBRARY_PATH'.