[Swan-dev] -fno-optimize-sibling-calls

D. Hugh Redelmeier hugh at mimosa.com
Fri Oct 3 20:46:02 EEST 2014


Tail Call Optimization is a wonderful thing.  For example, it lets 
certain kinds of recursion to be as cheap as looping.  I'm all in favour 
of it.

But:

In Pluto, we don't have a lot of cases where TCO gains us much.
Furthermore, it makes gdb tracebacks less informative.

(Continuation-passing style by its nature benefits from TCO but
that's just where our code is most confusing during debugging.)

(Continuations in Pluto are inspired by the Computer Science concept
of continuations:
<http://en.wikipedia.org/wiki/Continuation>
<http://en.wikipedia.org/wiki/Continuation-passing_style>
)

So:

I think we should tell GCC not to do TCO.

How:

-fno-optimize-sibling-calls

I have not tested this and I don't know where it belongs in the
Makefile edifice.


More information about the Swan-dev mailing list