jhc vs ghc and the surprising result involving ghc generatedassembly.

skaller skaller at users.sourceforge.net
Wed Nov 2 19:44:41 EST 2005

On Wed, 2005-11-02 at 18:05 +0100, Florian Weimer wrote:
> >> Is it correct that you use indirect gotos across functions?  Such
> >> gotos aren't supported by GCC and work only by accident.
> >
> > Even direct gotos aren't universally supported. Some info
> > in Fergus Henderson's paper may be of interest
> >
> > http://felix.sourceforge.net/papers/mercury_to_c.ps
> This paper seems to be from 1995 or so:
> %DVIPSSource:  TeX output 1995.11.29:1656
> (Why is it so uncommon to put the publication date on the first page?)
> GCC's IL has changed significantly since then; it's not clear if it
> still applies.

I am using some of it in Felix, that part I am using
seems to work fine on all platforms tested: various versions
of g++ and under Linux, OSX, Cygwin, and MinGW, possibly more.

The config script checks assembler labels are supported,
if they are the indirect jumps 'just work'.  Of course
the config would have to be built by hand for cross 
compilation ;(

However my system obeys a constraint: the runtime conspires
to ensure the function containing the target label is
entered before the jump is done. The address is calculated
by the caller though. So I don't run into any problems
loading the right data section pointer. I suspect Haskell
cannot do that, since it would defeat the intended optimisation.

[More precisely, in Felix the technique is used to implement
non-local gotos, and which can only occur in procedures,
not in functions]

John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

More information about the Glasgow-haskell-users mailing list