X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fsrctran.lisp;h=931032f8837b79cfca4b0c8ce097b7a6bbd93588;hb=4fc9d21ae1d8a6a2f8ff70f589d5da103203de13;hp=16d6cebb1598bcfc12fe83bc50e8827da2f7d8e9;hpb=3aff5655417da74a19ce576f55b2cb6999cda6c5;p=sbcl.git diff --git a/src/compiler/srctran.lisp b/src/compiler/srctran.lisp index 16d6ceb..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 @@ -127,7 +122,7 @@ (give-up-ir1-transform)) (let ((n (continuation-value n))) (when (> n - (if (policy node (= speed 3) (= space 0)) + (if (policy node (and (= speed 3) (= space 0))) *extreme-nthcdr-open-code-limit* *default-nthcdr-open-code-limit*)) (give-up-ir1-transform)) @@ -2482,7 +2477,6 @@ (frob logior) (frob logxor)) -;; MNA: defoptimizer for integer-length patch (defoptimizer (integer-length derive-type) ((x)) (let ((x-type (continuation-type x))) (when (and (numeric-type-p x-type) @@ -3002,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) @@ -3263,7 +3260,8 @@ ((= nargs 1) `(progn ,@args t)) ((= nargs 2) `(if (,predicate ,(first args) ,(second args)) nil t)) - ((not (policy nil (>= speed space) (>= speed cspeed))) + ((not (policy nil (and (>= speed space) + (>= speed compilation-speed)))) (values nil t)) (t (let ((vars (make-gensym-list nargs)))