GHC API: Access to nativeCodeGen?

Simon Marlow simonmar at
Mon Jul 18 10:35:17 EDT 2005

On 18 July 2005 12:01, Peter A Jonsson wrote:

> Ok, I gave it a spin, that was "interesting". Things I wrote down
> while looking at it that might be of interest to others:
> I tried to build with gcc 3.4.1 and it didn't work very well. Found a
> mail from November 2004 (<Message-Id: 419B599C.2020204 at>) which
> had the same problem. In a reply you said that it was the JMP_-macro
> in TailCall.h and changing the cast would make the warning go away. It
> did, however I think I messed up with something else since it made
> other problems appear. I reverted my changes and switched gcc
> instead.
> I had perl 5.005_03 first in my path, that made the splitter not
> work. Changing to a newer version made it work. Maybe a test could be
> added to configure to avoid too old versions of perl?

I'll be happy to - but I don't know exactly what version of Perl we
require.  Any clues?  What went wrong with the splitter?

> All those "Bad eta expand" looks slightly scary when building for the
> first time. Found a mail from Simon Peyton Jones which made me less
> worried. Maybe it could be documented that those are expected in the
> building guide?

Ok, we'll look into sqashing those.

> The GHC commentary was written for pre-CMM NCG. I tried patching that
> while going through the code but I just ended up butchering the
> document to basically contain no information whatsoever. I'm not sure
> it's helpful at all in its current shape though, unfortunately.

True - I'd love to update this, but quite gigantic.  A shame that Julian
put so much effort into writing this doc, and it's now mostly out of
date (and I don't think I even referred to it once when converting the
NCG to Cmm :-().

> Needed a patch to build NCG. I tried to preserve as much of the
> previous structure in order to avoid introducing bugs, but I wasn't
> entirely successfull. I've attached the patch and would appreciate if
> someone could glance over it looking for obvious errors.

There are never any "obvious" errors in the NCG :-)  I did glance over
it, and it mostly looks like a straightforward change over to Cmm.
Since your patch only touches code inside #ifdef sparc_TARGET_ARCH,
which is currently broken anyway, I'm inclined to just merge it as-is.

> With this patch a bunch of array tests with WAY=normal fails, all in
> the same way:
> Stack space overflow: current size 8388608 bytes.
> Use `+RTS -Ksize' to increase it.

Best guess is the code generated for a stack-check sequence is
incorrect.  Match up the assembly file (use -keep-s-file) with the Cmm
(-ddump-opt-cmm) and see if you can spot the incorrect code.  I can
provide some gdb tips - let me know if you need more help.

Also, the codeGen tests are probably a better place to start


More information about the Glasgow-haskell-users mailing list