CLabel.RtsLabel wants a Module parameter

Ben Lippmeier Ben.Lippmeier at anu.edu.au
Wed Oct 7 03:04:07 EDT 2009


Hi all,
To make Windows DLLs work again, I think I want to change cmm/CLabel to 
carry real module/package ids. Doing so looks like a lot of work, so I 
thought I'd run it by people before starting..

My problem is that when compiling 
libraries/integer-gmp/cbits/gmp-wrappers.cmm, all labels defined in this 
source file are treated as belonging to the runtime system, instead of 
the integer-gmp library. This happens directly in the Cmm parser. For 
instance, when parsing procs at CmmParse.y:246, the label which names 
the proc is created by (mkRtsCodeLabelFS $1). This creates a  RtsLabel 
(RtsCodeFS $1)  where  RtsCodeFS is a constructor of RtsLabelInfo.

When compiling integer-gmp into a DLL, we need to know whether a given 
symbol is in the local package/DLL, or in an external one. At the 
moment, it thinks that ALL symbols from gmp-wrappers.cmm are in the DLL 
for the runtime system, so generates the wrong code.

My proposed solution is to add a Module parameter to CmmLabel.RtsLabel 
so we have:

data CLabel = ... | RtsLabel Module RtsLabelInfo | ...

... then when I'm spending the next 3 days of my life in refactoring 
pergatory I'll also merge Rts* with Rts*FS in RtsLabelInfo, which seems 
to be begging for it.

We could also change the names "RtsLabel" and "RtsLabelInfo" to 
something less RTS specific, (maybe CmmLabel and CmmLabelInfo?)

Does this sound like a good idea, or is there a better way of doing it?

Thanks,
Ben.




More information about the Cvs-ghc mailing list