"Tobias C. Rittweiler" <tcr@...> writes:
> Christophe Rhodes <...> writes:
>
>> "Tobias C. Rittweiler" <...> writes:
>>
>> > (defmethod foo :around ((x string))
>> > (break))
>> >
>> > (defun quux (x)
>> > (foo x))
>> >
>> > and invoking (FOO "BAR") at the REPL directly, or indirectly via (QUUX
>> > "BAR") results in a backtrace with the two topmost frames being:
>> >
>> > 0: (BREAK "break")
>> > 1: (SB-INT:SIMPLE-EVAL-IN-LEXENV (QUUX "foo") #<NULL-LEXENV>)
>> >
>> > I.e. no frame for the :AROUND method shows up.
>>
>> the call to (break) in the :around method is in tail position. Compile
>> with a higher debug setting and the :around method frame should be
>> retained.
>
> Thank you for the quick answer. What is the reason that TCO is performed
> under default optimization settings?
Well, what's actually happening is that the effective method function is
compiled under higher-speed settings, and the bits of code and clever
structures within PCL get combined into something that manages the
control flow. At this point, I usually look at
COMPUTE-SECONDARY-DISPATCH-FUNCTION1 and its callees, before discovering
that there's apparently a cycle in the callees and giving up in
confusion. You're welcome to dive in that direction to find the exact
point at which the higher-speed optimization interferes with the normal
non-TCO case; I don't really have the energy right now... :-/
Cheers,
Christophe