Lambda the Ultimate

inactiveTopic Tail call optimizations in GCC
started 12/4/2000; 2:09:14 PM - last post 12/6/2000; 2:54:04 AM
Ehud Lamm - Tail call optimizations in GCC  blueArrow
12/4/2000; 2:09:14 PM (reads: 396, responses: 3)
Tail call optimizations in GCC
This is a discussion on the GCC mailing list about extending the C syntax, to allow the program to specify that a call should be treated like a tail-call even if the compiler can't be sure the call is indeed optimizable:

This feature is important for compilers of high-level functional and logic programming languages that target C. For such languages, recursion is the primary form of iteration, and it is important that sibling calls be optimized. Often the high-level language compiler has more information about when it is safe to do tail calls than gcc has, but currently there is no way for the high-level language compiler to communicate that to gcc.

Quite relevant to recent discussions on comp.lang.scheme about compiling Scheme to C, and in general interesting to anyone who likes to consider implementation details...
Posted to "" by Ehud Lamm on 12/4/00; 2:10:26 PM

Chris Rathman - Re: Tail call optimizations in GCC  blueArrow
12/4/2000; 4:04:10 PM (reads: 397, responses: 0)
Something I've been wondering about is how you go about verifying that functions have been interpreted / compiled as tail recursive. Nothing in Lisp (or Scheme) has a check for tail recursion, even though the assumption on stack usage may assume that tail recursion is necessary.

So, short of checking the stack usage at runtime, is there a way in Lisp (or Scheme) to check whether a function is interpreted / compiled as tail recursive? I can pretty well look at a function and make an educated guess but it'd still be nice to have a sanity check.

andrew cooke - Re: Tail call optimizations in GCC  blueArrow
12/5/2000; 12:03:14 AM (reads: 391, responses: 0)
Lisp has a disassembler (disassemble 'foo).

Ehud Lamm - Re: Tail call optimizations in GCC  blueArrow
12/6/2000; 2:54:04 AM (reads: 415, responses: 0)
Does Common Lisp require tail optimization? Scheme does, of course, but I don't think the Scheme standard says anything about a disassembler.