[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 10/12: Fix compilation of rank 0 typed array literals
From: |
Daniel Llorens |
Subject: |
[Guile-commits] 10/12: Fix compilation of rank 0 typed array literals |
Date: |
Mon, 16 Feb 2015 08:12:41 +0000 |
lloda pushed a commit to branch lloda-array-support
in repository guile.
commit 96e2c711ba7db28440df037e0900df880f6751df
Author: Daniel Llorens <address@hidden>
Date: Thu Feb 12 13:02:24 2015 +0100
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.
---
module/system/vm/assembler.scm | 4 +++-
test-suite/tests/arrays.test | 8 +++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/module/system/vm/assembler.scm b/module/system/vm/assembler.scm
index 6bc2bcf..7c13be1 100644
--- a/module/system/vm/assembler.scm
+++ b/module/system/vm/assembler.scm
@@ -835,7 +835,9 @@ lists. This procedure can be called many times before
calling
(define (simple-uniform-vector? obj)
(and (array? obj)
(symbol? (array-type obj))
- (equal? (array-shape obj) (list (list 0 (1- (array-length obj)))))))
+ (match (array-shape obj)
+ (((0 n)) #t)
+ (else #f))))
(define (statically-allocatable? x)
"Return @code{#t} if a non-immediate constant can be allocated
diff --git a/test-suite/tests/arrays.test b/test-suite/tests/arrays.test
index 85a53f7..e1c729d 100644
--- a/test-suite/tests/arrays.test
+++ b/test-suite/tests/arrays.test
@@ -216,7 +216,13 @@
(with-test-prefix/c&e "array-equal?"
(pass-if "#s16(...)"
- (array-equal? #s16(1 2 3) #s16(1 2 3))))
+ (array-equal? #s16(1 2 3) #s16(1 2 3)))
+
+ (pass-if "#0f64(...)"
+ (array-equal? #0f64(99) (make-typed-array 'f64 99)))
+
+ (pass-if "#0(...)"
+ (array-equal? #0(99) (make-array 99))))
;;;
;;; make-shared-array
- [Guile-commits] branch lloda-array-support updated (3159664 -> 6590864), Daniel Llorens, 2015/02/16
- [Guile-commits] 01/12: Avoid unneeded internal use of array handles, Daniel Llorens, 2015/02/16
- [Guile-commits] 03/12: Unuse array 'contiguous' flag, Daniel Llorens, 2015/02/16
- [Guile-commits] 02/12: Remove scm_from_contiguous_array, Daniel Llorens, 2015/02/16
- [Guile-commits] 05/12: Compile in C99 mode, Daniel Llorens, 2015/02/16
- [Guile-commits] 06/12: New functions array-from, array-from*, array-set-from!, Daniel Llorens, 2015/02/16
- [Guile-commits] 04/12: Reuse SCM_BYTEVECTOR_TYPED_LENGTH in scm_array_get_handle, Daniel Llorens, 2015/02/16
- [Guile-commits] 08/12: Rename array-set-from!, scm_array_set_from_x to array-amend!, scm_array_amend_x, Daniel Llorens, 2015/02/16
- [Guile-commits] 07/12: Tests & doc for array-from, array-from*, array-set-from!, Daniel Llorens, 2015/02/16
- [Guile-commits] 09/12: Don't use array handles in scm_c_array_rank, Daniel Llorens, 2015/02/16
- [Guile-commits] 10/12: Fix compilation of rank 0 typed array literals,
Daniel Llorens <=
- [Guile-commits] 11/12: Remove deprecated array functions, Daniel Llorens, 2015/02/16
- [Guile-commits] 12/12: Speed up for multi-arg cases of scm_ramap functions, Daniel Llorens, 2015/02/16