jhc vs ghc and the surprising result involving
simonmar at microsoft.com
Wed Nov 2 11:24:17 EST 2005
On 02 November 2005 13:59, Florian Weimer wrote:
> However, beginning with GCC 3.4, you can use:
> extern void bar();
> void foo()
> void (*p)(void) = bar;
Interesting.. though I'm not sure I'm comfortable with relying on gcc's
tail call optimisation to do the right thing. Aren't there side
conditions that might prevent it from kicking in?
> And the indirect call is turned into a direct jump. Tail recursive
> calls and really indirect tail calls are also optimzed. Together with
> -fomit-frame-pointer, this could give you what you need, without
> post-processing the generated assembler code (which is desirable
> because the asm volatile statements inhibit further optimization).
> Is it correct that you use indirect gotos across functions? Such
> gotos aren't supported by GCC and work only by accident.
Yes, but cross-function gotos are always to the beginning of a function.
Also, our post-processor removes the function prologue from the asm.
GHC via C has always worked "by accident" :-) But it has worked for a
long time with careful tweaking of the post-processor (known as the
mangler) for each new version of gcc. Yes, we're living dangerously,
and it's getting harder, but we're still alive (just).
More information about the Glasgow-haskell-users