logo       

Re: trying to get a registerised alpha build: msg#00003

lang.haskell.glasgow.bugs

Subject: Re: trying to get a registerised alpha build

Duncan Coutts wrote:
On Fri, 2006-03-31 at 11:43 +0100, Simon Marlow wrote:

Duncan Coutts wrote:


What would you recommend is the bat way for us to verify that each bit
of the registerised build is working? If we turn everything on including
the mangler and it breaks where do we start debugging?

I usually do this in one big step.


Right 'o. :-)


Regarding debugging, I just wrote this wiki page:

http://hackage.haskell.org/trac/ghc/wiki/DebuggingGhcCrashes

That should tell you everything you need to know, please feel free to expand it as you discover things.


That's fantastic, thanks.


Is it possible to build without tailcalls (ie using the
mini-interpreter) but using the stg->machine register mappings?

Certainly. I think if you use -optc-DUSE_MINIINTERPRETER and -fno-asm-mangling everywhere, that should get you registers but no mangling or tail calls.


Unfortunately this doesn't quite work because the TABLES_NEXT_TO_CODE
ends up inconsistent. I'm not quite sure why that happens to be honest.

Our clue is that the sanity check in initStorage barfs:
ASSERT(LOOKS_LIKE_CLOSURE_PTR(&stg_dummy_ret_closure));

By looking at this in gdb (thanks again for the ghc gdb guide!) we found
that this is because this closure was generated assuming
TABLES_NEXT_TO_CODE to be true but of course since we're using
-optc-DUSE_MINIINTERPRETER then the rts .c code is getting compiled
with !TABLES_NEXT_TO_CODE which changes the definition of
LOOKS_LIKE_CLOSURE_PTR.

I think the culprit is this bit of code in ghc/codeGen/SMRep.lhs:

tablesNextToCode :: Bool
#if defined(ia64_TARGET_ARCH) || defined(powerpc64_TARGET_ARCH)
tablesNextToCode = False
#else
tablesNextToCode = not opt_Unregisterised
#endif

This is the compiler's idea of TABLES_NEXT_TO_CODE, which doesn't match the RTS's idea from RtsConfig.h. I suggest you just tweak this directly - the right way is probably to have another build system variable eg. $(GhcTablesNextToCode), but that's tricky to get right, and not generally useful (but by all means go ahead if you want).

Also, I'm worried about the generation of ghc/includes/DerivedConstants.h, because this code in ghc/includes/Makefile says this:

ifeq "$(GhcUnregisterised)" "YES"
SRC_CC_OPTS += -DNO_REGS -DUSE_MINIINTERPRETER
endif

So if you want USE_MINIINTERPRETER without GhcUnregisterised, it better be in SRC_CC_OPTS here.

Cheers,
Simon


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise