[cmucl-imp] Type propagation for load-time-value
Helmut Eller
heller at common-lisp.net
Sat Aug 6 20:46:40 CEST 2011
* 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.
;;;
More information about the cmucl-imp
mailing list