Next: Unknown Locations and Interrupts, Previous: Funny Frames, Up: Stack Frames [Contents][Index]
Both the compiler and the interpreter are “properly tail recursive.” If a function call is in a tail-recursive position, the stack frame will be deallocated at the time of the call, rather than after the call returns. Consider this backtrace:
(BAR ...) (FOO ...)
Because of tail recursion, it is not necessarily the case that
FOO
directly called BAR
. It may be that FOO
called
some other function FOO2
which then called BAR
tail-recursively, as in this example:
(defun foo () ... (foo2 ...) ...) (defun foo2 (...) ... (bar ...)) (defun bar (...) ...)
Usually the elimination of tail-recursive frames makes debugging more pleasant, since theses frames are mostly uninformative. If there is any doubt about how one function called another, it can usually be eliminated by finding the source location in the calling frame (section source-locations.)
The elimination of tail-recursive frames can be prevented by disabling
tail-recursion optimization, which happens when the debug
optimization quality is greater than 2
(see debugger-policy.)
For a more thorough discussion of tail recursion, see tail-recursion.
Next: Unknown Locations and Interrupts, Previous: Funny Frames, Up: Stack Frames [Contents][Index]