X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcompiler%2Fsrctran.lisp;h=931032f8837b79cfca4b0c8ce097b7a6bbd93588;hb=4fc9d21ae1d8a6a2f8ff70f589d5da103203de13;hp=6365cf11435261d4da47a321b822b43aac382caf;hpb=64bf93a97814ea1caf62bbdcc7ef43e2fbfc8f73;p=sbcl.git diff --git a/src/compiler/srctran.lisp b/src/compiler/srctran.lisp index 6365cf1..931032f 100644 --- a/src/compiler/srctran.lisp +++ b/src/compiler/srctran.lisp @@ -18,11 +18,10 @@ (def-source-transform not (x) `(if ,x nil t)) (def-source-transform null (x) `(if ,x nil t)) -;;; ENDP is just NULL with a LIST assertion. +;;; ENDP is just NULL with a LIST assertion. The assertion will be +;;; optimized away when SAFETY optimization is low; hopefully that +;;; is consistent with ANSI's "should return an error". (def-source-transform endp (x) `(null (the list ,x))) -;;; FIXME: Is THE LIST a strong enough assertion for ANSI's "should -;;; return an error"? (THE LIST is optimized away when safety is low; -;;; does that satisfy the spec?) ;;; We turn IDENTITY into PROG1 so that it is obvious that it just ;;; returns the first value of its argument. Ditto for VALUES with one @@ -31,15 +30,11 @@ (def-source-transform values (x) `(prog1 ,x)) ;;; Bind the values and make a closure that returns them. -(def-source-transform constantly (value &rest values) - (let ((temps (make-gensym-list (1+ (length values)))) - (dum (gensym))) - `(let ,(loop for temp in temps and - value in (list* value values) - collect `(,temp ,value)) - #'(lambda (&rest ,dum) - (declare (ignore ,dum)) - (values ,@temps))))) +(def-source-transform constantly (value) + (let ((rest (gensym "CONSTANTLY-REST-"))) + `(lambda (&rest ,rest) + (declare (ignore ,rest)) + ,value))) ;;; If the function has a known number of arguments, then return a ;;; lambda with the appropriate fixed number of args. If the @@ -3001,6 +2996,9 @@ ;;; Perhaps we should have to prove that the denominator is nonzero before ;;; doing them? (Also the DOLIST over macro calls is weird. Perhaps ;;; just FROB?) -- WHN 19990917 +;;; +;;; FIXME: What gives with the single quotes in the argument lists +;;; for DEFTRANSFORMs here? Does that work? Is it needed? Why? (dolist (name '(ash /)) (deftransform name ((x y) '((constant-argument (integer 0 0)) integer) '* :eval-name t :when :both) @@ -3262,7 +3260,8 @@ ((= nargs 1) `(progn ,@args t)) ((= nargs 2) `(if (,predicate ,(first args) ,(second args)) nil t)) - ((not (policy nil (and (>= speed space) (>= speed cspeed)))) + ((not (policy nil (and (>= speed space) + (>= speed compilation-speed)))) (values nil t)) (t (let ((vars (make-gensym-list nargs)))