From: Paul F. Dietz Date: Tue, 2 Aug 2005 13:52:37 +0000 (+0000) Subject: 0.9.3.16: X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=8e500c66a52b58fd8dab4b098f76e36734d8fdbd;p=sbcl.git 0.9.3.16: Add source transform for (last x). Change nconc back to use last (which will be optimized with the source transform.) --- diff --git a/src/code/list.lisp b/src/code/list.lisp index b328681..225f1bb 100644 --- a/src/code/list.lisp +++ b/src/code/list.lisp @@ -394,12 +394,12 @@ ((endp elements)) (let ((ele (car elements))) (typecase ele - (cons (rplacd (last1 splice) ele) + (cons (rplacd (last splice) ele) (setf splice ele)) - (null (rplacd (last1 splice) nil)) + (null (rplacd (last splice) nil)) (atom (if (cdr elements) (fail ele) - (rplacd (last1 splice) ele))) + (rplacd (last splice) ele))) (t (fail ele))))) (return result))) (null) @@ -1121,7 +1121,7 @@ (setf (car l) (cdar l))) (setq res (apply fun (nreverse args))) (case accumulate - (:nconc (setq temp (last1 (nconc temp res)))) + (:nconc (setq temp (last (nconc temp res)))) (:list (rplacd temp (list res)) (setq temp (cdr temp)))))))) diff --git a/src/compiler/srctran.lisp b/src/compiler/srctran.lisp index 04060f8..8e96110 100644 --- a/src/compiler/srctran.lisp +++ b/src/compiler/srctran.lisp @@ -128,6 +128,13 @@ (define-source-transform nth (n l) `(car (nthcdr ,n ,l))) +;; (define-source-transform last (x) `(sb!impl::last1 ,x)) +(define-source-transform last (x) + `(let* ((x (the list ,x)) + (r (cdr x))) + (do () ((atom r) x) + (shiftf x r (cdr r))))) + (defvar *default-nthcdr-open-code-limit* 6) (defvar *extreme-nthcdr-open-code-limit* 20) diff --git a/version.lisp-expr b/version.lisp-expr index 02ef6bb..1e55d25 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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".) -"0.9.3.15" +"0.9.3.16"