summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorManuel M T Chakravarty <chak@cse.unsw.edu.au>2011-11-14 12:41:46 +1100
committerManuel M T Chakravarty <chak@cse.unsw.edu.au>2011-11-14 12:41:46 +1100
commit23f4b6ecc6160c47cef13c1734988a6d4cd3996d (patch)
tree76376ae7920f2844a28f669b851fa0edc0c78ec9 /compiler
parentec23c8910f9151a961c1ba7e1daba90e0dbfb9da (diff)
downloadhaskell-23f4b6ecc6160c47cef13c1734988a6d4cd3996d.tar.gz
Include superclass selectors in the vectorisation map
Diffstat (limited to 'compiler')
-rw-r--r--compiler/vectorise/Vectorise/Type/TyConDecl.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/vectorise/Vectorise/Type/TyConDecl.hs b/compiler/vectorise/Vectorise/Type/TyConDecl.hs
index 38af2dc846..f0d05b0413 100644
--- a/compiler/vectorise/Vectorise/Type/TyConDecl.hs
+++ b/compiler/vectorise/Vectorise/Type/TyConDecl.hs
@@ -48,7 +48,7 @@ vectTyConDecl tycon
-- vectorise superclass constraint (types)
; theta' <- mapM vectType (classSCTheta cls)
- -- vectorise method selectors and add them to the vectorisation map
+ -- vectorise method selectors
; methods' <- sequence [ vectMethod id meth | (id, meth) <- classOpItems cls]
-- keep the original recursiveness flag
@@ -75,6 +75,11 @@ vectTyConDecl tycon
Just datacon' = tyConSingleDataCon_maybe tycon'
; defDataCon datacon datacon'
+ -- the original superclass and methods selectors must map to the vectorised ones
+ ; let selIds = classAllSelIds cls
+ selIds' = classAllSelIds cls'
+ ; zipWithM_ defGlobalVar selIds selIds'
+
-- return the type constructor of the vectorised class
; return tycon'
}
@@ -110,7 +115,7 @@ vectTyConDecl tycon
| otherwise
= cantVectorise "Can't vectorise exotic type constructor" (ppr tycon)
--- |Vectorise a class method.
+-- |Vectorise a class method. (Don't enter into the vectorisation map yet.)
--
vectMethod :: Id -> DefMeth -> VM (Name, DefMethSpec, Type)
vectMethod id defMeth
@@ -119,7 +124,6 @@ vectMethod id defMeth
-- Create a name for the vectorised method.
; id' <- mkVectId id typ'
- ; defGlobalVar id id'
-- When we call buildClass in vectTyConDecl, it adds foralls and dictionaries
-- to the types of each method. However, the types we get back from vectType