1.0.7.33: better handling of ASSOC and MEMBER on empty lists
authorNikodemus Siivola <nikodemus@random-state.net>
Thu, 19 Jul 2007 18:49:44 +0000 (18:49 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Thu, 19 Jul 2007 18:49:44 +0000 (18:49 +0000)
 * If the second argument is a constant NIL, remove the whole
   call in the transform and just return NIL.

src/compiler/seqtran.lisp
version.lisp-expr

index 2ddcdbc..b687c92 100644 (file)
                  (if (eq 'key fun)
                      key-form
                      `(%coerce-callable-to-fun ,fun))))
-        (if (and (constant-lvar-p list) (policy node (>= speed space)))
-            `(let ,(mapcar (lambda (fun) `(,fun ,(ensure-fun fun))) funs)
-               ,(open-code (lvar-value list)))
-            `(,out-of-line item list ,@(mapcar #'ensure-fun funs)))))))
+        (let* ((cp (constant-lvar-p list))
+               (c-list (when cp (lvar-value list))))
+          (cond ((and cp c-list (policy node (>= speed space)))
+                 `(let ,(mapcar (lambda (fun) `(,fun ,(ensure-fun fun))) funs)
+                    ,(open-code c-list)))
+                ((and cp (not c-list))
+                 ;; constant nil list -- nothing to find!
+                 nil)
+                (t
+                 `(,out-of-line item list ,@(mapcar #'ensure-fun funs)))))))))
 
 (deftransform member ((item list &key key test test-not) * * :node node)
   (transform-list-item-seek 'member list key test test-not node))
index a888f19..880cba6 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.7.32"
+"1.0.7.33"