boxed FastTypes

Ian Lynagh igloo at earth.li
Fri Jan 4 11:13:06 EST 2008


On Thu, Jan 03, 2008 at 07:07:56AM -0500, Isaac Dupree wrote:
> 
> even have memory leaks.  To partially remedy this, What if in data types 
> everywhere
> data Foo = Foo FastInt
> becomes
> data Foo = Foo !FastInt
> (the strictness annotation simply has no additional effect when FastInt 
> = Int# )
> or even
> data Foo = Foo {-#UNPACK#-}!FastInt

Once this is done, it may be possible to go even further: If modern GHC
can optimise code using Int to the same code that we would get if we
used Int#, then it would be nice to de-hash as much of GHC's code as
possible, and use the standard (+), (>) etc.

We might need to give it a little help, e.g. using STRICT(x) in the odd
pattern, where:

#if __GLASGOW_HASKELL__ >= 608
#define STRICT(x) !(x)
#else
#define STRICT(x) (x)
#endif


Thanks
Ian



More information about the Cvs-ghc mailing list