[MLton] profiling and tail calls
Tue, 16 Nov 2004 15:42:16 -0500 (EST)
> > Is it true or false that -profile XYZ can change the tail-recursive
> > nature of a program?
> Yes. :-)
> Seriously, to err on the safe side, I would have to say true.
> Although, I would think the optimizer should get it.
> Then the Ssa shrinker has an optimization that notices when the only
> operations that make a call nontail are profiling operations, and if
> so, moves them before the call.
> So, I can't think of a case that would slip through. But I'm a long
> ways from a proof.
I understand, and that's what I thought.
I note that lib/cml/tests/ping-pong.mlb runs in constant stack space
without profiling, but runs with >= O(n) stack space with profiling (of