From: Nikodemus Siivola Date: Sat, 31 May 2008 17:43:12 +0000 (+0000) Subject: 1.0.17.14: slightly better LIST* X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=83ce01b419da19b549eb76b0c3451f2b32a266d5;p=sbcl.git 1.0.17.14: slightly better LIST* * Disable type-checks in full calls to LIST*, because we know the &REST list is a proper list. * Handle 1 argument case in the source-transform. * Add a derive-type optimizer, so we can figure out the common case when the return value is know to be a CONS. --- diff --git a/src/code/list.lisp b/src/code/list.lisp index 045e1de..d18d3a5 100644 --- a/src/code/list.lisp +++ b/src/code/list.lisp @@ -320,7 +320,9 @@ (defun list* (arg &rest others) #!+sb-doc - "Return a list of the arguments with last cons a dotted pair" + "Return a list of the arguments with last cons a dotted pair." + ;; We know the &REST is a proper list. + (declare (optimize (sb!c::type-check 0))) (cond ((atom others) arg) ((atom (cdr others)) (cons arg (car others))) (t (do ((x others (cdr x))) diff --git a/src/compiler/srctran.lisp b/src/compiler/srctran.lisp index 37c3a73..5ae92be 100644 --- a/src/compiler/srctran.lisp +++ b/src/compiler/srctran.lisp @@ -123,10 +123,15 @@ (t (values nil t)))) ;;; And similarly for LIST*. -(define-source-transform list* (&rest args) - (case (length args) - (2 `(cons ,(first args) ,(second args))) - (t (values nil t)))) +(define-source-transform list* (arg &rest others) + (cond ((not others) arg) + ((not (cdr others)) `(cons ,arg ,(car others))) + (t (values nil t)))) + +(defoptimizer (list* derive-type) ((arg &rest args)) + (if args + (specifier-type 'cons) + (lvar-type arg))) ;;; Translate RPLACx to LET and SETF. (define-source-transform rplaca (x y) diff --git a/version.lisp-expr b/version.lisp-expr index 7b01e17..c416aa7 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".) -"1.0.17.13" +"1.0.17.14"