From: Nikodemus S. <de...@us...> - 2009-05-18 07:58:19
|
Update of /cvsroot/sbcl/sbcl/src/code In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4660/src/code Modified Files: cross-type.lisp Log Message: 1.0.28.57: cross compiler is able to reason about host complexes ...based on the type the host object will take in target, which just needs to follow the same logic our dumper uses. ...fixing which shows the the new FILL transform didn't handle complex single floats quite right yet. Index: cross-type.lisp =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/code/cross-type.lisp,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- cross-type.lisp 9 Dec 2007 14:37:23 -0000 1.32 +++ cross-type.lisp 18 May 2009 07:58:11 -0000 1.33 @@ -214,12 +214,26 @@ (values (typep host-object target-type) t)) (t (values nil t)))) - (;; Complexes suffer the same kind of problems as arrays + (;; Complexes suffer the same kind of problems as arrays. + ;; Our dumping logic is based on contents, however, so + ;; reasoning about them should be safe (and (not (hairy-type-p (values-specifier-type target-type))) (sb!xc:subtypep target-type 'cl:complex)) (if (complexp host-object) - (warn-and-give-up) ; general-case complexes being way too hard - (values nil t))) ; but "obviously not a complex" being easy + (let ((re (realpart host-object)) + (im (imagpart host-object))) + (if (or (and (eq target-type 'complex) + (typep re 'rational) (typep im 'rational)) + (and (equal target-type '(cl:complex single-float)) + (typep re 'single-float) (typep im 'single-float)) + (and (equal target-type '(cl:complex double-float)) + (typep re 'double-float) (typep im 'double-float))) + (values t t) + (progn + ;; We won't know how to dump it either. + (warn "Host complex too complex: ~S" host-object) + (warn-and-give-up)))) + (values nil t))) ;; Some types require translation between the cross-compilation ;; host Common Lisp and the target SBCL. ((target-type-is-in '(classoid)) |