Related articles |
---|
[6 earlier articles] |
Re: C as assembly language jmorris2@twcny.rr.com (Morrisett) (2001-04-10) |
Re: C as assembly language jacob@jacob.remcomp.fr (jacob navia) (2001-04-10) |
Re: C as assembly language felixundduni@freenet.de (felix) (2001-04-10) |
Re: C as assembly language fjh@cs.mu.OZ.AU (2001-04-10) |
Re: C as assembly language fjh@cs.mu.OZ.AU (2001-04-12) |
Re: C as assembly language vbdis@aol.com (2001-04-12) |
Re: C as assembly language felixundduni@freenet.de (felix) (2001-04-14) |
Re: C as assembly language fjh@cs.mu.OZ.AU (2001-04-14) |
Re: C as assembly language rhyde@transdimension.com (Randall Hyde) (2001-04-14) |
Re: C as assembly language vbdis@aol.com (2001-04-15) |
Re: C as assembly language jim.granville@designtools.co.nz (Jim Granville) (2001-04-18) |
Re: C as assembly language joachim_d@gmx.de (Joachim Durchholz) (2001-05-03) |
Re: C as assembly language joachim_d@gmx.de (Joachim Durchholz) (2001-05-07) |
[4 later articles] |
From: | "felix" <felixundduni@freenet.de> |
Newsgroups: | comp.compilers |
Date: | 14 Apr 2001 17:15:09 -0400 |
Organization: | Compilers Central |
References: | 01-03-006 01-03-046 01-03-130 01-04-027 01-04-060 01-04-070 |
Keywords: | C |
Posted-Date: | 14 Apr 2001 17:15:09 EDT |
Fergus Henderson wrote
>>3) Tail-recursion is hard in C. Even GCC can't do it in the
>> general case. Possible solutions: a driver-loop (or "trampoline")
>> as used in Steele's Rabbit, in Gambit or sml2c, or Continuation Passing
>> Style.
>
>The trouble with the driver loop approach is that you can't pass
>arguments in registers anymore (unless you use global register
>variables -- and see below for the problems with that), and you have
>to use your own call stack, rather than the C call stack. This also
>makes interoperability more difficult.
There is an article by Eliot Miranda floating around in the
comp.compilers archives somewhere, where he uses some interesting
postprocessing on GCC's assembly output, applied to threaded code.
>The trouble with continuation passing style is that C compilers don't
>do general tail call optimization (indeed, doing so in C is tricky,
>because the program might take the address of local variables). So a
>straightforward CPS will suffer from stack leaks. There are
>approaches to avoid this, but they do have their drawbacks.
Which would that be?
cheers,
felix
Return to the
comp.compilers page.
Search the
comp.compilers archives again.