[metapost] recursion in MP/ MF [was: all intersections between
enge at nada.kth.se
Tue Jan 18 09:31:26 CET 2005
mån 2005-01-17 klockan 23:09 +0100 skrev Laurence Finston:
> I made the following experiment to test whether GCC
> (the GNU Compiler Collection) would optimize recursive
> function calls such that tail recursion would be performed.
> The results of the experiment indicate that it does not.
> I have tried to make the program as good a candidate as
> possible for this, but perhaps I'm missing something.
> If so, I'd appreciate it if someone would put me straight.
It could depend on the backend. I'm not an expert in SPARC
assembler, but it seems that with that back end, the stack frame
for the current recursive call is removed during the delay slot
corresponding to the next recursive function call.
I generated the assembler code with
g++ -S -foptimize-sibling-calls testrcrs.cc
using gcc 3.4.2.
More information about the metapost