[commit: ghc] cardinality: Merge remote-tracking branch 'origin/master' into cardinality (38d4161)

Simon Peyton Jones simonpj at microsoft.com
Wed Mar 13 14:50:52 CET 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : cardinality

http://hackage.haskell.org/trac/ghc/changeset/38d4161125ad605495f220b35f26f8e1cda99631

>---------------------------------------------------------------

commit 38d4161125ad605495f220b35f26f8e1cda99631
Merge: c78d511 56353e3
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Wed Mar 13 13:48:40 2013 +0000

    Merge remote-tracking branch 'origin/master' into cardinality
    
    Conflicts:
    	compiler/basicTypes/Demand.lhs

 aclocal.m4                            |  11 +-
 boot                                  |   2 +-
 compiler/basicTypes/Demand.lhs        |  25 ++
 compiler/cmm/Cmm.hs                   |   1 -
 compiler/cmm/CmmCommonBlockElim.hs    |   5 -
 compiler/cmm/CmmContFlowOpt.hs        |   3 +-
 compiler/cmm/CmmNode.hs               |   5 +-
 compiler/cmm/CmmProcPoint.hs          |   1 -
 compiler/cmm/CmmRewriteAssignments.hs |   3 -
 compiler/cmm/CmmUtils.hs              |  15 +-
 compiler/codeGen/StgCmmEnv.hs         | 133 ++++-----
 compiler/codeGen/StgCmmForeign.hs     |  53 ++--
 compiler/codeGen/StgCmmHeap.hs        |  83 ------
 compiler/codeGen/StgCmmMonad.hs       | 330 +++++++++++----------
 compiler/codeGen/StgCmmPrim.hs        |   2 +-
 compiler/codeGen/StgCmmUtils.hs       |   4 +-
 compiler/ghc.mk                       |  24 +-
 compiler/iface/LoadIface.lhs          |   3 +-
 compiler/main/CodeOutput.lhs          |  18 +-
 compiler/main/DriverPipeline.hs       | 521 ++++++++++++++++++----------------
 compiler/main/DynFlags.hs             |  29 +-
 compiler/main/GHC.hs                  |  10 +-
 compiler/main/GhcMake.hs              |   8 +-
 compiler/main/HscMain.hs              | 517 +++++++++++++--------------------
 compiler/nativeGen/AsmCodeGen.lhs     |  81 +++---
 compiler/typecheck/TcDeriv.lhs        |  99 ++++---
 compiler/utils/IOEnv.hs               |  20 --
 compiler/utils/Outputable.lhs         |   5 +-
 configure.ac                          |   3 +
 docs/users_guide/extending_ghc.xml    |   4 +-
 docs/users_guide/flags.xml            |   3 +-
 docs/users_guide/glasgow_exts.xml     |   3 +-
 docs/users_guide/profiling.xml        |   8 +-
 includes/rts/storage/ClosureMacros.h  |   4 -
 libraries/Cabal                       |   2 +-
 mk/config.mk.in                       |  39 +--
 packages                              |  89 +++---
 rts/LdvProfile.c                      |   2 +-
 rules/build-package-data.mk           |  13 +-
 rules/build-package-way.mk            |  53 +++-
 rules/distdir-opts.mk                 |   2 +-
 rules/distdir-way-opts.mk             |   4 +-
 rules/hs-suffix-way-rules-srcdir.mk   |  17 ++
 sync-all                              | 178 ++++--------
 utils/ghc-cabal/Main.hs               |  73 +++--
 utils/ghc-cabal/ghc.mk                |   2 +-
 utils/ghctags/Main.hs                 |   9 +-
 utils/ltx/Makefile                    |  12 -
 utils/ltx/ltx.prl                     | 229 ---------------
 utils/verbatim/Makefile               |  17 --
 utils/verbatim/verbatim.lex           |  63 ----
 51 files changed, 1150 insertions(+), 1690 deletions(-)

diff --cc compiler/basicTypes/Demand.lhs
index 816e792,25f3091..6ee45cf
--- a/compiler/basicTypes/Demand.lhs
+++ b/compiler/basicTypes/Demand.lhs
@@@ -483,26 -371,54 +483,51 @@@ seqDemandList :: [JointDmd] -> (
  seqDemandList [] = ()
  seqDemandList (d:ds) = seqDemand d `seq` seqDemandList ds
  
 +deferDmd :: JointDmd -> JointDmd
 +deferDmd (JD {absd = a}) = mkJointDmd Lazy a 
 +
+ isStrictDmd :: Demand -> Bool
+ -- See Note [Strict demands]
+ isStrictDmd (JD {absd = Abs})  = False
+ isStrictDmd (JD {strd = Lazy}) = False
+ isStrictDmd _                  = True
+ 
 +useDmd :: JointDmd -> JointDmd
 +useDmd (JD {strd=d, absd=a}) = mkJointDmd d (markAsUsedDmd a)
  
 -isUsedDmd :: Demand -> Bool
 -isUsedDmd (JD {absd = x}) = isUsed x
 -
 -isUsed :: AbsDmd -> Bool
 -isUsed x = x /= absBot
 -
 -someCompUsed :: AbsDmd -> Bool
 -someCompUsed Used      = True
 -someCompUsed (UProd _) = True
 -someCompUsed _         = False
 -
 -evalDmd :: JointDmd
 --- Evaluated strictly, and used arbitrarily deeply
 -evalDmd = mkJointDmd strStr absTop
 +cleanUseDmd_maybe :: JointDmd -> Maybe UseDmd
 +cleanUseDmd_maybe (JD { absd = Use _ ud }) = Just ud
 +cleanUseDmd_maybe _                        = Nothing
 +\end{code}
  
 -defer :: Demand -> Demand
 -defer (JD {absd = a}) = mkJointDmd strTop a 
 +%************************************************************************
 +%*                                                                      *
 +\subsection{Clean demand for Strictness and Usage}
 +%*                                                                      *
 +%************************************************************************
  
 --- use :: Demand -> Demand
 --- use (JD {strd = d}) = mkJointDmd d top
 -\end{code}
 +This domain differst from JointDemand in the sence that pure absence
 +is taken away, i.e., we deal *only* with non-absent demands.
  
+ Note [Strict demands]
+ ~~~~~~~~~~~~~~~~~~~~~
+ isStrictDmd returns true only of demands that are 
+    both strict
+    and  used
+ In particular, it is False for <HyperStr, Abs>, which can and does
+ arise in, say (Trac #7319)
+    f x = raise# <some exception>
+ Then 'x' is not used, so f gets strictness <HyperStr,Abs> -> .
+ Now the w/w generates
+    fx = let x <HyperStr,Abs> = absentError "unused"
+         in raise <some exception>
+ At this point we really don't want to convert to
+    fx = case absentError "unused" of x -> raise <some exception>
+ Since the program is going to diverge, this swaps one error for another,
+ but it's really a bad idea to *ever* evaluate an absent argument.
+ In Trac #7319 we get
+    T7319.exe: Oops!  Entered absent arg w_s1Hd{v} [lid] [base:GHC.Base.String{tc 36u}]
+ 
  Note [Dealing with call demands]
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Call demands are constructed and deconstructed coherently for





More information about the ghc-commits mailing list