diff --git a/compiler/envanal.lisp b/compiler/envanal.lisp index ac15cfab86b90575de65302dff3c3f74b5c7d996..8bedc9124a785b718ae3a7659029da35185acfc3 100644 --- a/compiler/envanal.lisp +++ b/compiler/envanal.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/envanal.lisp,v 1.27 1999/12/03 16:27:14 dtc Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/envanal.lisp,v 1.28 2002/02/06 23:20:46 pmai Exp $") ;;; ;;; ********************************************************************** ;;; @@ -401,8 +401,9 @@ (let ((result (return-result ret))) (do-uses (use result) (when (and (immediately-used-p result use) - (or (not (eq (node-derived-type use) *empty-type*)) - (not (basic-combination-p use)) - (eq (basic-combination-kind use) :local))) + (not (policy use (> debug 2))) + (or (not (eq (node-derived-type use) *empty-type*)) + (not (basic-combination-p use)) + (eq (basic-combination-kind use) :local))) (setf (node-tail-p use) t))))))) (undefined-value)) diff --git a/docs/cmu-user/compiler-hint.tex b/docs/cmu-user/compiler-hint.tex index 5e5e0e634620790108e8c4c891f79c0b8328e9ce..b1c721ef1583b85b3e3ab6849c8317e4c6f9f5e4 100644 --- a/docs/cmu-user/compiler-hint.tex +++ b/docs/cmu-user/compiler-hint.tex @@ -1660,7 +1660,8 @@ will not show some calls that would have been displayed in a non-tail-recursive implementation. In practice, this is not as bad as it sounds\dash{}in fact it isn't really clearly worse, just different. \xlref{debug-tail-recursion} for information about the debugger -implications of tail recursion. +implications of tail recursion, and how to turn it off for the sake of +more conservative backtrace information. In order to ensure that tail-recursion is preserved in arbitrarily complex calling patterns across separately compiled functions, the @@ -1700,6 +1701,10 @@ allocate stack space to represent the binding. Shallow-binding implementations of dynamic scoping also require cleanup code to be evaluated when the scope is exited. +In addition, optimization of tail-recursive calls is inhibited when +the \code{debug} optimization quality is greater than \code{2} +(\pxlref{debugger-policy}.) + \section{Local Call} \label{local-call} diff --git a/docs/cmu-user/debugger.tex b/docs/cmu-user/debugger.tex index ec155ea86b550872eb01ccbd6eddc4c1b315e255..21f959e3184ae5b35f5ffd4ed456cb6bd65d5394 100644 --- a/docs/cmu-user/debugger.tex +++ b/docs/cmu-user/debugger.tex @@ -356,6 +356,11 @@ doubt about how one function called another, it can usually be eliminated by finding the source location in the calling frame (section \ref{source-locations}.) +The elimination of tail-recursive frames can be prevented by disabling +tail-recursion optimization, which happens when the \code{debug} +optimization quality is greater than \code{2} +(\pxlref{debugger-policy}.) + For a more thorough discussion of tail recursion, \pxlref{tail-recursion}. @@ -754,11 +759,17 @@ information, and lifetime information that tells the debugger when arguments are available (even when \code{speed} is \code{3} or the argument is set.) This is the default. +\item[\code{\w{$>$ 2}}] +Any level greater than \code{2} gives level \code{2} and in addition +disables tail-call optimization, so that the backtrace will contain +frames for all invoked functions, even those in tail positions. + \item[\code{3}] Level \code{2} plus all uninterned variables. In addition, lifetime -analysis is disabled (even when \code{speed} is \code{3}), ensuring that all variable -values are available at any known location within the scope of the binding. -This has a speed penalty in addition to the obvious space penalty. +analysis is disabled (even when \code{speed} is \code{3}), ensuring +that all variable values are available at any known location within +the scope of the binding. This has a speed penalty in addition to the +obvious space penalty. \end{Lentry} As you can see, if the \code{speed} quality is \code{3}, debugger performance is