[gclist] tail-calls in C/C++
Paul R. Wilson
wilson@cs.utexas.edu
Tue, 6 Aug 1996 11:03:58 -0500
I believe that RMS's idea for tail call optimization for GCC was that it
be used only in situations where it's known safe. I'm not sure exactly
what contract between the caller and callee he has in mind, but you'd
declare some stuff in general. In some cases (like for static
procedures within a single C file) the compiler could do the inference
necessary to optimize both the caller and the callee as necessary.
RMS is explicitly interested in supporting systems hackery, like
writing fast inner interpreters that dispatch to and tail-call
interpretive routines which then tail-call back into the interpreter.
So if it's an "experts only" and "use with care" kind of thing, GNU
is still interested. They'd like to be supportive of things like
RScheme (and other implementations of Scheme and ML and whatnot)
which lose because the "apply-like procedure" hack is slow and label
addresses aren't sufficiently general.
I had suggested that GNU simply support label addresses better, so
that calls into different scopes work correctly on all machines. RMS would
rather just support an alternative tail-calling convention, which is about
as efficient but cleaner at the language level.