[commit: ghc] master: Comments only (0f0b002)
git at git.haskell.org
git at git.haskell.org
Fri Jun 10 16:15:16 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/0f0b002ce4593a78b8996c77c063c89e09b284e4/ghc
>---------------------------------------------------------------
commit 0f0b002ce4593a78b8996c77c063c89e09b284e4
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Thu Jun 9 14:42:26 2016 +0100
Comments only
...about unarisation and unboxed tuples
>---------------------------------------------------------------
0f0b002ce4593a78b8996c77c063c89e09b284e4
compiler/simplStg/UnariseStg.hs | 16 ++++++++++++++++
compiler/stgSyn/CoreToStg.hs | 2 +-
compiler/types/Type.hs | 24 +-----------------------
3 files changed, 18 insertions(+), 24 deletions(-)
diff --git a/compiler/simplStg/UnariseStg.hs b/compiler/simplStg/UnariseStg.hs
index d580942..1b94cbc 100644
--- a/compiler/simplStg/UnariseStg.hs
+++ b/compiler/simplStg/UnariseStg.hs
@@ -50,6 +50,22 @@ Of course all this applies recursively, so that we flatten out nested tuples.
Note [Unarisation and nullary tuples]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The above scheme has a special cases for nullary unboxed tuples, x :: (# #)
+To see why, consider
+ f2 :: (# Int, Int #) -> Int
+ f1 :: (# Int #) -> Int
+ f0 :: (# #) -> Int
+
+When we "unarise" to eliminate unboxed tuples (this is done at the STG level),
+we'll transform to
+ f2 :: Int -> Int -> Int
+ f1 :: Int -> Int
+ f0 :: ??
+
+We do not want to give f0 zero arguments, otherwise a lambda will
+turn into a thunk! So we want to get
+ f0 :: Void# -> Int
+
+So here is what we do for nullary tuples
* Extend the UnariseEnv with x :-> [voidPrimId]
diff --git a/compiler/stgSyn/CoreToStg.hs b/compiler/stgSyn/CoreToStg.hs
index d2010a8..273cbdb 100644
--- a/compiler/stgSyn/CoreToStg.hs
+++ b/compiler/stgSyn/CoreToStg.hs
@@ -451,7 +451,7 @@ mkStgAltType bndr alts = case repType (idType bndr) of
PolyAlt
Nothing -> PolyAlt
UbxTupleRep rep_tys -> UbxTupAlt (length rep_tys)
- -- NB Nullary unboxed tuples have UnaryRep, and generate a PrimAlt
+ -- UbxTupAlt includes nullary and and singleton unboxed tuples
where
_is_poly_alt_tycon tc
= isFunTyCon tc
diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs
index 9aaf3de..724a9a4 100644
--- a/compiler/types/Type.hs
+++ b/compiler/types/Type.hs
@@ -1714,33 +1714,11 @@ typeSize (CoercionTy co) = coercionSize co
* *
********************************************************************** -}
-{- Note [Nullary unboxed tuple]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-At runtime we represent the nullary unboxed tuple as the type Void#.
-To see why, consider
- f2 :: (# Int, Int #) -> Int
- f1 :: (# Int #) -> Int
- f0 :: (# #) -> Int
-
-When we "unarise" to eliminate unboxed tuples (this is done at the STG level),
-we'll transform to
- f2 :: Int -> Int -> Int
- f1 :: Int -> Int
- f0 :: ??
-
-We do not want to give f0 zero arguments, otherwise a lambda will
-turn into a thunk! So we want to get
- f0 :: Void# -> Int
-
-See Note [Unarisation and nullary tuples] in UnariseStg for more detail.
--}
-
type UnaryType = Type
data RepType
= UbxTupleRep [UnaryType] -- Represented by multiple values
- -- INVARIANT: never an empty list
- -- (see Note [Nullary unboxed tuple])
+ -- Can be zero, one, or more
| UnaryRep UnaryType -- Represented by a single value
instance Outputable RepType where
More information about the ghc-commits
mailing list