trying to get a registerised alpha build
Duncan Coutts
duncan.coutts at worc.ox.ac.uk
Thu Mar 30 14:23:43 EST 2006
On Wed, 2006-03-29 at 03:37 +0100, Duncan Coutts wrote:
> Well the full build finished and appears to work. We're going to try
> again with what I think is a better fix than just picking another fixed
> register. Instead of fixing a register we could let gcc pick any
> suitable register by use a local C variable. It'd be the same code as
> x86/amd64 use:
>
> #define JMP_(cont) \
> { \
> void *__target; \
> __DISCARD__(); \
> __target = (void *)(cont); \
> goto *__target; \
> }
>
> So we'll give that a go.
Well we were wrong. It doesn't work. Not with our original hack to use a
different register, nor with the above.
We were mistaken because we thought that because the build finished that
it might be ok. But it turns out the stage2 compiler segfaults
immediately on startup. gdb doesn't give us any useful stack trace.
(We initially thought it worked because of PATH confusion and a ghc
lurking in /usr/local/bin).
Simon, what we'd really like is a mini guide for what steps to go
through in going from an unregisterised build to a registerised one.
What things do we need to turn on, bit by bit. This should help us to
narrow down the problems. We don't mind having to stare at assembly
diffs and that kind of thing, but at the moment we're not sure if we're
taking the right approach and where to look to see where the bugs might
be.
We compiled a little module with the stage1 compiler. So we get
registerised output assembly. It is using machine registers and making
tail calls. We've looked through the assembly but we can't see anything
obviously wrong yet.
I assume it's possible to enable the various aspects of the registerised
built one by one and have something (mostly) working in between?
For my own understanding, what exactly are the differences between what
ghc does for registerised output compared to unregisterised? I
understand that of course to have a working program the ghc libs must be
compiled the same way, but on a single .hs -> .hc -> .raw_s -> .s
transformation what changes for a registerised compilation?
ghc changes some cpp defines when compiling the .hc file, so that
changes some things in the header files that the .hc file includes. So
this includes the tail calls definitions ie the JMP_, FB_, FE_ etc. Then
there is the MachRegs.h which tells us how to map STG regs to real regs
or to elements in a Capability structure.
> Next is the mangler.
Chris has been hacking on the mangler and thinks he is making progress
but it now needs more testing to be sure.
Duncan
More information about the Glasgow-haskell-bugs
mailing list