Re: Type propagation for load-time-value

Helmut Eller <[email protected]>
Newsgroups gmane.lisp.cmucl.devel
Message-ID <[email protected]>
* Helmut Eller [2011-08-06 18:38] writes:

> I'm proposing a patch to improve type propagation for load-time-value.

Oops, something removed the attachment.  Here it is again:

--- ltv.lisp.~1.4.~	2010-04-28 09:40:16.000000000 +0200
+++ ltv.lisp	2011-08-06 20:28:13.792158931 +0200
@@ -35,10 +35,10 @@
 	  (compile-load-time-value (if read-only-p
 				       form
 				       `(make-value-cell ,form)))
-	(declare (ignore type))
 	(ir1-convert start cont
 		     (if read-only-p
-			 `(%load-time-value ',handle)
+			 `(truly-the ,(type-specifier type)
+				     (%load-time-value ',handle))
 			 `(value-cell-ref (%load-time-value ',handle)))))
       (let ((value
 	     (handler-case (eval form)
--- main.lisp.~1.159.~	2010-12-29 15:51:19.000000000 +0100
+++ main.lisp	2011-08-06 20:21:03.709158808 +0200
@@ -1246,10 +1246,13 @@
   (let ((lambda (compile-load-time-stuff form name t)))
     (values
      (fasl-dump-load-time-value-lambda lambda *compile-object*)
-     (let ((type (leaf-type lambda)))
-       (if (function-type-p type)
-	   (single-value-type (function-type-returns type))
-	   *wild-type*)))))
+     (or (let ((return (lambda-return lambda)))
+	   (if return
+	       (single-value-type (return-result-type return))))
+	 (let ((type (leaf-type lambda)))
+	   (if (function-type-p type)
+	       (single-value-type (function-type-returns type))))
+	 *wild-type*))))
 
 ;;; COMPILE-MAKE-LOAD-FORM-INIT-FORMS  --  internal.
 ;;;


_______________________________________________
cmucl-imp mailing list
[email protected]
http://lists.zs64.net/mailman/listinfo/cmucl-imp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.