From 13fb43363e194ac787e287f447856165d6bb064d Mon Sep 17 00:00:00 2001 From: William Harold Newman Date: Thu, 11 Jul 2002 00:59:30 +0000 Subject: [PATCH] 0.7.5.8: tweaked MAKE-XEP so that its output is compiled with tail call elimination (I'll probably revisit this later to do similar tricks on other machinery like "varargs entry for ...", but even without that this little hack seems to be worth checking in.) --- src/compiler/locall.lisp | 22 ++++++++++++++++++++-- src/compiler/physenvanal.lisp | 4 ++-- version.lisp-expr | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/compiler/locall.lisp b/src/compiler/locall.lisp index d796d01..9846de7 100644 --- a/src/compiler/locall.lisp +++ b/src/compiler/locall.lisp @@ -136,7 +136,19 @@ ,(if (policy *lexenv* (zerop safety)) `(declare (ignore ,n-supplied)) `(%verify-arg-count ,n-supplied ,nargs)) - (%funcall ,fun ,@temps)))) + (locally + ;; KLUDGE: The intent here is to enable tail recursion + ;; optimization, since leaving frames for wrapper + ;; functions like this on the stack is actually more + ;; annoying than helpful for debugging. Unfortunately + ;; trying to express this by messing with the + ;; ANSI-standard declarations is a little awkward, since + ;; no matter how we do it we'll tend to have side-effects + ;; on things like SPEED-vs.-SAFETY comparisons. Perhaps + ;; it'd be better to define a new SB-EXT:TAIL-RECURSIVELY + ;; declaration and use that? -- WHN 2002-07-08 + (declare (optimize (speed 2) (debug 1))) + (%funcall ,fun ,@temps))))) (optional-dispatch (let* ((min (optional-dispatch-min-args fun)) (max (optional-dispatch-max-args fun)) @@ -162,7 +174,13 @@ (n-count (gensym))) `(multiple-value-bind (,n-context ,n-count) (%more-arg-context ,n-supplied ,max) - (%funcall ,more ,@temps ,n-context ,n-count)))))) + (locally + ;; KLUDGE: As above, we're trying to + ;; enable tail recursion optimization and + ;; any other effects of this declaration + ;; are accidental. -- WHN 2002-07-08 + (declare (optimize (speed 2) (debug 1))) + (%funcall ,more ,@temps ,n-context ,n-count))))))) (t (%arg-count-error ,n-supplied))))))))) diff --git a/src/compiler/physenvanal.lisp b/src/compiler/physenvanal.lisp index 120133f..ca8d927 100644 --- a/src/compiler/physenvanal.lisp +++ b/src/compiler/physenvanal.lisp @@ -402,8 +402,8 @@ (emit-cleanups block1 block2))))))) (values)) -;;; Mark optimizable tail-recursive uses of function result continuations with -;;; the corresponding TAIL-SET. +;;; Mark optimizable tail-recursive uses of function result +;;; continuations with the corresponding TAIL-SET. (defun tail-annotate (component) (declare (type component component)) (dolist (fun (component-lambdas component)) diff --git a/version.lisp-expr b/version.lisp-expr index ac502fc..5519d70 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -18,4 +18,4 @@ ;;; for internal versions, especially for internal versions off the ;;; main CVS branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.7.5.7" +"0.7.5.8" -- 1.7.10.4