[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 10/18: Fix compilation of rank 0 typed array literals
From: |
Daniel Llorens |
Subject: |
[Guile-commits] 10/18: Fix compilation of rank 0 typed array literals |
Date: |
Fri, 18 Mar 2016 10:38:12 +0000 |
lloda pushed a commit to branch lloda-array-support
in repository guile.
commit 191bfbefbfcb5663710e051dbc324730b8e5aae2
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 94ebf03..7bcd1d5 100644
--- a/module/system/vm/assembler.scm
+++ b/module/system/vm/assembler.scm
@@ -993,7 +993,9 @@ immediate, and @code{#f} otherwise."
(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 c6027c2..9bd0676 100644
--- a/test-suite/tests/arrays.test
+++ b/test-suite/tests/arrays.test
@@ -217,7 +217,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] 08/18: Rename array-set-from!, scm_array_set_from_x to array-amend!, scm_array_amend_x, (continued)
- [Guile-commits] 08/18: Rename array-set-from!, scm_array_set_from_x to array-amend!, scm_array_amend_x, Daniel Llorens, 2016/03/18
- [Guile-commits] 05/18: Compile in C99 mode, Daniel Llorens, 2016/03/18
- [Guile-commits] 12/18: Speed up for multi-arg cases of scm_ramap functions, Daniel Llorens, 2016/03/18
- [Guile-commits] 16/18: Draft documentation for (array-for-each-cell), Daniel Llorens, 2016/03/18
- [Guile-commits] 11/18: Remove deprecated array functions, Daniel Llorens, 2016/03/18
- [Guile-commits] 15/18: Draft of (array-for-each-cell), Daniel Llorens, 2016/03/18
- [Guile-commits] 09/18: Don't use array handles in scm_c_array_rank, Daniel Llorens, 2016/03/18
- [Guile-commits] 06/18: New functions array-from, array-from*, array-set-from!, Daniel Llorens, 2016/03/18
- [Guile-commits] 18/18: Special case for array-map! with three arguments, Daniel Llorens, 2016/03/18
- [Guile-commits] 14/18: Do not use array handles in scm_vector, Daniel Llorens, 2016/03/18
- [Guile-commits] 10/18: Fix compilation of rank 0 typed array literals,
Daniel Llorens <=