patch applied (ghc): Add new ForceSpecConstr annotation

Simon Peyton-Jones simonpj at microsoft.com
Fri Dec 4 03:20:33 EST 2009


Roman

I'm fine with this, but please add
	Note [ForceSpecConstr]
	~~~~~~~~~~~~~~~~~~~~~~
	<blah>
to Specialise, with at least the text in your commit message, and preferably some description of why this is a good thing to do.

Thanks

Simon

| -----Original Message-----
| From: cvs-ghc-bounces at haskell.org [mailto:cvs-ghc-bounces at haskell.org] On Behalf Of
| Roman Leshchinskiy
| Sent: 04 December 2009 02:46
| To: cvs-ghc at haskell.org
| Subject: patch applied (ghc): Add new ForceSpecConstr annotation
| 
| Wed Dec  2 22:54:55 PST 2009  Roman Leshchinskiy <rl at cse.unsw.edu.au>
|   * Add new ForceSpecConstr annotation
|   Ignore-this: ca5327f85d9d40c78d95e8bfe3e7fab1
| 
|   Annotating a type with {-# ANN type T ForceSpecConstr #-} makes SpecConstr
|   ignore -fspec-constr-threshold and -fspec-constr-count for recursive functions
|   that have arguments of type T. Such functions will be specialised regardless
|   of their size and there is no upper bound on the number of specialisations
|   that can be generated. This also works if T is embedded in other types such as
|   Maybe T (but not T -> T).
| 
|   T should not be a product type because it could be eliminated by the
|   worker/wrapper transformation. For instance, in
| 
|   data T = T Int Int
| 
|   foo :: T -> Int
|   foo (T m n) = ... foo (T m' n') ...
| 
|   SpecConstr will never see the T because w/w will get rid of it. I'm still
|   thinking about whether fixing this is worthwhile.
| 
|     M ./compiler/specialise/SpecConstr.lhs -12 +36
| 
| View patch online:
| http://darcs.haskell.org/ghc/_darcs/patches/20091203065455-b2b0a-
| 0cada94f63ecfd8488f5211da2df6e245f4b8d0f.gz
| 
| _______________________________________________
| Cvs-ghc mailing list
| Cvs-ghc at haskell.org
| http://www.haskell.org/mailman/listinfo/cvs-ghc



More information about the Cvs-ghc mailing list