[commit: ghc] master: Replace (State# RealWorld) with Void# where we just want a 0-bit value (f438464)
git at git.haskell.org
git at git.haskell.org
Fri Nov 22 20:05:18 UTC 2013
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/f438464754ad9abd885acf3529606ca57945edc2/ghc
>---------------------------------------------------------------
commit f438464754ad9abd885acf3529606ca57945edc2
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Fri Nov 22 15:23:22 2013 +0000
Replace (State# RealWorld) with Void# where we just want a 0-bit value
We were re-using the super-magical "state token" type (which has
VoidRep and is zero bits wide) for situations in which we simply want
to lambda-abstract over a zero-bit argument. For example, join points:
case (case x of { True -> e1; False -> e2 }) of
Red -> f1
Blue -> True
==>
let $j1 = \voidArg::Void# -> f1
in
case x of
True -> case e1 of
Red -> $j1 void
Blue -> True
False -> case e2 of
Red -> $j1 void
Blue -> True
This patch introduces
* The new primitive type GHC.Prim.Void#, with PrimRep = VoidRep
* A new global Id GHC.Prim.voidPrimId :: Void#.
This has no binding because the code generator drops it,
but is used as an argument (eg in the call of $j1)
* A new local Id, MkId.voidArgId, which can be lambda-bound
when you need to lambda-abstract over it.
and uses them throughout.
Now the State# thing is used only when we need state!
>---------------------------------------------------------------
f438464754ad9abd885acf3529606ca57945edc2
compiler/basicTypes/MkId.lhs | 37 +++++++++++++++++++++---------------
compiler/deSugar/DsUtils.lhs | 9 +++++----
compiler/prelude/PrelNames.lhs | 6 ++++--
compiler/prelude/TysPrim.lhs | 11 ++++++++++-
compiler/simplCore/Simplify.lhs | 8 ++++----
compiler/specialise/Specialise.lhs | 4 ++--
compiler/stranal/WwLib.lhs | 10 +++++-----
compiler/types/Type.lhs | 12 +++++++++---
8 files changed, 61 insertions(+), 36 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f438464754ad9abd885acf3529606ca57945edc2
More information about the ghc-commits
mailing list