From a8161e77843ee18a99ec30dd57f796264dfac05a Mon Sep 17 00:00:00 2001 From: Alexey Dejneka Date: Sun, 13 Oct 2002 05:55:22 +0000 Subject: [PATCH] 0.7.8.34: OAOOed floating point number reading FOPs ... fixed reading of (COMPLEX DOUBLE-FLOAT) numbers from FASLs --- NEWS | 1 + src/code/fop.lisp | 91 ++++++++++++++++-------------------------- tests/dump.impure-cload.lisp | 6 +++ version.lisp-expr | 2 +- 4 files changed, 42 insertions(+), 58 deletions(-) diff --git a/NEWS b/NEWS index 9603f80..f278677 100644 --- a/NEWS +++ b/NEWS @@ -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 diff --git a/src/code/fop.lisp b/src/code/fop.lisp index ea2ceef..22df57f 100644 --- a/src/code/fop.lisp +++ b/src/code/fop.lisp @@ -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 diff --git a/tests/dump.impure-cload.lisp b/tests/dump.impure-cload.lisp index 6017d0b..a9d77e7 100644 --- a/tests/dump.impure-cload.lisp +++ b/tests/dump.impure-cload.lisp @@ -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 diff --git a/version.lisp-expr b/version.lisp-expr index c394e89..6a76f1c 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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" -- 1.7.10.4