[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 10/24: Fix compilation of rank 0 typed array literals
From: |
Daniel Llorens |
Subject: |
[Guile-commits] 10/24: Fix compilation of rank 0 typed array literals |
Date: |
Thu, 23 Jun 2016 10:22:15 +0000 (UTC) |
lloda pushed a commit to branch lloda-array-support
in repository guile.
commit 642c96539648a835927608a08e555aa98a6c5345
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 9fc5349..d98aa9e 100644
--- a/module/system/vm/assembler.scm
+++ b/module/system/vm/assembler.scm
@@ -995,7 +995,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] branch lloda-array-support updated (901832e -> f7fdd8b), Daniel Llorens, 2016/06/23
- [Guile-commits] 01/24: Avoid unneeded internal use of array handles, Daniel Llorens, 2016/06/23
- [Guile-commits] 10/24: Fix compilation of rank 0 typed array literals,
Daniel Llorens <=
- [Guile-commits] 04/24: Reuse SCM_BYTEVECTOR_TYPED_LENGTH in scm_array_get_handle, Daniel Llorens, 2016/06/23
- [Guile-commits] 05/24: Compile in C99 mode, Daniel Llorens, 2016/06/23
- [Guile-commits] 17/24: New export (array-for-each-cell-in-order), Daniel Llorens, 2016/06/23
- [Guile-commits] 13/24: Remove deprecated and unused generalized-vector functions, Daniel Llorens, 2016/06/23
- [Guile-commits] 19/24: Avoid variable stack use in scm_array_for_each_cell(), Daniel Llorens, 2016/06/23
- [Guile-commits] 15/24: Draft of (array-for-each-cell), Daniel Llorens, 2016/06/23
- [Guile-commits] 11/24: Remove deprecated array functions, Daniel Llorens, 2016/06/23
- [Guile-commits] 21/24: Fix a corner case with empty arrays in (array-for-each-cell), Daniel Llorens, 2016/06/23
- [Guile-commits] 24/24: Remove uniform-array-read!, uniform-array-write from the manual, Daniel Llorens, 2016/06/23
- [Guile-commits] 23/24: Remove commented stack version of scm_array_for_each_cell(), Daniel Llorens, 2016/06/23