#4342: Review containers changes
----------------------------------+-----------------------------------------
Reporter: igloo | Owner:
Type: bug | Status: new
Priority: high | Milestone: 7.2.1
Component: libraries (other) | Version: 7.1
Keywords: | Testcase:
Blockedby: | Difficulty:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
----------------------------------+-----------------------------------------
Comment(by simonpj):
Just to summarise the current state of play on the containers front:
* For the GHC 7.0 branch, we have reverted all the container patches, so
the heat is off.
* For the HEAD we have left all patches in. That means that T1969 and
T3294 are failing. (This is allocation-bloat, not code-bloat, for reasons
I don't fully understand.) It would be good to fix this as soon as poss.
* I have committed a patch that allows specialising in the ''importing''
module; the commit message is below and gives more details. I think that
should allow you to get the benefits of specialisation without the code
bloat.
* All of this only concerns performance issues. I don't know what's
ongoing concerning API changes, but let's treat that as a separate matter.
At the moment I think Milan is holding the token. (Is anyone else working
on this?) It's not day-to-day urgent, but it is important and would be
good to get it sorted. Are you ok with this Milan?
Simon
{{{
Thu Oct 7 04:10:51 PDT 2010 [email protected]
* Implement auto-specialisation of imported Ids
This big-ish patch arranges that if an Id 'f' is
* Type-class overloaded
f :: Ord a => [a] -> [a]
* Defined with an INLINABLE pragma
{-# INLINABLE f #-}
* Exported from its defining module 'D'
then in any module 'U' that imports D
1. Any call of 'f' at a fixed type will generate
(a) a specialised version of f in U
(b) a RULE that rewrites unspecialised calls to the
specialised on
e.g. if the call is (f Int dOrdInt xs) then the
specialiser will generate
$sfInt :: [Int] -> [Int]
$sfInt = <code for f, imported from D, specialised>
{-# RULE forall d. f Int d = $sfInt #-}
2. In addition, you can give an explicit {-# SPECIALISE -#}
pragma for the imported Id
{-# SPECIALISE f :: [Bool] -> [Bool] #-}
This too generates a local specialised definition,
and the corresponding RULE
The new RULES are exported from module 'U', so that any module
importing U will see the specialised versions of 'f', and will
not re-specialise them.
There's a flag -fwarn-auto-orphan that warns you if the auto-generated
RULES are orphan rules. It's not in -Wall, mainly to avoid lots of
error messages with existing packages.
Main implementation changes
- A new flag on a CoreRule to say if it was auto-generated.
This is persisted across interface files, so there's a small
change in interface file format.
- Quite a bit of fiddling with plumbing, to get the
{-# SPECIALISE #-} pragmas for imported Ids. In particular, a
new field tgc_imp_specs in TcGblEnv, to keep the specialise
pragmas for imported Ids between the typechecker and the desugarer.
- Some new code (although surprisingly little) in Specialise,
to deal with calls of imported Ids
M ./compiler/basicTypes/BasicTypes.lhs -1 +7
M ./compiler/coreSyn/CoreSyn.lhs -1 +5
M ./compiler/deSugar/Desugar.lhs -14 +24
M ./compiler/deSugar/DsBinds.lhs -55 +66
M ./compiler/deSugar/DsForeign.lhs -4 +4
M ./compiler/hsSyn/HsBinds.lhs -9 +9
M ./compiler/iface/BinIface.hs -2 +4
M ./compiler/iface/IfaceSyn.lhs -1 +3
M ./compiler/iface/MkIface.lhs -6 +12
M ./compiler/iface/TcIface.lhs -1 +3
M ./compiler/main/DynFlags.hs +3
M ./compiler/rename/RnBinds.lhs -62 +84
M ./compiler/rename/RnEnv.lhs -9 +14
M ./compiler/rename/RnExpr.lhs -3 +3
M ./compiler/rename/RnSource.lhs -1 +1
M ./compiler/specialise/Rules.lhs -19 +11
M ./compiler/specialise/SpecConstr.lhs -1 +2
M ./compiler/specialise/Specialise.lhs -59 +156
M ./compiler/typecheck/TcBinds.lhs -24 +66
M ./compiler/typecheck/TcClassDcl.lhs -1 +1
M ./compiler/typecheck/TcDeriv.lhs -4 +2
M ./compiler/typecheck/TcHsSyn.lhs -6 +12
M ./compiler/typecheck/TcInstDcls.lhs -10 +19
M ./compiler/typecheck/TcRnDriver.lhs -13 +16
M ./compiler/typecheck/TcRnMonad.lhs -14 +15
M ./compiler/typecheck/TcRnTypes.lhs +1
M ./compiler/utils/FiniteMap.lhs -1 +3
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4342#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs