diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2016-06-09 14:42:26 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2016-06-10 17:18:56 +0100 |
commit | 0f0b002ce4593a78b8996c77c063c89e09b284e4 (patch) | |
tree | 7d466f300b4d68d51233470b9508d395bf536d0f /compiler/simplStg | |
parent | 6905ce26080ee30119d1949e8bbd3c36bfe754af (diff) | |
download | haskell-0f0b002ce4593a78b8996c77c063c89e09b284e4.tar.gz |
Comments only
...about unarisation and unboxed tuples
Diffstat (limited to 'compiler/simplStg')
-rw-r--r-- | compiler/simplStg/UnariseStg.hs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler/simplStg/UnariseStg.hs b/compiler/simplStg/UnariseStg.hs index d5809428dd..1b94cbcbc6 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] |