Skip to content

Commit

Permalink
0.7.8.34:
Browse files Browse the repository at this point in the history
        OAOOed floating point number reading FOPs
        ... fixed reading of (COMPLEX DOUBLE-FLOAT) numbers from FASLs
  • Loading branch information
Alexey Dejneka committed Oct 13, 2002
1 parent 53a7501 commit a8161e7
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 58 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -1321,6 +1321,7 @@ changes in sbcl-0.7.9 relative to sbcl-0.7.8:
functions now check the types of their inputs as required by ANSI.
* fixed bug 48c: SYMBOL-MACROLET signals PROGRAM-ERROR when an
introduced symbol is DECLAREd to be SPECIAL.
* fixed reading of (COMPLEX DOUBLE-FLOAT) literals from fasl files

planned incompatible changes in 0.7.x:
* When the profiling interface settles down, maybe in 0.7.x, maybe
Expand Down
91 changes: 34 additions & 57 deletions src/code/fop.lisp
Expand Up @@ -290,64 +290,41 @@
(let ((im (pop-stack)))
(%make-complex (pop-stack) im)))

(define-fop (fop-complex-single-float 72)
(prepare-for-fast-read-byte *fasl-input-stream*
(prog1
(complex (make-single-float (fast-read-s-integer 4))
(make-single-float (fast-read-s-integer 4)))
(done-with-fast-read-byte))))

(define-fop (fop-complex-double-float 73)
(prepare-for-fast-read-byte *fasl-input-stream*
(prog1
(let* ((re-lo (fast-read-u-integer 4))
(re-hi (fast-read-u-integer 4))
(re (make-double-float re-hi re-lo))
(im-lo (fast-read-u-integer 4))
(im-hi (fast-read-u-integer 4))
(im (make-double-float im-hi im-lo)))
(complex re im))
(done-with-fast-read-byte))))

#!+long-float
(define-fop (fop-complex-long-float 67)
(prepare-for-fast-read-byte *fasl-input-stream*
(prog1
(let* ((re-lo (fast-read-u-integer 4))
#!+sparc (re-mid (fast-read-u-integer 4))
(re-hi (fast-read-u-integer 4))
(re-exp (fast-read-s-integer #!+x86 2 #!+sparc 4))
(re (make-long-float re-exp re-hi #!+sparc re-mid re-lo))
(im-lo (fast-read-u-integer 4))
#!+sparc (im-mid (fast-read-u-integer 4))
(im-hi (fast-read-u-integer 4))
(im-exp (fast-read-s-integer #!+x86 2 #!+sparc 4))
(im (make-long-float im-exp im-hi #!+sparc im-mid im-lo)))
(complex re im))
(done-with-fast-read-byte))))

(define-fop (fop-single-float 46)
(prepare-for-fast-read-byte *fasl-input-stream*
(prog1 (make-single-float (fast-read-s-integer 4))
(done-with-fast-read-byte))))

(define-fop (fop-double-float 47)
(prepare-for-fast-read-byte *fasl-input-stream*
(prog1
(let ((lo (fast-read-u-integer 4)))
(make-double-float (fast-read-s-integer 4) lo))
(done-with-fast-read-byte))))
(macrolet ((fast-read-single-float ()
'(make-single-float (fast-read-s-integer 4)))
(fast-read-double-float ()
'(let ((lo (fast-read-u-integer 4)))
(make-double-float (fast-read-s-integer 4) lo)))
#!+long-float
(fast-read-long-float ()
'(let ((lo (fast-read-u-integer 4))
#!+sparc (mid (fast-read-u-integer 4))
(hi (fast-read-u-integer 4)) ; XXX
(exp (fast-read-s-integer #!+x86 2 #!+sparc 4)))
(make-long-float exp hi #!+sparc mid lo))))
(macrolet ((define-complex-fop (name fop-code type)
(let ((reader (symbolicate "FAST-READ-" type)))
`(define-fop (,name ,fop-code)
(prepare-for-fast-read-byte *fasl-input-stream*
(prog1
(complex (,reader) (,reader))
(done-with-fast-read-byte))))))
(define-float-fop (name fop-code type)
(let ((reader (symbolicate "FAST-READ-" type)))
`(define-fop (,name ,fop-code)
(prepare-for-fast-read-byte *fasl-input-stream*
(prog1
(,reader)
(done-with-fast-read-byte)))))))
(define-complex-fop fop-complex-single-float 72 single-float)
(define-complex-fop fop-complex-double-float 73 double-float)
#!+long-float
(define-complex-fop fop-complex-long-float 67 long-float)
(define-float-fop fop-single-float 46 single-float)
(define-float-fop fop-double-float 47 double-float)
#!+long-float
(define-float-fop fop-long-float 52 long-float)))

#!+long-float
(define-fop (fop-long-float 52)
(prepare-for-fast-read-byte *fasl-input-stream*
(prog1
(let ((lo (fast-read-u-integer 4))
#!+sparc (mid (fast-read-u-integer 4))
(hi (fast-read-u-integer 4))
(exp (fast-read-s-integer #!+x86 2 #!+sparc 4)))
(make-long-float exp hi #!+sparc mid lo))
(done-with-fast-read-byte))))

;;;; loading lists

Expand Down
6 changes: 6 additions & 0 deletions tests/dump.impure-cload.lisp
Expand Up @@ -66,4 +66,10 @@
:fill-pointer 2
:element-type 'character))

;;; SBCL 0.7.8 incorrectly read high bits of (COMPLEX DOUBLE-FLOAT)
;;; components as unsigned bytes.
(defparameter *numbers*
'(-1s0 -1f0 -1d0 -1l0
#c(-1s0 -1s0) #c(-1f0 -1f0) #c(-1d0 -1d0) #c(-1l0 -1l0)))

(sb-ext:quit :unix-status 104) ; success
2 changes: 1 addition & 1 deletion version.lisp-expr
Expand Up @@ -18,4 +18,4 @@
;;; internal versions off the main CVS branch, it gets hairier, e.g.
;;; "0.pre7.14.flaky4.13".)

"0.7.8.33"
"0.7.8.34"

0 comments on commit a8161e7

Please sign in to comment.