Related articles |
---|
Tail call hacks with gcc danwang@vista.CS.Princeton.EDU (Daniel Wang) (1999-11-19) |
Re: Tail call hacks with gcc cez@nomorespam.freeserve.co.uk (Ceri Storey) (1999-12-04) |
Re: Tail call hacks with gcc anton@mips.complang.tuwien.ac.at (1999-12-07) |
From: | Ceri Storey <cez@nomorespam.freeserve.co.uk> |
Newsgroups: | comp.compilers |
Date: | 4 Dec 1999 22:33:27 -0500 |
Organization: | Compilers Central |
References: | 99-11-108 |
Keywords: | code |
On 19 Nov 1999 22:33:37 -0500, Daniel Wang <danwang@vista.CS.Princeton.EDU> wrote:
>I'm using gcc as a backend, for a higher level language, and I really
>like a clean hack to get proper tail recusion to work. I'm aware of
>various "trampolining" tricks to get this to work, but I'd like to
>have something that doesn't hit performance too much.
Assuming you are using C backend, and this is not what you mean by
trampolining then why not have a label / goto combination? eg. this
scheme example:
(let loop ((bar "hello world"))
(foo bar)
(loop (frobincate bar)))
would become this:
char *bar = "hello world";
__tail_recurse:
foo(bar);
bar = frobnicate(bar);
goto __tail_recurse;
>I'm willing to play games with inline assembly (x86) and other gcc
>specific tricks, but a portable machine independent hack would be
>nicer. I'll summarize and put up a webpage if there's enough
>interest.
--
-----------| Ceri Storey
_\|/_ | http://cez.freeshell.org/
o(O O)o | {for geek code also}
_o0O(_)O0o_| cez@nomorespam.freeserve.co.uk
Return to the
comp.compilers page.
Search the
comp.compilers archives again.