Marc:
I've got a vector of length 262,144, each element of which is
supposed to be a length 4 f64vector.
Well, I get a interrupt in my program when it hits one of these
elements that is only of length 2.
Further investigation shows that only two elements of the whole
vector have length 2:
> 1> (Array-for-each (lambda (p) (if (not (= (f64vector-length p) 4))
> (pp p))) p)
> #f64(-.7079566418808501 -.2467907960478973)
> #f64(-.6672517342403924 -.31362141535348953)
This presents a very interesting debugging problem. Eventually, I
changed the code storing an array to check whether all the f64vectors
are the same length when the Array is built:
> (set! make-Array-base
> (lambda (domain ;; an Interval
> getter ;; (lambda (i_0 ... i_n-1) ...)
> returns a value for (i_0,...,i_n-1) in (Array-domain a)
> ;; Part of mutable arrays
> setter ;; (lambda (v i_0 ... i_n-1) ...)
> sets a value for (i_0,...,i_n-1) in (Array-domain a)
> ;; Part of Fixed arrays
> manipulators ;; a Fixed-array-manipulator
> body ;; the backing store for this array
> indexer ;; see below
> affine ;; A list that says in which
> coordiantes the indexer is affine.
> safe? ;; do we check whether bounds (in
> getters and setters) and values (in setters) are valid
> )
> (if (and body
> (vector? body)
> (< 0 (vector-length body))
> (let ((element (vector-ref body 0)))
> (and (f64vector? element)
> (let ((l (f64vector-length element)))
> (not (every (lambda (p) (= (f64vector-length p) l)) (vector-
> >list body)))))))
> (error "Bzzt, thank you for playing")
> (original-make-Array-base domain ;; an Interval
> getter ;; (lambda (i_0 ... i_n-1) ...)
> returns a value for (i_0,...,i_n-1) in (Array-domain a)
> ;; Part of mutable arrays
> setter ;; (lambda (v i_0 ... i_n-1) ...)
> sets a value for (i_0,...,i_n-1) in (Array-domain a)
> ;; Part of Fixed arrays
> manipulators ;; a Fixed-array-manipulator
> body ;; the backing store for this array
> indexer ;; see below
> affine ;; A list that says in which
> coordiantes the indexer is affine.
> safe? ;; do we check whether bounds (in
> getters and setters) and values (in setters) are valid
> ))))
and everything passed. The code works and is exercised:
> 1> (make-Array-base #f #f #f #f (vector '#f64(0.0) '#f64(0. 0.)) #f
> #f #f)
> *** ERROR IN (console)(a)8.1 -- Bzzt, thank you for playing
I'm only human, so I want to blame the system rather than my own
code. It makes me wonder whether there is still a gc bug in beta 22,
whether that bug has been fixed for the upcoming beta 23, etc.
Any suggestions?
Brad