From git at git.haskell.org Wed Mar 1 00:46:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Mar 2017 00:46:56 +0000 (UTC) Subject: [commit: ghc] master: Fix redundant import in CSE (4f10a22) Message-ID: <20170301004656.6C46B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4f10a2297952fee8be12bb80606707e4175282bb/ghc >--------------------------------------------------------------- commit 4f10a2297952fee8be12bb80606707e4175282bb Author: David Feuer Date: Tue Feb 28 19:46:35 2017 -0500 Fix redundant import in CSE >--------------------------------------------------------------- 4f10a2297952fee8be12bb80606707e4175282bb compiler/simplCore/CSE.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 31f0901..0feb676 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -24,7 +24,7 @@ import CoreSyn import Outputable import BasicTypes ( isAlwaysActive, isAnyInlinePragma ) import TrieMap -import Util ( compareLength, filterOut ) +import Util ( filterOut ) import Data.List ( mapAccumL ) {- From git at git.haskell.org Wed Mar 1 01:17:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Mar 2017 01:17:27 +0000 (UTC) Subject: [commit: ghc] master: Add VarSet.anyDVarSet, allDVarSet (cdf6b69) Message-ID: <20170301011727.15E773A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cdf6b69563f66b3ef26481003654d645466e5450/ghc >--------------------------------------------------------------- commit cdf6b69563f66b3ef26481003654d645466e5450 Author: Simon Peyton Jones Date: Tue Feb 28 20:17:10 2017 -0500 Add VarSet.anyDVarSet, allDVarSet I need these in a later commit. Also rename varSetAny --> anyVarSet varSetAll --> allVarSet for consistency with other functions; eg filterVarSet Reviewers: austin, goldfire, bgamari Subscribers: niteria, thomie Differential Revision: https://phabricator.haskell.org/D3202 >--------------------------------------------------------------- cdf6b69563f66b3ef26481003654d645466e5450 compiler/basicTypes/VarSet.hs | 20 +++++++++++++------- compiler/specialise/Rules.hs | 2 +- compiler/typecheck/TcType.hs | 2 +- compiler/types/Unify.hs | 4 ++-- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/compiler/basicTypes/VarSet.hs b/compiler/basicTypes/VarSet.hs index a6e508a..f6d82fd 100644 --- a/compiler/basicTypes/VarSet.hs +++ b/compiler/basicTypes/VarSet.hs @@ -17,7 +17,7 @@ module VarSet ( intersectVarSet, intersectsVarSet, disjointVarSet, isEmptyVarSet, delVarSet, delVarSetList, delVarSetByKey, minusVarSet, filterVarSet, - varSetAny, varSetAll, + anyVarSet, allVarSet, transCloVarSet, fixVarSet, lookupVarSet, lookupVarSetByName, sizeVarSet, seqVarSet, @@ -35,7 +35,7 @@ module VarSet ( intersectDVarSet, intersectsDVarSet, disjointDVarSet, isEmptyDVarSet, delDVarSet, delDVarSetList, minusDVarSet, foldDVarSet, filterDVarSet, - dVarSetMinusVarSet, + dVarSetMinusVarSet, anyDVarSet, allDVarSet, transCloDVarSet, sizeDVarSet, seqDVarSet, partitionDVarSet, @@ -50,7 +50,7 @@ import Name ( Name ) import UniqSet import UniqDSet import UniqFM( disjointUFM, pluralUFM, pprUFM ) -import UniqDFM( disjointUDFM, udfmToUfm ) +import UniqDFM( disjointUDFM, udfmToUfm, anyUDFM, allUDFM ) import Outputable (SDoc) -- | A non-deterministic Variable Set @@ -139,11 +139,11 @@ intersectsVarSet s1 s2 = not (s1 `disjointVarSet` s2) disjointVarSet s1 s2 = disjointUFM s1 s2 subVarSet s1 s2 = isEmptyVarSet (s1 `minusVarSet` s2) -varSetAny :: (Var -> Bool) -> VarSet -> Bool -varSetAny = uniqSetAny +anyVarSet :: (Var -> Bool) -> VarSet -> Bool +anyVarSet = uniqSetAny -varSetAll :: (Var -> Bool) -> VarSet -> Bool -varSetAll = uniqSetAll +allVarSet :: (Var -> Bool) -> VarSet -> Bool +allVarSet = uniqSetAll -- There used to exist mapVarSet, see Note [Unsound mapUniqSet] in UniqSet for -- why it got removed. @@ -282,6 +282,12 @@ dVarSetMinusVarSet = uniqDSetMinusUniqSet foldDVarSet :: (Var -> a -> a) -> a -> DVarSet -> a foldDVarSet = foldUniqDSet +anyDVarSet :: (Var -> Bool) -> DVarSet -> Bool +anyDVarSet = anyUDFM + +allDVarSet :: (Var -> Bool) -> DVarSet -> Bool +allDVarSet = allUDFM + filterDVarSet :: (Var -> Bool) -> DVarSet -> DVarSet filterDVarSet = filterUniqDSet diff --git a/compiler/specialise/Rules.hs b/compiler/specialise/Rules.hs index 2ad4e1c..47193c6 100644 --- a/compiler/specialise/Rules.hs +++ b/compiler/specialise/Rules.hs @@ -864,7 +864,7 @@ match_alts _ _ _ _ ------------------------------------------ okToFloat :: RnEnv2 -> VarSet -> Bool okToFloat rn_env bind_fvs - = varSetAll not_captured bind_fvs + = allVarSet not_captured bind_fvs where not_captured fv = not (inRnEnvR rn_env fv) diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 7e5c0b0..69d1f7c 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -911,7 +911,7 @@ anyRewritableTyVar ignore_cos pred ty go_co bound co | ignore_cos = False - | otherwise = varSetAny (go_tv bound) (tyCoVarsOfCo co) + | otherwise = anyVarSet (go_tv bound) (tyCoVarsOfCo co) -- We don't have an equivalent of anyRewritableTyVar for coercions -- (at least not yet) so take the free vars and test them diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs index ed879eb..517358d 100644 --- a/compiler/types/Unify.hs +++ b/compiler/types/Unify.hs @@ -522,7 +522,7 @@ niFixTCvSubst tenv = f tenv | not_fixpoint = f (mapVarEnv (substTy subst') tenv) | otherwise = subst where - not_fixpoint = varSetAny in_domain range_tvs + not_fixpoint = anyVarSet in_domain range_tvs in_domain tv = tv `elemVarEnv` tenv range_tvs = nonDetFoldUFM (unionVarSet . tyCoVarsOfType) emptyVarSet tenv @@ -1223,7 +1223,7 @@ ty_co_match menv subst ty co lkco rkco = noneSet (\v -> elemVarEnv v env) set noneSet :: (Var -> Bool) -> VarSet -> Bool - noneSet f = varSetAll (not . f) + noneSet f = allVarSet (not . f) ty_co_match menv subst ty co lkco rkco | CastTy ty' co' <- ty From git at git.haskell.org Wed Mar 1 01:20:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Mar 2017 01:20:32 +0000 (UTC) Subject: [commit: ghc] master: Improve pretty-printing of types (871b63e) Message-ID: <20170301012032.6FC243A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/871b63e4ea95d4c516d31378d0475167e75caa01/ghc >--------------------------------------------------------------- commit 871b63e4ea95d4c516d31378d0475167e75caa01 Author: Simon Peyton Jones Date: Tue Feb 28 20:20:21 2017 -0500 Improve pretty-printing of types When doing debug-printing it's really important that the free vars of a type are printed with their uniques. The IfaceTcTyVar thing was a stab in that direction, but it only worked for TcTyVars, not TyVars. This patch does it properly, by keeping track of the free vars of the type when translating Type -> IfaceType, and passing that down through toIfaceTypeX. Then when we find a variable, look in that set, and translate it to IfaceFreeTyVar if so. (I renamed IfaceTcTyVar to IfaceFreeTyVar.) Fiddly but not difficult. Reviewers: austin, goldfire, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3201 >--------------------------------------------------------------- 871b63e4ea95d4c516d31378d0475167e75caa01 compiler/backpack/RnModIface.hs | 4 +- compiler/iface/IfaceSyn.hs | 2 +- compiler/iface/IfaceType.hs | 38 +++--- compiler/iface/TcIface.hs | 2 +- compiler/iface/ToIface.hs | 147 ++++++++++++--------- compiler/iface/ToIface.hs-boot | 2 + compiler/typecheck/TcRnTypes.hs | 5 +- compiler/types/TyCoRep.hs | 37 +++--- compiler/types/Type.hs | 2 +- compiler/types/Type.hs-boot | 2 +- testsuite/tests/deriving/should_fail/T7148.stderr | 8 +- testsuite/tests/th/T8761.stderr | 57 ++++---- .../tests/typecheck/should_fail/T12785b.stderr | 15 +-- 13 files changed, 175 insertions(+), 146 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 871b63e4ea95d4c516d31378d0475167e75caa01 From git at git.haskell.org Wed Mar 1 01:23:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Mar 2017 01:23:30 +0000 (UTC) Subject: [commit: ghc] master: Improve SetLevels for join points (6eb52cf) Message-ID: <20170301012330.0D0873A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6eb52cfc2e31df2561860f43d41766464ccfe8af/ghc >--------------------------------------------------------------- commit 6eb52cfc2e31df2561860f43d41766464ccfe8af Author: Simon Peyton Jones Date: Tue Feb 28 20:23:15 2017 -0500 Improve SetLevels for join points C.f. Trac #13286, #13236 * Never destroy a join point unless it goes to top level See Note [Floating join point bindings] * Never float a MFE if it has a free join variable Note [Free join points] * Stop treating nullary join points specially * Enforce the invariant that le_join_ceil >= le_ctxt_lvl (Needs more thought...) Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3199 >--------------------------------------------------------------- 6eb52cfc2e31df2561860f43d41766464ccfe8af compiler/simplCore/SetLevels.hs | 301 +++++++++++++++++++--------------------- 1 file changed, 144 insertions(+), 157 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 6eb52cfc2e31df2561860f43d41766464ccfe8af From git at git.haskell.org Wed Mar 1 01:25:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Mar 2017 01:25:50 +0000 (UTC) Subject: [commit: ghc] master: Mark non-recursive join lambdas as one-shot (777b770) Message-ID: <20170301012550.221813A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/777b77077f3d6b794f96414a16e904452e1e6aba/ghc >--------------------------------------------------------------- commit 777b77077f3d6b794f96414a16e904452e1e6aba Author: Simon Peyton Jones Date: Tue Feb 28 20:25:33 2017 -0500 Mark non-recursive join lambdas as one-shot When we have join j x y = rhs in ... we know that the lambdas for 'x' and 'y' are one-shot. Let's mark them as such! This doesn't fix a specific bug, but it feels right to me. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: lukemaurer, thomie Differential Revision: https://phabricator.haskell.org/D3196 >--------------------------------------------------------------- 777b77077f3d6b794f96414a16e904452e1e6aba compiler/simplCore/OccurAnal.hs | 68 +++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 27 deletions(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index f2f7da6..949cbf1 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -732,7 +732,6 @@ add this analysis if necessary. ------------------------------------------------------------ Note [Adjusting for lambdas] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - There's a bit of a dance we need to do after analysing a lambda expression or a right-hand side. In particular, we need to @@ -802,28 +801,33 @@ occAnalNonRecBind env lvl imp_rule_edges binder rhs body_usage | otherwise -- It's mentioned in the body = (body_usage' +++ rhs_usage', [NonRec tagged_binder rhs']) where - (bndrs, body) = collectBinders rhs (body_usage', tagged_binder) = tagNonRecBinder lvl body_usage binder + mb_join_arity = willBeJoinId_maybe tagged_binder + + (bndrs, body) = collectBinders rhs + (rhs_usage1, bndrs', body') = occAnalNonRecRhs env tagged_binder bndrs body - rhs' = mkLams bndrs' body' + rhs' = mkLams (markJoinOneShots mb_join_arity bndrs') body' + -- For a /non-recursive/ join point we can mark all + -- its join-lambda as one-shot; and it's a good idea to do so + + -- Unfoldings + -- See Note [Unfoldings and join points] rhs_usage2 = case occAnalUnfolding env NonRecursive binder of Just unf_usage -> rhs_usage1 +++ unf_usage Nothing -> rhs_usage1 - -- See Note [Unfoldings and join points] - mb_join_arity = willBeJoinId_maybe tagged_binder + -- Rules + -- See Note [Rules are extra RHSs] and Note [Rule dependency info] rules_w_uds = occAnalRules env mb_join_arity NonRecursive tagged_binder - rhs_usage3 = rhs_usage2 +++ combineUsageDetailsList (map (\(_, l, r) -> l +++ r) rules_w_uds) - -- See Note [Rules are extra RHSs] and Note [Rule dependency info] - rhs_usage4 = maybe rhs_usage3 (addManyOccsSet rhs_usage3) $ lookupVarEnv imp_rule_edges binder -- See Note [Preventing loops due to imported functions rules] - rhs_usage' = adjustRhsUsage (willBeJoinId_maybe tagged_binder) NonRecursive - bndrs' rhs_usage4 + -- Final adjustment + rhs_usage' = adjustRhsUsage mb_join_arity NonRecursive bndrs' rhs_usage4 ----------------- occAnalRecBind :: OccEnv -> TopLevelFlag -> ImpRuleEdges -> [(Var,CoreExpr)] @@ -1550,7 +1554,6 @@ occAnalNonRecRhs env bndr bndrs body -- See Note [Sources of one-shot information] rhs_env = env1 { occ_one_shots = argOneShots dmd } - certainly_inline -- See Note [Cascading inlines] = case idOccInfo bndr of OneOcc { occ_in_lam = in_lam, occ_one_br = one_br } @@ -1731,7 +1734,8 @@ occAnal env app@(App _ _) -- (a) occurrences inside type lambdas only not marked as InsideLam -- (b) type variables not in environment -occAnal env (Lam x body) | isTyVar x +occAnal env (Lam x body) + | isTyVar x = case occAnal env body of { (body_usage, body') -> (markAllNonTailCalled body_usage, Lam x body') } @@ -1749,14 +1753,14 @@ occAnal env expr@(Lam _ _) = case occAnalLamOrRhs env binders body of { (usage, tagged_binders, body') -> let expr' = mkLams tagged_binders body' - final_usage | all isOneShotBndr tagged_binders - = markAllNonTailCalled usage - | otherwise - = markAllInsideLam $ markAllNonTailCalled usage + usage1 = markAllNonTailCalled usage + one_shot_gp = all isOneShotBndr tagged_binders + final_usage | one_shot_gp = usage1 + | otherwise = markAllInsideLam usage1 in (final_usage, expr') } where - (binders, body) = collectBinders expr + (binders, body) = collectBinders expr occAnal env (Case scrut bndr ty alts) = case occ_anal_scrut scrut alts of { (scrut_usage, scrut') -> @@ -2130,21 +2134,31 @@ oneShotGroup env@(OccEnv { occ_one_shots = ctxt }) bndrs = ( env { occ_one_shots = [], occ_encl = OccVanilla } , reverse rev_bndrs ++ bndrs ) - go ctxt (bndr:bndrs) rev_bndrs - | isId bndr - - = case ctxt of - [] -> go [] bndrs (bndr : rev_bndrs) - (one_shot : ctxt) -> go ctxt bndrs (bndr': rev_bndrs) - where - bndr' = updOneShotInfo bndr one_shot + go ctxt@(one_shot : ctxt') (bndr : bndrs) rev_bndrs + | isId bndr = go ctxt' bndrs (bndr': rev_bndrs) + | otherwise = go ctxt bndrs (bndr : rev_bndrs) + where + bndr' = updOneShotInfo bndr one_shot -- Use updOneShotInfo, not setOneShotInfo, as pre-existing -- one-shot info might be better than what we can infer, e.g. -- due to explicit use of the magic 'oneShot' function. -- See Note [The oneShot function] - | otherwise - = go ctxt bndrs (bndr:rev_bndrs) + +markJoinOneShots :: Maybe JoinArity -> [Var] -> [Var] +-- Mark the lambdas of a non-recursive join point as one-shot. +-- This is good to prevent gratuitous float-out etc +markJoinOneShots mb_join_arity bndrs + = case mb_join_arity of + Nothing -> bndrs + Just n -> go n bndrs + where + go 0 bndrs = bndrs + go _ [] = WARN( True, ppr mb_join_arity <+> ppr bndrs ) [] + go n (b:bs) = b' : go (n-1) bs + where + b' | isId b = setOneShotLambda b + | otherwise = b addAppCtxt :: OccEnv -> [Arg CoreBndr] -> OccEnv addAppCtxt env@(OccEnv { occ_one_shots = ctxt }) args From git at git.haskell.org Wed Mar 1 01:39:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Mar 2017 01:39:24 +0000 (UTC) Subject: [commit: ghc] master: Move isJoinId, isJoinId_maybe to Id (2ab6ce7) Message-ID: <20170301013924.1F2B93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2ab6ce783de9455369c12bb17afb4f596bb6ef06/ghc >--------------------------------------------------------------- commit 2ab6ce783de9455369c12bb17afb4f596bb6ef06 Author: Simon Peyton Jones Date: Tue Feb 28 20:39:02 2017 -0500 Move isJoinId, isJoinId_maybe to Id This is just a refactoring, moving these two functions where they belong. The reason they were there was because of the use of isJoinId_maybe in the OutputableBndr instance of TaggedBndr, which was in CoreSyn. I moved it to PprCore, to join the OutputableBndr instance for Var. That makes more sense anyway. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3207 >--------------------------------------------------------------- 2ab6ce783de9455369c12bb17afb4f596bb6ef06 compiler/basicTypes/Id.hs | 23 ++++++++++++++++++++--- compiler/basicTypes/IdInfo.hs-boot | 2 -- compiler/basicTypes/Var.hs | 12 ------------ compiler/coreSyn/CoreSyn.hs | 9 --------- compiler/coreSyn/PprCore.hs | 8 ++++++++ compiler/simplCore/CSE.hs | 5 +++-- compiler/simplCore/FloatIn.hs | 2 +- 7 files changed, 32 insertions(+), 29 deletions(-) diff --git a/compiler/basicTypes/Id.hs b/compiler/basicTypes/Id.hs index 69c2cc3..3934ae7 100644 --- a/compiler/basicTypes/Id.hs +++ b/compiler/basicTypes/Id.hs @@ -5,7 +5,7 @@ \section[Id]{@Ids@: Value and constructor identifiers} -} -{-# LANGUAGE CPP #-} +{-# LANGUAGE ImplicitParams, CPP #-} -- | -- #name_types# @@ -127,8 +127,7 @@ import Var( Id, CoVar, DictId, JoinId, InId, InVar, OutId, OutVar, idInfo, idDetails, setIdDetails, globaliseId, varType, - isId, isLocalId, isGlobalId, isExportedId, - isJoinId, isJoinId_maybe ) + isId, isLocalId, isGlobalId, isExportedId ) import qualified Var import Type @@ -478,6 +477,24 @@ isDataConId_maybe id = case Var.idDetails id of DataConWrapId con -> Just con _ -> Nothing +isJoinId :: Var -> Bool +-- It is convenient in SetLevels.lvlMFE to apply isJoinId +-- to the free vars of an expression, so it's convenient +-- if it returns False for type variables +isJoinId id + | isId id = case Var.idDetails id of + JoinId {} -> True + _ -> False + | otherwise = False + +isJoinId_maybe :: Var -> Maybe JoinArity +isJoinId_maybe id + | isId id = ASSERT2( isId id, ppr id ) + case Var.idDetails id of + JoinId arity -> Just arity + _ -> Nothing + | otherwise = Nothing + idDataCon :: Id -> DataCon -- ^ Get from either the worker or the wrapper 'Id' to the 'DataCon'. Currently used only in the desugarer. -- diff --git a/compiler/basicTypes/IdInfo.hs-boot b/compiler/basicTypes/IdInfo.hs-boot index 27c1217..0fabad3 100644 --- a/compiler/basicTypes/IdInfo.hs-boot +++ b/compiler/basicTypes/IdInfo.hs-boot @@ -1,5 +1,4 @@ module IdInfo where -import BasicTypes import Outputable data IdInfo data IdDetails @@ -7,6 +6,5 @@ data IdDetails vanillaIdInfo :: IdInfo coVarDetails :: IdDetails isCoVarDetails :: IdDetails -> Bool -isJoinIdDetails_maybe :: IdDetails -> Maybe JoinArity pprIdDetails :: IdDetails -> SDoc diff --git a/compiler/basicTypes/Var.hs b/compiler/basicTypes/Var.hs index 2b728af..2bdd5f0 100644 --- a/compiler/basicTypes/Var.hs +++ b/compiler/basicTypes/Var.hs @@ -57,7 +57,6 @@ module Var ( -- ** Predicates isId, isTyVar, isTcTyVar, isLocalVar, isLocalId, isCoVar, isNonCoVarId, isTyCoVar, - isJoinId, isJoinId_maybe, isGlobalId, isExportedId, mustHaveLocalBinding, @@ -85,10 +84,8 @@ module Var ( import {-# SOURCE #-} TyCoRep( Type, Kind, pprKind ) import {-# SOURCE #-} TcType( TcTyVarDetails, pprTcTyVarDetails, vanillaSkolemTv ) import {-# SOURCE #-} IdInfo( IdDetails, IdInfo, coVarDetails, isCoVarDetails, - isJoinIdDetails_maybe, vanillaIdInfo, pprIdDetails ) -import BasicTypes ( JoinArity ) import Name hiding (varName) import Unique ( Uniquable, Unique, getKey, getUnique , mkUniqueGrimily, nonDetCmpUnique ) @@ -96,7 +93,6 @@ import Util import Binary import DynFlags import Outputable -import Maybes import Data.Data @@ -618,14 +614,6 @@ isNonCoVarId :: Var -> Bool isNonCoVarId (Id { id_details = details }) = not (isCoVarDetails details) isNonCoVarId _ = False -isJoinId :: Var -> Bool -isJoinId (Id { id_details = details }) = isJust (isJoinIdDetails_maybe details) -isJoinId _ = False - -isJoinId_maybe :: Var -> Maybe JoinArity -isJoinId_maybe (Id { id_details = details }) = isJoinIdDetails_maybe details -isJoinId_maybe _ = Nothing - isLocalId :: Var -> Bool isLocalId (Id { idScope = LocalId _ }) = True isLocalId _ = False diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index b781863..2616e6f 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -1717,15 +1717,6 @@ type TaggedAlt t = Alt (TaggedBndr t) instance Outputable b => Outputable (TaggedBndr b) where ppr (TB b l) = char '<' <> ppr b <> comma <> ppr l <> char '>' --- OutputableBndr Var is declared separately in PprCore; using a FlexibleContext --- to avoid circularity -instance (OutputableBndr Var, Outputable b) => - OutputableBndr (TaggedBndr b) where - pprBndr _ b = ppr b -- Simple - pprInfixOcc b = ppr b - pprPrefixOcc b = ppr b - bndrIsJoin_maybe (TB b _) = isJoinId_maybe b - deTagExpr :: TaggedExpr t -> CoreExpr deTagExpr (Var v) = Var v deTagExpr (Lit l) = Lit l diff --git a/compiler/coreSyn/PprCore.hs b/compiler/coreSyn/PprCore.hs index 30de5d2..ddece8d 100644 --- a/compiler/coreSyn/PprCore.hs +++ b/compiler/coreSyn/PprCore.hs @@ -338,12 +338,20 @@ Furthermore, a dead case-binder is completely ignored, while otherwise, dead binders are printed as "_". -} +-- THese instances are sadly orphans + instance OutputableBndr Var where pprBndr = pprCoreBinder pprInfixOcc = pprInfixName . varName pprPrefixOcc = pprPrefixName . varName bndrIsJoin_maybe = isJoinId_maybe +instance Outputable b => OutputableBndr (TaggedBndr b) where + pprBndr _ b = ppr b -- Simple + pprInfixOcc b = ppr b + pprPrefixOcc b = ppr b + bndrIsJoin_maybe (TB b _) = isJoinId_maybe b + pprCoreBinder :: BindingSite -> Var -> SDoc pprCoreBinder LetBind binder | isTyVar binder = pprKindedTyVarBndr binder diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 0feb676..b8e26b5 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -11,10 +11,11 @@ module CSE (cseProgram, cseOneExpr) where #include "HsVersions.h" import CoreSubst -import Var ( Var, isJoinId ) +import Var ( Var ) import VarEnv ( elemInScopeSet ) import Id ( Id, idType, idInlineActivation, isDeadBinder - , zapIdOccInfo, zapIdUsageInfo, idInlinePragma ) + , zapIdOccInfo, zapIdUsageInfo, idInlinePragma + , isJoinId ) import CoreUtils ( mkAltExpr, eqExpr , exprIsLiteralString , stripTicksE, stripTicksT, mkTicks ) diff --git a/compiler/simplCore/FloatIn.hs b/compiler/simplCore/FloatIn.hs index cabdc3b..4d5a564 100644 --- a/compiler/simplCore/FloatIn.hs +++ b/compiler/simplCore/FloatIn.hs @@ -25,7 +25,7 @@ import CoreUtils ( exprIsDupable, exprIsExpandable, exprOkForSideEffects, mkTicks ) import CoreFVs import CoreMonad ( CoreM ) -import Id ( isOneShotBndr, idType ) +import Id ( isOneShotBndr, idType, isJoinId, isJoinId_maybe ) import Var import Type ( isUnliftedType ) import VarSet From git at git.haskell.org Wed Mar 1 03:30:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Mar 2017 03:30:41 +0000 (UTC) Subject: [commit: ghc] master: Update containers again (916658d) Message-ID: <20170301033041.B57AC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/916658d63d4a8d85f334c10e2a658fed8b3577d0/ghc >--------------------------------------------------------------- commit 916658d63d4a8d85f334c10e2a658fed8b3577d0 Author: David Feuer Date: Tue Feb 28 22:27:14 2017 -0500 Update containers again submodule update Get the version with `COMPLETE` pragmas for `Data.Sequence`. Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3249 >--------------------------------------------------------------- 916658d63d4a8d85f334c10e2a658fed8b3577d0 libraries/containers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/containers b/libraries/containers index 9e5d789..f42e932 160000 --- a/libraries/containers +++ b/libraries/containers @@ -1 +1 @@ -Subproject commit 9e5d789c77b7252fb3fbf7a26f649b96ba20649c +Subproject commit f42e9321dc1ba5f3bc58101b6dec9beb43a80a0a From git at git.haskell.org Wed Mar 1 04:07:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Mar 2017 04:07:09 +0000 (UTC) Subject: [commit: ghc] master: rts: Fix build (b86d226) Message-ID: <20170301040709.257C03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b86d226fda2f512178e04da4dec96b15c4480507/ghc >--------------------------------------------------------------- commit b86d226fda2f512178e04da4dec96b15c4480507 Author: Ben Gamari Date: Tue Feb 28 22:40:35 2017 -0500 rts: Fix build I evidently neglected to consider that validate doesn't build profiled ways. Arg. >--------------------------------------------------------------- b86d226fda2f512178e04da4dec96b15c4480507 includes/rts/Flags.h | 2 +- rts/Profiling.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/rts/Flags.h b/includes/rts/Flags.h index c8f71d1..5195a3a 100644 --- a/includes/rts/Flags.h +++ b/includes/rts/Flags.h @@ -119,7 +119,7 @@ typedef struct _COST_CENTRE_FLAGS { int profilerTicks; /* derived */ int msecsPerTick; /* derived */ - char const *oututFileNameStem; + char const *outputFileNameStem; } COST_CENTRE_FLAGS; /* See Note [Synchronization of flags and base APIs] */ diff --git a/rts/Profiling.c b/rts/Profiling.c index c0d60a5..65a9f7d 100644 --- a/rts/Profiling.c +++ b/rts/Profiling.c @@ -18,6 +18,7 @@ #include "Arena.h" #include "RetainerProfile.h" #include "ProfilerReport.h" +#include "ProfilerReportJson.h" #include "Printer.h" #include "Capability.h" From git at git.haskell.org Wed Mar 1 06:14:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Mar 2017 06:14:35 +0000 (UTC) Subject: [commit: ghc] master: Change catch# demand signature (701256d) Message-ID: <20170301061435.042ED3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/701256df88c61a2eee4cf00a59e61ef76a57b4b4/ghc >--------------------------------------------------------------- commit 701256df88c61a2eee4cf00a59e61ef76a57b4b4 Author: David Feuer Date: Wed Mar 1 01:14:13 2017 -0500 Change catch# demand signature * Give `catch#` a lazy demand signature, to make it more honest. * Make `catchException` and `catchAny` force their arguments so they actually behave as advertised. * Use `catch` rather than `catchException` in `forkIO`, `forkOn`, and `forkOS` to avoid losing exceptions. Fixes #13330 Reviewers: rwbarton, simonpj, simonmar, bgamari, hvr, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3244 >--------------------------------------------------------------- 701256df88c61a2eee4cf00a59e61ef76a57b4b4 compiler/basicTypes/Demand.hs | 2 +- compiler/prelude/primops.txt.pp | 2 +- libraries/base/Control/Concurrent.hs | 2 +- libraries/base/Control/Exception/Base.hs | 39 ---------- libraries/base/GHC/Conc/Sync.hs | 14 +++- libraries/base/GHC/Foreign.hs | 20 +++++- libraries/base/GHC/IO.hs | 82 +++++++++++++++------- .../should_run/{conc009.hs => T13330.hs} | 6 +- .../tests/concurrent/should_run/T13330.stderr | 3 + testsuite/tests/concurrent/should_run/all.T | 3 + 10 files changed, 98 insertions(+), 75 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 701256df88c61a2eee4cf00a59e61ef76a57b4b4 From git at git.haskell.org Wed Mar 1 13:29:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Mar 2017 13:29:58 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-D1259' created Message-ID: <20170301132958.2E4EA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rwbarton-D1259 Referencing: 85c486a16bff96281c53baf8b385a39f259d39be From git at git.haskell.org Wed Mar 1 13:30:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Mar 2017 13:30:02 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-D1259: D1259 (85c486a) Message-ID: <20170301133002.0400D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-D1259 Link : http://ghc.haskell.org/trac/ghc/changeset/85c486a16bff96281c53baf8b385a39f259d39be/ghc >--------------------------------------------------------------- commit 85c486a16bff96281c53baf8b385a39f259d39be Author: Reid Barton Date: Wed Mar 1 08:23:51 2017 -0500 D1259 >--------------------------------------------------------------- 85c486a16bff96281c53baf8b385a39f259d39be compiler/deSugar/Desugar.hs | 7 +- compiler/deSugar/DsBinds.hs | 24 ++- compiler/deSugar/DsExpr.hs | 2 +- compiler/deSugar/DsListComp.hs | 2 +- compiler/deSugar/DsMonad.hs | 22 +- compiler/deSugar/DsUtils.hs | 39 +++- compiler/deSugar/MatchLit.hs | 6 +- compiler/simplCore/CSE.hs | 9 +- compiler/simplCore/SimplUtils.hs | 8 + compiler/typecheck/TcRnTypes.hs | 44 ++++ libraries/base/Data/OldList.hs | 4 +- testsuite/tests/codeGen/should_run/cgrun057.stderr | 2 +- testsuite/tests/deSugar/should_compile/Makefile | 8 + testsuite/tests/deSugar/should_compile/T10844.hs | 13 ++ .../tests/deSugar/should_compile/T10844.stdout | 1 + testsuite/tests/deSugar/should_compile/T10844a.hs | 8 + testsuite/tests/deSugar/should_compile/all.T | 3 + .../tests/numeric/should_compile/T7116.stdout | 88 ++++---- .../tests/profiling/should_run/scc001.prof.sample | 45 ++-- .../tests/roles/should_compile/Roles13.stderr | 90 ++++---- .../tests/simplCore/should_compile/T13143.stderr | 111 +++++----- .../tests/simplCore/should_compile/T3234.stderr | 16 +- .../tests/simplCore/should_compile/T3717.stderr | 84 ++++---- .../tests/simplCore/should_compile/T3772.stdout | 4 +- .../tests/simplCore/should_compile/T4908.stderr | 127 ++++++------ .../tests/simplCore/should_compile/T4930.stderr | 84 ++++---- .../tests/simplCore/should_compile/T7360.stderr | 72 +++---- .../tests/simplCore/should_compile/T8274.stdout | 12 +- .../tests/simplCore/should_compile/T9400.stderr | 54 ++--- .../simplCore/should_compile/noinline01.stderr | 16 +- .../tests/simplCore/should_compile/par01.stderr | 24 +-- .../tests/simplCore/should_compile/rule2.stderr | 2 +- .../simplCore/should_compile/spec-inline.stderr | 230 ++++++++++----------- testsuite/tests/th/TH_Roles2.stderr | 4 +- testsuite/tests/th/all.T | 2 +- 35 files changed, 702 insertions(+), 565 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 85c486a16bff96281c53baf8b385a39f259d39be From git at git.haskell.org Wed Mar 1 18:14:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Mar 2017 18:14:56 +0000 (UTC) Subject: [commit: ghc] wip/T13351: Revise list fusion for and, or, all, any, elem, notElem (#13351) (8aa35df) Message-ID: <20170301181456.58CBC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13351 Link : http://ghc.haskell.org/trac/ghc/changeset/8aa35dfa94be50b89e41fd48aa8e78cb72032aa8/ghc >--------------------------------------------------------------- commit 8aa35dfa94be50b89e41fd48aa8e78cb72032aa8 Author: Joachim Breitner Date: Tue Feb 28 12:20:02 2017 -0800 Revise list fusion for and, or, all, any, elem, notElem (#13351) to make sure their list fusion is implemented in terms of foldr (and not build directly), with proper writing-back rules. This ensures that, for example, c `elem` "!@#$%^&*()" works without actual list code. Also, for good measure, add foldr fusion rules for short lists, and make the comment there more useful. Differential Revision: https://phabricator.haskell.org/D3246 >--------------------------------------------------------------- 8aa35dfa94be50b89e41fd48aa8e78cb72032aa8 libraries/base/GHC/Base.hs | 19 ++++++---- libraries/base/GHC/List.hs | 52 +++++++++++++++++++-------- testsuite/tests/simplCore/should_run/T2110.hs | 1 + 3 files changed, 52 insertions(+), 20 deletions(-) diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index e07c077..b5fa91c 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -897,16 +897,23 @@ augment g xs = g (:) xs -- Only activate this from phase 1, because that's -- when we disable the rule that expands (++) into foldr +"foldr/nil" forall k z. foldr k z [] = z +"foldr/single" forall k z x. foldr k z [x] = k x z +"foldr/short2" forall k z x1 x2. foldr k z [x1,x2] = k x1 (k x2 z) +"foldr/short3" forall k z x1 x2 x3. foldr k z [x1,x2,x3] = k x1 (k x2 (k x3 z)) +"foldr/short4" forall k z x1 x2 x3 x4. foldr k z [x1,x2,x3,x4] = k x1 (k x2 (k x3 (k x4 z))) + +-- "foldr/cons" forall k z x xs. foldr k z (x:xs) = k x (foldr k z xs) -- The foldr/cons rule looks nice, but it can give disastrously -- bloated code when commpiling -- array (a,b) [(1,2), (2,2), (3,2), ...very long list... ] -- i.e. when there are very very long literal lists --- So I've disabled it for now. We could have special cases --- for short lists, I suppose. --- "foldr/cons" forall k z x xs. foldr k z (x:xs) = k x (foldr k z xs) - -"foldr/single" forall k z x. foldr k z [x] = k x z -"foldr/nil" forall k z. foldr k z [] = z +-- So we disabled it, but have special cases for short lists up +-- to a completely arbitrary limit of 4. +-- +-- Note that static lists that are explicitly entered as such in the source, +-- the compiler desugars them to build (if they are short), and then normal +-- foldr/build rule fires, see note [Desugaring explicit lists] in DsExpr "foldr/cons/build" forall k z x (g::forall b. (a->b->b) -> b -> b) . foldr k z (x:build g) = k x (g k z) diff --git a/libraries/base/GHC/List.hs b/libraries/base/GHC/List.hs index 3eab407..7b6c059 100644 --- a/libraries/base/GHC/List.hs +++ b/libraries/base/GHC/List.hs @@ -730,9 +730,13 @@ and [] = True and (x:xs) = x && and xs {-# NOINLINE [1] and #-} +andFB :: Bool -> Bool -> Bool +andFB x r = x && r +{-# NOINLINE [0] andFB #-} + {-# RULES -"and/build" forall (g::forall b.(Bool->b->b)->b->b) . - and (build g) = g (&&) True +"and" [~1] forall xs. and xs = foldr andFB True xs +"andList" [1] foldr andFB True = and #-} #endif @@ -747,9 +751,13 @@ or [] = False or (x:xs) = x || or xs {-# NOINLINE [1] or #-} +orFB :: Bool -> Bool -> Bool +orFB x r = x || r +{-# NOINLINE [0] orFB #-} + {-# RULES -"or/build" forall (g::forall b.(Bool->b->b)->b->b) . - or (build g) = g (||) False +"or" [~1] forall xs. or xs = foldr orFB False xs +"orList" [1] foldr orFB False = or #-} #endif @@ -764,12 +772,15 @@ any p = or . map p #else any _ [] = False any p (x:xs) = p x || any p xs - {-# NOINLINE [1] any #-} +anyFB :: (t -> Bool) -> t -> Bool -> Bool +anyFB p x r = p x || r +{-# NOINLINE [0] anyFB #-} + {-# RULES -"any/build" forall p (g::forall b.(a->b->b)->b->b) . - any p (build g) = g ((||) . p) False +"any" [~1] forall p xs. any p xs = foldr (anyFB p) False xs +"anyList" [1] forall p. foldr (anyFB p) False = any p #-} #endif @@ -783,12 +794,15 @@ all p = and . map p #else all _ [] = True all p (x:xs) = p x && all p xs - {-# NOINLINE [1] all #-} +allFB :: (t -> Bool) -> t -> Bool -> Bool +allFB p x r = p x && r +{-# NOINLINE [0] allFB #-} + {-# RULES -"all/build" forall p (g::forall b.(a->b->b)->b->b) . - all p (build g) = g ((&&) . p) True +"all" [~1] forall p xs. all p xs = foldr (allFB p) True xs +"allList" [1] forall p. foldr (allFB p) True = all p #-} #endif @@ -803,9 +817,14 @@ elem x = any (== x) elem _ [] = False elem x (y:ys) = x==y || elem x ys {-# NOINLINE [1] elem #-} + +elemFB :: Eq a => a -> a -> Bool -> Bool +elemFB x y r = (x == y) || r +{-# NOINLINE [0] elemFB #-} + {-# RULES -"elem/build" forall x (g :: forall b . Eq a => (a -> b -> b) -> b -> b) - . elem x (build g) = g (\ y r -> (x == y) || r) False +"elem" [~1] forall x xs. elem x xs = foldr (elemFB x) False xs +"elemList" [1] forall x. foldr (elemFB x) False = elem x #-} #endif @@ -817,9 +836,14 @@ notElem x = all (/= x) notElem _ [] = True notElem x (y:ys)= x /= y && notElem x ys {-# NOINLINE [1] notElem #-} + +notElemFB :: Eq a => a -> a -> Bool -> Bool +notElemFB x y r = (x /= y) && r +{-# NOINLINE [0] notElemFB #-} + {-# RULES -"notElem/build" forall x (g :: forall b . Eq a => (a -> b -> b) -> b -> b) - . notElem x (build g) = g (\ y r -> (x /= y) && r) True +"notElem" [~1] forall x xs. notElem x xs = foldr (notElemFB x) False xs +"notElemList" [1] forall x. foldr (notElemFB x) True = notElem x #-} #endif diff --git a/testsuite/tests/simplCore/should_run/T2110.hs b/testsuite/tests/simplCore/should_run/T2110.hs index 610be09..7cde608 100644 --- a/testsuite/tests/simplCore/should_run/T2110.hs +++ b/testsuite/tests/simplCore/should_run/T2110.hs @@ -19,6 +19,7 @@ same x y = case reallyUnsafePtrEquality# (unsafeCoerce x) y of main = do let l = [1,2,3] + {-# NOINLINE l #-} same (fooAge l) l same (fooCoerce l) l same (fooUnsafeCoerce l) l From git at git.haskell.org Wed Mar 1 18:48:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Mar 2017 18:48:26 +0000 (UTC) Subject: [commit: ghc] master: Upgrade UniqSet to a newtype (cbe569a) Message-ID: <20170301184826.F12643A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cbe569a56e2a82bb93a008beb56869d9a6a1d047/ghc >--------------------------------------------------------------- commit cbe569a56e2a82bb93a008beb56869d9a6a1d047 Author: David Feuer Date: Wed Mar 1 13:47:39 2017 -0500 Upgrade UniqSet to a newtype The fundamental problem with `type UniqSet = UniqFM` is that `UniqSet` has a key invariant `UniqFM` does not. For example, `fmap` over `UniqSet` will generally produce nonsense. * Upgrade `UniqSet` from a type synonym to a newtype. * Remove unused and shady `extendVarSet_C` and `addOneToUniqSet_C`. * Use cached unique in `tyConsOfType` by replacing `unitNameEnv (tyConName tc) tc` with `unitUniqSet tc`. Reviewers: austin, hvr, goldfire, simonmar, niteria, bgamari Reviewed By: niteria Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3146 >--------------------------------------------------------------- cbe569a56e2a82bb93a008beb56869d9a6a1d047 compiler/basicTypes/DataCon.hs | 3 +- compiler/basicTypes/NameSet.hs | 5 +- compiler/basicTypes/RdrName.hs | 3 +- compiler/basicTypes/VarEnv.hs | 49 ++++---- compiler/basicTypes/VarSet.hs | 16 +-- compiler/cmm/PprC.hs | 2 +- compiler/coreSyn/CoreFVs.hs | 6 +- compiler/coreSyn/CoreSubst.hs | 2 +- compiler/coreSyn/CoreSyn.hs | 4 +- compiler/deSugar/DsArrows.hs | 21 ++-- compiler/deSugar/DsUsage.hs | 4 +- compiler/ghci/Debugger.hs | 10 +- compiler/ghci/RtClosureInspect.hs | 11 +- compiler/iface/MkIface.hs | 4 +- compiler/llvmGen/LlvmCodeGen/Base.hs | 2 +- compiler/nativeGen/RegAlloc/Graph/ArchBase.hs | 6 +- compiler/nativeGen/RegAlloc/Graph/Main.hs | 16 +-- compiler/nativeGen/RegAlloc/Graph/Spill.hs | 6 +- compiler/nativeGen/RegAlloc/Graph/SpillClean.hs | 6 +- compiler/nativeGen/RegAlloc/Graph/SpillCost.hs | 6 +- compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs | 6 +- compiler/nativeGen/RegAlloc/Linear/Main.hs | 6 +- compiler/nativeGen/RegAlloc/Liveness.hs | 28 +++-- compiler/rename/RnBinds.hs | 6 +- compiler/rename/RnSource.hs | 6 +- compiler/simplCore/OccurAnal.hs | 20 ++-- compiler/stranal/DmdAnal.hs | 3 +- compiler/typecheck/TcBinds.hs | 3 +- compiler/typecheck/TcEvidence.hs | 6 +- compiler/typecheck/TcExpr.hs | 6 +- compiler/typecheck/TcMType.hs | 6 +- compiler/typecheck/TcSMonad.hs | 3 +- compiler/typecheck/TcSimplify.hs | 8 +- compiler/typecheck/TcTyDecls.hs | 3 +- compiler/typecheck/TcValidity.hs | 6 +- compiler/types/TyCoRep.hs | 7 +- compiler/types/Type.hs | 52 ++++----- compiler/types/Unify.hs | 11 +- compiler/utils/GraphColor.hs | 4 +- compiler/utils/GraphOps.hs | 22 ++-- compiler/utils/GraphPpr.hs | 6 +- compiler/utils/UniqDSet.hs | 2 +- compiler/utils/UniqFM.hs | 2 +- compiler/utils/UniqSet.hs | 128 +++++++++++++++++---- compiler/vectorise/Vectorise/Env.hs | 3 +- compiler/vectorise/Vectorise/Type/Classify.hs | 10 +- testsuite/tests/callarity/unittest/CallArity1.hs | 6 +- 47 files changed, 321 insertions(+), 230 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 cbe569a56e2a82bb93a008beb56869d9a6a1d047 From git at git.haskell.org Thu Mar 2 02:31:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 02:31:46 +0000 (UTC) Subject: [commit: ghc] wip/T13351: Revise list fusion for and, or, all, any, elem, notElem (#13351) (b112f46) Message-ID: <20170302023146.4006E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13351 Link : http://ghc.haskell.org/trac/ghc/changeset/b112f4604811faa6f5aeb399d8b5ee575f413bb7/ghc >--------------------------------------------------------------- commit b112f4604811faa6f5aeb399d8b5ee575f413bb7 Author: Joachim Breitner Date: Tue Feb 28 12:20:02 2017 -0800 Revise list fusion for and, or, all, any, elem, notElem (#13351) to make sure their list fusion is implemented in terms of foldr (and not build directly), with proper writing-back rules. This ensures that, for example, c `elem` "!@#$%^&*()" works without actual list code. Also, for good measure, add foldr fusion rules for short lists, and make the comment there more useful. Differential Revision: https://phabricator.haskell.org/D3246 >--------------------------------------------------------------- b112f4604811faa6f5aeb399d8b5ee575f413bb7 libraries/base/GHC/Base.hs | 19 ++++++---- libraries/base/GHC/List.hs | 52 +++++++++++++++++++-------- testsuite/tests/simplCore/should_run/T2110.hs | 1 + testsuite/tests/th/TH_Roles2.stderr | 4 +-- 4 files changed, 54 insertions(+), 22 deletions(-) diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index e07c077..b5fa91c 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -897,16 +897,23 @@ augment g xs = g (:) xs -- Only activate this from phase 1, because that's -- when we disable the rule that expands (++) into foldr +"foldr/nil" forall k z. foldr k z [] = z +"foldr/single" forall k z x. foldr k z [x] = k x z +"foldr/short2" forall k z x1 x2. foldr k z [x1,x2] = k x1 (k x2 z) +"foldr/short3" forall k z x1 x2 x3. foldr k z [x1,x2,x3] = k x1 (k x2 (k x3 z)) +"foldr/short4" forall k z x1 x2 x3 x4. foldr k z [x1,x2,x3,x4] = k x1 (k x2 (k x3 (k x4 z))) + +-- "foldr/cons" forall k z x xs. foldr k z (x:xs) = k x (foldr k z xs) -- The foldr/cons rule looks nice, but it can give disastrously -- bloated code when commpiling -- array (a,b) [(1,2), (2,2), (3,2), ...very long list... ] -- i.e. when there are very very long literal lists --- So I've disabled it for now. We could have special cases --- for short lists, I suppose. --- "foldr/cons" forall k z x xs. foldr k z (x:xs) = k x (foldr k z xs) - -"foldr/single" forall k z x. foldr k z [x] = k x z -"foldr/nil" forall k z. foldr k z [] = z +-- So we disabled it, but have special cases for short lists up +-- to a completely arbitrary limit of 4. +-- +-- Note that static lists that are explicitly entered as such in the source, +-- the compiler desugars them to build (if they are short), and then normal +-- foldr/build rule fires, see note [Desugaring explicit lists] in DsExpr "foldr/cons/build" forall k z x (g::forall b. (a->b->b) -> b -> b) . foldr k z (x:build g) = k x (g k z) diff --git a/libraries/base/GHC/List.hs b/libraries/base/GHC/List.hs index 3eab407..7b6c059 100644 --- a/libraries/base/GHC/List.hs +++ b/libraries/base/GHC/List.hs @@ -730,9 +730,13 @@ and [] = True and (x:xs) = x && and xs {-# NOINLINE [1] and #-} +andFB :: Bool -> Bool -> Bool +andFB x r = x && r +{-# NOINLINE [0] andFB #-} + {-# RULES -"and/build" forall (g::forall b.(Bool->b->b)->b->b) . - and (build g) = g (&&) True +"and" [~1] forall xs. and xs = foldr andFB True xs +"andList" [1] foldr andFB True = and #-} #endif @@ -747,9 +751,13 @@ or [] = False or (x:xs) = x || or xs {-# NOINLINE [1] or #-} +orFB :: Bool -> Bool -> Bool +orFB x r = x || r +{-# NOINLINE [0] orFB #-} + {-# RULES -"or/build" forall (g::forall b.(Bool->b->b)->b->b) . - or (build g) = g (||) False +"or" [~1] forall xs. or xs = foldr orFB False xs +"orList" [1] foldr orFB False = or #-} #endif @@ -764,12 +772,15 @@ any p = or . map p #else any _ [] = False any p (x:xs) = p x || any p xs - {-# NOINLINE [1] any #-} +anyFB :: (t -> Bool) -> t -> Bool -> Bool +anyFB p x r = p x || r +{-# NOINLINE [0] anyFB #-} + {-# RULES -"any/build" forall p (g::forall b.(a->b->b)->b->b) . - any p (build g) = g ((||) . p) False +"any" [~1] forall p xs. any p xs = foldr (anyFB p) False xs +"anyList" [1] forall p. foldr (anyFB p) False = any p #-} #endif @@ -783,12 +794,15 @@ all p = and . map p #else all _ [] = True all p (x:xs) = p x && all p xs - {-# NOINLINE [1] all #-} +allFB :: (t -> Bool) -> t -> Bool -> Bool +allFB p x r = p x && r +{-# NOINLINE [0] allFB #-} + {-# RULES -"all/build" forall p (g::forall b.(a->b->b)->b->b) . - all p (build g) = g ((&&) . p) True +"all" [~1] forall p xs. all p xs = foldr (allFB p) True xs +"allList" [1] forall p. foldr (allFB p) True = all p #-} #endif @@ -803,9 +817,14 @@ elem x = any (== x) elem _ [] = False elem x (y:ys) = x==y || elem x ys {-# NOINLINE [1] elem #-} + +elemFB :: Eq a => a -> a -> Bool -> Bool +elemFB x y r = (x == y) || r +{-# NOINLINE [0] elemFB #-} + {-# RULES -"elem/build" forall x (g :: forall b . Eq a => (a -> b -> b) -> b -> b) - . elem x (build g) = g (\ y r -> (x == y) || r) False +"elem" [~1] forall x xs. elem x xs = foldr (elemFB x) False xs +"elemList" [1] forall x. foldr (elemFB x) False = elem x #-} #endif @@ -817,9 +836,14 @@ notElem x = all (/= x) notElem _ [] = True notElem x (y:ys)= x /= y && notElem x ys {-# NOINLINE [1] notElem #-} + +notElemFB :: Eq a => a -> a -> Bool -> Bool +notElemFB x y r = (x /= y) && r +{-# NOINLINE [0] notElemFB #-} + {-# RULES -"notElem/build" forall x (g :: forall b . Eq a => (a -> b -> b) -> b -> b) - . notElem x (build g) = g (\ y r -> (x /= y) && r) True +"notElem" [~1] forall x xs. notElem x xs = foldr (notElemFB x) False xs +"notElemList" [1] forall x. foldr (notElemFB x) True = notElem x #-} #endif diff --git a/testsuite/tests/simplCore/should_run/T2110.hs b/testsuite/tests/simplCore/should_run/T2110.hs index 610be09..7cde608 100644 --- a/testsuite/tests/simplCore/should_run/T2110.hs +++ b/testsuite/tests/simplCore/should_run/T2110.hs @@ -19,6 +19,7 @@ same x y = case reallyUnsafePtrEquality# (unsafeCoerce x) y of main = do let l = [1,2,3] + {-# NOINLINE l #-} same (fooAge l) l same (fooCoerce l) l same (fooUnsafeCoerce l) l diff --git a/testsuite/tests/th/TH_Roles2.stderr b/testsuite/tests/th/TH_Roles2.stderr index 3027911..bd2945e 100644 --- a/testsuite/tests/th/TH_Roles2.stderr +++ b/testsuite/tests/th/TH_Roles2.stderr @@ -16,8 +16,8 @@ TH_Roles2.$tcT TH_Roles2.$trModule (GHC.Types.TrNameS "T"#) 1 - krep_a4im -krep_a4im [InlPrag=[~]] + krep_a4ik +krep_a4ik [InlPrag=[~]] = GHC.Types.KindRepFun (GHC.Types.KindRepVar 0) (GHC.Types.KindRepTYPE GHC.Types.LiftedRep) From git at git.haskell.org Thu Mar 2 08:35:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 08:35:40 +0000 (UTC) Subject: [commit: ghc] master: Document interaction between ApplicativeDo and existentials (#13242) (d118807) Message-ID: <20170302083540.536333A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d118807d141abe4031fdcb1a4db3596dac00c7c7/ghc >--------------------------------------------------------------- commit d118807d141abe4031fdcb1a4db3596dac00c7c7 Author: Simon Marlow Date: Wed Mar 1 14:47:24 2017 +0000 Document interaction between ApplicativeDo and existentials (#13242) Test Plan: validate Reviewers: austin, bgamari, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3256 >--------------------------------------------------------------- d118807d141abe4031fdcb1a4db3596dac00c7c7 docs/users_guide/glasgow_exts.rst | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index edb28d2..6fd5f70 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -966,6 +966,42 @@ the optimal solution, provided as an option: times when there are very large ``do`` expressions (over 100 statements). The default ``ApplicativeDo`` algorithm is ``O(n^2)``. + +.. _applicative-do-existential: + +Existential patterns and GADTs +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Note that when the pattern in a statement matches a constructor with +existential type variables and/or constraints, the transformation that +``ApplicativeDo`` performs may mean that the pattern does not scope +over the statements that follow it. This is because the rearrangement +happens before the expression is typechecked. For example, this +program does not typecheck:: + + {-# LANGUAGE RankNTypes, GADTs, ApplicativeDo #-} + + data T where A :: forall a . Eq a => a -> T + + test = do + A x <- undefined + _ <- return True + return (x == x) + +The reason is that the ``Eq`` constraint that would be brought into +scope from the pattern match ``A x`` is not available when +typechecking the expression ``x == x``, because ``ApplicativeDo`` has +rearranged the expression to look like this:: + + test = + (\x _ -> x == x) + <$> do A x <- undefined; return x + <*> return True + +Turning off ``ApplicativeDo`` lets the program typecheck. This is +something to bear in mind when using ``ApplicativeDo`` in combination +with :ref:`existential-quantification` or :ref:`gadt`. + .. _applicative-do-pitfall: Things to watch out for From git at git.haskell.org Thu Mar 2 18:14:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 18:14:13 +0000 (UTC) Subject: [commit: ghc] master: Fix expected result from T13143 (d4a6a7f) Message-ID: <20170302181413.A54413A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d4a6a7fe6d80c23c7e724981d2cfab08cf0fd64b/ghc >--------------------------------------------------------------- commit d4a6a7fe6d80c23c7e724981d2cfab08cf0fd64b Author: David Feuer Date: Thu Mar 2 11:29:39 2017 -0500 Fix expected result from T13143 Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3260 >--------------------------------------------------------------- d4a6a7fe6d80c23c7e724981d2cfab08cf0fd64b .../tests/simplCore/should_compile/T13143.stderr | 52 +++++++++++----------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/testsuite/tests/simplCore/should_compile/T13143.stderr b/testsuite/tests/simplCore/should_compile/T13143.stderr index c576f56..3973a3c 100644 --- a/testsuite/tests/simplCore/should_compile/T13143.stderr +++ b/testsuite/tests/simplCore/should_compile/T13143.stderr @@ -4,16 +4,15 @@ Result size of Tidy Core = {terms: 73, types: 50, coercions: 0, joins: 0/0} Rec { +-- RHS size: {terms: 3, types: 4, coercions: 0, joins: 0/0} +T13143.$wf [InlPrag=NOINLINE] :: forall a. GHC.Prim.Void# -> a +[GblId, Arity=1, Str=b] +T13143.$wf = \ (@ a) _ [Occ=Dead] -> lvl @ a + -- RHS size: {terms: 3, types: 3, coercions: 0, joins: 0/0} lvl :: forall a. a [GblId, Str=b] lvl = \ (@ a) -> T13143.$wf @ a GHC.Prim.void# - --- RHS size: {terms: 3, types: 4, coercions: 0, joins: 0/0} -T13143.$wf [InlPrag=NOINLINE, Occ=LoopBreaker] - :: forall a. GHC.Prim.Void# -> a -[GblId, Arity=1, Str=b] -T13143.$wf = \ (@ a) _ [Occ=Dead] -> lvl @ a end Rec } -- RHS size: {terms: 3, types: 4, coercions: 0, joins: 0/0} @@ -68,8 +67,8 @@ T13143.$trModule :: GHC.Types.Module Str=m, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}] -T13143.$trModule = - GHC.Types.Module T13143.$trModule3 T13143.$trModule1 +T13143.$trModule + = GHC.Types.Module T13143.$trModule3 T13143.$trModule1 -- RHS size: {terms: 2, types: 1, coercions: 0, joins: 0/0} lvl1 :: Int @@ -81,20 +80,20 @@ Rec { T13143.$wg [InlPrag=[0], Occ=LoopBreaker] :: Bool -> Bool -> GHC.Prim.Int# -> GHC.Prim.Int# [GblId, Arity=3, Str=] -T13143.$wg = - \ (w :: Bool) (w1 :: Bool) (ww :: GHC.Prim.Int#) -> - case w of { - False -> - case w1 of { - False -> T13143.$wg GHC.Types.False GHC.Types.True ww; - True -> GHC.Prim.+# ww 1# - }; - True -> - case w1 of { - False -> T13143.$wg GHC.Types.True GHC.Types.True ww; - True -> case lvl1 of wild2 { } - } - } +T13143.$wg + = \ (w :: Bool) (w1 :: Bool) (ww :: GHC.Prim.Int#) -> + case w of { + False -> + case w1 of { + False -> T13143.$wg GHC.Types.False GHC.Types.True ww; + True -> GHC.Prim.+# ww 1# + }; + True -> + case w1 of { + False -> T13143.$wg GHC.Types.True GHC.Types.True ww; + True -> case lvl1 of wild2 { } + } + } end Rec } -- RHS size: {terms: 14, types: 6, coercions: 0, joins: 0/0} @@ -111,11 +110,10 @@ g [InlPrag=INLINE[0]] :: Bool -> Bool -> Int -> Int case w2 of { GHC.Types.I# ww1 [Occ=Once] -> case T13143.$wg w w1 ww1 of ww2 { __DEFAULT -> GHC.Types.I# ww2 } }}] -g = - \ (w :: Bool) (w1 :: Bool) (w2 :: Int) -> - case w2 of { GHC.Types.I# ww1 -> - case T13143.$wg w w1 ww1 of ww2 { __DEFAULT -> GHC.Types.I# ww2 } - } +g = \ (w :: Bool) (w1 :: Bool) (w2 :: Int) -> + case w2 of { GHC.Types.I# ww1 -> + case T13143.$wg w w1 ww1 of ww2 { __DEFAULT -> GHC.Types.I# ww2 } + } From git at git.haskell.org Thu Mar 2 18:14:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 18:14:16 +0000 (UTC) Subject: [commit: ghc] master: Bump bytes allocated for T12234 (fb06bee) Message-ID: <20170302181416.671A13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fb06bee1c5a0b4d5dfd8e0381ea2a999ca47b84c/ghc >--------------------------------------------------------------- commit fb06bee1c5a0b4d5dfd8e0381ea2a999ca47b84c Author: David Feuer Date: Thu Mar 2 11:30:48 2017 -0500 Bump bytes allocated for T12234 Reviewers: austin, bgamari Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D3258 >--------------------------------------------------------------- fb06bee1c5a0b4d5dfd8e0381ea2a999ca47b84c testsuite/tests/perf/compiler/all.T | 1 + 1 file changed, 1 insertion(+) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index b774815..6b89961 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -986,6 +986,7 @@ test('T12234', # 2017-02-05: 74374440 (Probably OccAnal fixes) # 2017-02-17: 86525344 (Type-indexed Typeable) # 2017-02-25: 80245640 (Early inline patch) + # 2017-03-01: 84750072 (Unclear. Possibly catch# signature change.) ]), ], compile, From git at git.haskell.org Thu Mar 2 18:14:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 18:14:19 +0000 (UTC) Subject: [commit: ghc] master: SymbolExtras: A bit of spring cleaning (55f6353) Message-ID: <20170302181419.204773A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/55f6353f7adc4d947aac8dfea227fdc4f54ac6d7/ghc >--------------------------------------------------------------- commit 55f6353f7adc4d947aac8dfea227fdc4f54ac6d7 Author: Ben Gamari Date: Thu Mar 2 11:20:12 2017 -0500 SymbolExtras: A bit of spring cleaning Const-hygiene and use bool when possible. >--------------------------------------------------------------- 55f6353f7adc4d947aac8dfea227fdc4f54ac6d7 rts/linker/SymbolExtras.c | 12 +++++------- rts/linker/SymbolExtras.h | 8 ++++---- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/rts/linker/SymbolExtras.c b/rts/linker/SymbolExtras.c index 468b3a9..73f219f 100644 --- a/rts/linker/SymbolExtras.c +++ b/rts/linker/SymbolExtras.c @@ -103,7 +103,7 @@ int ocAllocateSymbolExtras( ObjectCode* oc, int count, int first ) #ifndef arm_HOST_ARCH -SymbolExtra* makeSymbolExtra( ObjectCode* oc, +SymbolExtra* makeSymbolExtra( ObjectCode const* oc, unsigned long symbolNumber, unsigned long target ) { @@ -169,18 +169,16 @@ SymbolExtra* makeSymbolExtra( ObjectCode* oc, */ /* Produce a jump island for ARM/Thumb interworking */ -SymbolExtra* makeArmSymbolExtra( ObjectCode* oc, +SymbolExtra* makeArmSymbolExtra( ObjectCode const* oc, unsigned long symbolNumber, unsigned long target, - int fromThumb, - int toThumb ) + bool fromThumb, + bool toThumb ) { - SymbolExtra *extra; - ASSERT( symbolNumber >= oc->first_symbol_extra && symbolNumber - oc->first_symbol_extra < oc->n_symbol_extras); - extra = &oc->symbol_extras[symbolNumber - oc->first_symbol_extra]; + SymbolExtra *extra = &oc->symbol_extras[symbolNumber - oc->first_symbol_extra]; // Make sure instruction mode bit is set properly if (toThumb) diff --git a/rts/linker/SymbolExtras.h b/rts/linker/SymbolExtras.h index c897775..5e2a6d0 100644 --- a/rts/linker/SymbolExtras.h +++ b/rts/linker/SymbolExtras.h @@ -11,13 +11,13 @@ int ocAllocateSymbolExtras( ObjectCode* oc, int count, int first ); #ifdef arm_HOST_ARCH -SymbolExtra* makeArmSymbolExtra( ObjectCode* oc, +SymbolExtra* makeArmSymbolExtra( ObjectCode const* oc, unsigned long symbolNumber, unsigned long target, - int fromThumb, - int toThumb ); + bool fromThumb, + bool toThumb ); #else -SymbolExtra* makeSymbolExtra( ObjectCode* oc, +SymbolExtra* makeSymbolExtra( ObjectCode const* oc, unsigned long symbolNumber, unsigned long target ); From git at git.haskell.org Thu Mar 2 18:14:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 18:14:21 +0000 (UTC) Subject: [commit: ghc] master: Typeable: Rename KindRep bindings to $krep... (537ce41) Message-ID: <20170302181421.D4AF03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/537ce41c5373a2e6fa8961f0bdca75e887ac45b7/ghc >--------------------------------------------------------------- commit 537ce41c5373a2e6fa8961f0bdca75e887ac45b7 Author: Ben Gamari Date: Wed Mar 1 11:29:10 2017 -0500 Typeable: Rename KindRep bindings to $krep... >--------------------------------------------------------------- 537ce41c5373a2e6fa8961f0bdca75e887ac45b7 compiler/typecheck/TcTypeable.hs | 2 +- .../tests/deSugar/should_compile/T2431.stderr | 46 +++---- .../should_compile/DumpTypecheckedAst.stderr | 12 +- testsuite/tests/roles/should_compile/Roles1.stderr | 56 ++++----- .../tests/roles/should_compile/Roles13.stderr | 132 ++++++++++----------- .../tests/roles/should_compile/Roles14.stderr | 8 +- testsuite/tests/roles/should_compile/Roles2.stderr | 16 +-- testsuite/tests/roles/should_compile/Roles3.stderr | 24 ++-- testsuite/tests/roles/should_compile/Roles4.stderr | 16 +-- testsuite/tests/roles/should_compile/T8958.stderr | 24 ++-- .../tests/simplCore/should_compile/T7360.stderr | 10 +- .../tests/simplCore/should_compile/T8274.stdout | 10 +- testsuite/tests/th/TH_Roles2.stderr | 4 +- 13 files changed, 180 insertions(+), 180 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 537ce41c5373a2e6fa8961f0bdca75e887ac45b7 From git at git.haskell.org Thu Mar 2 18:14:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 18:14:27 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Mark T13340 as fixed (63191e9) Message-ID: <20170302181427.3FFD63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/63191e99adfac908d24fd1cfb744b6711ca11953/ghc >--------------------------------------------------------------- commit 63191e99adfac908d24fd1cfb744b6711ca11953 Author: Ben Gamari Date: Thu Mar 2 13:09:30 2017 -0500 testsuite: Mark T13340 as fixed It was fixed by 55efc9718b520ef354e32c15c4b49cdfecce412f >--------------------------------------------------------------- 63191e99adfac908d24fd1cfb744b6711ca11953 testsuite/tests/simplCore/should_compile/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index ca25d4f..03004fb 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -247,5 +247,5 @@ test('T13317', normal, run_command, ['$MAKE -s --no-print-directory T13317']) -test('T13340', expect_broken(13340), run_command, ['$MAKE -s --no-print-directory T13340']) +test('T13340', normal, run_command, ['$MAKE -s --no-print-directory T13340']) test('T13338', only_ways(['optasm']), compile, ['-dcore-lint']) From git at git.haskell.org Thu Mar 2 18:14:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 18:14:24 +0000 (UTC) Subject: [commit: ghc] master: Properly acquire locks on not yet existing package databases (5f7b45a) Message-ID: <20170302181424.89FE53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5f7b45a51f3736ad5a5046ba2fe4155446a2c467/ghc >--------------------------------------------------------------- commit 5f7b45a51f3736ad5a5046ba2fe4155446a2c467 Author: Andrzej Rybczak Date: Thu Mar 2 11:26:09 2017 -0500 Properly acquire locks on not yet existing package databases Reviewers: austin, bgamari, angerman Reviewed By: bgamari, angerman Subscribers: angerman, thomie Differential Revision: https://phabricator.haskell.org/D3259 >--------------------------------------------------------------- 5f7b45a51f3736ad5a5046ba2fe4155446a2c467 compiler/main/Packages.hs | 29 +++++++++++++++++++++++++++-- utils/ghc-pkg/Main.hs | 23 +++++++++++++++-------- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs index 5f1a7d5..0667831 100644 --- a/compiler/main/Packages.hs +++ b/compiler/main/Packages.hs @@ -549,8 +549,33 @@ readPackageConfig dflags conf_file = do where readDirStylePackageConfig conf_dir = do let filename = conf_dir "package.cache" - debugTraceMsg dflags 2 (text "Using binary package database:" <+> text filename) - readPackageDbForGhc filename + cache_exists <- doesFileExist filename + if cache_exists + then do + debugTraceMsg dflags 2 $ text "Using binary package database:" + <+> text filename + readPackageDbForGhc filename + else do + -- If there is no package.cache file, we check if the database is not + -- empty by inspecting if the directory contains any .conf file. If it + -- does, something is wrong and we fail. Otherwise we assume that the + -- database is empty. + debugTraceMsg dflags 2 $ text "There is no package.cache in" + <+> text conf_dir + <> text ", checking if the database is empty" + db_empty <- all (not . isSuffixOf ".conf") + <$> getDirectoryContents conf_dir + if db_empty + then do + debugTraceMsg dflags 3 $ text "There are no .conf files in" + <+> text conf_dir <> text ", treating" + <+> text "package database as empty" + return [] + else do + throwGhcExceptionIO $ InstallationError $ + "there is no package.cache in " ++ conf_dir ++ + " even though package database is not empty" + -- Single-file style package dbs have been deprecated for some time, but -- it turns out that Cabal was using them in one place. So this is a diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index dd49180..c42feec 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -807,7 +807,10 @@ readParseDatabase :: forall mode t. Verbosity readParseDatabase verbosity mb_user_conf mode use_cache path -- the user database (only) is allowed to be non-existent | Just (user_conf,False) <- mb_user_conf, path == user_conf - = mkPackageDB [] =<< F.mapM (const $ GhcPkg.lockPackageDb path) mode + = do lock <- F.forM mode $ \_ -> do + createDirectoryIfMissing True path + GhcPkg.lockPackageDb cache + mkPackageDB [] lock | otherwise = do e <- tryIO $ getDirectoryContents path case e of @@ -828,17 +831,17 @@ readParseDatabase verbosity mb_user_conf mode use_cache path Right fs | not use_cache -> ignore_cache (const $ return ()) | otherwise -> do - let cache = path cachefilename tdir <- getModificationTime path e_tcache <- tryIO $ getModificationTime cache case e_tcache of Left ex -> do whenReportCacheErrors $ if isDoesNotExistError ex - then do - warn ("WARNING: cache does not exist: " ++ cache) - warn ("ghc will fail to read this package db. " ++ - recacheAdvice) + then + when (verbosity >= Verbose) $ do + warn ("WARNING: cache does not exist: " ++ cache) + warn ("ghc will fail to read this package db. " ++ + recacheAdvice) else do warn ("WARNING: cache cannot be read: " ++ show ex) warn "ghc will fail to read this package db." @@ -876,7 +879,7 @@ readParseDatabase verbosity mb_user_conf mode use_cache path -- If we're opening for modification, we need to acquire a -- lock even if we don't open the cache now, because we are -- going to modify it later. - lock <- F.mapM (const $ GhcPkg.lockPackageDb path) mode + lock <- F.mapM (const $ GhcPkg.lockPackageDb cache) mode let confs = filter (".conf" `isSuffixOf`) fs doFile f = do checkTime f parseSingletonPackageConf verbosity f @@ -888,6 +891,8 @@ readParseDatabase verbosity mb_user_conf mode use_cache path whenReportCacheErrors = when $ verbosity > Normal || verbosity >= Normal && GhcPkg.isDbOpenReadMode mode where + cache = path cachefilename + recacheAdvice | Just (user_conf, True) <- mb_user_conf, path == user_conf = "Use 'ghc-pkg recache --user' to fix." @@ -1012,7 +1017,9 @@ tryReadParseOldFileStyleDatabase verbosity mb_user_conf locationAbsolute = path_abs } else do - lock <- F.mapM (const $ GhcPkg.lockPackageDb path_dir) mode + lock <- F.forM mode $ \_ -> do + createDirectoryIfMissing True path_dir + GhcPkg.lockPackageDb $ path_dir cachefilename return $ Just PackageDB { location = path, locationAbsolute = path_abs, From git at git.haskell.org Thu Mar 2 19:46:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 19:46:37 +0000 (UTC) Subject: [commit: ghc] master: User manual: Fix GADT paper link (27a1b12) Message-ID: <20170302194637.1DF483A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/27a1b12f90b4b27763d22310215f0df34cbd702a/ghc >--------------------------------------------------------------- commit 27a1b12f90b4b27763d22310215f0df34cbd702a Author: Ömer Sinan Ağacan Date: Thu Mar 2 22:44:56 2017 +0300 User manual: Fix GADT paper link >--------------------------------------------------------------- 27a1b12f90b4b27763d22310215f0df34cbd702a docs/users_guide/glasgow_exts.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 6fd5f70..6ba6935 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -2843,7 +2843,7 @@ also sets :ghc-flag:`-XGADTSyntax` and :ghc-flag:`-XMonoLocalBinds`. binding site. The easiest way to ensure that a variable a rigid type is to give it a type signature. For more precise details see `Simple unification-based type inference for - GADTs `__. The + GADTs `__. The criteria implemented by GHC are given in the Appendix. .. _record-system-extensions: From git at git.haskell.org Thu Mar 2 19:57:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 19:57:50 +0000 (UTC) Subject: [commit: ghc] master: Eliminate ListSetOps from imp_trust_pkgs (ae67619) Message-ID: <20170302195750.2DC2F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ae67619853d029ea8049a114f44e59f4ca10b990/ghc >--------------------------------------------------------------- commit ae67619853d029ea8049a114f44e59f4ca10b990 Author: David Feuer Date: Thu Mar 2 13:45:27 2017 -0500 Eliminate ListSetOps from imp_trust_pkgs Eliminate ListSetOps from imp_trust_pkgs and imp_dep_pkgs Replace Map with NameEnv in TmOracle Reviewers: austin, dfeuer, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3113 >--------------------------------------------------------------- ae67619853d029ea8049a114f44e59f4ca10b990 compiler/deSugar/DsUsage.hs | 8 ++++---- compiler/deSugar/TmOracle.hs | 14 +++++++------- compiler/main/GHC.hs | 3 ++- compiler/main/HscMain.hs | 41 +++++++++++++++++++++------------------- compiler/rename/RnNames.hs | 8 +++++--- compiler/typecheck/TcRnDriver.hs | 5 +++-- compiler/typecheck/TcRnTypes.hs | 13 +++++++------ compiler/utils/ListSetOps.hs | 6 +----- ghc/GHCi/UI.hs | 13 +++++++------ 9 files changed, 58 insertions(+), 53 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 ae67619853d029ea8049a114f44e59f4ca10b990 From git at git.haskell.org Thu Mar 2 20:02:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 20:02:25 +0000 (UTC) Subject: [commit: ghc] master: Prohibit RULES changing constructors (bc332b3) Message-ID: <20170302200225.048BC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bc332b3159613190a4dc33a067c1ab31039a8434/ghc >--------------------------------------------------------------- commit bc332b3159613190a4dc33a067c1ab31039a8434 Author: David Feuer Date: Thu Mar 2 15:01:26 2017 -0500 Prohibit RULES changing constructors Previously, `RULES` like ``` {-# RULES "JustNothing" forall x . Just x = Nothing #-} ``` were allowed. Simon Peyton Jones say this seems to have been a mistake, that such rules have never been supported intentionally, and that he doesn't know if they can break in horrible ways. Furthermore, Ben Gamari and Reid Barton are considering trying to detect the presence of "static data" that the simplifier doesn't need to traverse at all. Such rules do not play well with that. So for now, we ban them altogether. In most cases, it's possible to work around the ban using hand-written wrapper functions. Reviewers: austin, simonpj, bgamari Reviewed By: simonpj, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3169 >--------------------------------------------------------------- bc332b3159613190a4dc33a067c1ab31039a8434 compiler/deSugar/DsBinds.hs | 27 ++++++++++++++++++++-- docs/users_guide/8.2.1-notes.rst | 10 ++++++++ docs/users_guide/glasgow_exts.rst | 4 +++- testsuite/tests/deSugar/should_compile/T13290.hs | 7 ++++++ .../tests/deSugar/should_compile/T13290.stderr | 4 ++++ testsuite/tests/deSugar/should_compile/all.T | 1 + testsuite/tests/simplCore/should_run/T12689.hs | 26 --------------------- testsuite/tests/simplCore/should_run/T12689.stdout | 7 ------ testsuite/tests/simplCore/should_run/all.T | 1 - 9 files changed, 50 insertions(+), 37 deletions(-) diff --git a/compiler/deSugar/DsBinds.hs b/compiler/deSugar/DsBinds.hs index 0b115cb..0d96692 100644 --- a/compiler/deSugar/DsBinds.hs +++ b/compiler/deSugar/DsBinds.hs @@ -837,13 +837,15 @@ decomposeRuleLhs :: [Var] -> CoreExpr -> Either SDoc ([Var], Id, [CoreExpr]) -- The 'bndrs' are the quantified binders of the rules, but decomposeRuleLhs -- may add some extra dictionary binders (see Note [Free dictionaries]) -- --- Returns Nothing if the LHS isn't of the expected shape +-- Returns an error message if the LHS isn't of the expected shape -- Note [Decomposing the left-hand side of a RULE] decomposeRuleLhs orig_bndrs orig_lhs | not (null unbound) -- Check for things unbound on LHS -- See Note [Unused spec binders] = Left (vcat (map dead_msg unbound)) - + | Var funId <- fun2 + , Just con <- isDataConId_maybe funId + = Left (constructor_msg con) -- See Note [No RULES on datacons] | Just (fn_id, args) <- decompose fun2 args2 , let extra_bndrs = mk_extra_bndrs fn_id args = -- pprTrace "decmposeRuleLhs" (vcat [ text "orig_bndrs:" <+> ppr orig_bndrs @@ -899,6 +901,11 @@ decomposeRuleLhs orig_bndrs orig_lhs | Just pred <- evVarPred_maybe bndr = text "constraint" <+> quotes (ppr pred) | otherwise = text "variable" <+> quotes (ppr bndr) + constructor_msg con = vcat + [ text "A constructor," <+> ppr con <> + text ", appears as outermost match in RULE lhs." + , text "This rule will be ignored." ] + drop_dicts :: CoreExpr -> CoreExpr drop_dicts e = wrap_lets needed bnds body @@ -1087,6 +1094,22 @@ the constraint is unused. We could bind 'd' to (error "unused") but it seems better to reject the program because it's almost certainly a mistake. That's what the isDeadBinder call detects. +Note [No RULES on datacons] +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Previously, `RULES` like + + "JustNothing" forall x . Just x = Nothing + +were allowed. Simon Peyton Jones says this seems to have been a +mistake, that such rules have never been supported intentionally, +and that he doesn't know if they can break in horrible ways. +Furthermore, Ben Gamari and Reid Barton are considering trying to +detect the presence of "static data" that the simplifier doesn't +need to traverse at all. Such rules do not play well with that. +So for now, we ban them altogether as requested by #13290. See also #7398. + + ************************************************************************ * * Desugaring evidence diff --git a/docs/users_guide/8.2.1-notes.rst b/docs/users_guide/8.2.1-notes.rst index 9a222e6..b3dd2de 100644 --- a/docs/users_guide/8.2.1-notes.rst +++ b/docs/users_guide/8.2.1-notes.rst @@ -157,6 +157,16 @@ Compiler - The :ghc-flag:`-XExtendedDefaultRules` extension now defaults multi-parameter typeclasses. See :ghc-ticket:`12923`. +- GHC now ignores ``RULES`` for data constructors (:ghc-ticket:`13290`). + Previously, it accepted:: + + "NotAllowed" forall x. Just x = e + + That rule will no longer take effect, and a warning will be issued. ``RULES`` + may still mention data constructors, but not in the outermost position:: + + "StillWorks" forall x. f (Just x) = e + GHCi ~~~~ diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 6ba6935..205e12a 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -13268,9 +13268,11 @@ From a syntactic point of view: "wrong1" forall e1 e2. case True of { True -> e1; False -> e2 } = e1 "wrong2" forall f. f True = True + "wrong3" forall x. Just x = Nothing In ``"wrong1"``, the LHS is not an application; in ``"wrong2"``, the - LHS has a pattern variable in the head. + LHS has a pattern variable in the head. In ``"wrong3"``, the LHS consists + of a *constructor*, rather than a *variable*, applied to an argument. - A rule does not need to be in the same module as (any of) the variables it mentions, though of course they need to be in scope. diff --git a/testsuite/tests/deSugar/should_compile/T13290.hs b/testsuite/tests/deSugar/should_compile/T13290.hs new file mode 100644 index 0000000..9c72225 --- /dev/null +++ b/testsuite/tests/deSugar/should_compile/T13290.hs @@ -0,0 +1,7 @@ +module T13290 where + +data Foo = Bar Int Char | Baz Char + +{-# RULES +"BarBaz" Bar 0 'a' = Baz 'b' + #-} diff --git a/testsuite/tests/deSugar/should_compile/T13290.stderr b/testsuite/tests/deSugar/should_compile/T13290.stderr new file mode 100644 index 0000000..dd5bcee --- /dev/null +++ b/testsuite/tests/deSugar/should_compile/T13290.stderr @@ -0,0 +1,4 @@ + +T13290.hs:6:1: warning: + A constructor, Bar, appears as outermost match in RULE lhs. + This rule will be ignored. diff --git a/testsuite/tests/deSugar/should_compile/all.T b/testsuite/tests/deSugar/should_compile/all.T index 24b95a0..7694fb9 100644 --- a/testsuite/tests/deSugar/should_compile/all.T +++ b/testsuite/tests/deSugar/should_compile/all.T @@ -96,3 +96,4 @@ test('T12944', normal, compile, ['']) test('T12950', normal, compile, ['']) test('T13043', normal, compile, ['']) test('T13215', normal, compile, ['']) +test('T13290', normal, compile, ['']) diff --git a/testsuite/tests/simplCore/should_run/T12689.hs b/testsuite/tests/simplCore/should_run/T12689.hs deleted file mode 100644 index 84a5419..0000000 --- a/testsuite/tests/simplCore/should_run/T12689.hs +++ /dev/null @@ -1,26 +0,0 @@ -data T1 = MkT1Bad | MkT1Good deriving Show -data T2 = MkT2Bad Int | MkT2Good Int deriving Show -data T3 = MkT3Bad {-# UNPACK #-} !Int | MkT3Good {-# UNPACK #-} !Int deriving Show -data T4 = MkT4Bad Int | MkT4Good Int deriving Show -data T5 = MkT5Bad {-# UNPACK #-} !Int | MkT5Good {-# UNPACK #-} !Int deriving Show - -{-# RULES - -"T1" MkT1Bad = MkT1Good -"T2" forall x. MkT2Bad x = MkT2Good x -"T3" forall x. MkT3Bad x = MkT3Good x -"T4" MkT4Bad = MkT4Good -"T5" MkT5Bad = MkT5Good - #-} - -app = id -{-# NOINLINE app #-} - -main = do - print MkT1Bad - print (MkT2Bad 42) - print (MkT3Bad 42) - print (MkT4Bad 42) - print (app MkT4Bad 42) - print (MkT5Bad 42) - print (app MkT5Bad 42) diff --git a/testsuite/tests/simplCore/should_run/T12689.stdout b/testsuite/tests/simplCore/should_run/T12689.stdout deleted file mode 100644 index 7e9baf3..0000000 --- a/testsuite/tests/simplCore/should_run/T12689.stdout +++ /dev/null @@ -1,7 +0,0 @@ -MkT1Good -MkT2Good 42 -MkT3Good 42 -MkT4Good 42 -MkT4Good 42 -MkT5Good 42 -MkT5Good 42 diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T index 702d83c..9317b8b 100644 --- a/testsuite/tests/simplCore/should_run/all.T +++ b/testsuite/tests/simplCore/should_run/all.T @@ -68,7 +68,6 @@ test('T10830', extra_run_opts('+RTS -K100k -RTS'), compile_and_run, ['']) test('T11172', normal, compile_and_run, ['']) test('T11731', normal, compile_and_run, ['-fspec-constr']) test('T7611', normal, compile_and_run, ['']) -test('T12689', normal, compile_and_run, ['']) test('T12689broken', expect_broken(12689), compile_and_run, ['']) test('T12689a', normal, compile_and_run, ['']) From git at git.haskell.org Thu Mar 2 21:05:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 21:05:19 +0000 (UTC) Subject: [commit: ghc] master: Extend Windows runtime loader libsearch (f56fc7f) Message-ID: <20170302210519.DCDE03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f56fc7f7fe72f96348d663a83f736c4c8b12b08b/ghc >--------------------------------------------------------------- commit f56fc7f7fe72f96348d663a83f736c4c8b12b08b Author: Tamar Christina Date: Thu Mar 2 15:14:34 2017 -0500 Extend Windows runtime loader libsearch This adds `.obj` extension to the list of valid object file (we really shouldn't be using extensions but instead trying to read the file and see if the header makes sense.). Microsoft compilers use .obj instead of .o for object files. This also adds support to finding static archives when the "lib" prefix is already in the filename. e.g. `-llibfoo` to find `libfoo.a`. This is inline with binutils. Test Plan: ./validate Reviewers: simonmar, erikd, bgamari, hvr, austin Reviewed By: bgamari Subscribers: RyanGlScott, thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D3082 >--------------------------------------------------------------- f56fc7f7fe72f96348d663a83f736c4c8b12b08b compiler/ghci/Linker.hs | 11 +++++++---- rts/linker/LoadArchive.c | 5 ++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs index ebd27b0..49f57e5 100644 --- a/compiler/ghci/Linker.hs +++ b/compiler/ghci/Linker.hs @@ -1364,7 +1364,9 @@ locateLib hsc_env is_hs dirs lib obj_file = lib <.> "o" dyn_obj_file = lib <.> "dyn_o" - arch_file = "lib" ++ lib ++ lib_tag <.> "a" + arch_files = [ "lib" ++ lib ++ lib_tag <.> "a" + , lib <.> "a" -- native code has no lib_tag + ] lib_tag = if is_hs && loading_profiled_hs_libs then "_p" else "" loading_profiled_hs_libs = interpreterProfiled dflags @@ -1385,9 +1387,10 @@ locateLib hsc_env is_hs dirs lib findObject = liftM (fmap Object) $ findFile dirs obj_file findDynObject = liftM (fmap Object) $ findFile dirs dyn_obj_file - findArchive = let local = liftM (fmap Archive) $ findFile dirs arch_file - linked = liftM (fmap Archive) $ searchForLibUsingGcc dflags arch_file dirs - in liftM2 (<|>) local linked + findArchive = let local name = liftM (fmap Archive) $ findFile dirs name + linked name = liftM (fmap Archive) $ searchForLibUsingGcc dflags name dirs + check name = apply [local name, linked name] + in apply (map check arch_files) findHSDll = liftM (fmap DLLPath) $ findFile dirs hs_dyn_lib_file findDll = liftM (fmap DLLPath) $ findFile dirs dyn_lib_file findSysDll = fmap (fmap $ DLL . dropExtension . takeFileName) $ findSystemLibrary hsc_env so_name diff --git a/rts/linker/LoadArchive.c b/rts/linker/LoadArchive.c index 7d9dc22..62922a7 100644 --- a/rts/linker/LoadArchive.c +++ b/rts/linker/LoadArchive.c @@ -457,8 +457,11 @@ static HsInt loadArchive_ (pathchar *path) DEBUG_LOG("Found member file `%s'\n", fileName); + /* TODO: Stop relying on file extensions to determine input formats. + Instead try to match file headers. See Trac #13103. */ isObject = (thisFileNameSize >= 2 && strncmp(fileName + thisFileNameSize - 2, ".o" , 2) == 0) - || (thisFileNameSize >= 4 && strncmp(fileName + thisFileNameSize - 4, ".p_o", 4) == 0); + || (thisFileNameSize >= 4 && strncmp(fileName + thisFileNameSize - 4, ".p_o", 4) == 0) + || (thisFileNameSize >= 4 && strncmp(fileName + thisFileNameSize - 4, ".obj", 4) == 0); #if defined(OBJFORMAT_PEi386) /* From git at git.haskell.org Thu Mar 2 23:59:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 23:59:18 +0000 (UTC) Subject: [commit: ghc] master: More comments on role subtyping, unsoundness fix. (4aada7a) Message-ID: <20170302235918.2A97F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4aada7a6c13752652cfce5e04f015a8909553917/ghc >--------------------------------------------------------------- commit 4aada7a6c13752652cfce5e04f015a8909553917 Author: Edward Z. Yang Date: Sun Feb 26 20:15:30 2017 -0800 More comments on role subtyping, unsoundness fix. Summary: - We incorrectly allowed subroling on injective data in some cases. There is now a test to check for this case, and a Note. - More commentary on how the subtyping with roles works. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: goldfire, austin, simonpj, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3222 >--------------------------------------------------------------- 4aada7a6c13752652cfce5e04f015a8909553917 compiler/typecheck/TcRnDriver.hs | 55 +++++++++++++++++++++- testsuite/tests/backpack/should_fail/all.T | 2 + testsuite/tests/backpack/should_fail/bkpfail44.bkp | 10 ++++ .../tests/backpack/should_fail/bkpfail44.stderr | 23 +++++++++ testsuite/tests/backpack/should_fail/bkpfail45.bkp | 23 +++++++++ .../tests/backpack/should_fail/bkpfail45.stderr | 22 +++++++++ 6 files changed, 134 insertions(+), 1 deletion(-) 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 4aada7a6c13752652cfce5e04f015a8909553917 From git at git.haskell.org Thu Mar 2 23:59:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 23:59:21 +0000 (UTC) Subject: [commit: ghc] master: Disallow non-nullary constraint synonyms on class. (984c609) Message-ID: <20170302235921.C6F703A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/984c6097c63096d10789f6eb6da6f6656195cdaf/ghc >--------------------------------------------------------------- commit 984c6097c63096d10789f6eb6da6f6656195cdaf Author: Edward Z. Yang Date: Mon Feb 27 15:52:27 2017 -0800 Disallow non-nullary constraint synonyms on class. Test Plan: validate Reviewers: simonpj, bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3230 >--------------------------------------------------------------- 984c6097c63096d10789f6eb6da6f6656195cdaf compiler/typecheck/TcRnDriver.hs | 143 +++++++++++---------- testsuite/tests/backpack/should_compile/bkp39.bkp | 6 +- testsuite/tests/backpack/should_fail/all.T | 1 + .../bkp39.bkp => should_fail/bkpfail46.bkp} | 5 +- .../tests/backpack/should_fail/bkpfail46.stderr | 20 +++ 5 files changed, 97 insertions(+), 78 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 984c6097c63096d10789f6eb6da6f6656195cdaf From git at git.haskell.org Thu Mar 2 23:59:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 23:59:24 +0000 (UTC) Subject: [commit: ghc] master: Injective type families imply nominal injectivity, but NOT rep inj (e710686) Message-ID: <20170302235924.841673A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e71068617d15b0fea65fe24e20c0ab0db9fc660f/ghc >--------------------------------------------------------------- commit e71068617d15b0fea65fe24e20c0ab0db9fc660f Author: Edward Z. Yang Date: Sun Feb 26 21:10:15 2017 -0800 Injective type families imply nominal injectivity, but NOT rep inj Test Plan: validate Reviewers: simonpj, austin, jstolarek, bgamari, goldfire Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3223 >--------------------------------------------------------------- e71068617d15b0fea65fe24e20c0ab0db9fc660f compiler/types/TyCon.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs index f98da7b..99a20af 100644 --- a/compiler/types/TyCon.hs +++ b/compiler/types/TyCon.hs @@ -1652,7 +1652,7 @@ isInjectiveTyCon (AlgTyCon {algTcRhs = rhs}) Representational isInjectiveTyCon (SynonymTyCon {}) _ = False isInjectiveTyCon (FamilyTyCon { famTcFlav = DataFamilyTyCon _ }) Nominal = True -isInjectiveTyCon (FamilyTyCon { famTcInj = Injective inj }) _ = and inj +isInjectiveTyCon (FamilyTyCon { famTcInj = Injective inj }) Nominal = and inj isInjectiveTyCon (FamilyTyCon {}) _ = False isInjectiveTyCon (PrimTyCon {}) _ = True isInjectiveTyCon (PromotedDataCon {}) _ = True From git at git.haskell.org Thu Mar 2 23:59:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 23:59:34 +0000 (UTC) Subject: [commit: ghc] master: Typofix. (57ef18a) Message-ID: <20170302235934.446783A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/57ef18a291587999f695e28aa0cdc007d63054c5/ghc >--------------------------------------------------------------- commit 57ef18a291587999f695e28aa0cdc007d63054c5 Author: Edward Z. Yang Date: Wed Mar 1 14:21:48 2017 -0800 Typofix. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 57ef18a291587999f695e28aa0cdc007d63054c5 compiler/typecheck/TcValidity.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/TcValidity.hs b/compiler/typecheck/TcValidity.hs index 4a56bbe..12d4158 100644 --- a/compiler/typecheck/TcValidity.hs +++ b/compiler/typecheck/TcValidity.hs @@ -658,7 +658,7 @@ applying the instance decl would show up two uses of ?x. Trac #8912. -} checkValidTheta :: UserTypeCtxt -> ThetaType -> TcM () --- Assumes arguemt is fully zonked +-- Assumes argument is fully zonked checkValidTheta ctxt theta = do { env <- tcInitOpenTidyEnv (tyCoVarsOfTypesList theta) ; addErrCtxtM (checkThetaCtxt ctxt theta) $ From git at git.haskell.org Thu Mar 2 23:59:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 23:59:28 +0000 (UTC) Subject: [commit: ghc] master: Prevent users from defining instances for abstract classes. (bba004f) Message-ID: <20170302235928.14FC13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bba004f2a0642d3bb8c8876543aaa1a48a2f9a43/ghc >--------------------------------------------------------------- commit bba004f2a0642d3bb8c8876543aaa1a48a2f9a43 Author: Edward Z. Yang Date: Wed Mar 1 00:11:43 2017 -0800 Prevent users from defining instances for abstract classes. Summary: Fixes #13068. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3254 >--------------------------------------------------------------- bba004f2a0642d3bb8c8876543aaa1a48a2f9a43 compiler/typecheck/TcInstDcls.hs | 8 ++++++++ compiler/types/Class.hs | 5 +++++ testsuite/tests/typecheck/should_fail/T13068.hs | 4 ++++ testsuite/tests/typecheck/should_fail/T13068.hs-boot | 2 ++ testsuite/tests/typecheck/should_fail/T13068.stderr | 6 ++++++ testsuite/tests/typecheck/should_fail/T13068a.hs | 3 +++ testsuite/tests/typecheck/should_fail/T13068m.hs | 2 ++ testsuite/tests/typecheck/should_fail/all.T | 1 + 8 files changed, 31 insertions(+) diff --git a/compiler/typecheck/TcInstDcls.hs b/compiler/typecheck/TcInstDcls.hs index 95d33dd..76d963d 100644 --- a/compiler/typecheck/TcInstDcls.hs +++ b/compiler/typecheck/TcInstDcls.hs @@ -520,6 +520,10 @@ doClsInstErrorChecks inst_info -- In hs-boot files there should be no bindings ; failIfTc (is_boot && not no_binds) badBootDeclErr + -- If not in an hs-boot file, abstract classes cannot have + -- instances declared + ; failIfTc (not is_boot && isAbstractClass clas) abstractClassInstErr + -- Handwritten instances of any rejected -- class is always forbidden -- #12837 @@ -535,12 +539,16 @@ doClsInstErrorChecks inst_info binds = iBinds inst_info no_binds = isEmptyLHsBinds (ib_binds binds) && null (ib_pragmas binds) clas_nm = is_cls_nm ispec + clas = is_cls ispec gen_inst_err = hang (text ("Generic instances can only be " ++ "derived in Safe Haskell.") $+$ text "Replace the following instance:") 2 (pprInstanceHdr ispec) + abstractClassInstErr = + text "Cannot define instance for abstract class" <+> quotes (ppr clas_nm) + -- Report an error or a warning for certain class instances. -- If we are working on an .hs-boot file, we just report a warning, -- and ignore the instance. We do this, to give users a chance to fix diff --git a/compiler/types/Class.hs b/compiler/types/Class.hs index cd9f8de..ecc7e2e 100644 --- a/compiler/types/Class.hs +++ b/compiler/types/Class.hs @@ -18,6 +18,7 @@ module Class ( classKey, className, classATs, classATItems, classTyCon, classMethods, classOpItems, classBigSig, classExtraBigSig, classTvsFds, classSCTheta, classAllSelIds, classSCSelId, classMinimalDef, classHasFds, + isAbstractClass, naturallyCoherentClass ) where @@ -302,6 +303,10 @@ classExtraBigSig (Class {classTyVars = tyvars, classFunDeps = fundeps, }}) = (tyvars, fundeps, sc_theta, sc_sels, ats, op_stuff) +isAbstractClass :: Class -> Bool +isAbstractClass Class{ classBody = AbstractClass } = True +isAbstractClass _ = False + -- | If a class is "naturally coherent", then we needn't worry at all, in any -- way, about overlapping/incoherent instances. Just solve the thing! naturallyCoherentClass :: Class -> Bool diff --git a/testsuite/tests/typecheck/should_fail/T13068.hs b/testsuite/tests/typecheck/should_fail/T13068.hs new file mode 100644 index 0000000..e0b8f57 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13068.hs @@ -0,0 +1,4 @@ +module T13068 where +import T13068a +class C a where + f :: a diff --git a/testsuite/tests/typecheck/should_fail/T13068.hs-boot b/testsuite/tests/typecheck/should_fail/T13068.hs-boot new file mode 100644 index 0000000..b23b752 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13068.hs-boot @@ -0,0 +1,2 @@ +module T13068 where +class C a diff --git a/testsuite/tests/typecheck/should_fail/T13068.stderr b/testsuite/tests/typecheck/should_fail/T13068.stderr new file mode 100644 index 0000000..c161209 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13068.stderr @@ -0,0 +1,6 @@ +[1 of 4] Compiling T13068[boot] ( T13068.hs-boot, T13068.o-boot ) +[2 of 4] Compiling T13068a ( T13068a.hs, T13068a.o ) + +T13068a.hs:3:1: error: + • Cannot define instance for abstract class ‘C’ + • In the instance declaration for ‘C Int’ diff --git a/testsuite/tests/typecheck/should_fail/T13068a.hs b/testsuite/tests/typecheck/should_fail/T13068a.hs new file mode 100644 index 0000000..fb7bda6 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13068a.hs @@ -0,0 +1,3 @@ +module T13068a where +import {-# SOURCE #-} T13068 +instance C Int where diff --git a/testsuite/tests/typecheck/should_fail/T13068m.hs b/testsuite/tests/typecheck/should_fail/T13068m.hs new file mode 100644 index 0000000..3effc0a --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13068m.hs @@ -0,0 +1,2 @@ +import T13068 +main = print (f :: Int) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 86334ba..2d1d12b 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -424,6 +424,7 @@ test('T12918b', normal, compile_fail, ['']) test('T12921', normal, compile_fail, ['']) test('T12973', normal, compile_fail, ['']) test('StrictBinds', normal, compile_fail, ['']) +test('T13068', [extra_files(['T13068.hs', 'T13068a.hs', 'T13068.hs-boot', 'T13068m.hs'])], multimod_compile_fail, ['T13068m', '']) test('T13105', normal, compile_fail, ['']) test('LevPolyBounded', normal, compile_fail, ['']) test('T13292', normal, multimod_compile, ['T13292', '-v0 -fdefer-type-errors']) From git at git.haskell.org Thu Mar 2 23:59:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 23:59:31 +0000 (UTC) Subject: [commit: ghc] master: Properly represent abstract classes in Class and IfaceDecl (fb5cd9d) Message-ID: <20170302235931.892CF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fb5cd9d6d6185afe6d4ef2f3df3f895b6d0abf4c/ghc >--------------------------------------------------------------- commit fb5cd9d6d6185afe6d4ef2f3df3f895b6d0abf4c Author: Edward Z. Yang Date: Mon Feb 27 23:48:30 2017 -0800 Properly represent abstract classes in Class and IfaceDecl Summary: Previously, abstract classes looked very much like normal classes, except that they happened to have no methods, superclasses or ATs, and they came from boot files. This patch gives abstract classes a proper representation in Class and IfaceDecl, by moving the things which are never defined for abstract classes into ClassBody/IfaceClassBody. Because Class is abstract, this change had ~no disruption to any of the code in GHC; if you ask about the methods of an abstract class, we'll just give you an empty list. This also fixes a bug where abstract type classes were incorrectly treated as representationally injective (they're not!) Fixes #13347, and a TODO in the code. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: simonpj, bgamari, austin Subscribers: goldfire, thomie Differential Revision: https://phabricator.haskell.org/D3236 >--------------------------------------------------------------- fb5cd9d6d6185afe6d4ef2f3df3f895b6d0abf4c compiler/backpack/RnModIface.hs | 18 +-- compiler/iface/BuildTyCl.hs | 39 +++++-- compiler/iface/IfaceSyn.hs | 129 ++++++++++++++++----- compiler/iface/MkIface.hs | 20 ++-- compiler/iface/TcIface.hs | 50 +++++--- compiler/typecheck/TcRnDriver.hs | 23 +--- compiler/typecheck/TcTyClsDecls.hs | 13 ++- compiler/types/Class.hs | 116 +++++++++++++----- compiler/vectorise/Vectorise/Type/TyConDecl.hs | 9 +- testsuite/tests/typecheck/should_compile/Makefile | 6 + testsuite/tests/typecheck/should_compile/Tc271.hs | 10 ++ .../tests/typecheck/should_compile/Tc271.hs-boot | 5 + testsuite/tests/typecheck/should_compile/Tc271a.hs | 5 + testsuite/tests/typecheck/should_compile/all.T | 1 + 14 files changed, 315 insertions(+), 129 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 fb5cd9d6d6185afe6d4ef2f3df3f895b6d0abf4c From git at git.haskell.org Thu Mar 2 23:59:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Mar 2017 23:59:37 +0000 (UTC) Subject: [commit: ghc] master: Fix roles merging to apply only to non-rep-injective types. (df919fb) Message-ID: <20170302235937.B9F2C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/df919fb21c951c1892bd96d9e6306ce1bec3daa9/ghc >--------------------------------------------------------------- commit df919fb21c951c1892bd96d9e6306ce1bec3daa9 Author: Edward Z. Yang Date: Tue Feb 28 23:55:00 2017 -0800 Fix roles merging to apply only to non-rep-injective types. Test Plan: validate Reviewers: simonpj Subscribers: >--------------------------------------------------------------- df919fb21c951c1892bd96d9e6306ce1bec3daa9 compiler/iface/TcIface.hs | 49 +++++++++++++++++++++- testsuite/tests/backpack/should_compile/all.T | 1 + testsuite/tests/backpack/should_compile/bkp53.bkp | 22 ++++++++++ .../should_compile/{bkp45.stderr => bkp53.stderr} | 2 +- testsuite/tests/backpack/should_fail/all.T | 1 + testsuite/tests/backpack/should_fail/bkpfail47.bkp | 12 ++++++ .../{bkpfail38.stderr => bkpfail47.stderr} | 13 ++++-- 7 files changed, 93 insertions(+), 7 deletions(-) diff --git a/compiler/iface/TcIface.hs b/compiler/iface/TcIface.hs index 0363c9e..2a56392 100644 --- a/compiler/iface/TcIface.hs +++ b/compiler/iface/TcIface.hs @@ -235,20 +235,65 @@ mergeIfaceDecl d1 d2 ifSigs = ops, ifMinDef = BF.mkOr [noLoc bf1, noLoc bf2] } - } + } `withRolesFrom` d2 -- It doesn't matter; we'll check for consistency later when -- we merge, see 'mergeSignatures' - | otherwise = d1 + | otherwise = d1 `withRolesFrom` d2 + +-- Note [Role merging] +-- ~~~~~~~~~~~~~~~~~~~ +-- First, why might it be necessary to do a non-trivial role +-- merge? It may rescue a merge that might otherwise fail: +-- +-- signature A where +-- type role T nominal representational +-- data T a b +-- +-- signature A where +-- type role T representational nominal +-- data T a b +-- +-- A module that defines T as representational in both arguments +-- would successfully fill both signatures, so it would be better +-- if if we merged the roles of these types in some nontrivial +-- way. +-- +-- However, we have to be very careful about how we go about +-- doing this, because role subtyping is *conditional* on +-- the supertype being NOT representationally injective, e.g., +-- if we have instead: +-- +-- signature A where +-- type role T nominal representational +-- data T a b = T a b +-- +-- signature A where +-- type role T representational nominal +-- data T a b = T a b +-- +-- Should we merge the definitions of T so that the roles are R/R (or N/N)? +-- Absolutely not: neither resulting type is a subtype of the original +-- types (see Note [Role subtyping]), because data is not representationally +-- injective. +-- +-- Thus, merging only occurs when BOTH TyCons in question are +-- representationally injective. If they're not, no merge. withRolesFrom :: IfaceDecl -> IfaceDecl -> IfaceDecl d1 `withRolesFrom` d2 | Just roles1 <- ifMaybeRoles d1 , Just roles2 <- ifMaybeRoles d2 + , not (isRepInjectiveIfaceDecl d1 || isRepInjectiveIfaceDecl d2) = d1 { ifRoles = mergeRoles roles1 roles2 } | otherwise = d1 where mergeRoles roles1 roles2 = zipWith max roles1 roles2 +isRepInjectiveIfaceDecl :: IfaceDecl -> Bool +isRepInjectiveIfaceDecl IfaceData{ ifCons = IfDataTyCon _ } = True +isRepInjectiveIfaceDecl IfaceFamily{ ifFamFlav = IfaceDataFamilyTyCon } = True +isRepInjectiveIfaceDecl _ = False + mergeIfaceClassOp :: IfaceClassOp -> IfaceClassOp -> IfaceClassOp mergeIfaceClassOp op1@(IfaceClassOp _ _ (Just _)) _ = op1 mergeIfaceClassOp _ op2 = op2 diff --git a/testsuite/tests/backpack/should_compile/all.T b/testsuite/tests/backpack/should_compile/all.T index 1d0c95e..477c0fe 100644 --- a/testsuite/tests/backpack/should_compile/all.T +++ b/testsuite/tests/backpack/should_compile/all.T @@ -44,6 +44,7 @@ test('bkp49', normal, backpack_compile, ['']) test('bkp50', normal, backpack_compile, ['']) test('bkp51', normal, backpack_compile, ['']) test('bkp52', normal, backpack_compile, ['']) +test('bkp53', normal, backpack_compile, ['']) test('T13140', normal, backpack_compile, ['']) test('T13149', expect_broken(13149), backpack_compile, ['']) diff --git a/testsuite/tests/backpack/should_compile/bkp53.bkp b/testsuite/tests/backpack/should_compile/bkp53.bkp new file mode 100644 index 0000000..aa1dc53 --- /dev/null +++ b/testsuite/tests/backpack/should_compile/bkp53.bkp @@ -0,0 +1,22 @@ +{-# LANGUAGE RoleAnnotations #-} +-- Role merging test +unit p where + signature A where + type role T nominal representational + data T a b + newtype S a b = MkS (T a b) +unit q where + signature A where + type role T representational nominal + data T a b + newtype S a b = MkS (T a b) +unit r where + dependency p[A=] + dependency q[A=] + module M where + import A + import Data.Coerce + f :: (Coercible a1 a2, Coercible b1 b2) => T a1 b1 -> T a2 b2 + f = coerce + g :: (Coercible a1 a2, Coercible b1 b2) => S a1 b1 -> S a2 b2 + g = coerce diff --git a/testsuite/tests/backpack/should_compile/bkp45.stderr b/testsuite/tests/backpack/should_compile/bkp53.stderr similarity index 80% copy from testsuite/tests/backpack/should_compile/bkp45.stderr copy to testsuite/tests/backpack/should_compile/bkp53.stderr index 4a6f1d6..a2b1945 100644 --- a/testsuite/tests/backpack/should_compile/bkp45.stderr +++ b/testsuite/tests/backpack/should_compile/bkp53.stderr @@ -4,4 +4,4 @@ [1 of 1] Compiling A[sig] ( q/A.hsig, nothing ) [3 of 3] Processing r [1 of 2] Compiling A[sig] ( r/A.hsig, nothing ) - [2 of 2] Compiling B ( r/B.hs, nothing ) + [2 of 2] Compiling M ( r/M.hs, nothing ) diff --git a/testsuite/tests/backpack/should_fail/all.T b/testsuite/tests/backpack/should_fail/all.T index 82b4e68..e1416fc 100644 --- a/testsuite/tests/backpack/should_fail/all.T +++ b/testsuite/tests/backpack/should_fail/all.T @@ -42,3 +42,4 @@ test('bkpfail43', normal, backpack_compile_fail, ['']) test('bkpfail44', normal, backpack_compile_fail, ['']) test('bkpfail45', normal, backpack_compile_fail, ['']) test('bkpfail46', normal, backpack_compile_fail, ['']) +test('bkpfail47', normal, backpack_compile_fail, ['']) diff --git a/testsuite/tests/backpack/should_fail/bkpfail47.bkp b/testsuite/tests/backpack/should_fail/bkpfail47.bkp new file mode 100644 index 0000000..b8d4ae6 --- /dev/null +++ b/testsuite/tests/backpack/should_fail/bkpfail47.bkp @@ -0,0 +1,12 @@ +{-# LANGUAGE RoleAnnotations #-} +unit p where + signature A where + type role T nominal representational + data T a b +unit q where + signature A where + type role T representational nominal + data T a b = MkT +unit r where + dependency p[A=] + dependency q[A=] diff --git a/testsuite/tests/backpack/should_fail/bkpfail38.stderr b/testsuite/tests/backpack/should_fail/bkpfail47.stderr similarity index 50% copy from testsuite/tests/backpack/should_fail/bkpfail38.stderr copy to testsuite/tests/backpack/should_fail/bkpfail47.stderr index df4a1d0..b2bc08b 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail38.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail47.stderr @@ -5,11 +5,16 @@ [3 of 3] Processing r [1 of 1] Compiling A[sig] ( r/A.hsig, nothing ) -bkpfail38.bkp:8:9: error: - • Identifier ‘op’ has conflicting fixities in the module +bkpfail47.bkp:9:9: error: + • Type constructor ‘T’ has conflicting definitions in the module and its hsig file - Main module: infixr 4 - Hsig file: infixr 6 + Main module: type role T representational nominal + data T a b = MkT + Hsig file: type role T nominal representational + data T a b + The roles are not compatible: + Main module: [representational, nominal] + Hsig file: [nominal, representational] • while merging the signatures from: • p[A=]:A • q[A=]:A From git at git.haskell.org Fri Mar 3 00:02:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 00:02:13 +0000 (UTC) Subject: [commit: ghc] master: Fix T12234 stat mistakes (57d969e) Message-ID: <20170303000213.14C283A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/57d969ec9bea8ca44e735845e9aa91292fe5e75b/ghc >--------------------------------------------------------------- commit 57d969ec9bea8ca44e735845e9aa91292fe5e75b Author: David Feuer Date: Thu Mar 2 19:02:02 2017 -0500 Fix T12234 stat mistakes I goofed up updating the expected and recent historical results here. They should be right now. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3264 >--------------------------------------------------------------- 57d969ec9bea8ca44e735845e9aa91292fe5e75b testsuite/tests/perf/compiler/all.T | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 6b89961..fa63910 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -977,7 +977,7 @@ test('T12234', [ only_ways(['optasm']), compiler_stats_num_field('bytes allocated', [(platform('x86_64-unknown-mingw32'), 89180624, 5), - # initial: 89180624 + # initial: 83032768 # 2017-02-19 89180624 (x64/Windows) - Unknown (wordsize(64), 80245640, 5), # initial: 72958288 @@ -985,8 +985,7 @@ test('T12234', # 2017-02-01: 80882208 (Use superclass instances when solving) # 2017-02-05: 74374440 (Probably OccAnal fixes) # 2017-02-17: 86525344 (Type-indexed Typeable) - # 2017-02-25: 80245640 (Early inline patch) - # 2017-03-01: 84750072 (Unclear. Possibly catch# signature change.) + # 2017-02-25: 83032768 (Early inline patch) ]), ], compile, From git at git.haskell.org Fri Mar 3 00:58:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 00:58:24 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Move echoing commands in make invocations to VERBOSE=5 (6421c6f) Message-ID: <20170303005824.C9EE83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6421c6f2bb56bcdf2415e8556180821eedd77d2d/ghc >--------------------------------------------------------------- commit 6421c6f2bb56bcdf2415e8556180821eedd77d2d Author: Reid Barton Date: Thu Mar 2 16:39:16 2017 -0500 testsuite: Move echoing commands in make invocations to VERBOSE=5 D2894 added a new verbosity level VERBOSE=4 to strip -s/--silent flags from make invocations in test commands. This will probably cause the test to fail of course, but is useful for seeing what a test that's already failing is doing. However there was already an undocumented meaning of VERBOSE=4, added in commit cfeededf, that causes the results of performance tests to be printed unconditionally (even when they are within the expected range). nomeata's ghc builder uses these figures to collect historical data on performance test figures. The new meaning of VERBOSE=4 added in D2894 means that any test that uses make now fails on the builder. This commit moves the new behavior of D2894 to the level VERBOSE=5 so that nomeata's ghc builder again produces useful results on failing tests. It also adds documentation for both settings. Test Plan: did some manual testing Reviewers: austin, bgamari, Phyx, nomeata Reviewed By: bgamari, Phyx Subscribers: nomeata, thomie, Phyx Differential Revision: https://phabricator.haskell.org/D3141 >--------------------------------------------------------------- 6421c6f2bb56bcdf2415e8556180821eedd77d2d testsuite/README.md | 4 +++- testsuite/driver/runtests.py | 4 ++-- testsuite/driver/testlib.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/testsuite/README.md b/testsuite/README.md index 31193d6..5ab6daf 100644 --- a/testsuite/README.md +++ b/testsuite/README.md @@ -18,7 +18,9 @@ Commands to run testsuite: * Skip performance tests: `make SKIP_PERF_TESTS=YES` * Set verbosity: `make VERBOSE=n` where n=0: No per-test ouput, n=1: Only failures, - n=2: Progress output, n=3: Include commands called (default) + n=2: Progress output, n=3: Include commands called (default), + n=4: Include perf test results unconditionally, + n=5: Echo commands in subsidiary make invocations * Pass in extra GHC options: `make EXTRA_HC_OPTS=-fvectorize` You can also change directory to a specific test folder to run that diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index df85fa1..7e4f375 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -111,8 +111,8 @@ for opt,arg in opts: config.skip_perf_tests = True if opt == '--verbose': - if arg not in ["0","1","2","3","4"]: - sys.stderr.write("ERROR: requested verbosity %s not supported, use 0,1,2,3 or 4" % arg) + if arg not in ["0","1","2","3","4","5"]: + sys.stderr.write("ERROR: requested verbosity %s not supported, use 0,1,2,3,4 or 5" % arg) sys.exit(1) config.verbose = int(arg) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 44d1ccb..7dedb33 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -872,7 +872,7 @@ def do_test(name, way, func, args, files): # if found and instead have the testsuite decide on what to do # with the output. def override_options(pre_cmd): - if config.verbose >= 4 and bool(re.match('\$make', pre_cmd, re.I)): + if config.verbose >= 5 and bool(re.match('\$make', pre_cmd, re.I)): return pre_cmd.replace('-s' , '') \ .replace('--silent', '') \ .replace('--quiet' , '') From git at git.haskell.org Fri Mar 3 00:58:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 00:58:27 +0000 (UTC) Subject: [commit: ghc] master: Don't float out expressions that are okay for speculation (27bf6b6) Message-ID: <20170303005827.89F003A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/27bf6b6857b181cd70402829a10d78e8d205962f/ghc >--------------------------------------------------------------- commit 27bf6b6857b181cd70402829a10d78e8d205962f Author: Reid Barton Date: Thu Mar 2 16:30:52 2017 -0500 Don't float out expressions that are okay for speculation It turned out not to be worth the overhead according to nofib (+11.62% on fannkuch-redux, +4.3% on k-nucleotide, and some other smaller losses, with no significant gains). Test Plan: validate Reviewers: simonpj, austin, bgamari Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3250 >--------------------------------------------------------------- 27bf6b6857b181cd70402829a10d78e8d205962f compiler/simplCore/SetLevels.hs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index ed9aae6..fb1aa6e 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -562,11 +562,8 @@ lvlMFE env strict_ctxt ann_expr lvlExpr env ann_expr | float_is_new_lam || exprIsTopLevelBindable expr expr_ty - || expr_ok_for_spec && not (isTopLvl dest_lvl) -- No wrapping needed if the type is lifted, or is a literal string -- or if we are wrapping it in one or more value lambdas - -- or is okay for speculation (we'll now evaluate it earlier). - -- But in the last case, we can't float an unlifted thing to top level = do { expr1 <- lvlFloatRhs abs_vars dest_lvl rhs_env NonRecursive join_arity_maybe ann_expr -- Treat the expr just like a right-hand side @@ -764,15 +761,6 @@ float a boxed version and replace the original (f x) with case (case y of I# r -> r) of r -> blah -However if the expression to be floated (f x) is okay for speculation, -just float it without any boxing/unboxing. We'll evaluate it earlier, -but that's okay because the expression is okay for speculation. Simpler -and cheaper than boxing and unboxing. The only potential snag is that -we can't float an unlifted binding to top-level (unless it is an unboxed -string literal). In this case, we just don't float the expression at all. -No great loss since, by assumption, it is cheap to compute anyways. See -Note [Test cheapness with exprOkForSpeculation]. - Being able to float unboxed expressions is sometimes important; see Trac #12603. I'm not sure how /often/ it is important, but it's not hard to achieve. @@ -807,6 +795,18 @@ when the denominator is definitely no-zero. And yet that same expression says False to exprIsCheap. Simplest way to guarantee the let/app invariant is to use the same function! +If an expression is okay for speculation, we could also float it out +*without* boxing and unboxing, since evaluating it early is okay. +However, it turned out to usually be better not to float such expressions, +since they tend to be extremely cheap things like (x +# 1#). Even the +cost of spilling the let-bound variable to the stack across a call may +exceed the cost of recomputing such an expression. (And we can't float +unlifted bindings to top-level.) + +We could try to do something smarter here, and float out expensive yet +okay-for-speculation things, such as division by non-zero constants. +But I suspect it's a narrow target. + Note [Bottoming floats] ~~~~~~~~~~~~~~~~~~~~~~~ If we see From git at git.haskell.org Fri Mar 3 00:58:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 00:58:35 +0000 (UTC) Subject: [commit: ghc] master: Add -fwhole-archive-hs-libs (a6874e5) Message-ID: <20170303005835.356223A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a6874e546294173c166859769dd8054887a6ded7/ghc >--------------------------------------------------------------- commit a6874e546294173c166859769dd8054887a6ded7 Author: Simon Marlow Date: Thu Mar 2 16:17:12 2017 -0500 Add -fwhole-archive-hs-libs We're building a demo to show how to hot-swap Haskell code in a running process, and unfortunately it wasn't possible to convince GHC to generate the correct linker command line without this extra knob. Test Plan: Tested it on a hot-swapping demo (which is not released yet, but will be shortly) Reviewers: niteria, austin, erikd, JonCoens, bgamari Reviewed By: bgamari Subscribers: Phyx, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3136 >--------------------------------------------------------------- a6874e546294173c166859769dd8054887a6ded7 compiler/main/DriverPipeline.hs | 26 ++++++++++--- compiler/main/DynFlags.hs | 4 +- docs/users_guide/phases.rst | 15 ++++++++ testsuite/tests/driver/linkwhole/Handles.hs | 18 +++++++++ testsuite/tests/driver/linkwhole/Main.hs | 46 +++++++++++++++++++++++ testsuite/tests/driver/linkwhole/Makefile | 20 ++++++++++ testsuite/tests/driver/linkwhole/MyCode.hs | 6 +++ testsuite/tests/driver/linkwhole/Types.hs | 13 +++++++ testsuite/tests/driver/linkwhole/all.T | 2 + testsuite/tests/driver/linkwhole/linkwhole.stdout | 2 + 10 files changed, 146 insertions(+), 6 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 a6874e546294173c166859769dd8054887a6ded7 From git at git.haskell.org Fri Mar 3 00:58:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 00:58:30 +0000 (UTC) Subject: [commit: ghc] master: Changed parser message for RankNTypes (#12811) (488a9da) Message-ID: <20170303005830.E6D313A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/488a9daa8246e0dd364dc44b8b6b8650fa6f3822/ghc >--------------------------------------------------------------- commit 488a9daa8246e0dd364dc44b8b6b8650fa6f3822 Author: Rupert Horlick Date: Thu Mar 2 16:35:53 2017 -0500 Changed parser message for RankNTypes (#12811) Added a check for whether RankNTypes is enabled and changed error message accordingly Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D3262 >--------------------------------------------------------------- 488a9daa8246e0dd364dc44b8b6b8650fa6f3822 compiler/parser/Parser.y | 22 +++++++++++++++++----- testsuite/tests/parser/should_fail/T12811.hs | 5 +++++ testsuite/tests/parser/should_fail/T12811.stderr | 7 +++++++ testsuite/tests/parser/should_fail/all.T | 1 + 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index b590333..caa22dc 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -3181,11 +3181,7 @@ tyvarop :: { Located RdrName } tyvarop : '`' tyvarid '`' {% ams (sLL $1 $> (unLoc $2)) [mj AnnBackquote $1,mj AnnVal $2 ,mj AnnBackquote $3] } - | '.' {% parseErrorSDoc (getLoc $1) - (vcat [text "Illegal symbol '.' in type", - text "Perhaps you intended to use RankNTypes or a similar language", - text "extension to enable explicit-forall syntax: forall . "]) - } + | '.' {% hintExplicitForall' (getLoc $1) } tyvarid :: { Located RdrName } : VARID { sL1 $1 $! mkUnqual tvName (getVARID $1) } @@ -3585,6 +3581,22 @@ hintExplicitForall span = do , text "extension to enable explicit-forall syntax: \x2200 . " ] +-- Hint about explicit-forall, assuming UnicodeSyntax is off +hintExplicitForall' :: SrcSpan -> P (GenLocated SrcSpan RdrName) +hintExplicitForall' span = do + forall <- extension explicitForallEnabled + let illegalDot = "Illegal symbol '.' in type" + if forall + then parseErrorSDoc span $ vcat + [ text illegalDot + , text "Perhaps you meant to write 'forall . '?" + ] + else parseErrorSDoc span $ vcat + [ text illegalDot + , text "Perhaps you intended to use RankNTypes or a similar language" + , text "extension to enable explicit-forall syntax: forall . " + ] + {- %************************************************************************ %* * diff --git a/testsuite/tests/parser/should_fail/T12811.hs b/testsuite/tests/parser/should_fail/T12811.hs new file mode 100644 index 0000000..c82a830 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T12811.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE RankNTypes #-} +module Bug where + +foo :: foral a. a -> a +foo x = x diff --git a/testsuite/tests/parser/should_fail/T12811.stderr b/testsuite/tests/parser/should_fail/T12811.stderr new file mode 100644 index 0000000..de22baf --- /dev/null +++ b/testsuite/tests/parser/should_fail/T12811.stderr @@ -0,0 +1,7 @@ + +testsuite/tests/parser/should_fail/T12811.hs:4:15: error: + Illegal symbol '.' in type + Perhaps you meant to write 'forall . '? + | +4 | foo :: foral a. a -> a + | ^ diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T index e515e2f..b3efb5c 100644 --- a/testsuite/tests/parser/should_fail/all.T +++ b/testsuite/tests/parser/should_fail/all.T @@ -95,3 +95,4 @@ test('T10498a', normal, compile_fail, ['']) test('T10498b', normal, compile_fail, ['']) test('T12051', normal, compile_fail, ['']) test('T12429', normal, compile_fail, ['']) +test('T12811', normal, compile_fail, ['']) From git at git.haskell.org Fri Mar 3 00:58:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 00:58:44 +0000 (UTC) Subject: [commit: ghc] master: Add suggestion for PatternSynonyms parse error (fixes #12429) (4b1f072) Message-ID: <20170303005844.407783A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4b1f0721ce164d079848d1f8890630dbbf4cbf7a/ghc >--------------------------------------------------------------- commit 4b1f0721ce164d079848d1f8890630dbbf4cbf7a Author: Rupert Horlick Date: Thu Mar 2 16:35:31 2017 -0500 Add suggestion for PatternSynonyms parse error (fixes #12429) Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3261 >--------------------------------------------------------------- 4b1f0721ce164d079848d1f8890630dbbf4cbf7a compiler/parser/Lexer.x | 4 ++++ testsuite/tests/parser/should_fail/T12429.hs | 3 +++ testsuite/tests/parser/should_fail/T12429.stderr | 7 +++++++ testsuite/tests/parser/should_fail/all.T | 1 + 4 files changed, 15 insertions(+) diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index 3c5d98d..6f91f44 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -2394,8 +2394,12 @@ srcParseErr options buf len $$ ppWhen (token == "=") (text "Perhaps you need a 'let' in a 'do' block?" $$ text "e.g. 'let x = 5' instead of 'x = 5'") + $$ ppWhen (not ps_enabled && pattern == "pattern") -- #12429 + (text "Perhaps you intended to use PatternSynonyms") where token = lexemeToString (offsetBytes (-len) buf) len + pattern = lexemeToString (offsetBytes (-len - 8) buf) 7 th_enabled = extopt LangExt.TemplateHaskell options + ps_enabled = extopt LangExt.PatternSynonyms options -- Report a parse failure, giving the span of the previous token as -- the location of the error. This is the entry point for errors diff --git a/testsuite/tests/parser/should_fail/T12429.hs b/testsuite/tests/parser/should_fail/T12429.hs new file mode 100644 index 0000000..3e0496b --- /dev/null +++ b/testsuite/tests/parser/should_fail/T12429.hs @@ -0,0 +1,3 @@ +module X where + import Data.Text (pattern Y) + x = 3 diff --git a/testsuite/tests/parser/should_fail/T12429.stderr b/testsuite/tests/parser/should_fail/T12429.stderr new file mode 100644 index 0000000..fde11ec --- /dev/null +++ b/testsuite/tests/parser/should_fail/T12429.stderr @@ -0,0 +1,7 @@ + +testsuite/tests/parser/should_fail/T12429.hs:2:29: error: + parse error on input ‘Y’ + Perhaps you intended to use PatternSynonyms + | +2 | import Data.Text (pattern Y) + | ^ diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T index ca23d3b..e515e2f 100644 --- a/testsuite/tests/parser/should_fail/all.T +++ b/testsuite/tests/parser/should_fail/all.T @@ -94,3 +94,4 @@ test('T10196Fail2', normal, compile_fail, ['']) test('T10498a', normal, compile_fail, ['']) test('T10498b', normal, compile_fail, ['']) test('T12051', normal, compile_fail, ['']) +test('T12429', normal, compile_fail, ['']) From git at git.haskell.org Fri Mar 3 00:58:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 00:58:37 +0000 (UTC) Subject: [commit: ghc] master: Fix up test results. (e12ebf8) Message-ID: <20170303005837.E48463A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e12ebf88c49a2ae53256cea38aa0320977d52d92/ghc >--------------------------------------------------------------- commit e12ebf88c49a2ae53256cea38aa0320977d52d92 Author: David Feuer Date: Thu Mar 2 16:30:33 2017 -0500 Fix up test results. Set up test results and Makefile as SPJ intended (I believe). Previous changes accidentally did something a bit different. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3248 >--------------------------------------------------------------- e12ebf88c49a2ae53256cea38aa0320977d52d92 testsuite/tests/simplCore/should_compile/Makefile | 7 ++++--- testsuite/tests/simplCore/should_compile/T13156.stdout | 3 --- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile index 51aeaa1..4930c68 100644 --- a/testsuite/tests/simplCore/should_compile/Makefile +++ b/testsuite/tests/simplCore/should_compile/Makefile @@ -28,8 +28,9 @@ T8832: '$(TEST_HC)' $(TEST_HC_OPTS) $(T8832_WORDSIZE_OPTS) -O -c -ddump-simpl T8832.hs | grep '^[a-zA-Z0-9]\+ =' T12603: - $(RM) -f T8832.o T8832.hi - '$(TEST_HC)' $(TEST_HC_OPTS) -O -c -ddump-simpl -dsuppress-uniques T12603.hs | grep 'wf1' + $(RM) -f T12603.o T12603.hi + '$(TEST_HC)' $(TEST_HC_OPTS) -O -c -ddump-simpl -dsuppress-uniques T12603.hs | grep 'GHC.Real' + # Horribly delicate; looking for a top-level shared call to 2^8 T11155: $(RM) -f T11155.o T11155.hi @@ -129,7 +130,7 @@ T13155: T13156: $(RM) -f T13156.hi T13156.o - '$(TEST_HC)' $(TEST_HC_OPTS) -c T13156.hs -O -ddump-prep -dsuppress-uniques | grep "case" + '$(TEST_HC)' $(TEST_HC_OPTS) -c T13156.hs -O -ddump-prep -dsuppress-uniques | grep "case.*Any" # There should be a single 'case r @ GHC.Types.Any' .PHONY: T4138 diff --git a/testsuite/tests/simplCore/should_compile/T13156.stdout b/testsuite/tests/simplCore/should_compile/T13156.stdout index 765c5e1..265d07b 100644 --- a/testsuite/tests/simplCore/should_compile/T13156.stdout +++ b/testsuite/tests/simplCore/should_compile/T13156.stdout @@ -1,4 +1 @@ - case GHC.List.reverse @ a x of sat { __DEFAULT -> - case \ (@ a1) -> - case g x of { case r @ GHC.Types.Any of { __DEFAULT -> r @ a } From git at git.haskell.org Fri Mar 3 00:58:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 00:58:40 +0000 (UTC) Subject: [commit: ghc] master: Print out sub-libraries of packages more nicely. (0b92290) Message-ID: <20170303005840.A64BA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0b922909121f6a812d2861a29d0d0d3c7e2fcfce/ghc >--------------------------------------------------------------- commit 0b922909121f6a812d2861a29d0d0d3c7e2fcfce Author: Edward Z. Yang Date: Thu Mar 2 16:27:32 2017 -0500 Print out sub-libraries of packages more nicely. Previously, we would print out the munged package name which looked like z-bkpcabal01-z-p-0.1.0.0. Now it looks like: bkpcabal01-0.1.0.0:p. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: simonpj, bgamari, austin Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3235 >--------------------------------------------------------------- 0b922909121f6a812d2861a29d0d0d3c7e2fcfce compiler/backpack/DriverBkp.hs | 2 ++ compiler/main/Packages.hs | 13 ++++++++++--- libraries/ghc-boot/GHC/PackageDb.hs | 11 +++++++++++ .../tests/backpack/cabal/bkpcabal02/bkpcabal02.stderr | 2 +- utils/ghc-pkg/Main.hs | 15 +++++++++++++-- 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/compiler/backpack/DriverBkp.hs b/compiler/backpack/DriverBkp.hs index 38b9d4f..d85b80d 100644 --- a/compiler/backpack/DriverBkp.hs +++ b/compiler/backpack/DriverBkp.hs @@ -308,6 +308,8 @@ buildUnit session cid insts lunit = do packageName = compat_pn, packageVersion = makeVersion [0], unitId = toInstalledUnitId (thisPackage dflags), + mungedPackageName = Nothing, + libName = Nothing, componentId = cid, instantiatedWith = insts, -- Slight inefficiency here haha diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs index 0667831..cb350d7 100644 --- a/compiler/main/Packages.hs +++ b/compiler/main/Packages.hs @@ -97,6 +97,7 @@ import qualified Data.Semigroup as Semigroup import qualified Data.Map as Map import qualified Data.Map.Strict as MapStrict import qualified Data.Set as Set +import Data.Version -- --------------------------------------------------------------------------- -- The Package state @@ -1857,9 +1858,15 @@ missingDependencyMsg (Just parent) -- ----------------------------------------------------------------------------- componentIdString :: DynFlags -> ComponentId -> Maybe String -componentIdString dflags cid = - fmap sourcePackageIdString (lookupInstalledPackage dflags - (componentIdToInstalledUnitId cid)) +componentIdString dflags cid = do + conf <- lookupInstalledPackage dflags (componentIdToInstalledUnitId cid) + return $ + case libName conf of + Nothing -> sourcePackageIdString conf + Just (PackageName libname) -> + packageNameString conf + ++ "-" ++ showVersion (packageVersion conf) + ++ ":" ++ unpackFS libname displayInstalledUnitId :: DynFlags -> InstalledUnitId -> Maybe String displayInstalledUnitId dflags uid = diff --git a/libraries/ghc-boot/GHC/PackageDb.hs b/libraries/ghc-boot/GHC/PackageDb.hs index 7f8468a..ecd82dd 100644 --- a/libraries/ghc-boot/GHC/PackageDb.hs +++ b/libraries/ghc-boot/GHC/PackageDb.hs @@ -98,6 +98,8 @@ data InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulenam sourcePackageId :: srcpkgid, packageName :: srcpkgname, packageVersion :: Version, + mungedPackageName :: Maybe srcpkgname, + libName :: Maybe srcpkgname, abiHash :: String, depends :: [instunitid], -- | Like 'depends', but each dependency is annotated with the @@ -182,6 +184,8 @@ emptyInstalledPackageInfo = sourcePackageId = fromStringRep BS.empty, packageName = fromStringRep BS.empty, packageVersion = Version [] [], + mungedPackageName = Nothing, + libName = Nothing, abiHash = "", depends = [], abiDepends = [], @@ -440,6 +444,7 @@ instance (RepInstalledPackageInfo a b c d e f g) => put (InstalledPackageInfo unitId componentId instantiatedWith sourcePackageId packageName packageVersion + mungedPackageName libName abiHash depends abiDepends importDirs hsLibraries extraLibraries extraGHCiLibraries libraryDirs libraryDynDirs @@ -452,6 +457,8 @@ instance (RepInstalledPackageInfo a b c d e f g) => put (toStringRep sourcePackageId) put (toStringRep packageName) put packageVersion + put (fmap toStringRep mungedPackageName) + put (fmap toStringRep libName) put (toStringRep unitId) put (toStringRep componentId) put (map (\(mod_name, mod) -> (toStringRep mod_name, toDbModule mod)) @@ -484,6 +491,8 @@ instance (RepInstalledPackageInfo a b c d e f g) => sourcePackageId <- get packageName <- get packageVersion <- get + mungedPackageName <- get + libName <- get unitId <- get componentId <- get instantiatedWith <- get @@ -516,6 +525,8 @@ instance (RepInstalledPackageInfo a b c d e f g) => instantiatedWith) (fromStringRep sourcePackageId) (fromStringRep packageName) packageVersion + (fmap fromStringRep mungedPackageName) + (fmap fromStringRep libName) abiHash (map fromStringRep depends) (map (\(k,v) -> (fromStringRep k, v)) abiDepends) diff --git a/testsuite/tests/backpack/cabal/bkpcabal02/bkpcabal02.stderr b/testsuite/tests/backpack/cabal/bkpcabal02/bkpcabal02.stderr index 681c541..e6a1f31 100644 --- a/testsuite/tests/backpack/cabal/bkpcabal02/bkpcabal02.stderr +++ b/testsuite/tests/backpack/cabal/bkpcabal02/bkpcabal02.stderr @@ -6,5 +6,5 @@ q/H.hsig:2:1: error: Hsig file: x :: Bool The two types are different • while merging the signatures from: - • z-bkpcabal01-z-p-0.1.0.0[H=]:H + • bkpcabal01-0.1.0.0:p[H=]:H • ...and the local signature for H diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index c42feec..c5ecbf2 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -41,6 +41,7 @@ import Distribution.Package hiding (installedUnitId) import Distribution.Text import Distribution.Version import Distribution.Backpack +import Distribution.Types.UnqualComponentName import Distribution.Simple.Utils (fromUTF8, toUTF8, writeUTF8File, readUTF8File) import qualified Data.Version as Version import System.FilePath as FilePath @@ -1243,8 +1244,17 @@ convertPackageInfoToCacheFormat pkg = GhcPkg.componentId = installedComponentId pkg, GhcPkg.instantiatedWith = instantiatedWith pkg, GhcPkg.sourcePackageId = sourcePackageId pkg, - GhcPkg.packageName = packageName pkg, + GhcPkg.packageName = + case sourcePackageName pkg of + Nothing -> packageName pkg + Just pn -> pn, GhcPkg.packageVersion = Version.Version (versionNumbers (packageVersion pkg)) [], + GhcPkg.mungedPackageName = + case sourcePackageName pkg of + Nothing -> Nothing + Just _ -> Just (packageName pkg), + GhcPkg.libName = + fmap (mkPackageName . unUnqualComponentName) (sourceLibName pkg), GhcPkg.depends = depends pkg, GhcPkg.abiDepends = map (\(AbiDependency k v) -> (k,unAbiHash v)) (abiDepends pkg), GhcPkg.abiHash = unAbiHash (abiHash pkg), @@ -1268,7 +1278,8 @@ convertPackageInfoToCacheFormat pkg = GhcPkg.exposed = exposed pkg, GhcPkg.trusted = trusted pkg } - where convertExposed (ExposedModule n reexport) = (n, reexport) + where + convertExposed (ExposedModule n reexport) = (n, reexport) instance GhcPkg.BinaryStringRep ComponentId where fromStringRep = mkComponentId . fromStringRep From git at git.haskell.org Fri Mar 3 00:58:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 00:58:47 +0000 (UTC) Subject: [commit: ghc] master: Don't allow orphan COMPLETE pragmas (#13349) (fce3d37) Message-ID: <20170303005847.A9EC53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fce3d37c367346c67467ce3d56bc015fa9ed6062/ghc >--------------------------------------------------------------- commit fce3d37c367346c67467ce3d56bc015fa9ed6062 Author: Reid Barton Date: Thu Mar 2 16:29:55 2017 -0500 Don't allow orphan COMPLETE pragmas (#13349) We might support them properly in the future, but for now it's simpler to disallow them. Test Plan: validate Reviewers: mpickering, austin, bgamari, simonpj Reviewed By: mpickering, simonpj Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D3243 >--------------------------------------------------------------- fce3d37c367346c67467ce3d56bc015fa9ed6062 compiler/rename/RnBinds.hs | 36 +++++++++++++++++++++++- docs/users_guide/glasgow_exts.rst | 13 +++++---- testsuite/tests/patsyn/should_compile/T13349b.hs | 8 ++++++ testsuite/tests/patsyn/should_compile/all.T | 1 + testsuite/tests/patsyn/should_fail/T13349.hs | 5 ++++ testsuite/tests/patsyn/should_fail/T13349.stderr | 6 ++++ testsuite/tests/patsyn/should_fail/all.T | 1 + 7 files changed, 64 insertions(+), 6 deletions(-) diff --git a/compiler/rename/RnBinds.hs b/compiler/rename/RnBinds.hs index f8b3347..705befd 100644 --- a/compiler/rename/RnBinds.hs +++ b/compiler/rename/RnBinds.hs @@ -952,10 +952,44 @@ renameSig ctxt sig@(SCCFunSig st v s) -- COMPLETE Sigs can refer to imported IDs which is why we use -- lookupLocatedOccRn rather than lookupSigOccRn -renameSig _ctxt (CompleteMatchSig s (L l bf) mty) +renameSig _ctxt sig@(CompleteMatchSig s (L l bf) mty) = do new_bf <- traverse lookupLocatedOccRn bf new_mty <- traverse lookupLocatedOccRn mty + + this_mod <- fmap tcg_mod getGblEnv + unless (any (nameIsLocalOrFrom this_mod . unLoc) new_bf) $ do + -- Why 'any'? See Note [Orphan COMPLETE pragmas] + addErrCtxt (text "In" <+> ppr sig) $ failWithTc orphanError + return (CompleteMatchSig s (L l new_bf) new_mty, emptyFVs) + where + orphanError :: SDoc + orphanError = + text "Orphan COMPLETE pragmas not supported" $$ + text "A COMPLETE pragma must mention at least one data constructor" $$ + text "or pattern synonym defined in the same module." + +{- +Note [Orphan COMPLETE pragmas] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +We define a COMPLETE pragma to be a non-orphan if it includes at least +one conlike defined in the current module. Why is this sufficient? +Well if you have a pattern match + + case expr of + P1 -> ... + P2 -> ... + P3 -> ... + +any COMPLETE pragma which mentions a conlike other than P1, P2 or P3 +will not be of any use in verifying that the pattern match is +exhaustive. So as we have certainly read the interface files that +define P1, P2 and P3, we will have loaded all non-orphan COMPLETE +pragmas that could be relevant to this pattern match. + +For now we simply disallow orphan COMPLETE pragmas, as the added +complexity of supporting them properly doesn't seem worthwhile. +-} ppr_sig_bndrs :: [Located RdrName] -> SDoc ppr_sig_bndrs bs = quotes (pprWithCommas ppr bs) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 205e12a..3e6e50c 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -13128,11 +13128,14 @@ and ``RightChoice`` is total. :: definition matches on all the constructors specified in the pragma then the compiler will produce no warning. -``COMPLETE`` pragmas can contain any data constructors or pattern synonyms -which are in scope. Once defined, they are automatically imported and exported -from modules. ``COMPLETE`` pragmas should be thought of as asserting a universal -truth about a set of patterns and as a result, should not be used to silence -context specific incomplete match warnings. +``COMPLETE`` pragmas can contain any data constructors or pattern +synonyms which are in scope, but must mention at least one data +constructor or pattern synonym defined in the same module. +``COMPLETE`` pragmas may only appear at the top level of a module. +Once defined, they are automatically imported and exported from +modules. ``COMPLETE`` pragmas should be thought of as asserting a +universal truth about a set of patterns and as a result, should not be +used to silence context specific incomplete match warnings. When specifing a ``COMPLETE`` pragma, the result types of all patterns must be consistent with each other. This is a sanity check as it would be impossible diff --git a/testsuite/tests/patsyn/should_compile/T13349b.hs b/testsuite/tests/patsyn/should_compile/T13349b.hs new file mode 100644 index 0000000..9d77d56 --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T13349b.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE PatternSynonyms #-} + +module T13349b where + +pattern Nada = Nothing + +-- Not orphan because it mentions the locally-defined Nada. +{-# COMPLETE Just, Nada #-} diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T index a5066ea..87de2f0 100644 --- a/testsuite/tests/patsyn/should_compile/all.T +++ b/testsuite/tests/patsyn/should_compile/all.T @@ -63,3 +63,4 @@ test('T12615', normal, compile, ['']) test('T12698', normal, compile, ['']) test('T12746', normal, multi_compile, ['T12746', [('T12746A.hs', '-c')],'-v0']) test('T12968', normal, compile, ['']) +test('T13349b', normal, compile, ['']) diff --git a/testsuite/tests/patsyn/should_fail/T13349.hs b/testsuite/tests/patsyn/should_fail/T13349.hs new file mode 100644 index 0000000..45bdc23 --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T13349.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE PatternSynonyms #-} + +module T13349 where + +{-# COMPLETE False #-} diff --git a/testsuite/tests/patsyn/should_fail/T13349.stderr b/testsuite/tests/patsyn/should_fail/T13349.stderr new file mode 100644 index 0000000..5bf91cb --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T13349.stderr @@ -0,0 +1,6 @@ + +T13349.hs:5:1: error: + • Orphan COMPLETE pragmas not supported + A COMPLETE pragma must mention at least one data constructor + or pattern synonym defined in the same module. + • In {-# COMPLETE False #-} diff --git a/testsuite/tests/patsyn/should_fail/all.T b/testsuite/tests/patsyn/should_fail/all.T index 50a3eea..f674a8b 100644 --- a/testsuite/tests/patsyn/should_fail/all.T +++ b/testsuite/tests/patsyn/should_fail/all.T @@ -34,3 +34,4 @@ test('T11667', normal, compile_fail, ['']) test('T12165', normal, compile_fail, ['']) test('T12819', normal, compile_fail, ['']) test('UnliftedPSBind', normal, compile_fail, ['']) +test('T13349', normal, compile_fail, ['']) From git at git.haskell.org Fri Mar 3 11:16:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 11:16:21 +0000 (UTC) Subject: [commit: ghc] wip/T13351: Revise list fusion for and, or, all, any, elem, notElem (#13351) (5abc4f4) Message-ID: <20170303111621.A42083A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13351 Link : http://ghc.haskell.org/trac/ghc/changeset/5abc4f4bdbc5fb6a08eb7e0cf73e7daccbdc084e/ghc >--------------------------------------------------------------- commit 5abc4f4bdbc5fb6a08eb7e0cf73e7daccbdc084e Author: Joachim Breitner Date: Tue Feb 28 12:20:02 2017 -0800 Revise list fusion for and, or, all, any, elem, notElem (#13351) to make sure their list fusion is implemented in terms of foldr (and not build directly), with proper writing-back rules. This ensures that, for example, c `elem` "!@#$%^&*()" works without actual list code. Differential Revision: https://phabricator.haskell.org/D3246 >--------------------------------------------------------------- 5abc4f4bdbc5fb6a08eb7e0cf73e7daccbdc084e libraries/base/GHC/List.hs | 52 +++++++++++++++++++++++++++---------- testsuite/tests/th/TH_Roles2.stderr | 4 +-- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/libraries/base/GHC/List.hs b/libraries/base/GHC/List.hs index 3eab407..7b6c059 100644 --- a/libraries/base/GHC/List.hs +++ b/libraries/base/GHC/List.hs @@ -730,9 +730,13 @@ and [] = True and (x:xs) = x && and xs {-# NOINLINE [1] and #-} +andFB :: Bool -> Bool -> Bool +andFB x r = x && r +{-# NOINLINE [0] andFB #-} + {-# RULES -"and/build" forall (g::forall b.(Bool->b->b)->b->b) . - and (build g) = g (&&) True +"and" [~1] forall xs. and xs = foldr andFB True xs +"andList" [1] foldr andFB True = and #-} #endif @@ -747,9 +751,13 @@ or [] = False or (x:xs) = x || or xs {-# NOINLINE [1] or #-} +orFB :: Bool -> Bool -> Bool +orFB x r = x || r +{-# NOINLINE [0] orFB #-} + {-# RULES -"or/build" forall (g::forall b.(Bool->b->b)->b->b) . - or (build g) = g (||) False +"or" [~1] forall xs. or xs = foldr orFB False xs +"orList" [1] foldr orFB False = or #-} #endif @@ -764,12 +772,15 @@ any p = or . map p #else any _ [] = False any p (x:xs) = p x || any p xs - {-# NOINLINE [1] any #-} +anyFB :: (t -> Bool) -> t -> Bool -> Bool +anyFB p x r = p x || r +{-# NOINLINE [0] anyFB #-} + {-# RULES -"any/build" forall p (g::forall b.(a->b->b)->b->b) . - any p (build g) = g ((||) . p) False +"any" [~1] forall p xs. any p xs = foldr (anyFB p) False xs +"anyList" [1] forall p. foldr (anyFB p) False = any p #-} #endif @@ -783,12 +794,15 @@ all p = and . map p #else all _ [] = True all p (x:xs) = p x && all p xs - {-# NOINLINE [1] all #-} +allFB :: (t -> Bool) -> t -> Bool -> Bool +allFB p x r = p x && r +{-# NOINLINE [0] allFB #-} + {-# RULES -"all/build" forall p (g::forall b.(a->b->b)->b->b) . - all p (build g) = g ((&&) . p) True +"all" [~1] forall p xs. all p xs = foldr (allFB p) True xs +"allList" [1] forall p. foldr (allFB p) True = all p #-} #endif @@ -803,9 +817,14 @@ elem x = any (== x) elem _ [] = False elem x (y:ys) = x==y || elem x ys {-# NOINLINE [1] elem #-} + +elemFB :: Eq a => a -> a -> Bool -> Bool +elemFB x y r = (x == y) || r +{-# NOINLINE [0] elemFB #-} + {-# RULES -"elem/build" forall x (g :: forall b . Eq a => (a -> b -> b) -> b -> b) - . elem x (build g) = g (\ y r -> (x == y) || r) False +"elem" [~1] forall x xs. elem x xs = foldr (elemFB x) False xs +"elemList" [1] forall x. foldr (elemFB x) False = elem x #-} #endif @@ -817,9 +836,14 @@ notElem x = all (/= x) notElem _ [] = True notElem x (y:ys)= x /= y && notElem x ys {-# NOINLINE [1] notElem #-} + +notElemFB :: Eq a => a -> a -> Bool -> Bool +notElemFB x y r = (x /= y) && r +{-# NOINLINE [0] notElemFB #-} + {-# RULES -"notElem/build" forall x (g :: forall b . Eq a => (a -> b -> b) -> b -> b) - . notElem x (build g) = g (\ y r -> (x /= y) && r) True +"notElem" [~1] forall x xs. notElem x xs = foldr (notElemFB x) False xs +"notElemList" [1] forall x. foldr (notElemFB x) True = notElem x #-} #endif diff --git a/testsuite/tests/th/TH_Roles2.stderr b/testsuite/tests/th/TH_Roles2.stderr index 54841e7..bd2945e 100644 --- a/testsuite/tests/th/TH_Roles2.stderr +++ b/testsuite/tests/th/TH_Roles2.stderr @@ -16,8 +16,8 @@ TH_Roles2.$tcT TH_Roles2.$trModule (GHC.Types.TrNameS "T"#) 1 - $krep_a40L -$krep_a40L [InlPrag=[~]] + krep_a4ik +krep_a4ik [InlPrag=[~]] = GHC.Types.KindRepFun (GHC.Types.KindRepVar 0) (GHC.Types.KindRepTYPE GHC.Types.LiftedRep) From git at git.haskell.org Fri Mar 3 11:16:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 11:16:24 +0000 (UTC) Subject: [commit: ghc] wip/T13351: Add foldr fusion rules for short lists (c55ead7) Message-ID: <20170303111624.573D93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13351 Link : http://ghc.haskell.org/trac/ghc/changeset/c55ead70523d1458e3e5fe1c976b148547dea3bb/ghc >--------------------------------------------------------------- commit c55ead70523d1458e3e5fe1c976b148547dea3bb Author: Joachim Breitner Date: Tue Feb 28 12:20:02 2017 -0800 Add foldr fusion rules for short lists and make the comment there more useful. Differential Revision: https://phabricator.haskell.org/D3246 >--------------------------------------------------------------- c55ead70523d1458e3e5fe1c976b148547dea3bb libraries/base/GHC/Base.hs | 19 +++++++++++++------ testsuite/tests/simplCore/should_run/T2110.hs | 1 + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index e07c077..b5fa91c 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -897,16 +897,23 @@ augment g xs = g (:) xs -- Only activate this from phase 1, because that's -- when we disable the rule that expands (++) into foldr +"foldr/nil" forall k z. foldr k z [] = z +"foldr/single" forall k z x. foldr k z [x] = k x z +"foldr/short2" forall k z x1 x2. foldr k z [x1,x2] = k x1 (k x2 z) +"foldr/short3" forall k z x1 x2 x3. foldr k z [x1,x2,x3] = k x1 (k x2 (k x3 z)) +"foldr/short4" forall k z x1 x2 x3 x4. foldr k z [x1,x2,x3,x4] = k x1 (k x2 (k x3 (k x4 z))) + +-- "foldr/cons" forall k z x xs. foldr k z (x:xs) = k x (foldr k z xs) -- The foldr/cons rule looks nice, but it can give disastrously -- bloated code when commpiling -- array (a,b) [(1,2), (2,2), (3,2), ...very long list... ] -- i.e. when there are very very long literal lists --- So I've disabled it for now. We could have special cases --- for short lists, I suppose. --- "foldr/cons" forall k z x xs. foldr k z (x:xs) = k x (foldr k z xs) - -"foldr/single" forall k z x. foldr k z [x] = k x z -"foldr/nil" forall k z. foldr k z [] = z +-- So we disabled it, but have special cases for short lists up +-- to a completely arbitrary limit of 4. +-- +-- Note that static lists that are explicitly entered as such in the source, +-- the compiler desugars them to build (if they are short), and then normal +-- foldr/build rule fires, see note [Desugaring explicit lists] in DsExpr "foldr/cons/build" forall k z x (g::forall b. (a->b->b) -> b -> b) . foldr k z (x:build g) = k x (g k z) diff --git a/testsuite/tests/simplCore/should_run/T2110.hs b/testsuite/tests/simplCore/should_run/T2110.hs index 610be09..7cde608 100644 --- a/testsuite/tests/simplCore/should_run/T2110.hs +++ b/testsuite/tests/simplCore/should_run/T2110.hs @@ -19,6 +19,7 @@ same x y = case reallyUnsafePtrEquality# (unsafeCoerce x) y of main = do let l = [1,2,3] + {-# NOINLINE l #-} same (fooAge l) l same (fooCoerce l) l same (fooUnsafeCoerce l) l From git at git.haskell.org Fri Mar 3 11:16:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 11:16:27 +0000 (UTC) Subject: [commit: ghc] wip/T13351's head updated: Add foldr fusion rules for short lists (c55ead7) Message-ID: <20170303111627.206863A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T13351' now includes: 990f182 Fix windows build broken by D3080 (0d86aa5904e5a06c93632357122e57e4e118fd2a) c435402 Fix Mac OS X timestamp resolution bug. 377bf37 Clear import path in --backpack mode to not accidentally pick up source files. 36b6e13 DmdAnal: Clarify reference to Cardinality Analysis paper e94bfb6 configure: detect whether -lpthreads is necessary for pthreads 1db71f5 base: Expose Module from Type.Reflection 5dc28ba Add Eq instances for TrName, Module d0508ef When floating, don't box an expression that's okay for speculation (#13338) c662d41 Small changes to expression sizing in CoreUnfold c686af5 Add flag allowing convenient disabling of terminfo support db2a667 rts: Allow profile output path to be specified on RTS command line 29b5723 Again disable stage0 terminfo on Windows 1990bb0 Make Specialise work with casts fc6c222 Inline data constructor wrappers in phase 2 only 65c41cc config.mk.in: Disable terminfo support on iOS 23aca13 iOS: shared objects have .dylib extension. aa2143e Improve documentation for CreateBCOs Message. 3e33d33 Drop copy step from the rts/ghc.mk 122c677 Add COMPLETE pragmas for TypeRep and ErrorCall pattern synonyms 5fdb2b1 Try submodule bumps again defef52 testsuite: Bump down T5837 and T10370 allocations 55efc97 Combine identical case alternatives in CSE 2effe18 The Early Inline Patch 4f10a22 Fix redundant import in CSE cdf6b69 Add VarSet.anyDVarSet, allDVarSet 871b63e Improve pretty-printing of types 6eb52cf Improve SetLevels for join points 777b770 Mark non-recursive join lambdas as one-shot 2ab6ce7 Move isJoinId, isJoinId_maybe to Id 916658d Update containers again b86d226 rts: Fix build 701256d Change catch# demand signature cbe569a Upgrade UniqSet to a newtype d118807 Document interaction between ApplicativeDo and existentials (#13242) d4a6a7f Fix expected result from T13143 fb06bee Bump bytes allocated for T12234 537ce41 Typeable: Rename KindRep bindings to $krep... 55f6353 SymbolExtras: A bit of spring cleaning 5f7b45a Properly acquire locks on not yet existing package databases 63191e9 testsuite: Mark T13340 as fixed 27a1b12 User manual: Fix GADT paper link ae67619 Eliminate ListSetOps from imp_trust_pkgs bc332b3 Prohibit RULES changing constructors f56fc7f Extend Windows runtime loader libsearch 4aada7a More comments on role subtyping, unsoundness fix. 984c609 Disallow non-nullary constraint synonyms on class. e710686 Injective type families imply nominal injectivity, but NOT rep inj fb5cd9d Properly represent abstract classes in Class and IfaceDecl df919fb Fix roles merging to apply only to non-rep-injective types. bba004f Prevent users from defining instances for abstract classes. 57ef18a Typofix. 57d969e Fix T12234 stat mistakes a6874e5 Add -fwhole-archive-hs-libs 0b92290 Print out sub-libraries of packages more nicely. fce3d37 Don't allow orphan COMPLETE pragmas (#13349) e12ebf8 Fix up test results. 27bf6b6 Don't float out expressions that are okay for speculation 4b1f072 Add suggestion for PatternSynonyms parse error (fixes #12429) 488a9da Changed parser message for RankNTypes (#12811) 6421c6f testsuite: Move echoing commands in make invocations to VERBOSE=5 5abc4f4 Revise list fusion for and, or, all, any, elem, notElem (#13351) c55ead7 Add foldr fusion rules for short lists From git at git.haskell.org Fri Mar 3 14:25:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 14:25:23 +0000 (UTC) Subject: [commit: ghc] master: Read COMPLETE sets from external packages (0d2f733) Message-ID: <20170303142523.3C3FB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0d2f733050ff656b827351108d988e09abc363fc/ghc >--------------------------------------------------------------- commit 0d2f733050ff656b827351108d988e09abc363fc Author: Ryan Scott Date: Thu Mar 2 20:16:28 2017 -0500 Read COMPLETE sets from external packages Currently, `COMPLETE` pragmas are not read from external packages at all, which quite limits their usefulness. This extends `ExternalPackageState` to include `COMPLETE` sets from other packages, and plumbs around the appropriate values to make it work the way you'd expect it to. Fixes #13350. Test Plan: make test TEST=T13350 Reviewers: rwbarton, mpickering, austin, simonpj, bgamari Reviewed By: simonpj Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D3257 >--------------------------------------------------------------- 0d2f733050ff656b827351108d988e09abc363fc compiler/deSugar/Check.hs | 11 ++- compiler/deSugar/DsMonad.hs | 14 ++- compiler/iface/LoadIface.hs | 29 +++--- compiler/iface/MkIface.hs | 3 +- compiler/iface/TcIface.hs | 14 +-- compiler/iface/TcIface.hs-boot | 18 ++-- compiler/main/HscTypes.hs | 101 ++++++++++++++++++--- compiler/typecheck/TcBinds.hs | 10 +- compiler/typecheck/TcRnTypes.hs | 14 +-- compiler/utils/Binary.hs | 1 - .../tests/patsyn/should_compile/T13350/Makefile | 13 +++ .../tests/patsyn/should_compile/T13350/T13350.hs | 8 ++ testsuite/tests/patsyn/should_compile/T13350/all.T | 4 + .../should_compile/T13350/boolean/Boolean.hs | 9 ++ .../should_compile/T13350/boolean}/Setup.hs | 0 .../should_compile/T13350/boolean/boolean.cabal | 7 ++ 16 files changed, 190 insertions(+), 66 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 0d2f733050ff656b827351108d988e09abc363fc From git at git.haskell.org Fri Mar 3 14:25:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 14:25:19 +0000 (UTC) Subject: [commit: ghc] master: Show: Add ShowS for ", " (615ded1) Message-ID: <20170303142519.3EA163A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/615ded12f47d3685606bcfabb4f1980e748be1d9/ghc >--------------------------------------------------------------- commit 615ded12f47d3685606bcfabb4f1980e748be1d9 Author: Ben Gamari Date: Thu Mar 2 18:37:23 2017 -0500 Show: Add ShowS for ", " This is produced often enough in derived Show instances that it is likely worthwhile defining it once. >--------------------------------------------------------------- 615ded12f47d3685606bcfabb4f1980e748be1d9 compiler/prelude/PrelNames.hs | 3 ++- compiler/typecheck/TcGenDeriv.hs | 3 ++- libraries/base/GHC/Show.hs | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/compiler/prelude/PrelNames.hs b/compiler/prelude/PrelNames.hs index 470b736..0ae3867 100644 --- a/compiler/prelude/PrelNames.hs +++ b/compiler/prelude/PrelNames.hs @@ -751,13 +751,14 @@ prec_RDR = varQual_RDR rEAD_PREC (fsLit "prec") pfail_RDR = varQual_RDR rEAD_PREC (fsLit "pfail") showList_RDR, showList___RDR, showsPrec_RDR, shows_RDR, showString_RDR, - showSpace_RDR, showParen_RDR :: RdrName + showSpace_RDR, showCommaSpace_RDR, showParen_RDR :: RdrName showList_RDR = varQual_RDR gHC_SHOW (fsLit "showList") showList___RDR = varQual_RDR gHC_SHOW (fsLit "showList__") showsPrec_RDR = varQual_RDR gHC_SHOW (fsLit "showsPrec") shows_RDR = varQual_RDR gHC_SHOW (fsLit "shows") showString_RDR = varQual_RDR gHC_SHOW (fsLit "showString") showSpace_RDR = varQual_RDR gHC_SHOW (fsLit "showSpace") +showCommaSpace_RDR = varQual_RDR gHC_SHOW (fsLit "showCommaSpace") showParen_RDR = varQual_RDR gHC_SHOW (fsLit "showParen") undefined_RDR :: RdrName diff --git a/compiler/typecheck/TcGenDeriv.hs b/compiler/typecheck/TcGenDeriv.hs index 533664e..c46c291 100644 --- a/compiler/typecheck/TcGenDeriv.hs +++ b/compiler/typecheck/TcGenDeriv.hs @@ -1125,6 +1125,7 @@ gen_Show_binds get_fixity loc tycon ----------------------------------------------------------------------- data_cons = tyConDataCons tycon shows_prec = mk_FunBind loc showsPrec_RDR (map pats_etc data_cons) + comma_space = nlHsVar showCommaSpace_RDR pats_etc data_con | nullary_con = -- skip the showParen junk... @@ -1174,7 +1175,7 @@ gen_Show_binds get_fixity loc tycon -- Assumption for record syntax: no of fields == no of -- labelled fields (and in same order) show_record_args = concat $ - intersperse [mk_showString_app ", "] $ + intersperse [comma_space] $ [ [show_label lbl, arg] | (lbl,arg) <- zipEqual "gen_Show_binds" labels show_args ] diff --git a/libraries/base/GHC/Show.hs b/libraries/base/GHC/Show.hs index c52824b..6965335 100644 --- a/libraries/base/GHC/Show.hs +++ b/libraries/base/GHC/Show.hs @@ -39,7 +39,7 @@ module GHC.Show -- Show support code shows, showChar, showString, showMultiLineString, - showParen, showList__, showSpace, + showParen, showList__, showCommaSpace, showSpace, showLitChar, showLitString, protectEsc, intToDigit, showSignedInt, appPrec, appPrec1, @@ -344,6 +344,8 @@ showParen b p = if b then showChar '(' . p . showChar ')' else p showSpace :: ShowS showSpace = {-showChar ' '-} \ xs -> ' ' : xs +showCommaSpace :: ShowS +showCommaSpace = showString ", " -- Code specific for characters -- | Convert a character to a string using only printable characters, From git at git.haskell.org Fri Mar 3 14:25:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 14:25:25 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Fix output due to recent COMPLETE changes (ca538b8) Message-ID: <20170303142525.E5B603A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ca538b84e78b2b58161ca4c0910a65937c374b9c/ghc >--------------------------------------------------------------- commit ca538b84e78b2b58161ca4c0910a65937c374b9c Author: Ben Gamari Date: Thu Mar 2 21:34:51 2017 -0500 testsuite: Fix output due to recent COMPLETE changes It's unclear why this didn't show up in my initial local validation. Oh well. >--------------------------------------------------------------- ca538b84e78b2b58161ca4c0910a65937c374b9c testsuite/tests/parser/should_fail/T12429.stderr | 5 +---- testsuite/tests/parser/should_fail/T12811.stderr | 5 +---- testsuite/tests/pmcheck/complete_sigs/completesig04.stderr | 4 +++- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/testsuite/tests/parser/should_fail/T12429.stderr b/testsuite/tests/parser/should_fail/T12429.stderr index fde11ec..e29388f 100644 --- a/testsuite/tests/parser/should_fail/T12429.stderr +++ b/testsuite/tests/parser/should_fail/T12429.stderr @@ -1,7 +1,4 @@ -testsuite/tests/parser/should_fail/T12429.hs:2:29: error: +T12429.hs:2:29: error: parse error on input ‘Y’ Perhaps you intended to use PatternSynonyms - | -2 | import Data.Text (pattern Y) - | ^ diff --git a/testsuite/tests/parser/should_fail/T12811.stderr b/testsuite/tests/parser/should_fail/T12811.stderr index de22baf..e9cf78f 100644 --- a/testsuite/tests/parser/should_fail/T12811.stderr +++ b/testsuite/tests/parser/should_fail/T12811.stderr @@ -1,7 +1,4 @@ -testsuite/tests/parser/should_fail/T12811.hs:4:15: error: +T12811.hs:4:15: error: Illegal symbol '.' in type Perhaps you meant to write 'forall . '? - | -4 | foo :: foral a. a -> a - | ^ diff --git a/testsuite/tests/pmcheck/complete_sigs/completesig04.stderr b/testsuite/tests/pmcheck/complete_sigs/completesig04.stderr index b72cf6e..de990c7 100644 --- a/testsuite/tests/pmcheck/complete_sigs/completesig04.stderr +++ b/testsuite/tests/pmcheck/complete_sigs/completesig04.stderr @@ -1,4 +1,6 @@ completesig04.hs:3:1: error: - • Cannot form a group of complete patterns from patterns ‘Just’ and ‘Left’ as they match different type constructors (‘Maybe’ resp. ‘Either’) + • Orphan COMPLETE pragmas not supported + A COMPLETE pragma must mention at least one data constructor + or pattern synonym defined in the same module. • In {-# COMPLETE Just, Left #-} From git at git.haskell.org Fri Mar 3 16:22:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 16:22:13 +0000 (UTC) Subject: [commit: ghc] master: Revert "Read COMPLETE sets from external packages" (c02896a) Message-ID: <20170303162213.8F5513A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c02896abdb4cdbbec93a0a670f4d7f5dcc95cc25/ghc >--------------------------------------------------------------- commit c02896abdb4cdbbec93a0a670f4d7f5dcc95cc25 Author: Ben Gamari Date: Fri Mar 3 10:03:18 2017 -0500 Revert "Read COMPLETE sets from external packages" This reverts commit 0d2f733050ff656b827351108d988e09abc363fc. >--------------------------------------------------------------- c02896abdb4cdbbec93a0a670f4d7f5dcc95cc25 compiler/deSugar/Check.hs | 11 +-- compiler/deSugar/DsMonad.hs | 14 +-- compiler/iface/LoadIface.hs | 29 +++--- compiler/iface/MkIface.hs | 3 +- compiler/iface/TcIface.hs | 14 ++- compiler/iface/TcIface.hs-boot | 18 ++-- compiler/main/HscTypes.hs | 101 +++------------------ compiler/typecheck/TcBinds.hs | 10 +- compiler/typecheck/TcRnTypes.hs | 14 ++- compiler/utils/Binary.hs | 1 + .../tests/patsyn/should_compile/T13350/Makefile | 13 --- .../tests/patsyn/should_compile/T13350/T13350.hs | 8 -- testsuite/tests/patsyn/should_compile/T13350/all.T | 4 - .../should_compile/T13350/boolean/Boolean.hs | 9 -- .../patsyn/should_compile/T13350/boolean/Setup.hs | 2 - .../should_compile/T13350/boolean/boolean.cabal | 7 -- 16 files changed, 66 insertions(+), 192 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 c02896abdb4cdbbec93a0a670f4d7f5dcc95cc25 From git at git.haskell.org Fri Mar 3 16:22:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 16:22:16 +0000 (UTC) Subject: [commit: ghc] master: Update test completesig04 (61e760b) Message-ID: <20170303162216.445623A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/61e760b08704ba1c9aceeaffbd0cb207b345a2ef/ghc >--------------------------------------------------------------- commit 61e760b08704ba1c9aceeaffbd0cb207b345a2ef Author: Reid Barton Date: Fri Mar 3 09:50:50 2017 -0500 Update test completesig04 It relied on an orphan COMPLETE pragma, so was broken by commit fce3d37c3. Test Plan: validate Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3266 >--------------------------------------------------------------- 61e760b08704ba1c9aceeaffbd0cb207b345a2ef testsuite/tests/pmcheck/complete_sigs/completesig04.hs | 4 +++- testsuite/tests/pmcheck/complete_sigs/completesig04.stderr | 8 +++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/testsuite/tests/pmcheck/complete_sigs/completesig04.hs b/testsuite/tests/pmcheck/complete_sigs/completesig04.hs index 0d8eb81..2c072db 100644 --- a/testsuite/tests/pmcheck/complete_sigs/completesig04.hs +++ b/testsuite/tests/pmcheck/complete_sigs/completesig04.hs @@ -1,3 +1,5 @@ module TyMismatch where -{-# COMPLETE Just, Left #-} +data E = L | R + +{-# COMPLETE Just, L #-} diff --git a/testsuite/tests/pmcheck/complete_sigs/completesig04.stderr b/testsuite/tests/pmcheck/complete_sigs/completesig04.stderr index de990c7..72b3dde 100644 --- a/testsuite/tests/pmcheck/complete_sigs/completesig04.stderr +++ b/testsuite/tests/pmcheck/complete_sigs/completesig04.stderr @@ -1,6 +1,4 @@ -completesig04.hs:3:1: error: - • Orphan COMPLETE pragmas not supported - A COMPLETE pragma must mention at least one data constructor - or pattern synonym defined in the same module. - • In {-# COMPLETE Just, Left #-} +completesig04.hs:5:1: error: + • Cannot form a group of complete patterns from patterns ‘Just’ and ‘L’ as they match different type constructors (‘Maybe’ resp. ‘E’) + • In {-# COMPLETE Just, L #-} From git at git.haskell.org Fri Mar 3 16:22:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 16:22:18 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump down allocations for T12707 (9808ebc) Message-ID: <20170303162218.F01BA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9808ebc8ed742e6dc99e1420d79306cc0a61a92f/ghc >--------------------------------------------------------------- commit 9808ebc8ed742e6dc99e1420d79306cc0a61a92f Author: Ben Gamari Date: Fri Mar 3 11:21:38 2017 -0500 testsuite: Bump down allocations for T12707 >--------------------------------------------------------------- 9808ebc8ed742e6dc99e1420d79306cc0a61a92f testsuite/tests/perf/compiler/all.T | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index fa63910..b1f7fbe 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -1020,12 +1020,13 @@ test('T13056', test('T12707', [ compiler_stats_num_field('bytes allocated', - [(wordsize(64), 1310037632, 5), + [(wordsize(64), 1231809592, 5), # initial: 1271577192 # 2017-01-22: 1348865648 Allow top-level strings in Core # 2017-01-31: 1280336112 Join points (#12988) # 2017-02-11: 1310037632 Check local family instances vs imports # 2017-02-23: 1386110512 Type-indexed Typeable? (on Darwin) + # 2017-03-02: 1231809592 Drift from recent simplifier improvements ]), ], compile, From git at git.haskell.org Fri Mar 3 16:43:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 16:43:32 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-D3217' deleted Message-ID: <20170303164332.BEB7A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/rwbarton-D3217 From git at git.haskell.org Fri Mar 3 17:13:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 17:13:41 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add comment clarifying intention of completesig04 (fa360ea) Message-ID: <20170303171341.151223A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fa360eabe5a01815f27a09df4a245546ede9210a/ghc >--------------------------------------------------------------- commit fa360eabe5a01815f27a09df4a245546ede9210a Author: Ben Gamari Date: Fri Mar 3 11:33:24 2017 -0500 testsuite: Add comment clarifying intention of completesig04 >--------------------------------------------------------------- fa360eabe5a01815f27a09df4a245546ede9210a testsuite/tests/pmcheck/complete_sigs/completesig04.hs | 1 + testsuite/tests/pmcheck/complete_sigs/completesig04.stderr | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/pmcheck/complete_sigs/completesig04.hs b/testsuite/tests/pmcheck/complete_sigs/completesig04.hs index 2c072db..dbe1110 100644 --- a/testsuite/tests/pmcheck/complete_sigs/completesig04.hs +++ b/testsuite/tests/pmcheck/complete_sigs/completesig04.hs @@ -1,3 +1,4 @@ +-- Test that a COMPLETE pragma over constructors of different types fails. module TyMismatch where data E = L | R diff --git a/testsuite/tests/pmcheck/complete_sigs/completesig04.stderr b/testsuite/tests/pmcheck/complete_sigs/completesig04.stderr index 72b3dde..21a6377 100644 --- a/testsuite/tests/pmcheck/complete_sigs/completesig04.stderr +++ b/testsuite/tests/pmcheck/complete_sigs/completesig04.stderr @@ -1,4 +1,4 @@ -completesig04.hs:5:1: error: +completesig04.hs:6:1: error: • Cannot form a group of complete patterns from patterns ‘Just’ and ‘L’ as they match different type constructors (‘Maybe’ resp. ‘E’) • In {-# COMPLETE Just, L #-} From git at git.haskell.org Fri Mar 3 21:36:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 21:36:00 +0000 (UTC) Subject: [commit: ghc] master: TcTypeable: Try to reuse KindReps (a694cee) Message-ID: <20170303213600.10D7E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a694cee77b64235b42029fea248453ddf6b17d17/ghc >--------------------------------------------------------------- commit a694cee77b64235b42029fea248453ddf6b17d17 Author: Ben Gamari Date: Fri Mar 3 14:39:00 2017 -0500 TcTypeable: Try to reuse KindReps Here we rework the TcTypeable implementation to reuse KindRep bindings when possible. This is an attempt at minimizing the impact of Typeable binding generation by reducing the number of bindings that we produce. It turns out that this produces some pretty reasonable compiler allocations improvements. It seems to erase most of the increases initially introduced by TTypeable in the testsuite. Moreover, nofib shows, ``` -1 s.d. ----- -3.555% +1 s.d. ----- +1.937% Average ----- -0.847% ``` Here are a few of the high-scorers (ignore last column, which is for D3219), ``` veritas Types 88800920 -18.945% -21.480% veritas Tactics 540766744 -27.256% -27.338% sched Main 567013384 -4.947% -5.358% listcompr Main 532300000 -4.273% -4.572% listcopy Main 537785392 -4.382% -4.635% anna BaseDefs 1984225032 -10.639% -10.832% ``` as expected, these tend to be modules with either very many or very large types. Test Plan: Validate Reviewers: austin, dfeuer Subscribers: simonmar, dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3166 >--------------------------------------------------------------- a694cee77b64235b42029fea248453ddf6b17d17 compiler/coreSyn/TrieMap.hs | 28 ++- compiler/typecheck/TcTypeable.hs | 259 +++++++++++++-------- .../tests/deSugar/should_compile/T2431.stderr | 47 ++-- .../should_compile/DumpTypecheckedAst.stderr | 104 +++------ testsuite/tests/perf/compiler/all.T | 9 +- testsuite/tests/roles/should_compile/Roles1.stderr | 101 +++----- .../tests/roles/should_compile/Roles13.stderr | 85 +++---- .../tests/roles/should_compile/Roles14.stderr | 15 +- testsuite/tests/roles/should_compile/Roles2.stderr | 31 +-- testsuite/tests/roles/should_compile/Roles3.stderr | 56 ++--- testsuite/tests/roles/should_compile/Roles4.stderr | 33 +-- testsuite/tests/roles/should_compile/T8958.stderr | 66 ++---- .../tests/simplCore/should_compile/T7360.stderr | 61 ++--- .../tests/simplCore/should_compile/T8274.stdout | 14 +- testsuite/tests/th/TH_Roles2.stderr | 11 +- 15 files changed, 414 insertions(+), 506 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 a694cee77b64235b42029fea248453ddf6b17d17 From git at git.haskell.org Fri Mar 3 21:36:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 21:36:02 +0000 (UTC) Subject: [commit: ghc] master: Produce KindReps for common kinds in GHC.Types (c1dacb8) Message-ID: <20170303213602.C77B73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c1dacb8a9c18677495bbe7e41391f8ca7a573070/ghc >--------------------------------------------------------------- commit c1dacb8a9c18677495bbe7e41391f8ca7a573070 Author: Ben Gamari Date: Fri Mar 3 15:47:47 2017 -0500 Produce KindReps for common kinds in GHC.Types Unfortunately this comes with a fair bit of implementation cost. Perhaps some refactoring would help, but in the interest of getting 8.2 out the door I'm pushing as-is. While this doesn't have nearly the effect on compiler allocations that D3166 has, it's still nothing to sneeze at. nofib shows, ``` ------------------------------------------------------------------------ Program master D3166 D3219 ------------------------------------------------------------------------ -1 s.d. ----- -3.555% -4.081% +1 s.d. ----- +1.937% +1.593% Average ----- -0.847% -1.285% ``` Test Plan: Validate Reviewers: austin Subscribers: thomie, simonmar Differential Revision: https://phabricator.haskell.org/D3219 >--------------------------------------------------------------- c1dacb8a9c18677495bbe7e41391f8ca7a573070 compiler/prelude/PrelNames.hs | 23 ++- compiler/typecheck/TcTypeable.hs | 157 +++++++++++++++------ .../tests/deSugar/should_compile/T2431.stderr | 43 ++---- .../should_compile/DumpTypecheckedAst.stderr | 13 +- testsuite/tests/roles/should_compile/Roles1.stderr | 16 +-- .../tests/roles/should_compile/Roles13.stderr | 56 +++----- .../tests/roles/should_compile/Roles14.stderr | 4 +- testsuite/tests/roles/should_compile/Roles2.stderr | 6 +- testsuite/tests/roles/should_compile/Roles3.stderr | 14 +- testsuite/tests/roles/should_compile/Roles4.stderr | 6 +- testsuite/tests/roles/should_compile/T8958.stderr | 9 +- .../tests/simplCore/should_compile/T7360.stderr | 19 +-- .../tests/simplCore/should_compile/T8274.stdout | 8 +- testsuite/tests/th/TH_Roles2.stderr | 10 +- 14 files changed, 210 insertions(+), 174 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 c1dacb8a9c18677495bbe7e41391f8ca7a573070 From git at git.haskell.org Fri Mar 3 21:36:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 21:36:06 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add test for floating-point abs (numrun015) (10d28d0) Message-ID: <20170303213606.448CF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/10d28d0ababe52a705c10d450869d7a61063c4ae/ghc >--------------------------------------------------------------- commit 10d28d0ababe52a705c10d450869d7a61063c4ae Author: Ben Gamari Date: Fri Mar 3 15:49:14 2017 -0500 testsuite: Add test for floating-point abs (numrun015) Test Plan: Validate Reviewers: idontgetoutmuch, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3273 >--------------------------------------------------------------- 10d28d0ababe52a705c10d450869d7a61063c4ae testsuite/tests/numeric/should_run/all.T | 1 + testsuite/tests/numeric/should_run/numrun015.hs | 20 ++++++++++++++++++++ .../tests/numeric/should_run/numrun015.stdout | 4 ++++ 3 files changed, 25 insertions(+) diff --git a/testsuite/tests/numeric/should_run/all.T b/testsuite/tests/numeric/should_run/all.T index 6510dc9..2d2353b 100644 --- a/testsuite/tests/numeric/should_run/all.T +++ b/testsuite/tests/numeric/should_run/all.T @@ -33,6 +33,7 @@ test('numrun011', normal, compile_and_run, ['']) test('numrun012', normal, compile_and_run, ['']) test('numrun013', normal, compile_and_run, ['']) test('numrun014', normal, compile_and_run, ['']) +test('numrun015', normal, compile_and_run, ['']) test('arith016', normal, compile_and_run, ['']) test('arith017', normal, compile_and_run, ['']) test('arith018', normal, compile_and_run, ['']) diff --git a/testsuite/tests/numeric/should_run/numrun015.hs b/testsuite/tests/numeric/should_run/numrun015.hs new file mode 100644 index 0000000..070c5ab --- /dev/null +++ b/testsuite/tests/numeric/should_run/numrun015.hs @@ -0,0 +1,20 @@ +-- Test that floating-point abs works correctly + +absF :: Float -> Float +absF = abs + +absD :: Double -> Double +absD = abs + +main :: IO () +main = do + print $ absF (1 / 0) + print $ absD (1 / 0) + print $ absF 1 + print $ absD 1 + print $ absF (-1) + print $ absD (-1) + print $ absF (-1 / 0) + print $ absD (-1 / 0) + print $ absF (1 / 0) + print $ absD (1 / 0) diff --git a/libraries/base/tests/T7034.stdout b/testsuite/tests/numeric/should_run/numrun015.stdout similarity index 77% copy from libraries/base/tests/T7034.stdout copy to testsuite/tests/numeric/should_run/numrun015.stdout index 2675153..33cdeb4 100644 --- a/libraries/base/tests/T7034.stdout +++ b/testsuite/tests/numeric/should_run/numrun015.stdout @@ -1,5 +1,9 @@ Infinity Infinity +1.0 +1.0 +1.0 +1.0 Infinity Infinity Infinity From git at git.haskell.org Fri Mar 3 21:36:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 21:36:08 +0000 (UTC) Subject: [commit: ghc] master: Deserialize IfaceId more lazily (6446254) Message-ID: <20170303213608.F0E3F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/644625449a9b6fbeb9a81f1a7d0e7d18424fb707/ghc >--------------------------------------------------------------- commit 644625449a9b6fbeb9a81f1a7d0e7d18424fb707 Author: Reid Barton Date: Fri Mar 3 15:49:38 2017 -0500 Deserialize IfaceId more lazily This change sped up the total validate --build-only time by 0.8% on my test system; hopefully a representative result. I didn't bother making the other constructors lazy because for IfaceData and IfaceClass we need to pull on some of the fields in loadDecl, and all the others seem much more rare than IfaceId. Test Plan: validate, perf Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3269 >--------------------------------------------------------------- 644625449a9b6fbeb9a81f1a7d0e7d18424fb707 compiler/iface/IfaceSyn.hs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/compiler/iface/IfaceSyn.hs b/compiler/iface/IfaceSyn.hs index d73a738..1c30476 100644 --- a/compiler/iface/IfaceSyn.hs +++ b/compiler/iface/IfaceSyn.hs @@ -1565,9 +1565,7 @@ instance Binary IfaceDecl where put_ bh (IfaceId name ty details idinfo) = do putByte bh 0 putIfaceTopBndr bh name - put_ bh ty - put_ bh details - put_ bh idinfo + lazyPut bh (ty, details, idinfo) put_ bh (IfaceData a1 a2 a3 a4 a5 a6 a7 a8 a9) = do putByte bh 2 @@ -1657,9 +1655,7 @@ instance Binary IfaceDecl where h <- getByte bh case h of 0 -> do name <- get bh - ty <- get bh - details <- get bh - idinfo <- get bh + ~(ty, details, idinfo) <- lazyGet bh return (IfaceId name ty details idinfo) 1 -> error "Binary.get(TyClDecl): ForeignType" 2 -> do a1 <- getIfaceTopBndr bh From git at git.haskell.org Fri Mar 3 21:36:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 21:36:11 +0000 (UTC) Subject: [commit: ghc] master: Comments only, in CSE (#13340) (5ed56fc) Message-ID: <20170303213611.AAB1C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5ed56fc8163690c209f594dbfe9dd49b7053739b/ghc >--------------------------------------------------------------- commit 5ed56fc8163690c209f594dbfe9dd49b7053739b Author: Reid Barton Date: Fri Mar 3 15:49:51 2017 -0500 Comments only, in CSE (#13340) Reviewers: simonpj, austin, bgamari, dfeuer Reviewed By: dfeuer Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3268 >--------------------------------------------------------------- 5ed56fc8163690c209f594dbfe9dd49b7053739b compiler/simplCore/CSE.hs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index b8e26b5..8597579 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -217,8 +217,10 @@ Consider Here 'foo' has a stable unfolding, but its (optimised) RHS is trivial. (Turns out that this actually happens for the enumFromTo method of -the Integer instance of Enum in GHC.Enum.) Then we obviously do NOT -want to extend the substitution with (foo->x)! See similar +the Integer instance of Enum in GHC.Enum.) Suppose moreover that foo's +stable unfolding originates from an INLINE or INLINEABLE pragma on foo. +Then we obviously do NOT want to extend the substitution with (foo->x), +because we promised to inline foo as what the user wrote. See similar SimplUtils Note [Stable unfoldings and postInlineUnconditionally]. Nor do we want to change the reverse mapping. Suppose we have @@ -232,6 +234,11 @@ There could conceivably be merit in rewriting the RHS of bar: but now bar's inlining behaviour will change, and importing modules might see that. So it seems dodgy and we don't do it. +Stable unfoldings are also created during worker/wrapper when we decide +that a function's definition is so small that it should always inline. +In this case we still want to do CSE (#13340). Hence the use of +isAnyInlinePragma rather than isStableUnfolding. + Note [Corner case for case expressions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Here is another reason that we do not use SUBSTITUTE for @@ -367,7 +374,6 @@ noCSE :: InId -> Bool noCSE id = not (isAlwaysActive (idInlineActivation id)) -- See Note [CSE for INLINE and NOINLINE] || isAnyInlinePragma (idInlinePragma id) - --isStableUnfolding (idUnfolding id) -- See Note [CSE for stable unfoldings] || isJoinId id -- See Note [CSE for join points?] From git at git.haskell.org Fri Mar 3 21:36:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 21:36:14 +0000 (UTC) Subject: [commit: ghc] master: Allow iOS to load archives through the linker (d5e0b4b) Message-ID: <20170303213614.5F7D03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d5e0b4bd4a8623169e59a6de6d4d9f84ea94aa22/ghc >--------------------------------------------------------------- commit d5e0b4bd4a8623169e59a6de6d4d9f84ea94aa22 Author: Moritz Angermann Date: Fri Mar 3 15:50:01 2017 -0500 Allow iOS to load archives through the linker This basically just adds ios where darwin already was, and is just one of the pieces for the rts linker support for ios (aarch64-macho) --- The following diagram and legend tries to explain the dependencies a bit: ``` .- This v D3255 <- D3252 <- D3251 <- D3239 ^ '- D3238 ``` - In D3238 we started allowing preloading object code with mmap in iOS, where we can't have r+w+x. - In D3239 we introduced a richer extension of the object code data type to make working with mach-o files easier. - In D3240 we set the stage to allow loading archives (.a) on iOS - In D3251 we added init and deinit functions to populate and depopulate the enriched object code data structure for mach-o files. - In D3252 we refactored most of the MachO.c file to use the new types and data structure. - in D3255 we finally introduce the aarch64-mach-o linker. Reviewers: bgamari, austin, erikd, simonmar Reviewed By: bgamari Subscribers: thomie, ryantrinkle Differential Revision: https://phabricator.haskell.org/D3240 >--------------------------------------------------------------- d5e0b4bd4a8623169e59a6de6d4d9f84ea94aa22 rts/linker/LoadArchive.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/rts/linker/LoadArchive.c b/rts/linker/LoadArchive.c index 62922a7..f9997cf 100644 --- a/rts/linker/LoadArchive.c +++ b/rts/linker/LoadArchive.c @@ -13,7 +13,7 @@ /* Platform specific headers */ #if defined(OBJFORMAT_PEi386) # include "linker/PEi386.h" -#elif defined(darwin_HOST_OS) +#elif defined(darwin_HOST_OS) || defined(ios_HOST_OS) # include "linker/MachO.h" # include # include @@ -29,7 +29,7 @@ #define DEBUG_LOG(...) IF_DEBUG(linker, debugBelch("loadArchive: " __VA_ARGS__)) -#if defined(darwin_HOST_OS) +#if defined(darwin_HOST_OS) || defined(ios_HOST_OS) /* Read 4 bytes and convert to host byte order */ static uint32_t read4Bytes(const char buf[static 4]) { @@ -51,6 +51,9 @@ static StgBool loadFatArchive(char tmp[static 20], FILE* f, pathchar* path) #elif defined(powerpc64_HOST_ARCH) const uint32_t mycputype = CPU_TYPE_POWERPC64; const uint32_t mycpusubtype = CPU_SUBTYPE_POWERPC_ALL; +#elif defined(aarch64_HOST_ARCH) + const uint32_t mycputype = CPU_TYPE_ARM64; + const uint32_t mycpusubtype = CPU_SUBTYPE_ARM64_ALL; #else #error Unknown Darwin architecture #endif @@ -149,7 +152,7 @@ static StgBool checkFatArchive(char magic[static 20], FILE* f, pathchar* path) { StgBool success; success = false; -#ifdef darwin_HOST_OS +#if defined(darwin_HOST_OS) || defined(ios_HOST_OS) /* Not a standard archive, look for a fat archive magic number: */ if (read4Bytes(magic) == FAT_MAGIC) success = loadFatArchive(magic, f, path); @@ -341,7 +344,7 @@ static HsInt loadArchive_ (pathchar *path) } } -#if defined(darwin_HOST_OS) +#if defined(darwin_HOST_OS) || defined(ios_HOST_OS) if (strncmp(fileName, "!\n", 8) == 0) { DEBUG_LOG("found the start of another archive, breaking\n"); break; @@ -500,7 +503,7 @@ static HsInt loadArchive_ (pathchar *path) // cannot currently allocate blocks large enough. image = allocateImageAndTrampolines(path, fileName, f, memberSize, isThin); -#elif defined(darwin_HOST_OS) +#elif defined(darwin_HOST_OS) || defined(ios_HOST_OS) if (RTS_LINKER_USE_MMAP) image = mmapForLinker(memberSize, MAP_ANONYMOUS, -1, 0); else { From git at git.haskell.org Fri Mar 3 21:36:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 21:36:17 +0000 (UTC) Subject: [commit: ghc] master: Add test to ensure that SPEC rules are named deterministically (0ce11ae) Message-ID: <20170303213617.E1C6E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0ce11aedd404e2d1eabd362e5c3329960008de88/ghc >--------------------------------------------------------------- commit 0ce11aedd404e2d1eabd362e5c3329960008de88 Author: Ben Gamari Date: Fri Mar 3 15:50:41 2017 -0500 Add test to ensure that SPEC rules are named deterministically Test Plan: Validate Reviewers: niteria, austin, dfeuer Reviewed By: dfeuer Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D3220 >--------------------------------------------------------------- 0ce11aedd404e2d1eabd362e5c3329960008de88 testsuite/tests/determinism/determ022/A.hs | 6 ++++++ testsuite/tests/determinism/{determ003 => determ022}/Makefile | 2 +- testsuite/tests/determinism/determ022/all.T | 1 + .../{determ002/determ002.stdout => determ022/determ022.stdout} | 0 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/determinism/determ022/A.hs b/testsuite/tests/determinism/determ022/A.hs new file mode 100644 index 0000000..5b12e27 --- /dev/null +++ b/testsuite/tests/determinism/determ022/A.hs @@ -0,0 +1,6 @@ +-- | Test that SPEC rules are named deterministically. +module A where + +test1 :: Num a => a -> a -> a +test1 x y = x + 42 * y +{-# SPECIALISE test1 :: Int -> Int -> Int #-} diff --git a/testsuite/tests/determinism/determ003/Makefile b/testsuite/tests/determinism/determ022/Makefile similarity index 96% copy from testsuite/tests/determinism/determ003/Makefile copy to testsuite/tests/determinism/determ022/Makefile index faff63e..1bd543e 100644 --- a/testsuite/tests/determinism/determ003/Makefile +++ b/testsuite/tests/determinism/determ022/Makefile @@ -2,7 +2,7 @@ TOP=../../.. include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk -determ003: +determ022: $(RM) A.hi A.o '$(TEST_HC)' $(TEST_HC_OPTS) -O -dinitial-unique=0 -dunique-increment=1 A.hs $(CP) A.hi A.normal.hi diff --git a/testsuite/tests/determinism/determ022/all.T b/testsuite/tests/determinism/determ022/all.T new file mode 100644 index 0000000..3ecdf3c --- /dev/null +++ b/testsuite/tests/determinism/determ022/all.T @@ -0,0 +1 @@ +test('determ022', [extra_files(['A.hs'])], run_command, ['$MAKE -s --no-print-directory determ022']) diff --git a/testsuite/tests/determinism/determ002/determ002.stdout b/testsuite/tests/determinism/determ022/determ022.stdout similarity index 100% copy from testsuite/tests/determinism/determ002/determ002.stdout copy to testsuite/tests/determinism/determ022/determ022.stdout From git at git.haskell.org Fri Mar 3 21:36:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 21:36:20 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump down allocations of T4029 (96f5656) Message-ID: <20170303213620.9CD3E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/96f5656d2ae885fa4b0227c4650b1c375e16dd00/ghc >--------------------------------------------------------------- commit 96f5656d2ae885fa4b0227c4650b1c375e16dd00 Author: Ben Gamari Date: Fri Mar 3 16:34:52 2017 -0500 testsuite: Bump down allocations of T4029 >--------------------------------------------------------------- 96f5656d2ae885fa4b0227c4650b1c375e16dd00 testsuite/tests/perf/space_leaks/all.T | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/testsuite/tests/perf/space_leaks/all.T b/testsuite/tests/perf/space_leaks/all.T index 84dca41..5480680 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -66,6 +66,8 @@ test('T4029', # 2016-09-01: 71 (amd64/Linux) Restore w/w limit (#11565) # 2017-02-12: 80 (amd64/Linux) Type-indexed Typeable # 2017-02-20: 76 (amd64/Linux) Better reading of iface files + # 2017-03-03: 65 (amd64/Linux) Share Typeable KindReps or more + # lazy interface file reading stats_num_field('max_bytes_used', [(wordsize(64), 22016200, 5)]), # 2016-02-26: 24071720 (amd64/Linux) INITIAL @@ -80,6 +82,8 @@ test('T4029', # 2017-02-07: 22770352 (amd64/Linux) It is unclear # 2017-02-12: 24151096 (amd64/Linux) Type-indexed Typeable # 2017-02-20: 22016200 (amd64/Linux) Better reading of iface files + # 2017-03-03: 19172360 (amd64/Linux) Share Typeable KindReps or more + # lazy interface file reading extra_hc_opts('+RTS -G1 -RTS' ), ], ghci_script, From git at git.haskell.org Fri Mar 3 22:33:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 22:33:59 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add a NaN case to numrun015 (2f8534b) Message-ID: <20170303223359.C76B23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2f8534b512474188c54885e1b488798affaf08e2/ghc >--------------------------------------------------------------- commit 2f8534b512474188c54885e1b488798affaf08e2 Author: Ben Gamari Date: Fri Mar 3 17:32:23 2017 -0500 testsuite: Add a NaN case to numrun015 >--------------------------------------------------------------- 2f8534b512474188c54885e1b488798affaf08e2 testsuite/tests/numeric/should_run/numrun015.hs | 1 + testsuite/tests/numeric/should_run/numrun015.stdout | 1 + 2 files changed, 2 insertions(+) diff --git a/testsuite/tests/numeric/should_run/numrun015.hs b/testsuite/tests/numeric/should_run/numrun015.hs index 070c5ab..75d4a79 100644 --- a/testsuite/tests/numeric/should_run/numrun015.hs +++ b/testsuite/tests/numeric/should_run/numrun015.hs @@ -18,3 +18,4 @@ main = do print $ absD (-1 / 0) print $ absF (1 / 0) print $ absD (1 / 0) + print $ absD $ sqrt (-1) diff --git a/testsuite/tests/numeric/should_run/numrun015.stdout b/testsuite/tests/numeric/should_run/numrun015.stdout index 33cdeb4..c30dd62 100644 --- a/testsuite/tests/numeric/should_run/numrun015.stdout +++ b/testsuite/tests/numeric/should_run/numrun015.stdout @@ -8,3 +8,4 @@ Infinity Infinity Infinity Infinity +NaN From git at git.haskell.org Fri Mar 3 22:35:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 22:35:25 +0000 (UTC) Subject: [commit: ghc] master: Fix a tiny typo (a86e68c) Message-ID: <20170303223525.30CDB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a86e68cee83ea4290f0325c1a02ecb734fdaa485/ghc >--------------------------------------------------------------- commit a86e68cee83ea4290f0325c1a02ecb734fdaa485 Author: Ingo Blechschmidt Date: Fri Mar 3 22:46:08 2017 +0100 Fix a tiny typo >--------------------------------------------------------------- a86e68cee83ea4290f0325c1a02ecb734fdaa485 libraries/base/System/IO.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/base/System/IO.hs b/libraries/base/System/IO.hs index 656f852..d1ed9e3 100644 --- a/libraries/base/System/IO.hs +++ b/libraries/base/System/IO.hs @@ -426,7 +426,7 @@ fixIO k = do -- | The function creates a temporary file in ReadWrite mode. -- The created file isn\'t deleted automatically, so you need to delete it manually. -- --- The file is creates with permissions such that only the current +-- The file is created with permissions such that only the current -- user can read\/write it. -- -- With some exceptions (see below), the file will be created securely From git at git.haskell.org Fri Mar 3 22:46:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 22:46:15 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Fix double test of +Infinity (0fd8340) Message-ID: <20170303224615.AAFAD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0fd8340517a7a582bc5adb15771d82a69e3e4348/ghc >--------------------------------------------------------------- commit 0fd8340517a7a582bc5adb15771d82a69e3e4348 Author: Ben Gamari Date: Fri Mar 3 17:45:04 2017 -0500 testsuite: Fix double test of +Infinity The second set was supposed to be a NaN. >--------------------------------------------------------------- 0fd8340517a7a582bc5adb15771d82a69e3e4348 testsuite/tests/numeric/should_run/numrun015.hs | 4 ++-- testsuite/tests/numeric/should_run/numrun015.stdout | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/testsuite/tests/numeric/should_run/numrun015.hs b/testsuite/tests/numeric/should_run/numrun015.hs index 75d4a79..f0bb429 100644 --- a/testsuite/tests/numeric/should_run/numrun015.hs +++ b/testsuite/tests/numeric/should_run/numrun015.hs @@ -16,6 +16,6 @@ main = do print $ absD (-1) print $ absF (-1 / 0) print $ absD (-1 / 0) - print $ absF (1 / 0) - print $ absD (1 / 0) + print $ absF (0 / 0) + print $ absD (0 / 0) print $ absD $ sqrt (-1) diff --git a/testsuite/tests/numeric/should_run/numrun015.stdout b/testsuite/tests/numeric/should_run/numrun015.stdout index c30dd62..c897141 100644 --- a/testsuite/tests/numeric/should_run/numrun015.stdout +++ b/testsuite/tests/numeric/should_run/numrun015.stdout @@ -6,6 +6,6 @@ Infinity 1.0 Infinity Infinity -Infinity -Infinity +NaN +NaN NaN From git at git.haskell.org Fri Mar 3 23:43:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 23:43:13 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: Add new warning for bad CPP #if usage (81b284e) Message-ID: <20170303234313.CF34C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/81b284e123fd8f7fb2c4163a58f9ff380253f482/ghc >--------------------------------------------------------------- commit 81b284e123fd8f7fb2c4163a58f9ff380253f482 Author: Erik de Castro Lopo Date: Sun Oct 23 08:30:19 2016 +1100 Add new warning for bad CPP #if usage The C code in the RTS now gets built with `-Wundef` and the Haskell code (stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever `#if` is used on undefined identifiers. >--------------------------------------------------------------- 81b284e123fd8f7fb2c4163a58f9ff380253f482 ghc/GHCi/UI.hs | 2 +- includes/CodeGen.Platform.hs | 51 ++++++++++++++++++++++-------------------- includes/Stg.h | 6 ++--- includes/rts/OSThreads.h | 4 ++-- includes/stg/MachRegs.h | 14 ++++++------ includes/stg/SMP.h | 37 ++++++++++++++++-------------- libraries/ghci/GHCi/ObjLink.hs | 2 +- mk/warnings.mk | 4 ++-- rts/LinkerInternals.h | 3 ++- rts/OldARMAtomic.c | 2 +- rts/Schedule.c | 16 ++++++------- rts/Threads.c | 2 +- rts/ghc.mk | 3 +++ rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 8 +++---- rts/sm/CNF.c | 2 +- rts/sm/GCUtils.c | 2 +- rts/sm/GCUtils.h | 2 +- rts/sm/MBlock.c | 2 +- 19 files changed, 87 insertions(+), 77 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 81b284e123fd8f7fb2c4163a58f9ff380253f482 From git at git.haskell.org Fri Mar 3 23:43:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Mar 2017 23:43:20 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts's head updated: Add new warning for bad CPP #if usage (81b284e) Message-ID: <20170303234320.A5AD33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/erikd/rts' now includes: 518f289 New story for abstract data types in hsig files. 7e77c4b Support constraint synonym implementations of abstract classes. 9df4ce4 Only delete instances when merging when there is an exact match. 01490b4 Mark previously failing backpack tests as passing, with correct output. c2142ca Fix Mac OS X build by removing space after ASSERT. c23dc61 check-cpp: Make it more robust ff225b4 Typos in comments 45bfd1a Refactor typechecking of pattern bindings 82efad7 Comments and trivial refactoring cdbc73a Test Trac #12507 d61c7e8 Make TcLevel increase by 1 not 2 3f5673f A collection of type-inference refactorings. 1f09b24 Accept 20% dedgradation in Trac #5030 compile time 9417e57 Refactor occurrence-check logic e1fc5a3 Define emitNewWantedEq, and use it 6ddba64 Improve TcCanonical.unifyWanted and unifyDerived f41a8a3 Add and use a new dynamic-library-dirs field in the ghc-pkg info acc9851 Fix failure in setnumcapabilities001 (#12728) 1050e46 rts: configure.ac should populate HAVE_LIBNUMA instead of USE_LIBNUMA a662f46 Skip T5611 on OSX as it fails non-deterministically. 3cb32d8 Add -Wcpp-undef warning flag 6e9a51c Refactoring: Delete copied function in backpack/NameShape b76cf04 cmm/Hoopl/Dataflow: minor cleanup aaede1e rts/package.conf.in: Fix CPP usage a6bcf87 Refactoring: Replace when (not ...) with unless in ErrUtils f084e68 rts: Move path utilities to separate source file 1c4a39d Prioritise class-level equality costraints 1221f81 Don't instantaite when typechecking a pattern synonym 08ba691 Take account of kinds in promoteTcType 03b0b8e Test Trac #12174 853cdae Test Trac #12081 a182c0e testsuite: Bump peak_megabytes_allocated for T3064 801c263 Fundeps work even for unary type classes 9f814b2 Delete extraneous backtick in users' guide 925d178 Make traceRn behave more like traceTc 488a9ed rts/linker: Move loadArchive to new source file 23143f6 Refine ASSERT in buildPatSyn for the nullary case. 48876ae Remove -dtrace-level b8effa7 CmmUtils: remove the last dataflow functions 3562727 Simple refactor to remove misleading comment f9308c2 Collect coercion variables, not type variables eefe86d Allow levity-polymorpic arrows 0eb8934 Fix typo in comment cc29eb5 Revert "rts/linker: Move loadArchive to new source file" 815b837 Minor doc addition as requested in #12774. 7187ded Clarify comments on kinds (Trac #12536) aae2b3d Make it possible to use +RTS -qn without -N 60343a4 Add test for #12732 5ebcb3a Document unpackClosure# primop 4b300a3 Minor refactoring in stg_unpackClosurezh 4e088b4 Fix a bug in parallel GC synchronisation 7ddbdfd Zap redundant imports 80d4a03 Typos in comments 795be0e Align GHCi's library search order more closely with LDs 0b70ec0 Have static pointers work with -fno-full-laziness. 19ce8a5 Sparc*: Prevent GHC from doing unaligned accesses 79fb6e6 Tiny refactor 9968949 Get rid of TcTyVars more assiduously 7a50966 Simplify the API for TcHsType.kcHsTyVarBndrs f4a14d6 Use substTyUnchecked in TcMType.new_meta_tv_x 13508ba Fix Trac #12797: approximateWC 623b8e4 Renaming and comments in CorePrep 8a5960a Uninstall signal handlers cc4710a testsuite: Simplify kernel32 glue logic f4fb3bc linker: Split out CacheFlush logic abfa319 linker: Shuffle configuration into LinkerInternals.h 43c8c1c linker: Move mmapForLinker declaration into LinkerInternals.h 3f05126 linker: Split symbol extras logic into new source file c3446c6 Shuffle declarations into LinkerInternals.h 6ea0b4f linker: Split PEi386 implementation into new source file f6c47df linker: Split MachO implementation into new source file bdc262c linker: Split ELF implementation into separate source file 6fecb7e linker: Move ARM interworking note to SymbolExtras.c dc4d596 Hoopl/Dataflow: make the module more self-contained 80076fa Add notes describing SRT concepts b5460dd Add testcase for #12757 967dd5c Merge cpe_ExprIsTrivial and exprIsTrivial eaa3482 testsuite: Update T10858 allocations ec22bac Add test for #12788 f46bfeb API Annotations: make all ModuleName Located a977c96 Omit unnecessary linker flags e43f05b Add comments from Trac #12768 7b0ae41 Remove a debug trace 2cdd9bd Take account of injectivity when doing fundeps b012120 Handle types w/ type variables in signatures inside patterns (DsMeta) 1cab42d Update release notes for type sigs in TH patterns patch 1c886ea Stop -dno-debug-output suppressing -ddump-tc-trace 25c8e80 Add tracing infrastructure to pattern match checker 630d881 Allow GeneralizedNewtypeDeriving for classes with associated type families ead83db Describe symptoms of (and the cure for) #12768 in 8.0.2 release notes 1964d86 Some minor linker cleanups. 7d988dd Fix broken validate build. 91f9e13 Fix hs_try_putmvar003 (#12800) 2e8463b Update 8.0.2 release notes for #12784 2325afe Fix comment about pointer tagging 7fe7163 Adapt the (commented out) pprTrace in OccurAnal f05d685 Refactoring of mkNewTypeEqn 317236d Refactor CallStack defaulting slightly 500d90d ghc-cabal: Use correct name of linker flags env variable 816d2e4 build system: Include CONF_LD_LINKER_OPTS in ALL_LD_OPTS 9030d8e configure: Pass HC_OPTS_STAGEx to build system bae4a55 Pass -no-pie to GCC 0a122a4 testsuite: Update allocation numbers for T5631 e06e21a Add Richard Eisenberg's new email to mailmap bef7e78 Read parentheses better 122d826 rts: Add api to pin a thread to a numa node but without fixing a capability aa10c67 rts/linker: Move loadArchive to new source file e8ae4dc Update user's guide after D2490 03e8d26 Prevent GND from inferring an instance context for method-less classes 60bb9d1 Revert "Pass -no-pie to GCC" 7a7bb5d Revert "Refactor CallStack defaulting slightly" ec0bf81 rts: Fix LoadArchive on OS X d421a7e Pass -no-pie to GCC 46e2bef testsuite: Lower allocations for T876 7eae862 ghc-pkg: Munge dynamic library directories 2cfbee8 rts: Fix build when linked with gold 4e0b8f4 rts: Fix #include of 587dccc Make default output less verbose (source/object paths) 568e003 template-haskell: Version bump ca1b986 ghc: Fix ghc's template-haskell bound 8cb7bc5 rts: Fix references to UChar 6c0f10f Kill Type pretty-printer 55d535d Remove CONSTR_STATIC 034e01e Accept output for scc003 e0ca7ff Fix numa001 failure with "too many NUMA nodes" cb16890 testsuite: Fix creep of T4029 011af2b configure: Verify that GCC recognizes -no-pie flag 1b336d9 Skip 64-bit symbol tables 98f9759 Hopefully fix build on OS X 642adec Mark T12041 as expect_broken with -DDEBUG (#12826) 017d11e Typos in comments, notes and manual 31d5b6e fixup! Stop the simplifier from removing StaticPtr binds. 0e58652 Test for unnecessary register spills 4a835f0 Update xhtml submodule a637eeb Don't use mmap symbols when !RTS_LINKER_USE_MMAP 0135188 Storage.c: Pass a size to sys_icache_invalidate fa70b1e Fix -fobject-code with -fexternal-interpreter 7acee06 Avoid calling newDynFlags when there are no changes d3542fa Generalise the implicit prelude import 8dfca69 Inline compiler/NOTES into X86/Ppr.hs b769586 Fix windows validate 31398fb Test for type synonym loops on TyCon. 2878604 Correct spelling of command-line option in comment cede770 Correct name of Note in comment 07e40e9 Add Data instance for Const 18eb57b Revert "Add Data instance for Const" 9a4983d Pass autoconf triplets to sub-project configures 20fb781 LLVM generate llvm.expect for conditional branches 4d4f353 testsuite: Rip out hack for #12554 04b024a GHCi: Unconditionally import System.Directory 231a3ae Have reify work for local variables with functional dependencies. 9c39e09 Switch to LLVM version 3.9 94d1221 Add missing SMP symbols to RT linker. d328abc Spelling in comment only 3bd1dd4 Add Data instance for Const 4b72f85 Optimise whole module exports 6ad94d8 Updated code comment regarding EquationInfo. Trac #12856 ea37b83 A few typos in comments 5bce207 testsuite: Add test for #12855 926469f testsuite: Add test for #12024 b98dbdf testsuite: Add (still broken) testcase for #12447 e7ec521 testsuite: Add (still failing) testcase for #12550 ea76a21 add ieee754 next* functions to math_funs 514acfe Implement fine-grained `-Werror=...` facility 4c0dc76 Ignore Hadrian build products. 7e4b611 Make transformers upstream repository location consistent with others 1399c8b ghc/hschooks.c: Fix include path of Rts.h f430253 Allow to unregister threadWaitReadSTM action. 14ac372 Collect wildcards in sum types during renaming (#12711) d081fcf Make quoting and reification return the same types 9a431e5 Make a panic into an ASSERT 0476a64 Fix a bug in mk_superclasses_of f04f118 Comments only in TcType 0123efd Add elemDVarEnv 1eec1f2 Another major constraint-solver refactoring 18d0bdd Allow TyVars in TcTypes 4431e48 Remove redundant kind check 90a65ad Perf improvements in T6048, T10547 e319466 Typos in comments c1b4b76 Fix a name-space problem with promotion f0f4682 Test Trac #12867 83a952d Test Trac #12845 a5a3926 Kill off ifaceTyVarsOfType bc35c3f Use 'v' instead of 'tpl' for template vars edbe831 Use TyVars in a DFunUnfolding 12eff23 Use TyVars in PatSyns 5f349fe Improve pretty-printing of types eb55ec2 Refactor functional dependencies a bit 1bfff60 Fix inference of partial signatures 086b483 A tiny bit more tc tracing f8c966c Be a bit more selective about improvement 6ec2304 Fix an long-standing bug in OccurAnal 5238842 Typos in comments only [ci skip] 605af54 Test Trac #12776 27a6bdf Test Trac #12885 3aa9368 Comments only (related to #12789) abd4a4c Make note of #12881 in 8.0.2 release notes f8c8de8 Zonk the free tvs of a RULE lhs to TyVars e755930 Typos in comments 36e3622 Store string as parsed in SourceText for CImport 1732d7a Define thread primitives if they're supported. 30cecae users_guide: Bring 8.0.2 release notes up-to-date with ghc-8.0 branch f1fc8cb Make diagnostics slightly more colorful 52222f9b Detect color support da5a61e Minor cleanup of foldRegs{Used,Defd} 2d99da0 testsuite: Mention CLEANUP option in README 3ec8563 Replace -fshow-source-paths with -fhide-source-paths c2268ba Refactor Pattern Match Checker to use ListT 6845087 Purge GHC of literate Perl 4d4e7a5 Use newBlockId instead of newLabelC 7753273 AsmCodeGen: Refactor worker in cmmNativeGens 6d5c2e7 NCGMonad: Add MonadUnique NatM instance eaed140 OrdList: Add Foldable, Traversable instances fe3748b testsuite: Bump haddock.compiler allocations 795f8bd hschooks.c: Ensure correct header file is included 6f7ed1e Make globals use sharedCAF 56d7451 Fix type of GarbageCollect declaration 428e152 Use C99's bool 758b81d rts: Add missing #include 23dc6c4 Remove most functions from cmm/BlockId b92f8e3 Added Eq1, Ord1, Read1 and Show1 instances for NonEmpty 679ccd1 Hoopl/Dataflow: use block-oriented interface 0ce59be Fix testsuite threading, timeout, encoding and performance issues on Windows dd9ba50 Update test output for Windows 605bb9b testsuite: Use python3 by default 20c0614 Update Mingw-w64 bindist for Windows ef37580 Fix windows validate. be8a47f Tweaks to grammar and such. 03766cd Rename RuntimeRepPolymorphism to LevityPolymorphism e2330b6 Revert "Make globals use sharedCAF" c2a2911 Revert "Fix windows validate." 6c54fa5 testsuite: Add another testcase for #11821 0200ded Fix typo in functional dependencies doc f48f5a9e Ensure flags destined for ld are properly passed 514c01e Levity polymorphic expressions mustn't be floated-out in let-bindings. a452c6e Make note of #12907 in 8.0.2 release notes 0ac5e0c rts: Fix type of bool literal 7214e92 testsuite: Remove Unicode literals from driver 6576bf8 rts: Ensure we always give MADV_DONTNEED a chance in osDecommitMemory 0f37550 Typos in comments a934e25 testsuite: Actually update haddock.compiler allocations 7fafb84 testsuite/conc059: Don't attempt to use stdcall where it isn't supported 747e77c Fix naming of the native latin1 encodings ddc271e Travis: Add dependency on python3 27731f1 Note Trac #12141 in mk/build.mk.sample f46369b fdReady: use poll() instead of select() 895a131 Install toplevel handler inside fork. 2350906 Maintain in-scope set in deeply_instantiate (fixes #12549). eb6f673 8.2.1-notes.rst: tweak binutils version 90c5af4 core-spec: Fix S_MatchData 517d03e Fix an asymptotic bug in the occurrence analyser 6305674 Fix used-variable calculation (Trac #12548) e912310 Use isFamFreeTyCon now we have it 3e3f7c2 Test Trac #12925 847d229 Color output is wreaking havoc on test results b82f71b Fix x86 Windows build and testsuite eec02ab Give concrete example for #12784 in 8.0.2 release notes 24e6594 Overhaul GC stats 19ae142 Mark rn017 and T7672 as expect_broken(#12930) with -DDEBUG 6e4188a Fix unsafe usage of `is_iloc` selector in Ord instance for ImportSpec eafa06d Revert "Mark rn017 and T7672 as expect_broken(#12930) with -DDEBUG" b7e88ee Reduce the size of string literals in binaries. 41ec722d Test Trac #12919 39143a4 Mark T9577 as broken on Darwin due to #12937 4dd6b37 Really mark T9577 as broken 7036fde Overhaul of Compact Regions (#12455) c02aeb5 Ignore output for compact_gc: sizes change when profiling 5aa9c75 Fix the test with -O 9043a40 Fix crashes in hash table scanning with THREADED_RTS d70d452 rts: Use pthread itimer implementation on Darwin 83d69dc Don't barf() on failures in loadArchive() 499e438 Add HsSyn prettyprinter tests 58d78dc Fix pretty printer test to nog generate stdout 9bcc4e3 Remove stray commented out line in all.T c5fbbac Ignore stderr of all printer tests 62332f3 Setup tcg_imports earlier during signature matching, so orphans are visible. 617d57d Reduce qualification in error messages from signature matching. 58c290a hschooks.c: Fix long line 5063edb arclint: Lint cabal files c766d53 rts/linker: Fix LoadArchive build on Windows 6889400 testsuite: Add test for #10249 1e5b7d7 Update Windows GCC driver. 55361b3 nativeGen: Fix string merging on Windows 2bb099e BlockId: remove BlockMap and BlockSet synonyms 6da6253 rts/PosixSource.h: Define __USE_MINGW_ANSI_STDIO on Windows f65ff2c Disambiguate reified closed type family kinds in TH 61932cd Bump haddock submodule d3b546b Scrutinee Constant Folding cee72d5 Disable colors unless printing to stderr 1c296c0c Export `warningGroups' and `warningHierarchies' 62418b8 Mark T12903 as broken on OS X 90fae01 Fix LLVM TBAA metadata 2823492 NCG: Implement trivColorable for PowerPC 64-bit ca593c7 testsuite: make tests respond to SIGINT properly d1df8d1 Ensure each test inherits the TEST_HC_OPTS 5349d64 Rename TH constructors for deriving strategies 24a4fe2 testsuite: Mark prog003 as broken on Windows 2618090 testsuite: Fix syntax error in rts/all.T 17ac9b1 rts: Provide _lock_file in symbol table on Windows 0ac5a00 Add `_unlock_file` to RTS symbols 490b942 Automate GCC driver wrapper c3c7024 Make globals use sharedCAF 818e027 Refactor pruning of implication constraints f1036ad Make dropDerivedSimples restore [WD] constraints 6720376 Disable T12903 due to flakiness d03dd23 Fix a long-standing bug in CSE bc3d37d Float unboxed expressions by boxing 8f6d241 Add infix flag for class and data declarations 24f6bec Sanity check if we pick up an hsig file without -instantiated-with. db23ccf Fix recompilation detection when set of signatures to merge changes. f723ba2 Revert "Float unboxed expressions by boxing" cc2e3ec base: Make raw buffer IO operations more strict cb582b6 Don't have CPP macros expanding to 'defined'. 9cb4a13 Fix Win32 x86 build validation after D2756 aa123f4 Fix testcase T12903 on OS X 7031704 print * in unicode correctly (fixes #12550) 8ec864d Fix pretty printing of top level SCC pragmas 9c9a222 Load orphan interfaces before checking if module implements signature 26ce99c Fix typo in users' guide 52c5e55 mk/config.mk.in: enable SMP on ARMv7+ (Trac #12981) 0c3341b Show constraints when reporting typed holes 6f7d827 Reset FPU precision back to MSVCRT defaults 8b2e588 Adds llvm-prof flavour 6370a56 Build terminfo on iOS. 3c7cf18 Fix pprCLabel on platforms without native codegen. be5384c testsuite: Mark T9577 as broken due to #12965 27287c8 procPointAnalysis doesn't need UniqSM fe5d68a Add entry to .gitignore to for __.SYMDEF_SORTED 9550b8d Make unboxedTuple{Type,Data}Name support 0- and 1-tuples 2940a61 testsuite: Specify expected allocations of T12877 for Windows 5c76f83 check-ppr: Add a --dump flag to aid in debugging 394231b Fix cost-centre-stacks bug (#5654) 1ec632f Fix pretty printing of MINIMAL signatures 503219e Warn about missing instance methods that start with an underscore d398162 testsuite: Separate out Windows results for T5205 4d683fa base: Bump version to 4.10.0.0 8f0546b testsuite: Add test for #12971 0cad52d testsuite: Mark T10294 as fixed 81c4956 testsuite: Add test for #12966 cd4b202 array: Check for integer overflow during allocation 0d213c1 UniqSupply: Use full range of machine word ffc2327 base: Add more POSIX types (fixes #12795) 6fecb2a Verify that known-key uniques fit in interface file ed4cf03 Typos in comments 13c1fc4 DynFlags: Rip out remnants of WarnContextQuantification c889df8 Packages: Kill unused UnitId argument to isDllName 5bf344b CLabel: Kill redundant UnitId argument from labelDynamic 222e99d Make up a module name for c-- files 4026b45 Fix string merging with -split-sections 8f71d95 Enable split sections by default where possible c8ed1bd testsuite: Add test for #12993 2fa00f5 UNREG: include CCS_OVERHEAD to STG a6657bd revert '-Wl' prefixing to *_LD_OPTS c480860 rts/Compact.cmm: fix UNREG build failure d88efb7 Fix Pretty printer tests on Windows 0af959b Revert "Do not init record accessors as exported" 87c3b1d fix OpenBSD linkage (wxneeded) 6c816c5 utils/genargs: delete unused tool 8906e7b Reshuffle levity polymorphism checks. 3dbd2b0 Windows: Improve terminal detection mechanism 2d1beb1 rts/win32/IOManager: Fix integer types 343b147 Reexport Language.Haskell.TH.Lib from Language.Haskell.TH 2a02040 Fix bug in previous fix for #5654 90cfa84 Run some tests with -fexternal-interpreter -prof 21dde81 Improve StringBuffer and FastString docs e0fe7c3 Docs: Delete duplicate paragraph in user guide 52ba947 Allow use of the external interpreter in stage1. 25b70a2 Check family instance consistency of hs-boot families later, fixes #11062. 630cfc3 Fix Haddock comment typo. b5d788a Introduce unboxedSum{Data,Type}Name to template-haskell 513eb6a Fix #12998 by removing CTimer 88e8194 T12035j: disable on NOSMP targets 4704d65 T8209: disable on NOSMP targets 7f5be7e T10296a: disable on NOSMP targets d327ebd regalloc_unit_tests: disable on UNREG targets bb74bc7 T8242: disable on NOSMP targets f1dfce1 Revert "Allow use of the external interpreter in stage1." 6263e10 Fix timeout's timeout on Windows c0c1f80 Mark T8089 as unbroken since #7325 is now resolved 27f7925 Allow use of the external interpreter in stage1. 4535fa2 Test Trac #12996 8fdb937 Make CompactionFailed a newtype 574abb7 Rewrite Note [Api annotations] for clarity. 9a29b65 Suppress duplicate .T files 1771da2 Fix typos (not test relevant) f97d489 Test Trac #12968, plus some comments c73a982 Add note for rebindable syntax of [a..b] c66dd05 Move typeSize/coercionSize into TyCoRep d250d49 Add INLINE pragamas on Traversable default methods e07ad4d Don't eta-expand in stable unfoldings 0a18231 Lint DFunUnfoldings 05d233e Move InId/OutId to CoreSyn c48595e Never apply worker/wrapper to DFuns 1a4c04b Fix 'SPECIALISE instance' c469db4 Test Trac #12950 74033c4 Improved perf for T12227 ccc918c Fix a forward reference to a Note 2189239 Disambiguate two Notes with identical names ee4e165 Support for abi-depends for computing shadowing. 99db12f Update ghc-cabal command line usage text. 46f7f31 Notes on parsing lists in Parser.y 41ade95 Fix another forward reference to a Note b7a6e62 Revert "Suppress duplicate .T files" efc4a16 Allow timeout to kill entire process tree. 7a13f1f Alpha-renaming and white space only f06b71a Fix a bug in ABot handling in CoreArity ea8f91d White space only 9a4af2c Comments only 11306d6 Ensure that even bottoming functions have an unfolding 432f952 Float unboxed expressions by boxing 793ddb6 Tiny refactor in CoreTidy 75e8c30 Propagate evaluated-ness a bit more faithfully ee872d3 Removed dead code in DsCCall.mk_alt b4c3a66 Push coercions in exprIsConApp_maybe 8712148 testsuite: Split out Windows allocations numbers for T12234 f95e669 users-guide: Kill extraneous link 8f89e76 rename: Don't require 'fail' in non-monadic contexts 158530a Add caret diagnostics 46a195f Use python3 for linters 1b06231 Fix test for T12877 94d2cce base: Override Foldable.{toList,length} for NonEmpty 2689a16 Define MAP_ANONYMOUS on systems that only provide MAP_ANON 48a5da9 rename: Add note describing #11216 9331e33 check-ppr: Make --dump the default behavior 3c9fbba Remove redudant import from check-ppr 815099c CallArity: Use exprIsCheap to detect thunks d2788ab Expand I/O CP in comments 88f5add testsuite: Fix T13025 4dec7d1 Testsuite: Skip failing tests on PowerPC 64-bit f3b99c7 Bump array submodule a370440 Fix various issues with testsuite code on Windows bab4ae8 Fix incorrect statement about plugin packages. 9ff0738 Remove documentation about non-existent flag. c560957 Disallow users to write instances of KnownNat and KnownSym cc0abfa Update .mailmap b28ca38 Don't suggest enabling TypeApplications when it's already enabled 8d63ca9 Refactor importdecls/topdecls parsing. 5800b02 Add specialization rules for realToFrac on Complex 683ed47 Don't use $ in the definition of (<**>) in GHC.Base 6b3c039 Typo in manual [ci skip] df72368 Typofixes in manual and comments [ci skip] 2664641 Remove a redundant test c909e6e Minor refactoring in CSE baf9ebe Ensure nested binders have Internal Names 19d5c73 Add a CSE pass to Stg (#9291) 5d2a92a Use atomic counter for GHC.Event.Unique 5797784 Remove single top-level section in Foldable docs 5ef956e Fix doctests in Data.Functor 5f91ac8 Coerce for fmapDefault and foldMapDefault e6aefd6 Use the right in-scope set 3540d1e Avoid exponential blowup in FamInstEnv.normaliseType b4f2afe Fix the implementation of the "push rules" 5088110 Add performance test for #13056 3a18baf More fixes for #5654 f3c7cf9 Add missing stderr file for T13035 e5d1ed9 Have addModFinalizer expose the local type environment. 54227a4 Actually add the right file for T13035 stderr c5452cc Revert "Have addModFinalizer expose the local type environment." c1ed955 Have addModFinalizer expose the local type environment. 7b317ef TH: Add Trustworthy language pragma 6c869f9 Parse holes as infix operators 7d2e5da Fix zonk_eq_types in TcCanonical a8a714e Typos in comments (and in a test) 1a6bdca Make HsIParamTy have a Located HsIPName e94b07d CmmCommonBlockElim: Ignore CmmUnwind nodes 6fe9b05 Properly detect MinTTY when running GHCi on Windows 0a6c257 -dead_strip is now the default on Darwin fe75d2d Ensure mkUserGuidePart is compiled with current GHC version e8d7432 testsuite: Add performance testcase from #12707 12ad4d4 Throw an exception on heap overflow 226c535 base: Add Foreign.ForeignPtr.plusForeignPtr. 8a76d32 Check that type variable does not reference itself in its kind signature 58e68b3 Enable subsections via symbols on iOS 89d4d26 users-guide: Produce OpenSearch description fe8bc14 Add doc header to Dynamic's re-export of Typeable 6de7613 event manager: Don't worry if attempt to wake dead manager fails eee8199 Remove deprecated InteractiveEval API 5857dfb Remove tyConString b1923ed Fix typo in comment c2bd62e Expose purgeObj in ObjLink 35a5b60 testsuite driver: don't append to existing output files 22845ad Fix terminal corruption bug and clean up SDoc interface. 266a9dc Don't use the splitter on Darwin 09bce7a Mark *FB functions INLINE[0] (Fixes #13001) 8b15fc4 Fix references in let/app invariant note 2be364a Inline partially-applied wrappers 436aa7a Revert "event manager: Don't worry if attempt to wake dead manager fails" 5f9c6d2 Support for using only partial pieces of included signatures. 9f169bc Attach warnings to non-PVP compatible uses of signatures. 0bbcf76 Warn if you explicitly export an identifier with warning attached. e41c61f Improve Backpack support for fixities. 5def07f Revamp Backpack/hs-boot handling of type class signatures. 8744869 Rewrite module signature documentation. f59aad6 Fix handling of closed type families in Backpack. 501de26 Improve coment in typecheckIfacesForMerging. f9df77e Add mkUserGuidePart.cabal to .gitignore c6b0486 Typos in manual, comments and tests 89ce9cd Small refactoring in TcErrors f5f6d42 Fix top-level constraint handling (Trac #12921) 6b976eb Record evaluated-ness on workers and wrappers d3ad013 Typos in comments 8b6fa4f Spelling fixes in non-exported data type a62701f Simplify CPP logic as we now need v7.10 for bootstrapping dde63e0 Require python3 like everywhere else too 13a8521 Desugar static forms to makeStatic calls. f63c8ef Use latin1 code page on Windows for response files. 331f88d Fix abort and import lib search on Windows db91d17 Properly introduce CTimer to System.Posix.Types c13151e Improve access violation reporting on Windows 1f48fbc Revert "Record evaluated-ness on workers and wrappers" 9d67f04 LLVM: Tweak TBAA metadata codegen 1ff3c58 Add dump-parsed-ast flag and functionality 4bfe3d4 Add missing test files for T13082. be79289 Unbreak libGHCi by adding missing symbol. 5a9a173 Refine exprOkForSpeculation 563d64f Comments about TyBinders (only) 715be01 Typos in manual and comments [ci skip] 38f289f Fix API Annotations for unboxed sums 769e3ee testsuite/recomp001: Sleep to ensure that GHC notices file change b1726c1 Bitmap: Use foldl' instead of foldr 19cc007 testsuite: Bump allocations for T12234 e7e5f7a Some 8.2.1 release notes for my stuff d5cd505 event manager: Don't worry if attempt to wake dead manager fails e195add Unquote ‘import’ in bad import error message d360ec3 Split mkInlineUnfolding into two functions 2b61f52 Unbreak build with ghc-7.10.1 e324e31 Typos in comments only [ci skip] 70472bf Spelling fixes in comments [ci skip] 3046dbb testsuite: Really fix recomp001 0b7cd65 Clean up RTS Linker Windows. 852c6a0 Modify ForeignPtr documentation in light of plusForeignPtr 181688a Improve suggestion for misspelled flag including '=' (fixes #11789) 0d769d5 Add CBool to Foreign.C.Types 38374ca Fix get_op in the case of an unambiguous record selector (#13132) e7985ed Update levity polymorphism f5bea98 Fix the GHC 7.10 build f07a6c1 Don't error on missing Perl, just warn and disable object splitting. bf1e1f3 Add explicit foldMap implementation for Maybe 9be18ea Fix a nasty bug in exprIsExpandable b78fa75 Simplify and improve CSE b8f1b01 Test Trac #11444 5ff812c check-cpp.py: change rb'foo' to br'foo' for Python 3.2 compatibility 7026edc Add 'type family (m :: Symbol) <> (n :: Symbol)' a2a67b7 Bump Cabal submodule d49b2bb Allow top-level string literals in Core (#8472) 33140f4 Show explicit quantifiers in conflicting definitions error b476131 Add a failing test for #13099 b626a00 testsuite: Don't fail if "target has RTS linker" field is missing c43011d Clean up some shell code and M4 quoting 15b9a85 Warn on missing home modules f9ccad2 Always use -Xlinker for -rpath 560bc28 Revert "Remove unnecessary isTyVar tests in TcType" 238f31c configure.ac: Eliminate stray close bracket 3f1a21d testsuite: Bump allocations on T5321Fun and T12707 5d38fb6 Remove clean_cmd and extra_clean usage from .T files 294f95d Preserve coercion axioms when thinning. bbe8956 Rewrite Backpack comments on never-exported TyThings. 9ef237b Failing test for #13149. 6850eb6 Improve pretty-printing of IfaceCoercions 2b64e92 Apply the right substitution in ty-fam improvement 80560e6 Typos and grammar in manual/comments 18ceb14 Make checkFamInstConsistency faster 729a5e4 Don't quantify implicit type variables when quoting type signatures in TH 596dece Record evaluated-ness on workers and wrappers 532c6ad Make tickishContains faster 368d547 typecheck: Fix note 1761bfa users-guide: Document -dppr-ticks 53e2e70 Ensure that scrutinee constant folding wraps numbers abaa681 Re-sort case alternatives after scrutinee constant folding (#13170) a8c81f3 Document -fspecialise-aggressively 8f49f6d Add a failing test for #13102 7726fd7 Remove unused LOCAL_GHC_PKG definition from a test Makefile 90e83a7 Skip path_with_commas when dyn unavailable 9fd87ef Don't put foralls in front of TH-spliced GADT constructors that don't need them 99f8182 Partially revert D3001 deb75cb UniqSet: Implement unionManyUniqSets in terms of foldl' instead of foldr efc8e3b nativeGen: Use `foldl'` instead of `foldr` in free register accumulation 2cc67ad HscTypes: Use foldl' instead of foldr 2aaafc8 Bump Win32 version. 65cc762 testsuite: Bump compiler allocations of T5837 675b54f Update .mailmap e4ae78a Typos in comments [ci skip] a1cd959 Add myself [ci skip] 078c211 Update Win32 submodule to fix Windows build 1a3f1ee COMPLETE pragmas for enhanced pattern exhaustiveness checking 95dc6dc Template Haskell support for COMPLETE pragmas c344005 Generalize the type of runRW# e4ab8ba Add pragCompleteDName to templateHaskellNames 88a89b7 Nix typo and redundant where-clauses ff9355e Typos in comments [ci skip] 0d1cb15 Make type import/export API Annotation friendly 50544ee Prune unneeded Derive* language pragmas ad3d2df Don't unnecessarily qualify TH-converted instances with empty contexts 3eebd1f Generalizes the type of asProxyTypeOf (#12805) d8cb4b0 Bump nofib submodule 4e63e85 Bump hsc2hs submodule 2ffcdfa Fatal if we try to reinitialize the RTS 06b9561 Fix the right-shift operation for negative big integers (fixes #12136) 2af38b0 Remove Data.Tuple doc's claim to have tuple types 1f366b8 Add delete retry loop. [ci skip] de78ee6 Document GHC.Profiling functions [ci skip] bc42e2b Convert pprTrace in isPredTy to a WARN 34a0205 UNREG: fix "_bytes" string literal forward declaration 4441f90 UNREG: add a forward declaration for local literals f60287c Fix mismatched tick in GHC.Generics documentation d2cf5de Fix deprecation warnings from containers 2ec1c83 Fix broken tests 7363d53 Check that a default type signature aligns with the non-default signature 9169111 Add a flag to emit error messages as JSON 5593573 Fixes bug #11046 f41c27d Slighly clean up symbol loading error. 5f8e234 Print COMPLETE pragmas in --show-iface f984bf2 Simplify minusInteger in integer-gmp slightly 9af1fb2 Fix links to building guides in MAKEHELP.md e9a239c Fix minor typo in README.md 32729d3 Turn libraries/integer-gmp/gmp/tarball into a submodule c71f0c4 Fix binary instance for SrcStrictness 748b797 Use top-level instances to solve superclasses where possible b3576ed Mark reallyUnsafePtrEquality# as can_fail cb4b4fe users guide: Fix markup of COMPLETE pragma examples afc05c7 README: Mention acceptability of pull requests 44f079f FloatOut: Allow floating through breakpoint ticks 4dfc6d1 Abstract over the way eventlogs are flushed b15136a user-guide: fix links and file names (fixes #13198) 25e0cfc Export callStackDoc 99e920c Typos in note header and test f660306 Update output of failing 11223 tests 4fa439e Remove very broad ignore. [ci skip] 8d5cf8b Join points 3d65411 testsuite: Update allocations for T12234 d2b681b Fix documentation NOTE about can_fail 5cb5b7a base: Derive Enum, Bounded for VecCount, VecElem f5b275a Don't tick top-level string literals 1fcede4 Introduce GHC.TypeNats module, change KnownNat evidence to be Natural b16239a Make interface loading for COMPLETE pragmas lazy eedb3df Add support for StaticPointers in GHCi 8dd82ea Spelling fixes d8ac64e Add a testcase for #13227 b103532 Exhaustiveness check for EmptyCase (Trac #10746) 895aa6d Bump haskeline submodule 5728f4b Remove INLINE pragma on loopbreaker 6128b2f users-guide: Explain behavior of verbose-core2core + dump-inlinings bbd3c39 Ditch static flags 09b8332 Get rid of ProbOneShot c2becee Bump performance mark for T9020 afa409f Use tyCoVarsOfType for CTyEqCan in shouldSplitWD 2f5cb3d Attempt to make lazy ST thread safe 9984024 Fix comment (old file names) in includes/ 31bb85f Fix comment (old file names) in rts/ 8d60d73 Fix comment (old file names) in compiler/ 4d31880 Fix comment (old filename '.lhs') in libraries/ 283acec Make split sections by default work again 18cdef3 Fix minusNatural exception to be Underflow 157a46f Update binary submodule to 0.8.4.1 2912231 Improve wrapTicks performance with lots of redundant source notes 68cbe52 Don't panic when printing match with RecUpd context bd818a7 Fix comment (old file names) in mk/ and utils/ 8212135 New internal dynamic flag: Very aggressive inlining 54b9b06 Expose cseExpr from CSE a2f39da Add liftA2 to Applicative class fbcef83 Use proper primitives in Utils.Binary 0abe736 Don't replace type family instances with the same LHS in GHCi (#7102) adb565a Don't return empty initial uncovered set for an unsat context 26f5e60 Fix comment (old file names '.hc' ) in libraries/ 563148c Fix broken link of GHC.RTS.Flags 795bc49 Fixes for OccurAnal bugs (#13221) a9754e3 testsuite: Update expected values for T13035 and T12234 b572aad Do Worker/Wrapper for NOINLINE things 2dff54b Typos in comments [skip ci] 4aae191 Typos in comments [skip ci] a28a552 Remove unnecessary use of -DGENERICS flag 2219c8c Derive <$ 17ae5e7 Typos in comments [skip ci] a0174d2 Do not inline bottoming things f77e99b Comments only b8f58d7 Another improvement to SetLevels 078beea Docs: Fix typo in glasgow_exts.rst 5ce39f6 Add Wredundant-constraints to list of flags excluded from -Wall d5e9b7f Use better map operations in CoreMonad e90f611 Clean up findPartiallyCompletedCycles 369c534 testsuite: Bump max_bytes_used for T4029 0aa3f8d testsuite: Bump bytes allocated for T5837 8c25be8 cpeApp: Make Int accumulator strict bc376d3 Update Core formalize for Levity -> RuntimeRep 062f112 Fix push_bang_into_newtype when the pattern match has no arguments 3e07126 Fix comment of `section "Exceptions"` db3a797 Fix comment (broken link to users_guide) in $(TOP)/ 015e97a Pass -v0 to ghc-pkg to reduce noise in build ouput 512f157 Update hoopl submodule b990f65 More typos in comments [skip ci] 8e9593f Improve the simple optimiser 421308e Improve -dsuppress-coercions 3eb737e Generalize CmmUnwind and pass unwind information through NCG 733e845 CmmLayoutStack: Add unwind information on stack fixups 3328ddb Cmm: Add support for undefined unwinding statements 5279b08 CmmLayoutStack: Correctly annotate Sp adjustments with unwinding information 34e3523 Fix stop_thread unwinding information 9f3c1e6 Add some commented-out tracing in SpecConstr 3cfef76 Kill inaccessible-branch complaints in record update a94b484 Back-pedal the fix for Trac #8155 7e4e6a7 Add dump flags for the renamed and typechecked hsSyn ASTs 41c7437 users-guide: Document defaults for remaining optimization flags 082936d Fix documentation for setByteArray# afaf6d5 Bump array submodule b9bebd8 Implement addCStub in template-haskell. e8f5efb Tweaks and typos in manual, note refs, comments a6a4d0e Bump array submodule d266aac Library docs: Document the order for sort and sortOn. b92ca83 Bump bytestring submodule c22cd7c testsuite: Add testcase for #13248 a5a6c52 Guard rewritableTyVarsOfType 258c719 TH-spliced class instances are pretty-printed incorrectly post-#3384 3211fa0 Spelling in comments [ci skip] 76244ec Change rewritableTyVarsOfType to anyRewritableTyVar 283a346 Prevent Template Haskell splices from throwing a spurious TypeInType error e79ef75 Relax test TH_addCStub2 so it succeeds on travis. 639e702 Refactor DeriveAnyClass's instance context inference 594123f IcmmMachOpFoldM: clarify panic message 7fac7cd Dwarf.Types: Use DW_CFA_same_value encoding when possible 17b1e0b Mark orphan instances and rules in --show-iface output a1980ec Improve the Occurrence Analyzer’s handling of one-shot functions 26eaa7e Fix #13214 by correctly setting up dep_orphs for signatures. 1a14d38 rts/Profiling: Kill a few globals and add consts 56c9bb3 rts/Profiling: Factor out report generation 07292e9 zonkCt tries to maintain the canonical form of a Ct. 64da671 Binary: Only allocate un-interned FastStrings 7938ef2 Avoid repeated list elem checks 4e2e9b7 Fix: Default FD buffer size is not a power of 2 (#13245) 805db96 Fix: hPutBuf issues unnecessary empty write syscalls for large writes (#13246) 6b4e46a bufWrite: Save extra syscall when data fills handle buffer completely. a50082c Apply SplitSections to all C compilations d3ea38e Binary: Correct endian issue when cross-compiling e46a2e1 Bump hoopl submodule to 3.10.2.2 a4ccd33 Add index entry for signature files / Backpack. 8e9ad24 Setup more error context for Backpack operations. c81f3bc Remove obsolete Backpack manual. 2f16484 Slightly reword not-exported message. 7666a9f Disable PVP warnings temporarily. 20b5dfc Typos in notes and comments [ci skip] 2d6e91e Debug: Use local symbols for unwind points (#13278) 60c4986 Typecast covers entire expression to fix format warning. 6626242 TcUnify: Assert precondition of matchExpectedTyConApp 2484d4d Refactor renaming of operators/sections to fix DuplicateRecordFields bugs 04f67c9 Expand list of always loaded Windows shared libs 2f1017b Fix ExtraSymbols jump table on Windows. c3bbd1a Allow type defaulting for multi-param type classes with ExtendedDefaultRules da49389 Implement HasField constraint solving and modify OverloadedLabels 392cec4 Update .mailmap [skip ci] bedcb71 Check local type family instances against all imported ones f90e61a Make deSugarExpr use runTcInteractive 93e65c8 Don't warn about missing methods for instances in signatures. e28fbbb Typos [ci skip] fc9d152 Comments and tiny refactor only 6bab649 Improve checking of joins in Core Lint b8c29bc Use the correct origin in SectionL and Section R f4aa998 Better perf for haddock.base, haddock.Cabal e52a335 Comments only, about inl_inline and inl_act 8d401e5 Honour -dsuppress-uniques more thoroughly e55986a Fix a substitution bug in cseCase 0e76017 Simplify OutputableBndr ca54315 Fix a Backpack recompilation avoidance bug when signatures change. 22dba98 Fix recompilation tracking on signatures. fd2d5b6 Improvements/bugfixes to signature reexport handling. 8916884 Say 'data' explicitly in IfAbstractTyCon output. 7c057b5 Bump libraries/array submodule efeaf9e Bump nofib submodule b207b53 Generalize kind of the (->) tycon 8fa4bf9 Type-indexed Typeable 42ff5d9 Disable Typeable binding generation for unboxed sums 98e494a Improve Haddock documentation for compact. dae5003 Remove ghc-api/landmine tests 0aafe51 Typos in manual, tests and comments 2d5be63 Change -dppr-ticks to -dsuppress-ticks 8a9b57f Kill off the remaining Rec [] 3f653c1 Fix Core pretty printer 8dd4e3b Remove redundant import 27a2854 A number of Typeable wibbles from review 087dbbe Bump Cabal submodule 6ad89d7 Bump a few more performance regressions from Type-indexed Typeable 240b43e Bump Win32 submodule to 2.5.1.0 7153370 Bump time submodule to 1.8 b7265ff build.mk: Add option for debug symbols 59026b3 Spelling in comments only fd841f8 Fix DeriveAnyClass (again) 713ebd7 Fix computation of dfun_tvs in mkNewTypeEqn 95cbb55 Refactor inferConstraints not to use CPS 82694e6 testsuite: Fix allocations of T10547 e790126 Improve Core Lint, mainly for join points 6e32884 Fix SetLevels for join points 4080a63 Minor spelling, grammar, and formatting fixes 611f998 Replace some pushTcLevelM's with pushTcLevelM_ 0d43f74 A little refactoring of the simplifier around join points 0c9d9de Remove panics for TcTyCon e3e218e A bit more tc-tracing in TcTyClsDecls c750808 Disallow class instances for synonyms 3c62b1d Gather constraints locally in checkMain 499a15d Test Trac #13300 9ef2749 Fix all broken perf tests on x64 Windows 8ccbc2e Bump Cabal and containers submodules b125392 Test Trac #13271 484f8d3 Fix ApplicativeDo constraint scoping fed7136 Test Trac #13244 254bc33 A much nicer solution for typechecking ApplicativeDo c8d995d Bump time submodule c347a12 Revert recent submodule bumps 992ea02 Changelog notice for compact. 5841574 Drop NFData constraint from compact. 8a6b8c5 Export commentToAnnotation from Lexer.x 9a2a2ae Spelling only [ci skip] 050f05d testsuite: Bump a performance tests de80558 Give better error message with you run ghc foo.bkp 0a77ced Have --backpack complain if multiple files are passed. a204333 JSON profiler reports 3cb9b52 Set $1_$2_SplitSections in distdir-opts.mk not build-package.mk 48a967c testsuite: Remove old python version tests 7d116e5 rts: Correct the nursery size in the gen 1 growth computation 6ca6a36 base: Add handling of -- to getArgs for Windows bb1c660 ghci users guide: mention "~" expansion in :add 12e21d3 Use half as much memory when reading interfaces 39d926c More tracing in SpecConstr 8f8016a Include OverloadedRecordFields selectors in NameShape. 4ad3620 Fix parsing of And chains in BoolFormula 8d64395 Correct Windows libdir assumptions. c88b7c9 Add instances for (:~~:) mirroring those for (:~:) a6e13d5 Make exprIsConApp_maybe work better for literals strings 67c2e07 Add API Annotation AnnSignature for backpack signature modules 9b859ef Make SCCFunSig tag Located for ghc-exactprint 00c0120 Add a comment explaining CompleteMatchSig in HsBinds 93ffcb0 Document AMP as a Report deviation 9d17028 Record full FieldLabel in ifConFields. 7c060e4 Fix validate. 8f15ab9 Delete redundant import. 8f20844 Correctly pretty print a wild card in infix position a0b4a2a Rename compact to ghc-compact. cae1a71 Bring in unicode variants of API Annotations for HsBracket 41e54b4 Load dependent dlls. 9968502 Make list of deprecated symbols on Windows weak. be3f436 Load `pthreads` by default on Windows 97b1505 rts: Usage message wibbles d4b6dee testsuite: Bump down T2762 number 517ad20 Add testcase for #13340 ad617a3 Bring sanity to openTempFile 2aac0ba Update OverloadedLabels docs and document HasField ff9ff4a Change -ddump-tc-trace output in TcErrors, slightly 9bc4311 Fix SetLevels for makeStaticPtr a7eeb60 build system: Persist CrossCompiling in binary distributions d2f4849 Coercion: Try dropping constraintIsLifted axiom bcffc35 Move Typeable Binary instances to binary package b494689 users-guide: Add documentation for JSON profile format 0d86aa5 Add support for concurrent package db access and updates 6dfc5eb Ensure that Literals are in range ac55394 Bump hpc submodule to allow time-1.8 35b5790 Manually move extra_files for tests T9579_* 8bb63c2 Remove extra_files entries for deleted tests 98119f5 tests: manually move some extra_files into *.T files 3415bca tests: remove extra_files.py (#12223) 5c95e6b Remove outdated information about main() in HSrts (#1) 9603de6 Treat all TyCon with hole names as skolem abstract. 923d7ca Subtyping for roles in signatures. e4188b5 Refactor floating of bindings (fiBind) 4f38fa1 Add -fspec-constr-keen 76f2cd0 Occurrence-analyse the result of rule firings c0af206 Explicitly capture whether a splice has a dollar prefix 0f7a369 Stop uniques ending up in SPEC rule names 990f182 Fix windows build broken by D3080 (0d86aa5904e5a06c93632357122e57e4e118fd2a) c435402 Fix Mac OS X timestamp resolution bug. 377bf37 Clear import path in --backpack mode to not accidentally pick up source files. 36b6e13 DmdAnal: Clarify reference to Cardinality Analysis paper e94bfb6 configure: detect whether -lpthreads is necessary for pthreads 1db71f5 base: Expose Module from Type.Reflection 5dc28ba Add Eq instances for TrName, Module d0508ef When floating, don't box an expression that's okay for speculation (#13338) c662d41 Small changes to expression sizing in CoreUnfold c686af5 Add flag allowing convenient disabling of terminfo support db2a667 rts: Allow profile output path to be specified on RTS command line 29b5723 Again disable stage0 terminfo on Windows 1990bb0 Make Specialise work with casts fc6c222 Inline data constructor wrappers in phase 2 only 65c41cc config.mk.in: Disable terminfo support on iOS 23aca13 iOS: shared objects have .dylib extension. aa2143e Improve documentation for CreateBCOs Message. 3e33d33 Drop copy step from the rts/ghc.mk 122c677 Add COMPLETE pragmas for TypeRep and ErrorCall pattern synonyms 5fdb2b1 Try submodule bumps again defef52 testsuite: Bump down T5837 and T10370 allocations 55efc97 Combine identical case alternatives in CSE 2effe18 The Early Inline Patch 4f10a22 Fix redundant import in CSE cdf6b69 Add VarSet.anyDVarSet, allDVarSet 871b63e Improve pretty-printing of types 6eb52cf Improve SetLevels for join points 777b770 Mark non-recursive join lambdas as one-shot 2ab6ce7 Move isJoinId, isJoinId_maybe to Id 916658d Update containers again b86d226 rts: Fix build 701256d Change catch# demand signature cbe569a Upgrade UniqSet to a newtype d118807 Document interaction between ApplicativeDo and existentials (#13242) d4a6a7f Fix expected result from T13143 fb06bee Bump bytes allocated for T12234 537ce41 Typeable: Rename KindRep bindings to $krep... 55f6353 SymbolExtras: A bit of spring cleaning 5f7b45a Properly acquire locks on not yet existing package databases 63191e9 testsuite: Mark T13340 as fixed 27a1b12 User manual: Fix GADT paper link ae67619 Eliminate ListSetOps from imp_trust_pkgs bc332b3 Prohibit RULES changing constructors f56fc7f Extend Windows runtime loader libsearch 4aada7a More comments on role subtyping, unsoundness fix. 984c609 Disallow non-nullary constraint synonyms on class. e710686 Injective type families imply nominal injectivity, but NOT rep inj fb5cd9d Properly represent abstract classes in Class and IfaceDecl df919fb Fix roles merging to apply only to non-rep-injective types. bba004f Prevent users from defining instances for abstract classes. 57ef18a Typofix. 57d969e Fix T12234 stat mistakes a6874e5 Add -fwhole-archive-hs-libs 0b92290 Print out sub-libraries of packages more nicely. fce3d37 Don't allow orphan COMPLETE pragmas (#13349) e12ebf8 Fix up test results. 27bf6b6 Don't float out expressions that are okay for speculation 4b1f072 Add suggestion for PatternSynonyms parse error (fixes #12429) 488a9da Changed parser message for RankNTypes (#12811) 6421c6f testsuite: Move echoing commands in make invocations to VERBOSE=5 615ded1 Show: Add ShowS for ", " 0d2f733 Read COMPLETE sets from external packages ca538b8 testsuite: Fix output due to recent COMPLETE changes c02896a Revert "Read COMPLETE sets from external packages" 61e760b Update test completesig04 9808ebc testsuite: Bump down allocations for T12707 fa360ea testsuite: Add comment clarifying intention of completesig04 a694cee TcTypeable: Try to reuse KindReps c1dacb8 Produce KindReps for common kinds in GHC.Types 10d28d0 testsuite: Add test for floating-point abs (numrun015) 6446254 Deserialize IfaceId more lazily 5ed56fc Comments only, in CSE (#13340) d5e0b4b Allow iOS to load archives through the linker 0ce11ae Add test to ensure that SPEC rules are named deterministically 96f5656 testsuite: Bump down allocations of T4029 81b284e Add new warning for bad CPP #if usage From git at git.haskell.org Sat Mar 4 01:00:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Mar 2017 01:00:36 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: Add new warning for bad CPP #if usage (0ef0979) Message-ID: <20170304010036.E4D733A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/0ef09791921c3156224300781ec1ef435ce29a9d/ghc >--------------------------------------------------------------- commit 0ef09791921c3156224300781ec1ef435ce29a9d Author: Erik de Castro Lopo Date: Sun Oct 23 08:30:19 2016 +1100 Add new warning for bad CPP #if usage The C code in the RTS now gets built with `-Wundef` and the Haskell code (stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever `#if` is used on undefined identifiers. >--------------------------------------------------------------- 0ef09791921c3156224300781ec1ef435ce29a9d compiler/utils/Util.hs | 2 +- ghc/GHCi/UI.hs | 2 +- includes/CodeGen.Platform.hs | 51 ++++++++++++++++++++++-------------------- includes/Stg.h | 6 ++--- includes/rts/OSThreads.h | 4 ++-- includes/stg/MachRegs.h | 14 ++++++------ includes/stg/SMP.h | 37 ++++++++++++++++-------------- libraries/ghci/GHCi/ObjLink.hs | 2 +- mk/warnings.mk | 4 ++-- rts/LinkerInternals.h | 3 ++- rts/OldARMAtomic.c | 2 +- rts/Schedule.c | 16 ++++++------- rts/Threads.c | 2 +- rts/ghc.mk | 3 +++ rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 8 +++---- rts/sm/CNF.c | 2 +- rts/sm/GCUtils.c | 2 +- rts/sm/GCUtils.h | 2 +- rts/sm/MBlock.c | 2 +- 20 files changed, 88 insertions(+), 78 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 0ef09791921c3156224300781ec1ef435ce29a9d From git at git.haskell.org Sat Mar 4 06:16:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Mar 2017 06:16:47 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: Enable new warning for bad CPP #if usage (8bc809b) Message-ID: <20170304061647.3CB143A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/8bc809b7d3bc416d63eba96013553498c95ecc6f/ghc >--------------------------------------------------------------- commit 8bc809b7d3bc416d63eba96013553498c95ecc6f Author: Erik de Castro Lopo Date: Sun Oct 23 08:30:19 2016 +1100 Enable new warning for bad CPP #if usage The C code in the RTS now gets built with `-Wundef` and the Haskell code (stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever `#if` is used on undefined identifiers. >--------------------------------------------------------------- 8bc809b7d3bc416d63eba96013553498c95ecc6f compiler/utils/Util.hs | 2 +- ghc/GHCi/UI.hs | 2 +- includes/CodeGen.Platform.hs | 51 ++++++++++++++++++++++-------------------- includes/Stg.h | 6 ++--- includes/rts/OSThreads.h | 4 ++-- includes/stg/MachRegs.h | 14 ++++++------ includes/stg/SMP.h | 37 ++++++++++++++++-------------- libraries/ghci/GHCi/ObjLink.hs | 2 +- mk/warnings.mk | 4 ++-- rts/LinkerInternals.h | 3 ++- rts/OldARMAtomic.c | 2 +- rts/RtsUtils.c | 4 ++-- rts/Schedule.c | 16 ++++++------- rts/Threads.c | 2 +- rts/ghc.mk | 3 +++ rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 8 +++---- rts/sm/CNF.c | 2 +- rts/sm/GCUtils.c | 2 +- rts/sm/GCUtils.h | 2 +- rts/sm/MBlock.c | 2 +- 21 files changed, 90 insertions(+), 80 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 8bc809b7d3bc416d63eba96013553498c95ecc6f From git at git.haskell.org Sat Mar 4 19:51:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Mar 2017 19:51:46 +0000 (UTC) Subject: [commit: ghc] master: Update dangling Note reference (2e58c3b) Message-ID: <20170304195146.5D8123A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2e58c3b21b40ec40649bae8925f2a977022a80c3/ghc >--------------------------------------------------------------- commit 2e58c3b21b40ec40649bae8925f2a977022a80c3 Author: Joachim Breitner Date: Tue Feb 28 17:29:22 2017 -0800 Update dangling Note reference >--------------------------------------------------------------- 2e58c3b21b40ec40649bae8925f2a977022a80c3 compiler/simplCore/Simplify.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index d18eda7..df77742 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -3245,7 +3245,7 @@ substitute the RULES and add them back onto the binders; this is done cases where he really, really wanted a RULE for a recursive function to apply in that function's own right-hand side. -See Note [Loop breaking and RULES] in OccAnal. +See Note [Forming Rec groups] in OccurAnal -} addBndrRules :: SimplEnv -> InBndr -> OutBndr -> SimplM (SimplEnv, OutBndr) From git at git.haskell.org Sat Mar 4 19:55:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Mar 2017 19:55:26 +0000 (UTC) Subject: [commit: ghc] branch 'wip/travis' created Message-ID: <20170304195526.5488F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/travis Referencing: 033d9466796e7dd7b0d19889a21dedc4ba0c7c70 From git at git.haskell.org Sat Mar 4 19:55:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Mar 2017 19:55:29 +0000 (UTC) Subject: [commit: ghc] wip/travis: Travis experiments to speed up the build (033d946) Message-ID: <20170304195529.0D5CE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/travis Link : http://ghc.haskell.org/trac/ghc/changeset/033d9466796e7dd7b0d19889a21dedc4ba0c7c70/ghc >--------------------------------------------------------------- commit 033d9466796e7dd7b0d19889a21dedc4ba0c7c70 Author: Joachim Breitner Date: Tue Feb 7 14:48:27 2017 -0500 Travis experiments to speed up the build * language: generic * trusty environment * bump boot GHC * “quickest” build flavor * without split sections >--------------------------------------------------------------- 033d9466796e7dd7b0d19889a21dedc4ba0c7c70 .travis.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 218f5ba..64e8239 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ # The following enables container-based travis instances +dist: trusty sudo: false +language: generic git: submodules: false @@ -17,15 +19,15 @@ addons: #- llvm-toolchain-precise-3.7 - ubuntu-toolchain-r-test packages: - - cabal-install-1.18 - - ghc-7.10.3 - - alex-3.1.3 - - happy-1.19.4 + - cabal-install-1.24 + - ghc-8.0.2 + - alex-3.1.7 + - happy-1.19.5 - python3 #- llvm-3.7 before_install: - - export PATH=/opt/ghc/7.10.3/bin:/opt/cabal/1.18/bin:/opt/alex/3.1.3/bin:/opt/happy/1.19.4/bin:/usr/lib/llvm-3.7/bin:$PATH + - export PATH=/opt/ghc/8.0.2/bin:/opt/cabal/1.24/bin:/opt/alex/3.1.7/bin:/opt/happy/1.19.5/bin:/usr/lib/llvm-3.7/bin:$PATH # Be explicit about which protocol to use, such that we don't have to repeat the rewrite command for each. - git config remote.origin.url git://github.com/${TRAVIS_REPO_SLUG}.git @@ -42,6 +44,12 @@ before_install: - git submodule --quiet update --recursive # Now we can be quiet again. script: + # try "quickest" flavor + - echo 'SRC_HC_OPTS = -O0 -H64m' >> mk/validate.mk + - echo 'GhcStage1HcOpts = -O' >> mk/validate.mk + - echo 'GhcStage2HcOpts = -O0' >> mk/validate.mk + # split sections cost time + - echo 'SplitSections = NO' >> mk/validate.mk # do not build docs - echo 'HADDOCK_DOCS = NO' >> mk/validate.mk - echo 'BUILD_SPHINX_HTML = NO' >> mk/validate.mk From git at git.haskell.org Sat Mar 4 21:45:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Mar 2017 21:45:43 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add expected output for T8848 (5e5f8c8) Message-ID: <20170304214543.02CE43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5e5f8c8e40d5f21daa4ebf78e5c0f55965540eb9/ghc >--------------------------------------------------------------- commit 5e5f8c8e40d5f21daa4ebf78e5c0f55965540eb9 Author: Ben Gamari Date: Sat Mar 4 15:09:17 2017 -0500 testsuite: Add expected output for T8848 >--------------------------------------------------------------- 5e5f8c8e40d5f21daa4ebf78e5c0f55965540eb9 testsuite/tests/simplCore/should_compile/T8848.stdout | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testsuite/tests/simplCore/should_compile/T8848.stdout b/testsuite/tests/simplCore/should_compile/T8848.stdout new file mode 100644 index 0000000..de0d424 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T8848.stdout @@ -0,0 +1,2 @@ +Rule fired: SPEC map2 +Rule fired: SPEC map2 From git at git.haskell.org Sat Mar 4 21:45:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Mar 2017 21:45:45 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump down allocations for T4029 (31b3d0c) Message-ID: <20170304214545.B17DF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/31b3d0c7aa35860521cfe9232270871015d693de/ghc >--------------------------------------------------------------- commit 31b3d0c7aa35860521cfe9232270871015d693de Author: Ben Gamari Date: Sat Mar 4 15:09:50 2017 -0500 testsuite: Bump down allocations for T4029 Previously I only updated the comment in one case. >--------------------------------------------------------------- 31b3d0c7aa35860521cfe9232270871015d693de testsuite/tests/perf/space_leaks/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/perf/space_leaks/all.T b/testsuite/tests/perf/space_leaks/all.T index 5480680..67283ec 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -69,7 +69,7 @@ test('T4029', # 2017-03-03: 65 (amd64/Linux) Share Typeable KindReps or more # lazy interface file reading stats_num_field('max_bytes_used', - [(wordsize(64), 22016200, 5)]), + [(wordsize(64), 19172360, 5)]), # 2016-02-26: 24071720 (amd64/Linux) INITIAL # 2016-04-21: 25542832 (amd64/Linux) # 2016-05-23: 25247216 (amd64/Linux) Use -G1 From git at git.haskell.org Sat Mar 4 21:45:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Mar 2017 21:45:40 +0000 (UTC) Subject: [commit: ghc] master: configure: Don't pass GHC's sanitized triple to libraries' configure (e901ed1) Message-ID: <20170304214540.0FEB33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e901ed1c5d662a6f343e7d1a576f727e5e556d43/ghc >--------------------------------------------------------------- commit e901ed1c5d662a6f343e7d1a576f727e5e556d43 Author: Ben Gamari Date: Fri Mar 3 17:48:50 2017 -0500 configure: Don't pass GHC's sanitized triple to libraries' configure Reviewers: hvr, rwbarton, austin Subscribers: thomie, danharaj, erikd Differential Revision: https://phabricator.haskell.org/D3247 >--------------------------------------------------------------- e901ed1c5d662a6f343e7d1a576f727e5e556d43 configure.ac | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 3c153c6..ba5836d 100644 --- a/configure.ac +++ b/configure.ac @@ -434,8 +434,19 @@ fi # Despite its similarity in name to TargetPlatform, TargetPlatformFull is used # in calls to subproject configure scripts and thus must be set to the autoconf # triple, not the normalized GHC triple that TargetPlatform is set to. -# It may be better to just do away with the GHC triples all together. -TargetPlatformFull="${target}" +# +# We use the non-canonicalized triple, target_alias, here since the subproject +# configure scripts will use this triple to construct the names of the toolchain +# executables. If we instead passed down the triple produced by +# AC_CANONICAL_TARGET then it may look for the target toolchain under the wrong +# name (this is a known problem in the case of the Android NDK, which has +# slightly odd triples). +# +# It may be better to just do away with the GHC triples all together. This would +# all be taken care of for us if we configured the subprojects using +# AC_CONFIG_DIR, but unfortunately Cabal needs to be the one to do the +# configuration. +TargetPlatformFull="${target_alias}" AC_SUBST(CrossCompiling) AC_SUBST(CrossCompilePrefix) AC_SUBST(TargetPlatformFull) From git at git.haskell.org Sat Mar 4 21:45:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Mar 2017 21:45:48 +0000 (UTC) Subject: [commit: ghc] master: Fixes a spaceleak in `maximumBy` and `minimumBy` (#10830). (2e43848) Message-ID: <20170304214548.670C83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2e43848236a4b80015d8fb09a87f6f6a746c1365/ghc >--------------------------------------------------------------- commit 2e43848236a4b80015d8fb09a87f6f6a746c1365 Author: Ryan Scott Date: Fri Mar 3 17:49:35 2017 -0500 Fixes a spaceleak in `maximumBy` and `minimumBy` (#10830). This involved changing the implementation from using `foldr11` to using `foldl1`. Test Plan: validate Reviewers: austin, hvr, bgamari, dalaing, dfeuer Reviewed By: bgamari Subscribers: RyanGlScott, dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3019 >--------------------------------------------------------------- 2e43848236a4b80015d8fb09a87f6f6a746c1365 libraries/base/Data/Foldable.hs | 30 ++++++++++++++++++++++++++++-- libraries/base/changelog.md | 4 ++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/libraries/base/Data/Foldable.hs b/libraries/base/Data/Foldable.hs index 0a8b003..1d9fc92 100644 --- a/libraries/base/Data/Foldable.hs +++ b/libraries/base/Data/Foldable.hs @@ -551,16 +551,20 @@ all p = getAll #. foldMap (All #. p) -- | The largest element of a non-empty structure with respect to the -- given comparison function. + +-- See Note [maximumBy/minimumBy space usage] maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a -maximumBy cmp = foldr1 max' +maximumBy cmp = foldl1 max' where max' x y = case cmp x y of GT -> x _ -> y -- | The least element of a non-empty structure with respect to the -- given comparison function. + +-- See Note [maximumBy/minimumBy space usage] minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a -minimumBy cmp = foldr1 min' +minimumBy cmp = foldl1 min' where min' x y = case cmp x y of GT -> y _ -> x @@ -574,3 +578,25 @@ notElem x = not . elem x -- 'Nothing' if there is no such element. find :: Foldable t => (a -> Bool) -> t a -> Maybe a find p = getFirst . foldMap (\ x -> First (if p x then Just x else Nothing)) + +{- +Note [maximumBy/minimumBy space usage] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +When the type signatures of maximumBy and minimumBy were generalized to work +over any Foldable instance (instead of just lists), they were defined using +foldr1. This was problematic for space usage, as the semantics of maximumBy +and minimumBy essentially require that they examine every element of the +data structure. Using foldr1 to examine every element results in space usage +proportional to the size of the data structure. For the common case of lists, +this could be particularly bad (see Trac #10830). + +For the common case of lists, switching the implementations of maximumBy and +minimumBy to foldl1 solves the issue, as GHC's strictness analysis can then +make these functions only use O(1) stack space. It is perhaps not the optimal +way to fix this problem, as there are other conceivable data structures +(besides lists) which might benefit from specialized implementations for +maximumBy and minimumBy (see +https://ghc.haskell.org/trac/ghc/ticket/10830#comment:26 for a further +discussion). But using foldl1 is at least always better than using foldr1, so +GHC has chosen to adopt that approach for now. +-} diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 3bb60fe..f39e149 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -73,6 +73,10 @@ functions which solely match again `ErrorCall` do not produce non-exhaustive pattern-match warnings (#8779) + * Change the implementations of `maximumBy` and `minimumBy` from + `Data.Foldable` to use `fold11` instead of `foldr1`. This makes them run + in constant space when applied to lists. (#10830) + ## 4.9.0.0 *May 2016* * Bundled with GHC 8.0 From git at git.haskell.org Sat Mar 4 21:45:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Mar 2017 21:45:51 +0000 (UTC) Subject: [commit: ghc] master: Reexport CmpNat and friends (defined in GHC.TypeNats) from GHC.TypeLits (35ca135) Message-ID: <20170304214551.2798B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/35ca13520747dffa1c3c971198f4e1a7bb12bf72/ghc >--------------------------------------------------------------- commit 35ca13520747dffa1c3c971198f4e1a7bb12bf72 Author: Ryan Scott Date: Fri Mar 3 21:18:01 2017 -0500 Reexport CmpNat and friends (defined in GHC.TypeNats) from GHC.TypeLits Previously, there were identical copies of `CmpNat`, `(<=?)`, `(+)`, etc. spread across `GHC.TypeLits` and `GHC.TypeNats`. This makes `GHC.TypeNats` the canonical home for them, and reexports them from `GHC.TypeLits` to avoid confusion. Test Plan: ./validate Reviewers: bgamari, austin, hvr Reviewed By: bgamari Subscribers: thomie, phadej Differential Revision: https://phabricator.haskell.org/D3272 >--------------------------------------------------------------- 35ca13520747dffa1c3c971198f4e1a7bb12bf72 compiler/typecheck/TcTypeNats.hs | 13 +++++----- libraries/base/GHC/TypeLits.hs | 37 ++-------------------------- testsuite/tests/ghci/scripts/T9181.stdout | 40 +++++++++++++++---------------- 3 files changed, 29 insertions(+), 61 deletions(-) diff --git a/compiler/typecheck/TcTypeNats.hs b/compiler/typecheck/TcTypeNats.hs index 6aff38a..6af486c 100644 --- a/compiler/typecheck/TcTypeNats.hs +++ b/compiler/typecheck/TcTypeNats.hs @@ -27,6 +27,7 @@ import Name ( Name, BuiltInSyntax(..) ) import TysWiredIn import TysPrim ( mkTemplateAnonTyConBinders ) import PrelNames ( gHC_TYPELITS + , gHC_TYPENATS , typeNatAddTyFamNameKey , typeNatMulTyFamNameKey , typeNatExpTyFamNameKey @@ -67,7 +68,7 @@ typeNatAddTyCon = mkTypeNatFunTyCon2 name , sfInteractInert = interactInertAdd } where - name = mkWiredInTyConName UserSyntax gHC_TYPELITS (fsLit "+") + name = mkWiredInTyConName UserSyntax gHC_TYPENATS (fsLit "+") typeNatAddTyFamNameKey typeNatAddTyCon typeNatSubTyCon :: TyCon @@ -78,7 +79,7 @@ typeNatSubTyCon = mkTypeNatFunTyCon2 name , sfInteractInert = interactInertSub } where - name = mkWiredInTyConName UserSyntax gHC_TYPELITS (fsLit "-") + name = mkWiredInTyConName UserSyntax gHC_TYPENATS (fsLit "-") typeNatSubTyFamNameKey typeNatSubTyCon typeNatMulTyCon :: TyCon @@ -89,7 +90,7 @@ typeNatMulTyCon = mkTypeNatFunTyCon2 name , sfInteractInert = interactInertMul } where - name = mkWiredInTyConName UserSyntax gHC_TYPELITS (fsLit "*") + name = mkWiredInTyConName UserSyntax gHC_TYPENATS (fsLit "*") typeNatMulTyFamNameKey typeNatMulTyCon typeNatExpTyCon :: TyCon @@ -100,7 +101,7 @@ typeNatExpTyCon = mkTypeNatFunTyCon2 name , sfInteractInert = interactInertExp } where - name = mkWiredInTyConName UserSyntax gHC_TYPELITS (fsLit "^") + name = mkWiredInTyConName UserSyntax gHC_TYPENATS (fsLit "^") typeNatExpTyFamNameKey typeNatExpTyCon typeNatLeqTyCon :: TyCon @@ -114,7 +115,7 @@ typeNatLeqTyCon = NotInjective where - name = mkWiredInTyConName UserSyntax gHC_TYPELITS (fsLit "<=?") + name = mkWiredInTyConName UserSyntax gHC_TYPENATS (fsLit "<=?") typeNatLeqTyFamNameKey typeNatLeqTyCon ops = BuiltInSynFamily { sfMatchFam = matchFamLeq @@ -133,7 +134,7 @@ typeNatCmpTyCon = NotInjective where - name = mkWiredInTyConName UserSyntax gHC_TYPELITS (fsLit "CmpNat") + name = mkWiredInTyConName UserSyntax gHC_TYPENATS (fsLit "CmpNat") typeNatCmpTyFamNameKey typeNatCmpTyCon ops = BuiltInSynFamily { sfMatchFam = matchFamCmpNat diff --git a/libraries/base/GHC/TypeLits.hs b/libraries/base/GHC/TypeLits.hs index ccfffc3..0964db9 100644 --- a/libraries/base/GHC/TypeLits.hs +++ b/libraries/base/GHC/TypeLits.hs @@ -34,9 +34,9 @@ module GHC.TypeLits -- * Functions on type literals - , type (<=), type (<=?), type (+), type (*), type (^), type (-) + , type (N.<=), type (N.<=?), type (N.+), type (N.*), type (N.^), type (N.-) , AppendSymbol - , CmpNat, CmpSymbol + , N.CmpNat, CmpSymbol -- * User-defined type errors , TypeError @@ -129,44 +129,11 @@ type instance a == b = EqSymbol a b -------------------------------------------------------------------------------- -infix 4 <=?, <= -infixl 6 +, - -infixl 7 * -infixr 8 ^ - --- | Comparison of type-level naturals, as a constraint. -type x <= y = (x <=? y) ~ 'True - -- | Comparison of type-level symbols, as a function. -- -- @since 4.7.0.0 type family CmpSymbol (m :: Symbol) (n :: Symbol) :: Ordering --- | Comparison of type-level naturals, as a function. --- --- @since 4.7.0.0 -type family CmpNat (m :: Nat) (n :: Nat) :: Ordering - -{- | Comparison of type-level naturals, as a function. -NOTE: The functionality for this function should be subsumed -by 'CmpNat', so this might go away in the future. -Please let us know, if you encounter discrepancies between the two. -} -type family (m :: Nat) <=? (n :: Nat) :: Bool - --- | Addition of type-level naturals. -type family (m :: Nat) + (n :: Nat) :: Nat - --- | Multiplication of type-level naturals. -type family (m :: Nat) * (n :: Nat) :: Nat - --- | Exponentiation of type-level naturals. -type family (m :: Nat) ^ (n :: Nat) :: Nat - --- | Subtraction of type-level naturals. --- --- @since 4.7.0.0 -type family (m :: Nat) - (n :: Nat) :: Nat - -- | Concatenation of type-level symbols. -- -- @since 4.10.0.0 diff --git a/testsuite/tests/ghci/scripts/T9181.stdout b/testsuite/tests/ghci/scripts/T9181.stdout index 3894125..d51b345 100644 --- a/testsuite/tests/ghci/scripts/T9181.stdout +++ b/testsuite/tests/ghci/scripts/T9181.stdout @@ -1,23 +1,6 @@ -type family (GHC.TypeLits.*) (a :: GHC.Types.Nat) - (b :: GHC.Types.Nat) - :: GHC.Types.Nat -type family (GHC.TypeLits.+) (a :: GHC.Types.Nat) - (b :: GHC.Types.Nat) - :: GHC.Types.Nat -type family (GHC.TypeLits.-) (a :: GHC.Types.Nat) - (b :: GHC.Types.Nat) - :: GHC.Types.Nat -type (GHC.TypeLits.<=) (x :: GHC.Types.Nat) (y :: GHC.Types.Nat) = - (x GHC.TypeLits.<=? y) ~ 'True :: Constraint -type family (GHC.TypeLits.<=?) (a :: GHC.Types.Nat) - (b :: GHC.Types.Nat) - :: Bool type family GHC.TypeLits.AppendSymbol (a :: GHC.Types.Symbol) (b :: GHC.Types.Symbol) :: GHC.Types.Symbol -type family GHC.TypeLits.CmpNat (a :: GHC.Types.Nat) - (b :: GHC.Types.Nat) - :: Ordering type family GHC.TypeLits.CmpSymbol (a :: GHC.Types.Symbol) (b :: GHC.Types.Symbol) :: Ordering @@ -36,9 +19,6 @@ data GHC.TypeLits.SomeSymbol where (Data.Proxy.Proxy n) -> GHC.TypeLits.SomeSymbol type family GHC.TypeLits.TypeError (a :: GHC.TypeLits.ErrorMessage) :: b -type family (GHC.TypeLits.^) (a :: GHC.Types.Nat) - (b :: GHC.Types.Nat) - :: GHC.Types.Nat GHC.TypeLits.natVal :: GHC.TypeNats.KnownNat n => proxy n -> Integer GHC.TypeLits.natVal' :: @@ -53,6 +33,23 @@ GHC.TypeLits.symbolVal :: GHC.TypeLits.KnownSymbol n => proxy n -> String GHC.TypeLits.symbolVal' :: GHC.TypeLits.KnownSymbol n => GHC.Prim.Proxy# n -> String +type family (GHC.TypeNats.*) (a :: GHC.Types.Nat) + (b :: GHC.Types.Nat) + :: GHC.Types.Nat +type family (GHC.TypeNats.+) (a :: GHC.Types.Nat) + (b :: GHC.Types.Nat) + :: GHC.Types.Nat +type family (GHC.TypeNats.-) (a :: GHC.Types.Nat) + (b :: GHC.Types.Nat) + :: GHC.Types.Nat +type (GHC.TypeNats.<=) (x :: GHC.Types.Nat) (y :: GHC.Types.Nat) = + (x GHC.TypeNats.<=? y) ~ 'True :: Constraint +type family (GHC.TypeNats.<=?) (a :: GHC.Types.Nat) + (b :: GHC.Types.Nat) + :: Bool +type family GHC.TypeNats.CmpNat (a :: GHC.Types.Nat) + (b :: GHC.Types.Nat) + :: Ordering class GHC.TypeNats.KnownNat (n :: GHC.Types.Nat) where GHC.TypeNats.natSing :: GHC.TypeNats.SNat n {-# MINIMAL natSing #-} @@ -61,6 +58,9 @@ data GHC.TypeNats.SomeNat where GHC.TypeNats.SomeNat :: GHC.TypeNats.KnownNat n => (Data.Proxy.Proxy n) -> GHC.TypeNats.SomeNat data GHC.Types.Symbol +type family (GHC.TypeNats.^) (a :: GHC.Types.Nat) + (b :: GHC.Types.Nat) + :: GHC.Types.Nat GHC.TypeNats.sameNat :: (GHC.TypeNats.KnownNat a, GHC.TypeNats.KnownNat b) => Data.Proxy.Proxy a From git at git.haskell.org Sat Mar 4 21:45:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Mar 2017 21:45:53 +0000 (UTC) Subject: [commit: ghc] master: Drop HAVE_containers_050 from bootstrap flags (669333d) Message-ID: <20170304214553.DDA753A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/669333d8afaf388a3ce4a56e383b24ea2bdea145/ghc >--------------------------------------------------------------- commit 669333d8afaf388a3ce4a56e383b24ea2bdea145 Author: Ben Gamari Date: Sat Mar 4 16:04:37 2017 -0500 Drop HAVE_containers_050 from bootstrap flags Cabal now sets this itself if MIN_VERSION_containers isn't defined. >--------------------------------------------------------------- 669333d8afaf388a3ce4a56e383b24ea2bdea145 utils/ghc-cabal/ghc.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk index b8f03a9..6250484 100644 --- a/utils/ghc-cabal/ghc.mk +++ b/utils/ghc-cabal/ghc.mk @@ -54,7 +54,6 @@ $(ghc-cabal_DIST_BINARY): utils/ghc-cabal/Main.hs $(TOUCH_DEP) | $$(dir $$@)/. b -no-user-$(GHC_PACKAGE_DB_FLAG) \ -Wall -fno-warn-unused-imports -fno-warn-warnings-deprecations \ -DCABAL_VERSION=$(CABAL_VERSION) \ - -DHAVE_containers_050 \ -DBOOTSTRAPPING \ -optP-include -optPutils/ghc-cabal/cabal_macros_boot.h \ -odir bootstrapping \ From git at git.haskell.org Sun Mar 5 11:44:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 5 Mar 2017 11:44:09 +0000 (UTC) Subject: [commit: ghc] wip/travis: Travis experiment: Not “quickest” flavor (e49fc6c) Message-ID: <20170305114409.59E813A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/travis Link : http://ghc.haskell.org/trac/ghc/changeset/e49fc6caf71be34de526a88de107e0d61f15b53f/ghc >--------------------------------------------------------------- commit e49fc6caf71be34de526a88de107e0d61f15b53f Author: Joachim Breitner Date: Sun Mar 5 12:43:57 2017 +0100 Travis experiment: Not “quickest” flavor >--------------------------------------------------------------- e49fc6caf71be34de526a88de107e0d61f15b53f .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 64e8239..93c9241 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,10 +44,10 @@ before_install: - git submodule --quiet update --recursive # Now we can be quiet again. script: - # try "quickest" flavor - - echo 'SRC_HC_OPTS = -O0 -H64m' >> mk/validate.mk - - echo 'GhcStage1HcOpts = -O' >> mk/validate.mk - - echo 'GhcStage2HcOpts = -O0' >> mk/validate.mk + # # try "quickest" flavor + # - echo 'SRC_HC_OPTS = -O0 -H64m' >> mk/validate.mk + # - echo 'GhcStage1HcOpts = -O' >> mk/validate.mk + # - echo 'GhcStage2HcOpts = -O0' >> mk/validate.mk # split sections cost time - echo 'SplitSections = NO' >> mk/validate.mk # do not build docs From git at git.haskell.org Mon Mar 6 15:20:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 15:20:49 +0000 (UTC) Subject: [commit: ghc] master: Fix CSE (again) on literal strings (9304df5) Message-ID: <20170306152049.DFD553A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9304df5230a7a29d3e992916d133e462b854e55f/ghc >--------------------------------------------------------------- commit 9304df5230a7a29d3e992916d133e462b854e55f Author: Simon Peyton Jones Date: Fri Mar 3 11:00:04 2017 +0000 Fix CSE (again) on literal strings Fixes Trac #13367. See Note [Take care with literal strings] >--------------------------------------------------------------- 9304df5230a7a29d3e992916d133e462b854e55f compiler/simplCore/CSE.hs | 79 ++++++++++++---------- testsuite/tests/simplCore/should_compile/Makefile | 5 ++ testsuite/tests/simplCore/should_compile/T13367.hs | 10 +++ .../tests/simplCore/should_compile/T13367.stdout | 1 + testsuite/tests/simplCore/should_compile/all.T | 1 + 5 files changed, 61 insertions(+), 35 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 9304df5230a7a29d3e992916d133e462b854e55f From git at git.haskell.org Mon Mar 6 15:20:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 15:20:52 +0000 (UTC) Subject: [commit: ghc] master: Tiny refactor (1163f4f) Message-ID: <20170306152052.96D203A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1163f4f2fe9aabd722c963497c67c5f8c71ef71b/ghc >--------------------------------------------------------------- commit 1163f4f2fe9aabd722c963497c67c5f8c71ef71b Author: Simon Peyton Jones Date: Fri Mar 3 12:51:21 2017 +0000 Tiny refactor >--------------------------------------------------------------- 1163f4f2fe9aabd722c963497c67c5f8c71ef71b compiler/simplCore/OccurAnal.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index 3aaa1f3..c828249 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -1357,13 +1357,13 @@ nodeScore old_bndr new_bndr bind_rhs lb_deps = mk_score 5 -- Note [Constructor applications] | isStableUnfolding id_unfolding - , canUnfold id_unfolding + , can_unfold = mk_score 3 | isOneOcc (idOccInfo new_bndr) = mk_score 2 -- Likely to be inlined - | canUnfold id_unfolding -- The Id has some kind of unfolding + | can_unfold -- The Id has some kind of unfolding = mk_score 1 | otherwise @@ -1386,6 +1386,7 @@ nodeScore old_bndr new_bndr bind_rhs lb_deps -> size _ -> cheapExprSize rhs + can_unfold = canUnfold id_unfolding id_unfolding = realIdUnfolding old_bndr -- realIdUnfolding: Ignore loop-breaker-ness here because -- that is what we are setting! From git at git.haskell.org Mon Mar 6 15:20:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 15:20:55 +0000 (UTC) Subject: [commit: ghc] master: Make FloatOut/SetLevels idemoptent on bottoming functions (fb9ae28) Message-ID: <20170306152055.593A73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fb9ae288088a3eabc4e1bb4e86fa473a3881d2e2/ghc >--------------------------------------------------------------- commit fb9ae288088a3eabc4e1bb4e86fa473a3881d2e2 Author: Simon Peyton Jones Date: Fri Mar 3 16:10:06 2017 +0000 Make FloatOut/SetLevels idemoptent on bottoming functions This fixes Trac #13369. It turned out that I really had got the bottoming-float code wrong, again. The new story is explained in Note [Bottoming floats], esp item (3), and Note [Floating from a RHS]. I didn't make a regression test; it's hard to to so. Nofib result are good -------------------------------------------------------------------------------- Program Size Allocs Runtime Elapsed TotalMem -------------------------------------------------------------------------------- banner -2.2% -4.6% 0.00 0.00 +0.0% bspt -1.3% -1.6% 0.01 0.01 +0.0% cacheprof -1.8% -0.3% +3.7% +3.7% -0.9% digits-of-e2 -1.0% -1.5% -0.5% -0.5% +0.0% expert -1.3% -0.2% 0.00 0.00 +0.0% n-body -1.1% -0.2% +0.1% +0.1% +0.0% veritas -2.9% -0.1% 0.00 0.00 +0.0% -------------------------------------------------------------------------------- Min -2.9% -4.6% -7.4% -7.4% -19.8% Max -1.0% +0.0% +5.2% +5.1% +10.0% Geometric Mean -1.2% -0.1% +0.5% +0.5% -0.1% I /think/ all this is due to this error-floating change; but it's possible that some was due to commit "Fix CSE (again) on literal strings" a couple of commits earlier. >--------------------------------------------------------------- fb9ae288088a3eabc4e1bb4e86fa473a3881d2e2 compiler/simplCore/SetLevels.hs | 166 +++++++++++++-------- .../tests/simplCore/should_compile/T13143.stderr | 27 ++-- 2 files changed, 117 insertions(+), 76 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 fb9ae288088a3eabc4e1bb4e86fa473a3881d2e2 From git at git.haskell.org Mon Mar 6 15:20:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 15:20:58 +0000 (UTC) Subject: [commit: ghc] master: Make TH_Roles2 less fragile (9b2c73e) Message-ID: <20170306152058.1324E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9b2c73ea8082199245bfa6a28390b70b38f87fd1/ghc >--------------------------------------------------------------- commit 9b2c73ea8082199245bfa6a28390b70b38f87fd1 Author: Simon Peyton Jones Date: Fri Mar 3 11:00:59 2017 +0000 Make TH_Roles2 less fragile We need -dsuppress-uniques else this test keeps failing spuriously >--------------------------------------------------------------- 9b2c73ea8082199245bfa6a28390b70b38f87fd1 testsuite/tests/th/TH_Roles2.stderr | 8 ++++---- testsuite/tests/th/all.T | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/testsuite/tests/th/TH_Roles2.stderr b/testsuite/tests/th/TH_Roles2.stderr index 65b8c1d..8d52da4 100644 --- a/testsuite/tests/th/TH_Roles2.stderr +++ b/testsuite/tests/th/TH_Roles2.stderr @@ -16,10 +16,10 @@ TH_Roles2.$tcT TH_Roles2.$trModule (GHC.Types.TrNameS "T"#) 1 - $krep_a3TO -$krep_a3TP [InlPrag=[~]] = GHC.Types.KindRepVar 0 -$krep_a3TO [InlPrag=[~]] - = GHC.Types.KindRepFun $krep_a3TP GHC.Types.krep$* + $krep +$krep [InlPrag=[~]] = GHC.Types.KindRepVar 0 +$krep [InlPrag=[~]] + = GHC.Types.KindRepFun $krep GHC.Types.krep$* TH_Roles2.$trModule = GHC.Types.Module (GHC.Types.TrNameS "main"#) (GHC.Types.TrNameS "TH_Roles2"#) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 47da8df..d73ad86 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -252,7 +252,7 @@ test('TH_Roles2', normalise_version('array', 'base', 'deepseq', 'ghc-prim', 'ghc-boot', 'ghc-boot-th', 'integer-gmp', 'pretty', 'template-haskell', 'binary', 'bytestring', 'containers' - ), compile, ['-v0 -ddump-tc']) + ), compile, ['-v0 -ddump-tc -dsuppress-uniques']) test('TH_Roles3', normal, compile, ['-v0 -dsuppress-uniques']) test('TH_Roles4', normal, compile, ['-v0']) From git at git.haskell.org Mon Mar 6 15:21:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 15:21:00 +0000 (UTC) Subject: [commit: ghc] master: Comments only (995ab74) Message-ID: <20170306152100.BCE873A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/995ab74b3c55fe3a0299bd94b49e948c942e76d6/ghc >--------------------------------------------------------------- commit 995ab74b3c55fe3a0299bd94b49e948c942e76d6 Author: Simon Peyton Jones Date: Fri Mar 3 12:51:46 2017 +0000 Comments only >--------------------------------------------------------------- 995ab74b3c55fe3a0299bd94b49e948c942e76d6 compiler/basicTypes/Demand.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/basicTypes/Demand.hs b/compiler/basicTypes/Demand.hs index eab01d0..1ba25c6 100644 --- a/compiler/basicTypes/Demand.hs +++ b/compiler/basicTypes/Demand.hs @@ -1327,7 +1327,7 @@ splitDmdTy ty@(DmdType _ [] res_ty) = (resTypeArgDmd res_ty, ty) -- what of this demand should we consider, given that the IO action can cleanly -- exit? -- * We have to kill all strictness demands (i.e. lub with a lazy demand) --- * We can keep demand information (i.e. lub with an absent demand) +-- * We can keep usage information (i.e. lub with an absent demand) -- * We have to kill definite divergence -- * We can keep CPR information. -- See Note [IO hack in the demand analyser] in DmdAnal From git at git.haskell.org Mon Mar 6 15:57:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 15:57:20 +0000 (UTC) Subject: [commit: ghc] master: Typos in comments and manual (749740f) Message-ID: <20170306155720.DDAD33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/749740f9c3cb25ee95e04a21c1ef73e1bf96afb1/ghc >--------------------------------------------------------------- commit 749740f9c3cb25ee95e04a21c1ef73e1bf96afb1 Author: Gabor Greif Date: Mon Mar 6 16:55:42 2017 +0100 Typos in comments and manual >--------------------------------------------------------------- 749740f9c3cb25ee95e04a21c1ef73e1bf96afb1 compiler/coreSyn/CoreUnfold.hs | 2 +- compiler/simplCore/SetLevels.hs | 2 +- compiler/simplCore/Simplify.hs | 2 +- compiler/specialise/Specialise.hs | 2 +- compiler/typecheck/TcDerivInfer.hs | 2 +- compiler/typecheck/TcHsType.hs | 2 +- compiler/typecheck/TcValidity.hs | 4 ++-- docs/users_guide/glasgow_exts.rst | 6 +++--- libraries/base/Control/Monad.hs | 2 +- libraries/base/GHC/Generics.hs | 2 +- libraries/base/Text/Printf.hs | 2 +- libraries/ghc-compact/GHC/Compact.hs | 4 ++-- libraries/ghc-prim/GHC/CString.hs | 2 +- testsuite/tests/perf/compiler/all.T | 4 ++-- testsuite/tests/simplCore/should_compile/T13317.hs | 2 +- utils/deriveConstants/Main.hs | 2 +- 16 files changed, 21 insertions(+), 21 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 749740f9c3cb25ee95e04a21c1ef73e1bf96afb1 From git at git.haskell.org Mon Mar 6 18:38:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 18:38:17 +0000 (UTC) Subject: [commit: packages/binary] master: Remove redundant pattern-match warning when built with GHC 8.2 (7e8cde8) Message-ID: <20170306183817.317EB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/7e8cde813aaaf45e2a48e8feb40b56fd7d5a1f45 >--------------------------------------------------------------- commit 7e8cde813aaaf45e2a48e8feb40b56fd7d5a1f45 Author: Ryan Scott Date: Thu Mar 2 23:23:41 2017 -0500 Remove redundant pattern-match warning when built with GHC 8.2 >--------------------------------------------------------------- 7e8cde813aaaf45e2a48e8feb40b56fd7d5a1f45 src/Data/Binary/Class.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index ea36101..dd70f39 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -911,7 +911,6 @@ instance Binary KindRep where put (KindRepFun a b) = putWord8 3 >> put a >> put b put (KindRepTYPE r) = putWord8 4 >> put r put (KindRepTypeLit sort r) = putWord8 5 >> put sort >> put r - put _ = fail "GHCi.TH.Binary.putKindRep: Impossible" get = do tag <- getWord8 From git at git.haskell.org Mon Mar 6 18:38:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 18:38:19 +0000 (UTC) Subject: [commit: packages/binary] master: Merge pull request #132 from RyanGlScott/master (0147456) Message-ID: <20170306183819.378383A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/0147456b11c38d1121fd84a2b53effefde111240 >--------------------------------------------------------------- commit 0147456b11c38d1121fd84a2b53effefde111240 Merge: 42bba1c 7e8cde8 Author: Lennart Kolmodin Date: Mon Mar 6 17:51:13 2017 +0100 Merge pull request #132 from RyanGlScott/master Remove redundant pattern-match warning when built with GHC 8.2 >--------------------------------------------------------------- 0147456b11c38d1121fd84a2b53effefde111240 src/Data/Binary/Class.hs | 1 - 1 file changed, 1 deletion(-) From git at git.haskell.org Mon Mar 6 18:38:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 18:38:49 +0000 (UTC) Subject: [commit: ghc] master: Add -dno-debug-output to validate GhcStage1HcOpts (c02d03d) Message-ID: <20170306183849.820D83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c02d03de839c4ee0acbd52dad575bc5e27972595/ghc >--------------------------------------------------------------- commit c02d03de839c4ee0acbd52dad575bc5e27972595 Author: Matthew Pickering Date: Sat Mar 4 16:52:05 2017 -0500 Add -dno-debug-output to validate GhcStage1HcOpts This flag only affects whether WARNs are printed to the build log. ASSERT fails will still be printed and cause an abort. Most of the WARNs in the compiler are speculative and meant to help with debugging rather than indicative of any real errors. This causes a lot of noise in the build log which is not helpful and makes them very long. Test Plan: Check that the build log is less than 27000 lines long Reviewers: austin, bgamari, rwbarton Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3213 >--------------------------------------------------------------- c02d03de839c4ee0acbd52dad575bc5e27972595 mk/flavours/validate.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mk/flavours/validate.mk b/mk/flavours/validate.mk index 5783103..2ff7c20 100644 --- a/mk/flavours/validate.mk +++ b/mk/flavours/validate.mk @@ -1,8 +1,8 @@ SRC_HC_OPTS = -O0 -H64m SRC_HC_OPTS_STAGE1 = -fllvm-fill-undef-with-garbage # See Trac 11487 GhcStage1HcOpts = -O -DDEBUG -GhcStage2HcOpts = -O -dcore-lint -GhcLibHcOpts = -O -dcore-lint +GhcStage2HcOpts = -O -dcore-lint -dno-debug-output +GhcLibHcOpts = -O -dcore-lint -dno-debug-output BUILD_PROF_LIBS = NO SplitObjs = NO SplitSections = NO From git at git.haskell.org Mon Mar 6 18:38:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 18:38:46 +0000 (UTC) Subject: [commit: ghc] master: Add SplitSections = NO to build flavors with SplitObjs = NO (29b6845) Message-ID: <20170306183846.C611D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/29b6845e2a9a375ce8095946ac107f733835c45a/ghc >--------------------------------------------------------------- commit 29b6845e2a9a375ce8095946ac107f733835c45a Author: Reid Barton Date: Sat Mar 4 16:49:37 2017 -0500 Add SplitSections = NO to build flavors with SplitObjs = NO Test Plan: harbormaster Reviewers: nomeata, austin, bgamari Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3276 >--------------------------------------------------------------- 29b6845e2a9a375ce8095946ac107f733835c45a mk/flavours/bench-cross.mk | 1 + mk/flavours/bench-llvm.mk | 1 + mk/flavours/bench.mk | 1 + mk/flavours/devel1.mk | 1 + mk/flavours/devel2.mk | 1 + mk/flavours/prof-llvm.mk | 1 + mk/flavours/quick-cross.mk | 1 + mk/flavours/quick-llvm.mk | 1 + mk/flavours/quick.mk | 1 + mk/flavours/quickest.mk | 1 + mk/flavours/validate.mk | 1 + 11 files changed, 11 insertions(+) diff --git a/mk/flavours/bench-cross.mk b/mk/flavours/bench-cross.mk index 90344fc..ae67f34 100644 --- a/mk/flavours/bench-cross.mk +++ b/mk/flavours/bench-cross.mk @@ -4,6 +4,7 @@ GhcStage2HcOpts = -O0 -fllvm GhcLibHcOpts = -O2 -fllvm BUILD_PROF_LIBS = NO SplitObjs = NO +SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO BUILD_SPHINX_PDF = NO diff --git a/mk/flavours/bench-llvm.mk b/mk/flavours/bench-llvm.mk index 2da8ddb..9b71005 100644 --- a/mk/flavours/bench-llvm.mk +++ b/mk/flavours/bench-llvm.mk @@ -4,6 +4,7 @@ GhcStage2HcOpts = -O0 GhcLibHcOpts = -O2 BUILD_PROF_LIBS = NO SplitObjs = NO +SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO BUILD_SPHINX_PDF = NO diff --git a/mk/flavours/bench.mk b/mk/flavours/bench.mk index ad77219..0a7cf80 100644 --- a/mk/flavours/bench.mk +++ b/mk/flavours/bench.mk @@ -4,6 +4,7 @@ GhcStage2HcOpts = -O0 GhcLibHcOpts = -O2 BUILD_PROF_LIBS = NO SplitObjs = NO +SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO BUILD_SPHINX_PDF = NO diff --git a/mk/flavours/devel1.mk b/mk/flavours/devel1.mk index ea730c9..8c8925c 100644 --- a/mk/flavours/devel1.mk +++ b/mk/flavours/devel1.mk @@ -4,6 +4,7 @@ GhcStage2HcOpts = -O GhcLibHcOpts = -O -dcore-lint BUILD_PROF_LIBS = NO SplitObjs = NO +SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO BUILD_SPHINX_PDF = NO diff --git a/mk/flavours/devel2.mk b/mk/flavours/devel2.mk index c86624a..34808a3 100644 --- a/mk/flavours/devel2.mk +++ b/mk/flavours/devel2.mk @@ -4,6 +4,7 @@ GhcStage2HcOpts = -O0 -DDEBUG GhcLibHcOpts = -O -dcore-lint BUILD_PROF_LIBS = NO SplitObjs = NO +SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO BUILD_SPHINX_PDF = NO diff --git a/mk/flavours/prof-llvm.mk b/mk/flavours/prof-llvm.mk index b54fabd..dcbd6a4 100644 --- a/mk/flavours/prof-llvm.mk +++ b/mk/flavours/prof-llvm.mk @@ -4,6 +4,7 @@ GhcStage2HcOpts = -O GhcLibHcOpts = -O BUILD_PROF_LIBS = YES SplitObjs = NO +SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO BUILD_SPHINX_PDF = NO diff --git a/mk/flavours/quick-cross.mk b/mk/flavours/quick-cross.mk index b886a8d..f0f00d2 100644 --- a/mk/flavours/quick-cross.mk +++ b/mk/flavours/quick-cross.mk @@ -4,6 +4,7 @@ GhcStage2HcOpts = -O0 -fllvm GhcLibHcOpts = -O -fllvm BUILD_PROF_LIBS = NO SplitObjs = NO +SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO BUILD_SPHINX_PDF = NO diff --git a/mk/flavours/quick-llvm.mk b/mk/flavours/quick-llvm.mk index 0a63f5f..8a5c5e1 100644 --- a/mk/flavours/quick-llvm.mk +++ b/mk/flavours/quick-llvm.mk @@ -4,6 +4,7 @@ GhcStage2HcOpts = -O0 GhcLibHcOpts = -O BUILD_PROF_LIBS = NO SplitObjs = NO +SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO BUILD_SPHINX_PDF = NO diff --git a/mk/flavours/quick.mk b/mk/flavours/quick.mk index 9f1e2e2..735de6a 100644 --- a/mk/flavours/quick.mk +++ b/mk/flavours/quick.mk @@ -4,6 +4,7 @@ GhcStage2HcOpts = -O0 GhcLibHcOpts = -O BUILD_PROF_LIBS = NO SplitObjs = NO +SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO BUILD_SPHINX_PDF = NO diff --git a/mk/flavours/quickest.mk b/mk/flavours/quickest.mk index 69c0385..61e091c 100644 --- a/mk/flavours/quickest.mk +++ b/mk/flavours/quickest.mk @@ -4,6 +4,7 @@ GhcStage2HcOpts = -O0 GhcLibHcOpts = -O0 BUILD_PROF_LIBS = NO SplitObjs = NO +SplitSections = NO HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO BUILD_SPHINX_PDF = NO diff --git a/mk/flavours/validate.mk b/mk/flavours/validate.mk index 1d18641..5783103 100644 --- a/mk/flavours/validate.mk +++ b/mk/flavours/validate.mk @@ -5,6 +5,7 @@ GhcStage2HcOpts = -O -dcore-lint GhcLibHcOpts = -O -dcore-lint BUILD_PROF_LIBS = NO SplitObjs = NO +SplitSections = NO HADDOCK_DOCS = YES BUILD_SPHINX_HTML = YES BUILD_SPHINX_PDF = NO From git at git.haskell.org Mon Mar 6 18:38:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 18:38:53 +0000 (UTC) Subject: [commit: ghc] master: Read COMPLETE sets from external packages (8ca4bb1) Message-ID: <20170306183853.7A9C93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8ca4bb1ce9d94bb9f519f620c1f5ed8063007d33/ghc >--------------------------------------------------------------- commit 8ca4bb1ce9d94bb9f519f620c1f5ed8063007d33 Author: Ben Gamari Date: Mon Mar 6 12:20:06 2017 -0500 Read COMPLETE sets from external packages Currently, `COMPLETE` pragmas are not read from external packages at all, which quite limits their usefulness. This extends `ExternalPackageState` to include `COMPLETE` sets from other packages, and plumbs around the appropriate values to make it work the way you'd expect it to. Requires a `binary` submodule update. Fixes #13350. Test Plan: make test TEST=T13350 Reviewers: rwbarton, mpickering, austin, simonpj, bgamari Reviewed By: simonpj Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D3257 >--------------------------------------------------------------- 8ca4bb1ce9d94bb9f519f620c1f5ed8063007d33 compiler/deSugar/Check.hs | 11 ++- compiler/deSugar/DsMonad.hs | 14 ++- compiler/iface/LoadIface.hs | 29 +++--- compiler/iface/MkIface.hs | 3 +- compiler/iface/TcIface.hs | 14 +-- compiler/iface/TcIface.hs-boot | 18 ++-- compiler/main/HscTypes.hs | 101 ++++++++++++++++++--- compiler/typecheck/TcBinds.hs | 10 +- compiler/typecheck/TcRnTypes.hs | 14 +-- compiler/utils/Binary.hs | 1 - libraries/binary | 2 +- .../tests/patsyn/should_compile/T13350/Makefile | 13 +++ .../tests/patsyn/should_compile/T13350/T13350.hs | 8 ++ testsuite/tests/patsyn/should_compile/T13350/all.T | 4 + .../should_compile/T13350/boolean/Boolean.hs | 9 ++ .../should_compile/T13350/boolean}/Setup.hs | 0 .../should_compile/T13350/boolean/boolean.cabal | 7 ++ 17 files changed, 191 insertions(+), 67 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 8ca4bb1ce9d94bb9f519f620c1f5ed8063007d33 From git at git.haskell.org Mon Mar 6 22:26:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 22:26:29 +0000 (UTC) Subject: [commit: ghc] master: Add GCC bin folder to search path. (016b10c) Message-ID: <20170306222629.4E6353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/016b10c50e365ca62a9baffa1c590f4efa8db409/ghc >--------------------------------------------------------------- commit 016b10c50e365ca62a9baffa1c590f4efa8db409 Author: Tamar Christina Date: Mon Mar 6 13:42:47 2017 -0500 Add GCC bin folder to search path. D3155 added pthread by default to GHCi. However this was only tested using something running in an msys2 shell. As it turns out it's been picking up pthread in the environment and not the inplace gcc. This results in an error when using ghci outside of msys2. Test Plan: start cmd, start ghc-stage2 --interactive Reviewers: austin, hvr, bgamari, dfeuer Reviewed By: dfeuer Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3279 >--------------------------------------------------------------- 016b10c50e365ca62a9baffa1c590f4efa8db409 compiler/ghci/Linker.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs index 49f57e5..390d914 100644 --- a/compiler/ghci/Linker.hs +++ b/compiler/ghci/Linker.hs @@ -345,8 +345,10 @@ linkCmdLineLibs' hsc_env pls = if null cmdline_lib_specs then return pls else do - -- Add directories to library search paths - let all_paths = let paths = framework_paths + -- Add directories to library search paths, this only has an effect + -- on Windows. On Unix OSes this function is a NOP. + let all_paths = let paths = takeDirectory (fst $ sPgm_c $ settings dflags) + : framework_paths ++ lib_paths ++ [ takeDirectory dll | DLLPath dll <- libspecs ] in nub $ map normalise paths From git at git.haskell.org Mon Mar 6 22:26:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 22:26:32 +0000 (UTC) Subject: [commit: ghc] master: Changed OverLit warnings to work with negative literals (#13257) (3fdabe9) Message-ID: <20170306222632.926893A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3fdabe9873e311571f614d455d1b16bc3f4fdc0f/ghc >--------------------------------------------------------------- commit 3fdabe9873e311571f614d455d1b16bc3f4fdc0f Author: Rupert Horlick Date: Mon Mar 6 13:43:34 2017 -0500 Changed OverLit warnings to work with negative literals (#13257) Test Plan: Validate, check generated warnings Reviewers: austin, bgamari, dfeuer Reviewed By: bgamari, dfeuer Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3281 >--------------------------------------------------------------- 3fdabe9873e311571f614d455d1b16bc3f4fdc0f compiler/deSugar/DsExpr.hs | 9 +++++++++ compiler/deSugar/MatchLit.hs | 5 +++-- testsuite/tests/deSugar/should_compile/T13257.hs | 6 ++++++ testsuite/tests/deSugar/should_compile/T13257.stderr | 3 +++ testsuite/tests/deSugar/should_compile/all.T | 1 + testsuite/tests/numeric/should_compile/T8542.stderr | 4 ---- 6 files changed, 22 insertions(+), 6 deletions(-) diff --git a/compiler/deSugar/DsExpr.hs b/compiler/deSugar/DsExpr.hs index 28254c9..faf562e 100644 --- a/compiler/deSugar/DsExpr.hs +++ b/compiler/deSugar/DsExpr.hs @@ -271,6 +271,15 @@ dsExpr (HsWrap co_fn e) ; warnAboutIdentities dflags e' (exprType wrapped_e) ; return wrapped_e } +dsExpr (NegApp (L loc (HsOverLit lit@(OverLit { ol_val = HsIntegral src i }))) + neg_expr) + = do { expr' <- putSrcSpanDs loc $ do + { dflags <- getDynFlags + ; warnAboutOverflowedLiterals dflags + (lit { ol_val = HsIntegral src (-i) }) + ; dsOverLit' dflags lit } + ; dsSyntaxExpr neg_expr [expr'] } + dsExpr (NegApp expr neg_expr) = do { expr' <- dsLExpr expr ; dsSyntaxExpr neg_expr [expr'] } diff --git a/compiler/deSugar/MatchLit.hs b/compiler/deSugar/MatchLit.hs index 2e9a523..6ed34f4 100644 --- a/compiler/deSugar/MatchLit.hs +++ b/compiler/deSugar/MatchLit.hs @@ -8,10 +8,11 @@ Pattern-matching literal patterns {-# LANGUAGE CPP, ScopedTypeVariables #-} -module MatchLit ( dsLit, dsOverLit, hsLitKey +module MatchLit ( dsLit, dsOverLit, dsOverLit', hsLitKey , tidyLitPat, tidyNPat , matchLiterals, matchNPlusKPats, matchNPats - , warnAboutIdentities, warnAboutEmptyEnumerations + , warnAboutIdentities, warnAboutOverflowedLiterals + , warnAboutEmptyEnumerations ) where #include "HsVersions.h" diff --git a/testsuite/tests/deSugar/should_compile/T13257.hs b/testsuite/tests/deSugar/should_compile/T13257.hs new file mode 100644 index 0000000..b9188df --- /dev/null +++ b/testsuite/tests/deSugar/should_compile/T13257.hs @@ -0,0 +1,6 @@ +module T13257 where + + import Data.Int + + int8 = -128 :: Int8 + word = -1 :: Word diff --git a/testsuite/tests/deSugar/should_compile/T13257.stderr b/testsuite/tests/deSugar/should_compile/T13257.stderr new file mode 100644 index 0000000..93412f1 --- /dev/null +++ b/testsuite/tests/deSugar/should_compile/T13257.stderr @@ -0,0 +1,3 @@ + +T13257.hs:6:11: warning: [-Woverflowed-literals (in -Wdefault)] + Literal -1 is out of the Word range 0..18446744073709551615 diff --git a/testsuite/tests/deSugar/should_compile/all.T b/testsuite/tests/deSugar/should_compile/all.T index 7694fb9..7a39b1e 100644 --- a/testsuite/tests/deSugar/should_compile/all.T +++ b/testsuite/tests/deSugar/should_compile/all.T @@ -97,3 +97,4 @@ test('T12950', normal, compile, ['']) test('T13043', normal, compile, ['']) test('T13215', normal, compile, ['']) test('T13290', normal, compile, ['']) +test('T13257', normal, compile, ['']) diff --git a/testsuite/tests/numeric/should_compile/T8542.stderr b/testsuite/tests/numeric/should_compile/T8542.stderr index f414382..699ba5d 100644 --- a/testsuite/tests/numeric/should_compile/T8542.stderr +++ b/testsuite/tests/numeric/should_compile/T8542.stderr @@ -1,8 +1,4 @@ -T8542.hs:6:6: warning: [-Woverflowed-literals (in -Wdefault)] - Literal 128 is out of the Int8 range -128..127 - If you are trying to write a large negative literal, use NegativeLiterals - T8542.hs:9:5: warning: [-Woverflowed-literals (in -Wdefault)] Literal 128 is out of the Int8 range -128..127 If you are trying to write a large negative literal, use NegativeLiterals From git at git.haskell.org Mon Mar 6 22:26:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 22:26:35 +0000 (UTC) Subject: [commit: ghc] master: add example documentation for tuple Applicative (f57bd2a) Message-ID: <20170306222635.4FC1B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f57bd2ae8fc787f14aeafa3f2f7ded253456528c/ghc >--------------------------------------------------------------- commit f57bd2ae8fc787f14aeafa3f2f7ded253456528c Author: GinBaby Date: Mon Mar 6 13:43:57 2017 -0500 add example documentation for tuple Applicative Reviewers: austin, hvr, bgamari, dfeuer Reviewed By: dfeuer Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3284 >--------------------------------------------------------------- f57bd2ae8fc787f14aeafa3f2f7ded253456528c libraries/base/Control/Applicative.hs | 2 +- libraries/base/GHC/Base.hs | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libraries/base/Control/Applicative.hs b/libraries/base/Control/Applicative.hs index 8883818..406f086 100644 --- a/libraries/base/Control/Applicative.hs +++ b/libraries/base/Control/Applicative.hs @@ -106,7 +106,7 @@ instance (ArrowZero a, ArrowPlus a) => Alternative (WrappedArrow a b) where newtype ZipList a = ZipList { getZipList :: [a] } deriving ( Show, Eq, Ord, Read, Functor , Foldable, Generic, Generic1) --- See Data.Traversable for Traversabel instance due to import loops +-- See Data.Traversable for Traversable instance due to import loops -- | @since 2.01 instance Applicative ZipList where diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index e07c077..2f155c6 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -327,7 +327,14 @@ instance Monoid a => Monoid (Maybe a) where m `mappend` Nothing = m Just m1 `mappend` Just m2 = Just (m1 `mappend` m2) --- | @since 2.01 +-- | For tuples, the 'Monoid' constraint on @a@ determines +-- how the first values merge. +-- For example, 'String's concatenate: +-- +-- > ("hello ", (+15)) <*> ("world!", 2002) +-- > ("hello world!",2017) +-- +-- @since 2.01 instance Monoid a => Applicative ((,) a) where pure x = (mempty, x) (u, f) <*> (v, x) = (u `mappend` v, f x) From git at git.haskell.org Mon Mar 6 22:26:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 22:26:38 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add test for #11076 (494907f) Message-ID: <20170306222638.A70243A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/494907f89d129370ec5ab178cec860a64b456ac8/ghc >--------------------------------------------------------------- commit 494907f89d129370ec5ab178cec860a64b456ac8 Author: Ben Gamari Date: Mon Mar 6 15:54:20 2017 -0500 testsuite: Add test for #11076 >--------------------------------------------------------------- 494907f89d129370ec5ab178cec860a64b456ac8 testsuite/tests/stranal/should_run/T13380.hs | 10 ++++++++++ testsuite/tests/stranal/should_run/all.T | 1 + 2 files changed, 11 insertions(+) diff --git a/testsuite/tests/stranal/should_run/T13380.hs b/testsuite/tests/stranal/should_run/T13380.hs new file mode 100644 index 0000000..4a012bf --- /dev/null +++ b/testsuite/tests/stranal/should_run/T13380.hs @@ -0,0 +1,10 @@ +import Control.Exception + +-- This should result in the "What" exception, not the undefined. +{-# NOINLINE f #-} +f :: Int -> Int -> IO Int +f x y | x>0 = throwIO (userError "What") + | y>0 = return 1 + | otherwise = return 2 + +main = f 2 undefined >>= print diff --git a/testsuite/tests/stranal/should_run/all.T b/testsuite/tests/stranal/should_run/all.T index d3d4aaf..0764746 100644 --- a/testsuite/tests/stranal/should_run/all.T +++ b/testsuite/tests/stranal/should_run/all.T @@ -14,3 +14,4 @@ test('T11076', normal, multimod_compile_and_run, ['T11076.hs', 'T11076_prim.cmm' test('T11555a', normal, compile_and_run, ['']) test('T12368', exit_code(1), compile_and_run, ['']) test('T12368a', exit_code(1), compile_and_run, ['']) +test('T13380', [expect_broken(13380), exit_code(1)], compile_and_run, ['']) From git at git.haskell.org Mon Mar 6 22:26:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 22:26:41 +0000 (UTC) Subject: [commit: ghc] master: Disallow unboxed string literals in patterns (#13260) (6177c0d) Message-ID: <20170306222641.DE6D13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6177c0d8bdc6f5c0675b2eace592620abb658787/ghc >--------------------------------------------------------------- commit 6177c0d8bdc6f5c0675b2eace592620abb658787 Author: Rupert Horlick Date: Mon Mar 6 13:44:40 2017 -0500 Disallow unboxed string literals in patterns (#13260) Signed-off-by: Rupert Horlick Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3286 >--------------------------------------------------------------- 6177c0d8bdc6f5c0675b2eace592620abb658787 compiler/parser/RdrHsSyn.hs | 3 +++ testsuite/tests/parser/should_fail/T13260.hs | 7 +++++++ testsuite/tests/parser/should_fail/T13260.stderr | 4 ++++ testsuite/tests/parser/should_fail/all.T | 1 + 4 files changed, 15 insertions(+) diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs index 2c63c42..e06c7e3 100644 --- a/compiler/parser/RdrHsSyn.hs +++ b/compiler/parser/RdrHsSyn.hs @@ -829,6 +829,9 @@ checkAPat msg loc e0 = do case e0 of EWildPat -> return (WildPat placeHolderType) HsVar x -> return (VarPat x) + HsLit (HsStringPrim _ _) -- (#13260) + -> parseErrorSDoc loc (text "Illegal unboxed string literal in pattern:" $$ ppr e0) + HsLit l -> return (LitPat l) -- Overloaded numeric patterns (e.g. f 0 x = x) diff --git a/testsuite/tests/parser/should_fail/T13260.hs b/testsuite/tests/parser/should_fail/T13260.hs new file mode 100644 index 0000000..b0e1f97 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T13260.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE MagicHash #-} + +module T13260 where + + g y = case y of + "a"# -> True + _ -> False diff --git a/testsuite/tests/parser/should_fail/T13260.stderr b/testsuite/tests/parser/should_fail/T13260.stderr new file mode 100644 index 0000000..05e99d6 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T13260.stderr @@ -0,0 +1,4 @@ + +T13260.hs:6:5: error: + Illegal unboxed string literal in pattern: + "a"# diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T index b3efb5c..1496fec 100644 --- a/testsuite/tests/parser/should_fail/all.T +++ b/testsuite/tests/parser/should_fail/all.T @@ -96,3 +96,4 @@ test('T10498b', normal, compile_fail, ['']) test('T12051', normal, compile_fail, ['']) test('T12429', normal, compile_fail, ['']) test('T12811', normal, compile_fail, ['']) +test('T13260', normal, compile_fail, ['']) From git at git.haskell.org Mon Mar 6 22:26:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 22:26:44 +0000 (UTC) Subject: [commit: ghc] master: base: Kill out-of-date Notes (1831208) Message-ID: <20170306222644.9970A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/18312086a48c90b22583c81fdb7bd2d7bfd38991/ghc >--------------------------------------------------------------- commit 18312086a48c90b22583c81fdb7bd2d7bfd38991 Author: Ben Gamari Date: Mon Mar 6 15:54:35 2017 -0500 base: Kill out-of-date Notes These were rendered out-of-date by D1103. Resolves #13174. >--------------------------------------------------------------- 18312086a48c90b22583c81fdb7bd2d7bfd38991 libraries/base/GHC/IO/Unsafe.hs | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/libraries/base/GHC/IO/Unsafe.hs b/libraries/base/GHC/IO/Unsafe.hs index 5bb9824..7523535 100644 --- a/libraries/base/GHC/IO/Unsafe.hs +++ b/libraries/base/GHC/IO/Unsafe.hs @@ -103,33 +103,6 @@ like 'bracket' cannot be used safely within 'unsafeDupablePerformIO'. unsafeDupablePerformIO :: IO a -> a unsafeDupablePerformIO (IO m) = case runRW# m of (# _, a #) -> a --- Note [unsafeDupablePerformIO is NOINLINE] --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- Why do we NOINLINE unsafeDupablePerformIO? See the comment with --- GHC.ST.runST. Essentially the issue is that the IO computation --- inside unsafePerformIO must be atomic: it must either all run, or --- not at all. If we let the compiler see the application of the IO --- to realWorld#, it might float out part of the IO. - --- Note [unsafeDupablePerformIO has a lazy RHS] --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- Why is there a call to 'lazy' in unsafeDupablePerformIO? --- If we don't have it, the demand analyser discovers the following strictness --- for unsafeDupablePerformIO: C(U(AV)) --- But then consider --- unsafeDupablePerformIO (\s -> let r = f x in --- case writeIORef v r s of (# s1, _ #) -> --- (# s1, r #) ) --- The strictness analyser will find that the binding for r is strict, --- (because of uPIO's strictness sig), and so it'll evaluate it before --- doing the writeIORef. This actually makes libraries/base/tests/memo002 --- get a deadlock, where we specifically wanted to write a lazy thunk --- into the ref cell. --- --- Solution: don't expose the strictness of unsafeDupablePerformIO, --- by hiding it with 'lazy' --- But see discussion in Trac #9390 (comment:33) - {-| 'unsafeInterleaveIO' allows 'IO' computation to be deferred lazily. When passed a value of type @IO a@, the 'IO' will only be performed From git at git.haskell.org Mon Mar 6 22:44:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 22:44:49 +0000 (UTC) Subject: [commit: ghc] master: Update .mailmap [skip ci] (cd9c709) Message-ID: <20170306224449.82FCA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cd9c7094756e5f479afd718b08b2d82d6b78e6f0/ghc >--------------------------------------------------------------- commit cd9c7094756e5f479afd718b08b2d82d6b78e6f0 Author: Matthew Pickering Date: Mon Mar 6 22:43:44 2017 +0000 Update .mailmap [skip ci] >--------------------------------------------------------------- cd9c7094756e5f479afd718b08b2d82d6b78e6f0 .mailmap | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.mailmap b/.mailmap index c4a93de..ed78978 100644 --- a/.mailmap +++ b/.mailmap @@ -12,6 +12,7 @@ Alexander Vershilov Alexey Rodriguez mrchebas at gmail.com Alex Biehl +Alex Biehl Andrew Farmer Andrew Farmer Andrew Pimlott andrew.pimlott.ctr at metnet.navy.mil @@ -97,6 +98,7 @@ Duncan Coutts Duncan Coutts Edward Z. Yang +Eric Seidel Erik de Castro Lopo Evan Hauck Fumiaki Kinoshita @@ -147,6 +149,7 @@ Jost Berthold berthold at mathematik. Juan J. Quintela quintela Judah Jacobson judah.jacobson at gmail.com Julian Seward sewardj +Julie Moronuki Karel Gardas Karel Gardas Keith Wansbrough keithw @@ -202,8 +205,9 @@ Pepe Iborra pepe Pepe Iborra pepeiborra at gmail.com Peter Jonsson t-peterj at microsoft.com Peter Trommler -Peter Wortmann -Peter Wortmann scpmw at leeds.ac.uk +Peter Wortmann +Peter Wortmann +Peter Wortmann scpmw at leeds.ac.uk Ralf Laemmel ralf # https://ghc.haskell.org/trac/ghc/wiki/TeamGHC Ravi Nanavati # Commit 70c044. Reuben Thomas rrt @@ -224,6 +228,7 @@ Sergei Trofimovich Sergei Trofimovich Shae Matijs Erisson shae at ScannedInAvian.com +Siddhanathan Shanmugam Siddharth Bhat Sigbjorn Finne sof Sigbjorn Finne sof at galois.com From git at git.haskell.org Mon Mar 6 23:23:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 23:23:00 +0000 (UTC) Subject: [commit: ghc] master: A few remarks on role subtyping in the manual. (2f115a1) Message-ID: <20170306232300.A56F03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2f115a13a0fab84f6bc384c9b6159f29ea038d36/ghc >--------------------------------------------------------------- commit 2f115a13a0fab84f6bc384c9b6159f29ea038d36 Author: Edward Z. Yang Date: Mon Mar 6 15:22:37 2017 -0800 A few remarks on role subtyping in the manual. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 2f115a13a0fab84f6bc384c9b6159f29ea038d36 docs/users_guide/separate_compilation.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/users_guide/separate_compilation.rst b/docs/users_guide/separate_compilation.rst index 743822f..a140d46 100644 --- a/docs/users_guide/separate_compilation.rst +++ b/docs/users_guide/separate_compilation.rst @@ -917,11 +917,17 @@ to ``hs-boot`` files, but with some slight changes: relation ``phantom < representational < nominal``: for example, an abstract type with a nominal type parameter can be implemented using a concrete type with a representational type parameter. + Merging respects this subtyping relation (e.g., ``nominal`` + merged with ``representational`` is ``representational``.) Roles in signatures default to ``nominal``, which gives maximum flexibility on the implementor's side. You should only need to give an explicit role annotation if a client of the signature would like to coerce the abstract type in a type parameter (in which case you - should specify ``representational`` explicitly.) + should specify ``representational`` explicitly.) Unlike + regular data types, we do *not* assume that abstract + data types are representationally injective: if we have + ``Coercible (T a) (T b)``, and ``T`` has role ``nominal``, + this does not imply that ``a ~ b``. - A class declarations can either be abstract or concrete. An abstract class is one with no superclasses or class methods:: @@ -990,6 +996,8 @@ to ``hs-boot`` files, but with some slight changes: Known limitations: +- Pattern synonyms are not supported. + - Algebraic data types specified in a signature cannot be implemented using pattern synonyms. See :ghc-ticket:`12717` From git at git.haskell.org Mon Mar 6 23:51:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 23:51:40 +0000 (UTC) Subject: [commit: ghc] master: Add rule mapFB c (λx.x) = c (2fa4421) Message-ID: <20170306235140.D58513A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2fa44217c1d9722227297eefb0d6c6aed7e128ca/ghc >--------------------------------------------------------------- commit 2fa44217c1d9722227297eefb0d6c6aed7e128ca Author: Joachim Breitner Date: Mon Mar 6 17:30:52 2017 -0500 Add rule mapFB c (λx.x) = c Test Plan: exended T2110 with a case for that. Reviewers: austin, hvr, dfeuer, bgamari Reviewed By: dfeuer Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3275 >--------------------------------------------------------------- 2fa44217c1d9722227297eefb0d6c6aed7e128ca libraries/base/GHC/Base.hs | 1 + testsuite/tests/simplCore/should_run/T2110.hs | 3 +++ testsuite/tests/simplCore/should_run/T2110.stdout | 1 + 3 files changed, 5 insertions(+) diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index 2f155c6..6f9d454 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -973,6 +973,7 @@ mapFB c f = \x ys -> c (f x) ys "map" [~1] forall f xs. map f xs = build (\c n -> foldr (mapFB c f) n xs) "mapList" [1] forall f. foldr (mapFB (:) f) [] = map f "mapFB" forall c f g. mapFB (mapFB c f) g = mapFB c (f.g) +"mapFB/id" forall c. mapFB c (\x -> x) = c #-} -- See Breitner, Eisenberg, Peyton Jones, and Weirich, "Safe Zero-cost diff --git a/testsuite/tests/simplCore/should_run/T2110.hs b/testsuite/tests/simplCore/should_run/T2110.hs index 610be09..d945fac 100644 --- a/testsuite/tests/simplCore/should_run/T2110.hs +++ b/testsuite/tests/simplCore/should_run/T2110.hs @@ -5,6 +5,8 @@ import Unsafe.Coerce newtype Age = Age Int +foo :: [Int] -> [Int] +foo = map id fooAge :: [Int] -> [Age] fooAge = map Age fooCoerce :: [Int] -> [Age] @@ -19,6 +21,7 @@ same x y = case reallyUnsafePtrEquality# (unsafeCoerce x) y of main = do let l = [1,2,3] + same (foo l) l same (fooAge l) l same (fooCoerce l) l same (fooUnsafeCoerce l) l diff --git a/testsuite/tests/simplCore/should_run/T2110.stdout b/testsuite/tests/simplCore/should_run/T2110.stdout index 55f7ebb..4ff957b 100644 --- a/testsuite/tests/simplCore/should_run/T2110.stdout +++ b/testsuite/tests/simplCore/should_run/T2110.stdout @@ -1,3 +1,4 @@ yes yes yes +yes From git at git.haskell.org Mon Mar 6 23:51:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 23:51:46 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Disable linkwhole test on Windows (5dddf35) Message-ID: <20170306235146.47FF83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5dddf3546809c332a3de1e78a465798d2cb6eb94/ghc >--------------------------------------------------------------- commit 5dddf3546809c332a3de1e78a465798d2cb6eb94 Author: Ben Gamari Date: Mon Mar 6 16:50:28 2017 -0500 testsuite: Disable linkwhole test on Windows It relies on System.Posix.DynamicLinker, which is not available. >--------------------------------------------------------------- 5dddf3546809c332a3de1e78a465798d2cb6eb94 testsuite/tests/driver/linkwhole/all.T | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/driver/linkwhole/all.T b/testsuite/tests/driver/linkwhole/all.T index dcef32b..294a879 100644 --- a/testsuite/tests/driver/linkwhole/all.T +++ b/testsuite/tests/driver/linkwhole/all.T @@ -1,2 +1,3 @@ -test('linkwhole', [extra_files(['Types.hs','Main.hs','MyCode.hs','Handles.hs'])], +test('linkwhole', [extra_files(['Types.hs','Main.hs','MyCode.hs','Handles.hs']), + when(opsys('mingw32'), skip)], run_command, ['$MAKE -s --no-print-directory linkwhole']) From git at git.haskell.org Mon Mar 6 23:51:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 23:51:43 +0000 (UTC) Subject: [commit: ghc] master: Mangle .subsections_via_symbols away. (1686f30) Message-ID: <20170306235143.8BE2D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1686f30951292e94bf3076ce8b3eafb0bcbba91d/ghc >--------------------------------------------------------------- commit 1686f30951292e94bf3076ce8b3eafb0bcbba91d Author: Moritz Angermann Date: Mon Mar 6 17:31:04 2017 -0500 Mangle .subsections_via_symbols away. This is a rather stupid mangler hack. However, when using prefix data with llvm, on systems that support -dead_strip (macOS, iOS), the prefix data is stipped. llvm generiously adds .subsections_via_symbols for macho in any case. Thus we use our trusted mangler to drop the .subsections_via_symbols line from the assembly. This ultimately means that for (macOS, llvm), and (iOS, llvm) will not benefit from -dead_strip. Yet, this patch will allow building ghc on macOS again. Test Plan: build ghc with llvm on macOS Reviewers: rwbarton, bgamari, austin Reviewed By: rwbarton, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3287 >--------------------------------------------------------------- 1686f30951292e94bf3076ce8b3eafb0bcbba91d compiler/llvmGen/LlvmMangler.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/compiler/llvmGen/LlvmMangler.hs b/compiler/llvmGen/LlvmMangler.hs index acf344f..eed13ba 100644 --- a/compiler/llvmGen/LlvmMangler.hs +++ b/compiler/llvmGen/LlvmMangler.hs @@ -47,11 +47,20 @@ type Rewrite = DynFlags -> B.ByteString -> Maybe B.ByteString -- | Rewrite a line of assembly source with the given rewrites, -- taking the first rewrite that applies. rewriteLine :: DynFlags -> [Rewrite] -> B.ByteString -> B.ByteString -rewriteLine dflags rewrites l = +rewriteLine dflags rewrites l + -- We disable .subsections_via_symbols on darwin and ios, as the llvm code + -- gen uses prefix data for the info table. This however does not prevent + -- llvm from generating .subsections_via_symbols, which in turn with + -- -dead_strip, strips the info tables, and therefore breaks ghc. + | isSubsectionsViaSymbols l = + (B.pack "## no .subsection_via_symbols for ghc. We need our info tables!") + | otherwise = case firstJust $ map (\rewrite -> rewrite dflags rest) rewrites of Nothing -> l Just rewritten -> B.concat $ [symbol, B.pack "\t", rewritten] where + isSubsectionsViaSymbols = B.isPrefixOf (B.pack ".subsections_via_symbols") + (symbol, rest) = splitLine l firstJust :: [Maybe a] -> Maybe a From git at git.haskell.org Mon Mar 6 23:51:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Mar 2017 23:51:49 +0000 (UTC) Subject: [commit: ghc] master: primops: Add comment describing type of atomicModifyMutVar# (d91b104) Message-ID: <20170306235149.1C98E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d91b10458885aede47ff17fa649b2c0fd9fdf3ca/ghc >--------------------------------------------------------------- commit d91b10458885aede47ff17fa649b2c0fd9fdf3ca Author: Ben Gamari Date: Mon Mar 6 17:31:20 2017 -0500 primops: Add comment describing type of atomicModifyMutVar# This resolves #13130. It's not entirely clear to me why we don't use an unboxed tuple here but this is at least better than the status quo. [skip ci] Test Plan: Read it Reviewers: simonmar, austin, dfeuer Reviewed By: dfeuer Subscribers: dfeuer, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3288 >--------------------------------------------------------------- d91b10458885aede47ff17fa649b2c0fd9fdf3ca compiler/prelude/primops.txt.pp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 855bdfc..11928b6 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -1924,13 +1924,25 @@ primop WriteMutVarOp "writeMutVar#" GenPrimOp primop SameMutVarOp "sameMutVar#" GenPrimOp MutVar# s a -> MutVar# s a -> Int# --- not really the right type, but we don't know about pairs here. The --- correct type is +-- Note [Why not an unboxed tuple in atomicModifyMutVar#?] +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- --- MutVar# s a -> (a -> (a,b)) -> State# s -> (# State# s, b #) +-- Looking at the type of atomicModifyMutVar#, one might wonder why +-- it doesn't return an unboxed tuple. e.g., -- +-- MutVar# s a -> (a -> (# a, b #)) -> State# s -> (# State# s, b #) +-- +-- The reason is that atomicModifyMutVar# relies on laziness for its atomicity. +-- Given a MutVar# containing x, atomicModifyMutVar# merely replaces the +-- its contents with a thunk of the form (fst (f x)). This can be done using an +-- atomic compare-and-swap as it is merely replacing a pointer. + primop AtomicModifyMutVarOp "atomicModifyMutVar#" GenPrimOp MutVar# s a -> (a -> b) -> State# s -> (# State# s, c #) + { Modify the contents of a {\tt MutVar\#}. Note that this isn't strictly + speaking the correct type for this function, it should really be + {\tt MutVar# s a -> (a -> (a,b)) -> State# s -> (# State# s, b #)}, however + we don't know about pairs here. } with out_of_line = True has_side_effects = True From git at git.haskell.org Tue Mar 7 07:35:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Mar 2017 07:35:54 +0000 (UTC) Subject: [commit: ghc] master: Typos in changelog and comments (99fe579) Message-ID: <20170307073554.658D23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/99fe579d8f952512ca00ba81683dd51a45a86245/ghc >--------------------------------------------------------------- commit 99fe579d8f952512ca00ba81683dd51a45a86245 Author: Gabor Greif Date: Mon Mar 6 17:53:29 2017 +0100 Typos in changelog and comments >--------------------------------------------------------------- 99fe579d8f952512ca00ba81683dd51a45a86245 compiler/deSugar/Desugar.hs | 2 +- compiler/simplCore/SetLevels.hs | 2 +- compiler/specialise/SpecConstr.hs | 2 +- compiler/typecheck/TcInteract.hs | 2 +- compiler/typecheck/TcTyDecls.hs | 2 +- configure.ac | 2 +- libraries/base/Data/Data.hs | 2 +- libraries/base/GHC/IO/Buffer.hs | 2 +- libraries/base/changelog.md | 2 +- testsuite/tests/indexed-types/should_fail/T2239.hs | 2 +- testsuite/tests/typecheck/should_fail/tcfail179.hs | 2 +- testsuite/tests/typecheck/should_run/T1735_Help/Basics.hs | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/compiler/deSugar/Desugar.hs b/compiler/deSugar/Desugar.hs index d5931d1..1458b91 100644 --- a/compiler/deSugar/Desugar.hs +++ b/compiler/deSugar/Desugar.hs @@ -525,7 +525,7 @@ by 'competesWith' Class methods have a built-in RULE to select the method from the dictionary, so you can't change the phase on this. That makes id very dubious to match on class methods in RULE lhs's. See Trac #10595. I'm not happy -about this. For exmaple in Control.Arrow we have +about this. For example in Control.Arrow we have {-# RULES "compose/arr" forall f g . (arr f) . (arr g) = arr (f . g) #-} diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 2976895..8822019 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -1104,7 +1104,7 @@ lvlBind env (AnnRec pairs) -- Both are checked by Lint is_fun = all isFunction rhss is_bot = False -- It's odd to have an unconditionally divergent - -- funtion in a Rec, and we don't much care what + -- function in a Rec, and we don't much care what -- happens to it. False is simple! do_rhs env (bndr,rhs) = lvlFloatRhs abs_vars dest_lvl env Recursive diff --git a/compiler/specialise/SpecConstr.hs b/compiler/specialise/SpecConstr.hs index c2470bd..7162841 100644 --- a/compiler/specialise/SpecConstr.hs +++ b/compiler/specialise/SpecConstr.hs @@ -777,7 +777,7 @@ But it is much better to specialise f for the case where the argument is of form (I# x); then we build the box only when returning y, which is on the cold path. -Another exmaple: +Another example: f x = ...(g x).... diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index e1ad484..c710fd5 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -2475,7 +2475,7 @@ doTyLit kc t = do { kc_clas <- tcLookupClass kc {- Note [Typeable (T a b c)] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For type applications we always decompose using binary application, -via doTyApp, until we get to a *kind* instantiation. Exmaple +via doTyApp, until we get to a *kind* instantiation. Example Proxy :: forall k. k -> * To solve Typeable (Proxy (* -> *) Maybe) we diff --git a/compiler/typecheck/TcTyDecls.hs b/compiler/typecheck/TcTyDecls.hs index c518101..2933890 100644 --- a/compiler/typecheck/TcTyDecls.hs +++ b/compiler/typecheck/TcTyDecls.hs @@ -243,7 +243,7 @@ one approach is to instantiate all of C's superclasses, transitively. We can only do so if that set is finite. This potential loop occurs only through superclasses. This, for -exmaple, is fine +example, is fine class C a where op :: C b => a -> b -> b even though C's full definition uses C. diff --git a/configure.ac b/configure.ac index ba5836d..949c3d0 100644 --- a/configure.ac +++ b/configure.ac @@ -442,7 +442,7 @@ fi # name (this is a known problem in the case of the Android NDK, which has # slightly odd triples). # -# It may be better to just do away with the GHC triples all together. This would +# It may be better to just do away with the GHC triples altogether. This would # all be taken care of for us if we configured the subprojects using # AC_CONFIG_DIR, but unfortunately Cabal needs to be the one to do the # configuration. diff --git a/libraries/base/Data/Data.hs b/libraries/base/Data/Data.hs index 8233f98..1b55f59 100644 --- a/libraries/base/Data/Data.hs +++ b/libraries/base/Data/Data.hs @@ -687,7 +687,7 @@ readConstr dt str = ------------------------------------------------------------------------------ -- --- Convenience funtions: algebraic data types +-- Convenience functions: algebraic data types -- ------------------------------------------------------------------------------ diff --git a/libraries/base/GHC/IO/Buffer.hs b/libraries/base/GHC/IO/Buffer.hs index b2d4cd1..50de06e 100644 --- a/libraries/base/GHC/IO/Buffer.hs +++ b/libraries/base/GHC/IO/Buffer.hs @@ -173,7 +173,7 @@ charSize = 4 -- -- The "live" elements of the buffer are those between the 'bufL' and -- 'bufR' offsets. In an empty buffer, 'bufL' is equal to 'bufR', but --- they might not be zero: for exmaple, the buffer might correspond to +-- they might not be zero: for example, the buffer might correspond to -- a memory-mapped file and in which case 'bufL' will point to the -- next location to be written, which is not necessarily the beginning -- of the file. diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index f39e149..2c9d029 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -74,7 +74,7 @@ non-exhaustive pattern-match warnings (#8779) * Change the implementations of `maximumBy` and `minimumBy` from - `Data.Foldable` to use `fold11` instead of `foldr1`. This makes them run + `Data.Foldable` to use `foldl1` instead of `foldr1`. This makes them run in constant space when applied to lists. (#10830) ## 4.9.0.0 *May 2016* diff --git a/testsuite/tests/indexed-types/should_fail/T2239.hs b/testsuite/tests/indexed-types/should_fail/T2239.hs index 52a8296..0d675b1 100644 --- a/testsuite/tests/indexed-types/should_fail/T2239.hs +++ b/testsuite/tests/indexed-types/should_fail/T2239.hs @@ -51,7 +51,7 @@ complexFD = id :: (forall b. MyEq b Bool => b->b) complexTF = id :: (forall b. b~Bool => b->b) -> (forall c. c~Bool => c->c) -{- For exmaple, here is how the subsumption check works for complexTF +{- For example, here is how the subsumption check works for complexTF when type-checking the expression (id :: (forall b. b~Bool => b->b) -> (forall c. c~Bool => c->c)) diff --git a/testsuite/tests/typecheck/should_fail/tcfail179.hs b/testsuite/tests/typecheck/should_fail/tcfail179.hs index a270cbf..f2e026e 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail179.hs +++ b/testsuite/tests/typecheck/should_fail/tcfail179.hs @@ -1,6 +1,6 @@ {-# LANGUAGE ExistentialQuantification #-} --- Exmaples from Doaitse Swierestra and Brandon Moore +-- Examples from Doaitse Swierstra and Brandon Moore -- GHC users mailing list, April 07, title "Release plans" -- This one should fail, but Hugs passes it diff --git a/testsuite/tests/typecheck/should_run/T1735_Help/Basics.hs b/testsuite/tests/typecheck/should_run/T1735_Help/Basics.hs index 62dac43..83b147e 100644 --- a/testsuite/tests/typecheck/should_run/T1735_Help/Basics.hs +++ b/testsuite/tests/typecheck/should_run/T1735_Help/Basics.hs @@ -371,7 +371,7 @@ readConstr dt str = ------------------------------------------------------------------------------ -- --- Convenience funtions: algebraic data types +-- Convenience functions: algebraic data types -- ------------------------------------------------------------------------------ From git at git.haskell.org Tue Mar 7 10:54:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Mar 2017 10:54:11 +0000 (UTC) Subject: [commit: ghc] wip/T13351: Revise list fusion for and, or, all, any, elem, notElem (#13351) (9d15d5c) Message-ID: <20170307105411.1D12C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13351 Link : http://ghc.haskell.org/trac/ghc/changeset/9d15d5c64ad2215fd6d3102b57714b810b6f7b0b/ghc >--------------------------------------------------------------- commit 9d15d5c64ad2215fd6d3102b57714b810b6f7b0b Author: Joachim Breitner Date: Tue Feb 28 12:20:02 2017 -0800 Revise list fusion for and, or, all, any, elem, notElem (#13351) to make sure their list fusion is implemented in terms of foldr (and not build directly), with proper writing-back rules. This ensures that, for example, c `elem` "!@#$%^&*()" works without actual list code. Differential Revision: https://phabricator.haskell.org/D3246 >--------------------------------------------------------------- 9d15d5c64ad2215fd6d3102b57714b810b6f7b0b libraries/base/GHC/List.hs | 52 +++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/libraries/base/GHC/List.hs b/libraries/base/GHC/List.hs index 3eab407..7b6c059 100644 --- a/libraries/base/GHC/List.hs +++ b/libraries/base/GHC/List.hs @@ -730,9 +730,13 @@ and [] = True and (x:xs) = x && and xs {-# NOINLINE [1] and #-} +andFB :: Bool -> Bool -> Bool +andFB x r = x && r +{-# NOINLINE [0] andFB #-} + {-# RULES -"and/build" forall (g::forall b.(Bool->b->b)->b->b) . - and (build g) = g (&&) True +"and" [~1] forall xs. and xs = foldr andFB True xs +"andList" [1] foldr andFB True = and #-} #endif @@ -747,9 +751,13 @@ or [] = False or (x:xs) = x || or xs {-# NOINLINE [1] or #-} +orFB :: Bool -> Bool -> Bool +orFB x r = x || r +{-# NOINLINE [0] orFB #-} + {-# RULES -"or/build" forall (g::forall b.(Bool->b->b)->b->b) . - or (build g) = g (||) False +"or" [~1] forall xs. or xs = foldr orFB False xs +"orList" [1] foldr orFB False = or #-} #endif @@ -764,12 +772,15 @@ any p = or . map p #else any _ [] = False any p (x:xs) = p x || any p xs - {-# NOINLINE [1] any #-} +anyFB :: (t -> Bool) -> t -> Bool -> Bool +anyFB p x r = p x || r +{-# NOINLINE [0] anyFB #-} + {-# RULES -"any/build" forall p (g::forall b.(a->b->b)->b->b) . - any p (build g) = g ((||) . p) False +"any" [~1] forall p xs. any p xs = foldr (anyFB p) False xs +"anyList" [1] forall p. foldr (anyFB p) False = any p #-} #endif @@ -783,12 +794,15 @@ all p = and . map p #else all _ [] = True all p (x:xs) = p x && all p xs - {-# NOINLINE [1] all #-} +allFB :: (t -> Bool) -> t -> Bool -> Bool +allFB p x r = p x && r +{-# NOINLINE [0] allFB #-} + {-# RULES -"all/build" forall p (g::forall b.(a->b->b)->b->b) . - all p (build g) = g ((&&) . p) True +"all" [~1] forall p xs. all p xs = foldr (allFB p) True xs +"allList" [1] forall p. foldr (allFB p) True = all p #-} #endif @@ -803,9 +817,14 @@ elem x = any (== x) elem _ [] = False elem x (y:ys) = x==y || elem x ys {-# NOINLINE [1] elem #-} + +elemFB :: Eq a => a -> a -> Bool -> Bool +elemFB x y r = (x == y) || r +{-# NOINLINE [0] elemFB #-} + {-# RULES -"elem/build" forall x (g :: forall b . Eq a => (a -> b -> b) -> b -> b) - . elem x (build g) = g (\ y r -> (x == y) || r) False +"elem" [~1] forall x xs. elem x xs = foldr (elemFB x) False xs +"elemList" [1] forall x. foldr (elemFB x) False = elem x #-} #endif @@ -817,9 +836,14 @@ notElem x = all (/= x) notElem _ [] = True notElem x (y:ys)= x /= y && notElem x ys {-# NOINLINE [1] notElem #-} + +notElemFB :: Eq a => a -> a -> Bool -> Bool +notElemFB x y r = (x /= y) && r +{-# NOINLINE [0] notElemFB #-} + {-# RULES -"notElem/build" forall x (g :: forall b . Eq a => (a -> b -> b) -> b -> b) - . notElem x (build g) = g (\ y r -> (x /= y) && r) True +"notElem" [~1] forall x xs. notElem x xs = foldr (notElemFB x) False xs +"notElemList" [1] forall x. foldr (notElemFB x) True = notElem x #-} #endif From git at git.haskell.org Tue Mar 7 10:54:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Mar 2017 10:54:13 +0000 (UTC) Subject: [commit: ghc] wip/T13351: Add foldr fusion rules for short lists (0cdff0f) Message-ID: <20170307105413.CBC633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13351 Link : http://ghc.haskell.org/trac/ghc/changeset/0cdff0f15d122988ada2bdb427cf813aa38f4341/ghc >--------------------------------------------------------------- commit 0cdff0f15d122988ada2bdb427cf813aa38f4341 Author: Joachim Breitner Date: Tue Feb 28 12:20:02 2017 -0800 Add foldr fusion rules for short lists and make the comment there more useful. Differential Revision: https://phabricator.haskell.org/D3246 >--------------------------------------------------------------- 0cdff0f15d122988ada2bdb427cf813aa38f4341 libraries/base/GHC/Base.hs | 19 +++++++++++++------ testsuite/tests/simplCore/should_run/T2110.hs | 1 + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index 6f9d454..5f79b93 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -904,16 +904,23 @@ augment g xs = g (:) xs -- Only activate this from phase 1, because that's -- when we disable the rule that expands (++) into foldr +"foldr/nil" forall k z. foldr k z [] = z +"foldr/single" forall k z x. foldr k z [x] = k x z +"foldr/short2" forall k z x1 x2. foldr k z [x1,x2] = k x1 (k x2 z) +"foldr/short3" forall k z x1 x2 x3. foldr k z [x1,x2,x3] = k x1 (k x2 (k x3 z)) +"foldr/short4" forall k z x1 x2 x3 x4. foldr k z [x1,x2,x3,x4] = k x1 (k x2 (k x3 (k x4 z))) + +-- "foldr/cons" forall k z x xs. foldr k z (x:xs) = k x (foldr k z xs) -- The foldr/cons rule looks nice, but it can give disastrously -- bloated code when commpiling -- array (a,b) [(1,2), (2,2), (3,2), ...very long list... ] -- i.e. when there are very very long literal lists --- So I've disabled it for now. We could have special cases --- for short lists, I suppose. --- "foldr/cons" forall k z x xs. foldr k z (x:xs) = k x (foldr k z xs) - -"foldr/single" forall k z x. foldr k z [x] = k x z -"foldr/nil" forall k z. foldr k z [] = z +-- So we disabled it, but have special cases for short lists up +-- to a completely arbitrary limit of 4. +-- +-- Note that static lists that are explicitly entered as such in the source, +-- the compiler desugars them to build (if they are short), and then normal +-- foldr/build rule fires, see note [Desugaring explicit lists] in DsExpr "foldr/cons/build" forall k z x (g::forall b. (a->b->b) -> b -> b) . foldr k z (x:build g) = k x (g k z) diff --git a/testsuite/tests/simplCore/should_run/T2110.hs b/testsuite/tests/simplCore/should_run/T2110.hs index d945fac..3e9b316 100644 --- a/testsuite/tests/simplCore/should_run/T2110.hs +++ b/testsuite/tests/simplCore/should_run/T2110.hs @@ -21,6 +21,7 @@ same x y = case reallyUnsafePtrEquality# (unsafeCoerce x) y of main = do let l = [1,2,3] + {-# NOINLINE l #-} same (foo l) l same (fooAge l) l same (fooCoerce l) l From git at git.haskell.org Tue Mar 7 10:54:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Mar 2017 10:54:16 +0000 (UTC) Subject: [commit: ghc] wip/T13351's head updated: Add foldr fusion rules for short lists (0cdff0f) Message-ID: <20170307105416.8E7A23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T13351' now includes: 615ded1 Show: Add ShowS for ", " 0d2f733 Read COMPLETE sets from external packages ca538b8 testsuite: Fix output due to recent COMPLETE changes c02896a Revert "Read COMPLETE sets from external packages" 61e760b Update test completesig04 9808ebc testsuite: Bump down allocations for T12707 fa360ea testsuite: Add comment clarifying intention of completesig04 a694cee TcTypeable: Try to reuse KindReps c1dacb8 Produce KindReps for common kinds in GHC.Types 10d28d0 testsuite: Add test for floating-point abs (numrun015) 6446254 Deserialize IfaceId more lazily 5ed56fc Comments only, in CSE (#13340) d5e0b4b Allow iOS to load archives through the linker 0ce11ae Add test to ensure that SPEC rules are named deterministically 96f5656 testsuite: Bump down allocations of T4029 2f8534b testsuite: Add a NaN case to numrun015 a86e68c Fix a tiny typo 0fd8340 testsuite: Fix double test of +Infinity 2e58c3b Update dangling Note reference e901ed1 configure: Don't pass GHC's sanitized triple to libraries' configure 5e5f8c8 testsuite: Add expected output for T8848 31b3d0c testsuite: Bump down allocations for T4029 2e43848 Fixes a spaceleak in `maximumBy` and `minimumBy` (#10830). 35ca135 Reexport CmpNat and friends (defined in GHC.TypeNats) from GHC.TypeLits 669333d Drop HAVE_containers_050 from bootstrap flags 9304df5 Fix CSE (again) on literal strings 9b2c73e Make TH_Roles2 less fragile 1163f4f Tiny refactor 995ab74 Comments only fb9ae28 Make FloatOut/SetLevels idemoptent on bottoming functions 749740f Typos in comments and manual 29b6845 Add SplitSections = NO to build flavors with SplitObjs = NO c02d03d Add -dno-debug-output to validate GhcStage1HcOpts 8ca4bb1 Read COMPLETE sets from external packages 016b10c Add GCC bin folder to search path. 3fdabe9 Changed OverLit warnings to work with negative literals (#13257) f57bd2a add example documentation for tuple Applicative 6177c0d Disallow unboxed string literals in patterns (#13260) 1831208 base: Kill out-of-date Notes 494907f testsuite: Add test for #11076 cd9c709 Update .mailmap [skip ci] 2f115a1 A few remarks on role subtyping in the manual. 2fa4421 Add rule mapFB c (λx.x) = c 1686f30 Mangle .subsections_via_symbols away. d91b104 primops: Add comment describing type of atomicModifyMutVar# 5dddf35 testsuite: Disable linkwhole test on Windows 99fe579 Typos in changelog and comments 9d15d5c Revise list fusion for and, or, all, any, elem, notElem (#13351) 0cdff0f Add foldr fusion rules for short lists From git at git.haskell.org Tue Mar 7 18:32:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Mar 2017 18:32:48 +0000 (UTC) Subject: [commit: ghc] master: Generate better fp abs for X86 and llvm with default cmm otherwise (12ccf76) Message-ID: <20170307183248.A2C323A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/12ccf767af3373e319b75d5d61fe79df4a389e45/ghc >--------------------------------------------------------------- commit 12ccf767af3373e319b75d5d61fe79df4a389e45 Author: Dominic Steinitz Date: Tue Mar 7 09:26:16 2017 -0500 Generate better fp abs for X86 and llvm with default cmm otherwise Currently we have this in libraries/base/GHC/Float.hs: ``` abs x | x == 0 = 0 -- handles (-0.0) | x > 0 = x | otherwise = negateFloat x ``` But 3-4 years ago it was noted that this was inefficient: https://mail.haskell.org/pipermail/libraries/2013-April/019690.html We can generate better code for X86 and llvm and for others generate some custom cmm code which is similar to what the compiler generates now. Reviewers: austin, simonmar, hvr, bgamari Reviewed By: bgamari Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3265 >--------------------------------------------------------------- 12ccf767af3373e319b75d5d61fe79df4a389e45 compiler/cmm/CmmMachOp.hs | 2 ++ compiler/cmm/PprC.hs | 2 ++ compiler/codeGen/StgCmmPrim.hs | 34 ++++++++++++++++++++++++++ compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 2 ++ compiler/nativeGen/PPC/CodeGen.hs | 2 ++ compiler/nativeGen/SPARC/CodeGen.hs | 2 ++ compiler/nativeGen/X86/CodeGen.hs | 42 +++++++++++++++++++++++++++++---- compiler/nativeGen/X86/Ppr.hs | 2 ++ compiler/prelude/primops.txt.pp | 4 ++++ libraries/base/GHC/Float.hs | 14 +++++------ 10 files changed, 94 insertions(+), 12 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 12ccf767af3373e319b75d5d61fe79df4a389e45 From git at git.haskell.org Tue Mar 7 18:32:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Mar 2017 18:32:51 +0000 (UTC) Subject: [commit: ghc] master: ghc-pkg: Consider .conf files when computing package db mtime (30d69f4) Message-ID: <20170307183251.65A763A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/30d69f404ba102da94423836f86fbec2fb4adaf9/ghc >--------------------------------------------------------------- commit 30d69f404ba102da94423836f86fbec2fb4adaf9 Author: Andrzej Rybczak Date: Tue Mar 7 09:55:02 2017 -0500 ghc-pkg: Consider .conf files when computing package db mtime We can no longer use the mtime of the containing directory since it now contains a lock file in addition to the .cache and .conf files. Fixes #13375. Test Plan: Validate on Windows Reviewers: austin, arybczak Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3289 >--------------------------------------------------------------- 30d69f404ba102da94423836f86fbec2fb4adaf9 utils/ghc-pkg/Main.hs | 85 +++++++++++++-------------------------------------- 1 file changed, 21 insertions(+), 64 deletions(-) diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index c5ecbf2..ed73c29 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -832,14 +832,15 @@ readParseDatabase verbosity mb_user_conf mode use_cache path Right fs | not use_cache -> ignore_cache (const $ return ()) | otherwise -> do - tdir <- getModificationTime path e_tcache <- tryIO $ getModificationTime cache case e_tcache of Left ex -> do whenReportCacheErrors $ if isDoesNotExistError ex then - when (verbosity >= Verbose) $ do + -- It's fine if the cache is not there as long as the + -- database is empty. + when (not $ null confs) $ do warn ("WARNING: cache does not exist: " ++ cache) warn ("ghc will fail to read this package db. " ++ recacheAdvice) @@ -848,21 +849,13 @@ readParseDatabase verbosity mb_user_conf mode use_cache path warn "ghc will fail to read this package db." ignore_cache (const $ return ()) Right tcache -> do - let compareTimestampToCache file = - when (verbosity >= Verbose) $ do - tFile <- getModificationTime file - compareTimestampToCache' file tFile - compareTimestampToCache' file tFile = do - let rel = case tcache `compare` tFile of - LT -> " (NEWER than cache)" - GT -> " (older than cache)" - EQ -> " (same as cache)" - warn ("Timestamp " ++ show tFile - ++ " for " ++ file ++ rel) when (verbosity >= Verbose) $ do warn ("Timestamp " ++ show tcache ++ " for " ++ cache) - compareTimestampToCache' path tdir - if tcache >= tdir + -- If any of the .conf files is newer than package.cache, we + -- assume that cache is out of date. + cache_outdated <- (`anyM` confs) $ \conf -> + (tcache <) <$> getModificationTime conf + if not cache_outdated then do when (verbosity > Normal) $ infoLn ("using cache: " ++ cache) @@ -873,18 +866,27 @@ readParseDatabase verbosity mb_user_conf mode use_cache path warn ("WARNING: cache is out of date: " ++ cache) warn ("ghc will see an old view of this " ++ "package db. " ++ recacheAdvice) - ignore_cache compareTimestampToCache + ignore_cache $ \file -> do + when (verbosity >= Verbose) $ do + tFile <- getModificationTime file + let rel = case tcache `compare` tFile of + LT -> " (NEWER than cache)" + GT -> " (older than cache)" + EQ -> " (same as cache)" + warn ("Timestamp " ++ show tFile + ++ " for " ++ file ++ rel) where + confs = map (path ) $ filter (".conf" `isSuffixOf`) fs + ignore_cache :: (FilePath -> IO ()) -> IO (PackageDB mode) ignore_cache checkTime = do -- If we're opening for modification, we need to acquire a -- lock even if we don't open the cache now, because we are -- going to modify it later. lock <- F.mapM (const $ GhcPkg.lockPackageDb cache) mode - let confs = filter (".conf" `isSuffixOf`) fs - doFile f = do checkTime f + let doFile f = do checkTime f parseSingletonPackageConf verbosity f - pkgs <- mapM doFile $ map (path ) confs + pkgs <- mapM doFile confs mkPackageDB pkgs lock -- We normally report cache errors for read-only commands, @@ -1215,16 +1217,6 @@ updateDBCache verbosity db = do then die $ filename ++ ": you don't have permission to modify this file" else ioError e - -- See Note [writeAtomic leaky abstraction] - -- Cross-platform "touch". This only works if filename is not empty, and - -- not open for writing already. - -- TODO. When the Win32 or directory packages have either a touchFile or a - -- setModificationTime function, use one of those. - withBinaryFile filename ReadWriteMode $ \handle -> do - c <- hGetChar handle - hSeek handle AbsoluteSeek 0 - hPutChar handle c - case packageDbLock db of GhcPkg.DbOpenReadWrite lock -> GhcPkg.unlockPackageDb lock @@ -2180,38 +2172,3 @@ removeFileSafe fn = -- absolute path. absolutePath :: FilePath -> IO FilePath absolutePath path = return . normalise . ( path) =<< getCurrentDirectory - - -{- Note [writeAtomic leaky abstraction] -GhcPkg.writePackageDb calls writeAtomic, which first writes to a temp file, -and then moves the tempfile to its final destination. This all happens in the -same directory (package.conf.d). -Moving a file doesn't change its modification time, but it *does* change the -modification time of the directory it is placed in. Since we compare the -modification time of the cache file to that of the directory it is in to -decide whether the cache is out-of-date, it will be instantly out-of-date -after creation, if the renaming takes longer than the smallest time difference -that the getModificationTime can measure. - -The solution we opt for is a "touch" of the cache file right after it is -created. This resets the modification time of the cache file and the directory -to the current time. - -Other possible solutions: - * backdate the modification time of the directory to the modification time - of the cachefile. This is what we used to do on posix platforms. An - observer of the directory would see the modification time of the directory - jump back in time. Not nice, although in practice probably not a problem. - Also note that a cross-platform implementation of setModificationTime is - currently not available. - * set the modification time of the cache file to the modification time of - the directory (instead of the curent time). This could also work, - given that we are the only ones writing to this directory. It would also - require a high-precision getModificationTime (lower precision times get - rounded down it seems), or the cache would still be out-of-date. - * change writeAtomic to create the tempfile outside of the target file's - directory. - * create the cachefile outside of the package.conf.d directory in the first - place. But there are tests and there might be tools that currently rely on - the package.conf.d/package.cache format. --} From git at git.haskell.org Tue Mar 7 18:32:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Mar 2017 18:32:54 +0000 (UTC) Subject: [commit: ghc] master: Fix comment (48759c0) Message-ID: <20170307183254.27B303A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/48759c0ef0e7ce718b52557599ebbb884c19a2ad/ghc >--------------------------------------------------------------- commit 48759c0ef0e7ce718b52557599ebbb884c19a2ad Author: Ben Gamari Date: Mon Mar 6 22:43:39 2017 -0500 Fix comment >--------------------------------------------------------------- 48759c0ef0e7ce718b52557599ebbb884c19a2ad libraries/base/GHC/IO.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/base/GHC/IO.hs b/libraries/base/GHC/IO.hs index 62b3d5c..8459db6 100644 --- a/libraries/base/GHC/IO.hs +++ b/libraries/base/GHC/IO.hs @@ -182,7 +182,7 @@ catch (IO io) handler = IO $ catch# io handler' -- | Catch any 'Exception' type in the 'IO' monad. -- -- Note that this function is /strict/ in the action. That is, --- @catchException undefined b == _|_ at . See #exceptions_and_strictness# for +-- @catchAny undefined b == _|_ at . See #exceptions_and_strictness# for -- details. catchAny :: IO a -> (forall e . Exception e => e -> IO a) -> IO a catchAny !(IO io) handler = IO $ catch# io handler' From git at git.haskell.org Tue Mar 7 18:32:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Mar 2017 18:32:56 +0000 (UTC) Subject: [commit: ghc] master: base: kevent.filter is signed (ecb880c) Message-ID: <20170307183256.D72673A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ecb880caea441b6dd7f75a555546e55abe11c233/ghc >--------------------------------------------------------------- commit ecb880caea441b6dd7f75a555546e55abe11c233 Author: Ben Gamari Date: Tue Mar 7 09:31:42 2017 -0500 base: kevent.filter is signed I checked both the FreeBSD and Darwin manpages; it's signed in both cases. This was producing validation failures on OS X due to the new literal range-check. >--------------------------------------------------------------- ecb880caea441b6dd7f75a555546e55abe11c233 libraries/base/GHC/Event/KQueue.hsc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/base/GHC/Event/KQueue.hsc b/libraries/base/GHC/Event/KQueue.hsc index d6461c2..0d5350e 100644 --- a/libraries/base/GHC/Event/KQueue.hsc +++ b/libraries/base/GHC/Event/KQueue.hsc @@ -186,10 +186,10 @@ newtype Flag = Flag Word16 , flagOneshot = EV_ONESHOT } -#if SIZEOF_KEV_FILTER == 4 /*kevent.filter: uint32_t or uint16_t. */ -newtype Filter = Filter Word32 +#if SIZEOF_KEV_FILTER == 4 /*kevent.filter: int32_t or int16_t. */ +newtype Filter = Filter Int32 #else -newtype Filter = Filter Word16 +newtype Filter = Filter Int16 #endif deriving (Bits, FiniteBits, Eq, Num, Show, Storable) From git at git.haskell.org Tue Mar 7 20:07:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Mar 2017 20:07:02 +0000 (UTC) Subject: [commit: ghc] master: DsMonad: Collect DPH things (6297996) Message-ID: <20170307200702.9029C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/629799627f7b47c07ead984bad7f45f2a9c6d351/ghc >--------------------------------------------------------------- commit 629799627f7b47c07ead984bad7f45f2a9c6d351 Author: Ben Gamari Date: Tue Mar 7 14:28:30 2017 -0500 DsMonad: Collect DPH things This is just a bit of reorganization, pulling out the DPH things into a separate section of the file. Test Plan: Validate Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3274 >--------------------------------------------------------------- 629799627f7b47c07ead984bad7f45f2a9c6d351 compiler/deSugar/DsMonad.hs | 289 +++++++++++++++++++++++--------------------- 1 file changed, 152 insertions(+), 137 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 629799627f7b47c07ead984bad7f45f2a9c6d351 From git at git.haskell.org Tue Mar 7 20:07:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Mar 2017 20:07:05 +0000 (UTC) Subject: [commit: ghc] master: Desugar: Refactor initDs (4bd2232) Message-ID: <20170307200705.65FAB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4bd2232754f2c0b365177d177e6d749c64e73176/ghc >--------------------------------------------------------------- commit 4bd2232754f2c0b365177d177e6d749c64e73176 Author: Ben Gamari Date: Tue Mar 7 14:30:38 2017 -0500 Desugar: Refactor initDs As far as I can tell we were unnecessarily building a new TcgEnv when we already had one on hand. TcRnMonad now sports an initTcWithGbl function, which allows us to run a TcM monad in the context of this TcgEnv. This appears to simplify things nicely. Test Plan: Validate Reviewers: austin Subscribers: dfeuer, simonpj, thomie Differential Revision: https://phabricator.haskell.org/D3228 >--------------------------------------------------------------- 4bd2232754f2c0b365177d177e6d749c64e73176 compiler/deSugar/Desugar.hs | 6 +- compiler/deSugar/DsMonad.hs | 123 ++++++++++++++++++++-------------- compiler/typecheck/TcRnMonad.hs | 51 ++++++++------ compiler/vectorise/Vectorise/Monad.hs | 13 ++-- 4 files changed, 110 insertions(+), 83 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 4bd2232754f2c0b365177d177e6d749c64e73176 From git at git.haskell.org Wed Mar 8 04:53:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Mar 2017 04:53:49 +0000 (UTC) Subject: [commit: packages/haskeline] master: Release 0.7.3.1. (f2cf8b5) Message-ID: <20170308045349.2EC813A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/f2cf8b508d07c78319490d1765b2cb19b367b95c >--------------------------------------------------------------- commit f2cf8b508d07c78319490d1765b2cb19b367b95c Author: Judah Jacobson Date: Sat Feb 4 13:52:53 2017 -0800 Release 0.7.3.1. >--------------------------------------------------------------- f2cf8b508d07c78319490d1765b2cb19b367b95c Changelog | 3 +++ haskeline.cabal | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 137d83a..87dab99 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,6 @@ +Changed in version 0.7.3.1: + * Properly disable echoing in getPassword when running in MinTTY. + * Use `cast` from Data.Typeable instead of Data.Dynamic. Changed in version 0.7.3.0: * Require ghc version of at least 7.4.1, and clean up obsolete code * Add thread-safe (in terminal-style interaction) external print function diff --git a/haskeline.cabal b/haskeline.cabal index 17ef5cc..8529ad5 100644 --- a/haskeline.cabal +++ b/haskeline.cabal @@ -1,6 +1,6 @@ Name: haskeline Cabal-Version: >=1.10 -Version: 0.7.3.0 +Version: 0.7.3.1 Category: User Interfaces License: BSD3 License-File: LICENSE From git at git.haskell.org Wed Mar 8 04:53:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Mar 2017 04:53:51 +0000 (UTC) Subject: [commit: packages/haskeline] master: Properly process Unicode key events on Windows (#55) (18a978c) Message-ID: <20170308045351.351333A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/18a978ce7138eec9bbe6d93e5e241f135f76e2e0 >--------------------------------------------------------------- commit 18a978ce7138eec9bbe6d93e5e241f135f76e2e0 Author: Ryan Scott Date: Fri Feb 17 18:08:10 2017 -0500 Properly process Unicode key events on Windows (#55) Fixes #54. >--------------------------------------------------------------- 18a978ce7138eec9bbe6d93e5e241f135f76e2e0 Changelog | 2 ++ System/Console/Haskeline/Backend/Win32.hsc | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 87dab99..388e339 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,5 @@ +next: + * Properly process Unicode key events on Windows. Changed in version 0.7.3.1: * Properly disable echoing in getPassword when running in MinTTY. * Use `cast` from Data.Typeable instead of Data.Dynamic. diff --git a/System/Console/Haskeline/Backend/Win32.hsc b/System/Console/Haskeline/Backend/Win32.hsc index 9471354..b15a827 100644 --- a/System/Console/Haskeline/Backend/Win32.hsc +++ b/System/Console/Haskeline/Backend/Win32.hsc @@ -73,8 +73,12 @@ consoleHandles = do processEvent :: InputEvent -> Maybe Event -processEvent KeyEvent {keyDown = True, unicodeChar = c, virtualKeyCode = vc, +processEvent KeyEvent {keyDown = kd, unicodeChar = c, virtualKeyCode = vc, controlKeyState = cstate} + | kd || ((testMod (#const LEFT_ALT_PRESSED) || vc == (#const VK_MENU)) + && c /= '\NUL') + -- Make sure not to ignore Unicode key events! The Unicode character might + -- only be emitted on a keyup event. See also GH issue #54. = fmap (\e -> KeyInput [Key modifier' e]) $ keyFromCode vc `mplus` simpleKeyChar where simpleKeyChar = guard (c /= '\NUL') >> return (KeyChar c) From git at git.haskell.org Wed Mar 8 04:53:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Mar 2017 04:53:53 +0000 (UTC) Subject: [commit: packages/haskeline] master: Bump upper bound on process (07db990) Message-ID: <20170308045353.3AA463A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/07db99022253b72642f884f4caeee4ac122ba70f >--------------------------------------------------------------- commit 07db99022253b72642f884f4caeee4ac122ba70f Author: Ben Gamari Date: Tue Feb 21 11:11:00 2017 -0500 Bump upper bound on process >--------------------------------------------------------------- 07db99022253b72642f884f4caeee4ac122ba70f haskeline.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haskeline.cabal b/haskeline.cabal index 17ef5cc..217fecb 100644 --- a/haskeline.cabal +++ b/haskeline.cabal @@ -45,7 +45,7 @@ Library Build-depends: base >=4.5 && < 4.11, containers>=0.4 && < 0.6, directory>=1.1 && < 1.4, bytestring>=0.9 && < 0.11, filepath >= 1.2 && < 1.5, transformers >= 0.2 && < 0.6, - process >= 1.0 && < 1.5 + process >= 1.0 && < 1.7 Default-Language: Haskell98 Default-Extensions: ForeignFunctionInterface, Rank2Types, FlexibleInstances, From git at git.haskell.org Wed Mar 8 04:53:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Mar 2017 04:53:57 +0000 (UTC) Subject: [commit: packages/haskeline] master: Use 0xffffffff in place of -1 to MessageBeep (fd5116c) Message-ID: <20170308045357.48E3C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/fd5116c81031da68ec23dfb09a06a46bc006e1d7 >--------------------------------------------------------------- commit fd5116c81031da68ec23dfb09a06a46bc006e1d7 Author: Ben Gamari Date: Tue Mar 7 12:04:34 2017 -0500 Use 0xffffffff in place of -1 to MessageBeep MessageBeep expects an unsigned argument, leading to a literal-out-of-range error previously. >--------------------------------------------------------------- fd5116c81031da68ec23dfb09a06a46bc006e1d7 System/Console/Haskeline/Backend/Win32.hsc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/System/Console/Haskeline/Backend/Win32.hsc b/System/Console/Haskeline/Backend/Win32.hsc index 9471354..01552be 100644 --- a/System/Console/Haskeline/Backend/Win32.hsc +++ b/System/Console/Haskeline/Backend/Win32.hsc @@ -226,7 +226,8 @@ writeConsole h str = writeConsole' >> writeConsole h ys foreign import WINDOWS_CCONV "windows.h MessageBeep" c_messageBeep :: UINT -> IO Bool messageBeep :: IO () -messageBeep = c_messageBeep (-1) >> return ()-- intentionally ignore failures. +messageBeep = c_messageBeep simpleBeep >> return ()-- intentionally ignore failures. + where simpleBeep = 0xffffffff ---------- From git at git.haskell.org Wed Mar 8 04:53:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Mar 2017 04:53:59 +0000 (UTC) Subject: [commit: packages/haskeline] master: Merge pull request #58 from bgamari/master (91f6afd) Message-ID: <20170308045359.4E8DE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/91f6afd971fde46423237bfa5215e95365017f99 >--------------------------------------------------------------- commit 91f6afd971fde46423237bfa5215e95365017f99 Merge: 5ec0c46 fd5116c Author: Judah Jacobson Date: Tue Mar 7 13:38:06 2017 -0800 Merge pull request #58 from bgamari/master Use 0xffffffff in place of -1 to MessageBeep >--------------------------------------------------------------- 91f6afd971fde46423237bfa5215e95365017f99 System/Console/Haskeline/Backend/Win32.hsc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) From git at git.haskell.org Wed Mar 8 04:53:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Mar 2017 04:53:55 +0000 (UTC) Subject: [commit: packages/haskeline] master: Merge pull request #56 from bgamari/master (5ec0c46) Message-ID: <20170308045355.401D23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/5ec0c46c09b009daec1578e4cd9b3bb2dd43efb1 >--------------------------------------------------------------- commit 5ec0c46c09b009daec1578e4cd9b3bb2dd43efb1 Merge: 18a978c 07db990 Author: Judah Jacobson Date: Tue Feb 21 10:15:47 2017 -0800 Merge pull request #56 from bgamari/master Bump upper bound on process >--------------------------------------------------------------- 5ec0c46c09b009daec1578e4cd9b3bb2dd43efb1 haskeline.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Wed Mar 8 08:18:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Mar 2017 08:18:55 +0000 (UTC) Subject: [commit: ghc] master: Win32: bump submodule to v2.5.2.0 (bd66817) Message-ID: <20170308081855.B3AE93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bd6681713a603bcdcf2fde9aab85b17183eefb0b/ghc >--------------------------------------------------------------- commit bd6681713a603bcdcf2fde9aab85b17183eefb0b Author: Tamar Christina Date: Tue Mar 7 22:21:00 2017 +0000 Win32: bump submodule to v2.5.2.0 Summary: This fixes the Windows build after the latest -Werror patches landed. Test Plan: ./validate Reviewers: austin, bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3293 >--------------------------------------------------------------- bd6681713a603bcdcf2fde9aab85b17183eefb0b libraries/Win32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Win32 b/libraries/Win32 index a410b4e..06d5849 160000 --- a/libraries/Win32 +++ b/libraries/Win32 @@ -1 +1 @@ -Subproject commit a410b4e8276d118273d3205dc58fdc632803a71a +Subproject commit 06d584916a4c32e6d31b60499afd52e32e4281ef From git at git.haskell.org Wed Mar 8 11:04:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Mar 2017 11:04:25 +0000 (UTC) Subject: [commit: ghc] master: Join points can be levity-polymorphic (8e05370) Message-ID: <20170308110425.D0CB33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8e053700f9357c1b9030c406130062795ae5015c/ghc >--------------------------------------------------------------- commit 8e053700f9357c1b9030c406130062795ae5015c Author: Simon Peyton Jones Date: Wed Mar 8 09:39:29 2017 +0000 Join points can be levity-polymorphic It's ok to have a levity-polymorphic join point, thus let j :: r :: TYPE l = blah in ... Usually we don't allow levity-polymorphic binders, but join points are different because they are not first class. I updated the invariants in CoreSyn. This commit fixes Trac #13394. >--------------------------------------------------------------- 8e053700f9357c1b9030c406130062795ae5015c compiler/coreSyn/CoreLint.hs | 29 +++++++++++++++++------------ compiler/coreSyn/CoreSyn.hs | 18 +++++++++++++++++- compiler/coreSyn/CoreUnfold.hs | 2 +- testsuite/tests/polykinds/T13394.hs | 15 +++++++++++++++ testsuite/tests/polykinds/all.T | 1 + 5 files changed, 51 insertions(+), 14 deletions(-) diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index aed9382..93fcbe4 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -506,13 +506,20 @@ lintSingleBinding top_lvl_flag rec_flag (binder,rhs) ; binder_ty <- applySubstTy (idType binder) ; ensureEqTys binder_ty ty (mkRhsMsg binder (text "RHS") ty) + -- Check that it's not levity-polymorphic + -- Do this first, because otherwise isUnliftedType panics + -- Annoyingly, this duplicates the test in lintIdBdr, + -- because for non-rec lets we call lintSingleBinding first + ; checkL (isJoinId binder || not (isTypeLevPoly binder_ty)) + (badBndrTyMsg binder (text "levity-polymorphic")) + -- Check the let/app invariant -- See Note [CoreSyn let/app invariant] in CoreSyn - ; checkL (not (isUnliftedType binder_ty) - || isJoinId binder - || (isNonRec rec_flag && exprOkForSpeculation rhs) - || exprIsLiteralString rhs) - (mkRhsPrimMsg binder rhs) + ; checkL ( isJoinId binder + || not (isUnliftedType binder_ty) + || (isNonRec rec_flag && exprOkForSpeculation rhs) + || exprIsLiteralString rhs) + (badBndrTyMsg binder (text "unlifted")) -- Check that if the binder is top-level or recursive, it's not -- demanded. Primitive string literals are exempt as there is no @@ -1208,7 +1215,7 @@ lintIdBndr top_lvl bind_site id linterF ; (ty, k) <- lintInTy (idType id) -- See Note [Levity polymorphism invariants] in CoreSyn - ; lintL (not (isKindLevPoly k)) + ; lintL (isJoinId id || not (isKindLevPoly k)) (text "Levity-polymorphic binder:" <+> (ppr id <+> dcolon <+> parens (ppr ty <+> dcolon <+> ppr k))) @@ -2263,12 +2270,10 @@ mkLetAppMsg e = hang (text "This argument does not satisfy the let/app invariant:") 2 (ppr e) -mkRhsPrimMsg :: Id -> CoreExpr -> MsgDoc -mkRhsPrimMsg binder _rhs - = vcat [hsep [text "The type of this binder is primitive:", - ppr binder], - hsep [text "Binder's type:", ppr (idType binder)] - ] +badBndrTyMsg :: Id -> SDoc -> MsgDoc +badBndrTyMsg binder what + = vcat [ text "The type of this binder is" <+> what <> colon <+> ppr binder + , text "Binder's type:" <+> ppr (idType binder) ] mkStrictMsg :: Id -> MsgDoc mkStrictMsg binder diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 31fbd12..385ea4e 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -444,7 +444,10 @@ Note [Levity polymorphism invariants] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The levity-polymorphism invariants are these: -* The type of a term-binder must not be levity-polymorphic +* The type of a term-binder must not be levity-polymorphic, + unless it is a let(rec)-bound join point + (see Note [Invariants on join points]) + * The type of the argument of an App must not be levity-polymorphic. A type (t::TYPE r) is "levity polymorphic" if 'r' has any free variables. @@ -570,12 +573,25 @@ Join points must follow these invariants: 1. All occurrences must be tail calls. Each of these tail calls must pass the same number of arguments, counting both types and values; we call this the "join arity" (to distinguish from regular arity, which only counts values). + 2. For join arity n, the right-hand side must begin with at least n lambdas. + 3. If the binding is recursive, then all other bindings in the recursive group must also be join points. + 4. The binding's type must not be polymorphic in its return type (as defined in Note [The polymorphism rule of join points]). +However, join points have simpler invariants in other ways + + 5. A join point can have an unboxed type without the RHS being + ok-for-speculation (i.e. drop the let/app invariant) + e.g. let j :: Int# = factorial x in ... + + 6. A join point can have a levity-polymorphic RHS + e.g. let j :: r :: TYPE l = fail void# in ... + This happened in an intermediate program Trac #13394 + Examples: join j1 x = 1 + x in jump j (jump j x) -- Fails 1: non-tail call diff --git a/compiler/coreSyn/CoreUnfold.hs b/compiler/coreSyn/CoreUnfold.hs index 3a46d58..0e3efbf 100644 --- a/compiler/coreSyn/CoreUnfold.hs +++ b/compiler/coreSyn/CoreUnfold.hs @@ -657,8 +657,8 @@ sizeExpr dflags bOMB_OUT_SIZE top_args expr -- Cost to allocate binding with given binder size_up_alloc bndr | isTyVar bndr -- Doesn't exist at runtime - || isUnliftedType (idType bndr) -- Doesn't live in heap || isJoinId bndr -- Not allocated at all + || isUnliftedType (idType bndr) -- Doesn't live in heap = 0 | otherwise = 10 diff --git a/testsuite/tests/polykinds/T13394.hs b/testsuite/tests/polykinds/T13394.hs new file mode 100644 index 0000000..88c482a --- /dev/null +++ b/testsuite/tests/polykinds/T13394.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE PatternSynonyms #-} +module T13394 where + +import Data.ByteString + +newtype ProperName = + ProperName { runProperName :: ByteString + -- purescript actually uses the Text type, but this works + -- just as well for the purposes of illustrating the bug + } +newtype ModuleName = ModuleName [ProperName] + +pattern TypeDataSymbol :: ModuleName +pattern TypeDataSymbol = ModuleName [ProperName "Type"] diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index 270aea3..8dd27b0 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -155,3 +155,4 @@ test('T12718', normal, compile, ['']) test('T12444', normal, compile_fail, ['']) test('T12885', normal, compile, ['']) test('T13267', normal, compile_fail, ['']) +test('T13394', normal, compile, ['']) From git at git.haskell.org Wed Mar 8 11:08:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Mar 2017 11:08:33 +0000 (UTC) Subject: [commit: ghc] branch 'wip/spj-T13397' created Message-ID: <20170308110833.621113A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/spj-T13397 Referencing: 43540c8c6b9e914f302c71213a71ab5c780be2ac From git at git.haskell.org Wed Mar 8 11:08:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Mar 2017 11:08:41 +0000 (UTC) Subject: [commit: ghc] wip/spj-T13397: Improve code generation for conditionals (43540c8) Message-ID: <20170308110841.AA39C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-T13397 Link : http://ghc.haskell.org/trac/ghc/changeset/43540c8c6b9e914f302c71213a71ab5c780be2ac/ghc >--------------------------------------------------------------- commit 43540c8c6b9e914f302c71213a71ab5c780be2ac Author: Simon Peyton Jones Date: Wed Mar 8 11:05:53 2017 +0000 Improve code generation for conditionals This patch in in preparation for the fix to Trac #13397 The code generator has a special case for case tagToEnum (a>#b) of False -> e1 True -> e2 but it was not doing nearly so well on case a>#b of DEFAULT -> e1 1# -> e2 This patch arranges to behave essentially identically in both cases. In due course we can eliminate the special case for tagToEnum#, once we've completed Trac #13397. The changes are: * Make CmmSink swizzle the order of a conditional where necessary; see Note [Improving conditionals] in CmmSink * Hack the general case of StgCmmExpr.cgCase so that it use NoGcInAlts for conditionals. This doesn't seem right, but it's the same choice as the tagToEnum version. Without it, code size increases a lot (more heap checks). There's a loose end here. * Add comments in CmmOpt.cmmMachOpFoldM >--------------------------------------------------------------- 43540c8c6b9e914f302c71213a71ab5c780be2ac compiler/cmm/CmmOpt.hs | 83 +++++++++++++++++++++++++++------------ compiler/cmm/CmmSink.hs | 39 +++++++++++++++--- compiler/codeGen/StgCmmClosure.hs | 2 +- compiler/codeGen/StgCmmExpr.hs | 28 +++++++++++-- compiler/prelude/PrimOp.hs | 7 +++- 5 files changed, 121 insertions(+), 38 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 43540c8c6b9e914f302c71213a71ab5c780be2ac From git at git.haskell.org Wed Mar 8 11:08:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Mar 2017 11:08:38 +0000 (UTC) Subject: [commit: ghc] wip/spj-T13397: Re-engineer caseRules to add tagToEnum/dataToTag (e49f315) Message-ID: <20170308110838.E5FB53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-T13397 Link : http://ghc.haskell.org/trac/ghc/changeset/e49f3154a5ceb1894414f4635579aeb3aa84054f/ghc >--------------------------------------------------------------- commit e49f3154a5ceb1894414f4635579aeb3aa84054f Author: Simon Peyton Jones Date: Wed Mar 8 10:26:47 2017 +0000 Re-engineer caseRules to add tagToEnum/dataToTag See Note [Scrutinee Constant Folding] in SimplUtils * Add cases for tagToEnum and dataToTag. This is the main new bit. It allows the simplifier to remove the pervasive uses of case tagToEnum (a > b) of False -> e1 True -> e2 and replace it by the simpler case a > b of DEFAULT -> e1 1# -> e2 See Note [caseRules for tagToEnum] and Note [caseRules for dataToTag] in PrelRules. * This required some changes to the API of caseRules, and hence to code in SimplUtils. See Note [Scrutinee Constant Folding] in SimplUtils. * Avoid duplication of work in the (unusual) case of case BIG + 3# of b DEFAULT -> e1 6# -> e2 Previously we got case BIG of DEFAULT -> let b = BIG + 3# in e1 3# -> let b = 6# in e2 Now we get case BIG of b# DEFAULT -> let b = b' + 3# in e1 3# -> let b = 6# in e2 * Avoid duplicated code in caseRules A knock-on refactoring: * Move Note [Word/Int underflow/overflow] to Literal, as documentation to accompany mkMachIntWrap etc; and get rid of PrelRuls.intResult' in favour of mkMachIntWrap >--------------------------------------------------------------- e49f3154a5ceb1894414f4635579aeb3aa84054f compiler/basicTypes/Literal.hs | 21 ++ compiler/coreSyn/CoreSyn.hs | 2 + compiler/prelude/PrelRules.hs | 231 +++++++++++++-------- compiler/simplCore/SimplUtils.hs | 177 +++++++++++----- .../tests/simplCore/should_compile/T3772.stdout | 10 +- .../tests/simplCore/should_compile/T4930.stderr | 30 +-- .../simplCore/should_compile/spec-inline.stderr | 152 +++++++------- 7 files changed, 391 insertions(+), 232 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 e49f3154a5ceb1894414f4635579aeb3aa84054f From git at git.haskell.org Wed Mar 8 11:08:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Mar 2017 11:08:36 +0000 (UTC) Subject: [commit: ghc] wip/spj-T13397: Move dataConTagZ to DataCon (cdfa1ec) Message-ID: <20170308110836.2BA713A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-T13397 Link : http://ghc.haskell.org/trac/ghc/changeset/cdfa1ec6a24e882a0a78400497766e0c147e7c59/ghc >--------------------------------------------------------------- commit cdfa1ec6a24e882a0a78400497766e0c147e7c59 Author: Simon Peyton Jones Date: Tue Mar 7 13:28:34 2017 +0000 Move dataConTagZ to DataCon Just a simple refactoring to remove duplication >--------------------------------------------------------------- cdfa1ec6a24e882a0a78400497766e0c147e7c59 compiler/basicTypes/DataCon.hs | 8 ++++++-- compiler/cmm/SMRep.hs | 4 ++-- compiler/codeGen/StgCmmClosure.hs | 12 ++++-------- compiler/codeGen/StgCmmMonad.hs | 1 + compiler/vectorise/Vectorise/Utils/Base.hs | 5 +---- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/compiler/basicTypes/DataCon.hs b/compiler/basicTypes/DataCon.hs index 43bcf75..4644d40 100644 --- a/compiler/basicTypes/DataCon.hs +++ b/compiler/basicTypes/DataCon.hs @@ -28,8 +28,9 @@ module DataCon ( -- ** Type deconstruction dataConRepType, dataConSig, dataConInstSig, dataConFullSig, - dataConName, dataConIdentity, dataConTag, dataConTyCon, - dataConOrigTyCon, dataConUserType, + dataConName, dataConIdentity, dataConTag, dataConTagZ, + dataConTyCon, dataConOrigTyCon, + dataConUserType, dataConUnivTyVars, dataConUnivTyVarBinders, dataConExTyVars, dataConExTyVarBinders, dataConAllTyVars, @@ -861,6 +862,9 @@ dataConName = dcName dataConTag :: DataCon -> ConTag dataConTag = dcTag +dataConTagZ :: DataCon -> ConTagZ +dataConTagZ con = dataConTag con - fIRST_TAG + -- | The type constructor that we are building via this data constructor dataConTyCon :: DataCon -> TyCon dataConTyCon = dcRepTyCon diff --git a/compiler/cmm/SMRep.hs b/compiler/cmm/SMRep.hs index 83ddf18..d40af4f 100644 --- a/compiler/cmm/SMRep.hs +++ b/compiler/cmm/SMRep.hs @@ -50,6 +50,7 @@ module SMRep ( #include "../HsVersions.h" #include "../includes/MachDeps.h" +import BasicTypes( ConTagZ ) import DynFlags import Outputable import Platform @@ -185,14 +186,13 @@ type IsStatic = Bool -- rtsClosureType below. data ClosureTypeInfo - = Constr ConstrTag ConstrDescription + = Constr ConTagZ ConstrDescription | Fun FunArity ArgDescr | Thunk | ThunkSelector SelectorOffset | BlackHole | IndStatic -type ConstrTag = Int type ConstrDescription = [Word8] -- result of dataConIdentity type FunArity = Int type SelectorOffset = Int diff --git a/compiler/codeGen/StgCmmClosure.hs b/compiler/codeGen/StgCmmClosure.hs index e799ea6..bc5e473 100644 --- a/compiler/codeGen/StgCmmClosure.hs +++ b/compiler/codeGen/StgCmmClosure.hs @@ -13,7 +13,6 @@ module StgCmmClosure ( DynTag, tagForCon, isSmallFamily, - ConTagZ, dataConTagZ, idPrimRep, isVoidRep, isGcPtrRep, addIdReps, addArgReps, argPrimRep, @@ -360,17 +359,12 @@ type DynTag = Int -- The tag on a *pointer* isSmallFamily :: DynFlags -> Int -> Bool isSmallFamily dflags fam_size = fam_size <= mAX_PTR_TAG dflags --- We keep the *zero-indexed* tag in the srt_len field of the info --- table of a data constructor. -dataConTagZ :: DataCon -> ConTagZ -dataConTagZ con = dataConTag con - fIRST_TAG - tagForCon :: DynFlags -> DataCon -> DynTag tagForCon dflags con - | isSmallFamily dflags fam_size = con_tag + 1 + | isSmallFamily dflags fam_size = con_tag | otherwise = 1 where - con_tag = dataConTagZ con + con_tag = dataConTag con -- NB: 1-indexed fam_size = tyConFamilySize (dataConTyCon con) tagForArity :: DynFlags -> RepArity -> DynTag @@ -1050,6 +1044,8 @@ mkDataConInfoTable dflags data_con is_static ptr_wds nonptr_wds info_lbl = mkConInfoTableLabel name NoCafRefs sm_rep = mkHeapRep dflags is_static ptr_wds nonptr_wds cl_type cl_type = Constr (dataConTagZ data_con) (dataConIdentity data_con) + -- We keep the *zero-indexed* tag in the srt_len field + -- of the info table of a data constructor. prof | not (gopt Opt_SccProfilingOn dflags) = NoProfilingInfo | otherwise = ProfilingInfo ty_descr val_descr diff --git a/compiler/codeGen/StgCmmMonad.hs b/compiler/codeGen/StgCmmMonad.hs index bb093a5..998ea1d 100644 --- a/compiler/codeGen/StgCmmMonad.hs +++ b/compiler/codeGen/StgCmmMonad.hs @@ -74,6 +74,7 @@ import Module import Id import VarEnv import OrdList +import BasicTypes( ConTagZ ) import Unique import UniqSupply import FastString diff --git a/compiler/vectorise/Vectorise/Utils/Base.hs b/compiler/vectorise/Vectorise/Utils/Base.hs index 071fab9..aa79834 100644 --- a/compiler/vectorise/Vectorise/Utils/Base.hs +++ b/compiler/vectorise/Vectorise/Utils/Base.hs @@ -4,7 +4,7 @@ module Vectorise.Utils.Base ( voidType , newLocalVVar - , mkDataConTag, dataConTagZ + , mkDataConTag , mkWrapType , mkClosureTypes , mkPReprType @@ -66,9 +66,6 @@ newLocalVVar fs vty mkDataConTag :: DynFlags -> DataCon -> CoreExpr mkDataConTag dflags = mkIntLitInt dflags . dataConTagZ -dataConTagZ :: DataCon -> Int -dataConTagZ con = dataConTag con - fIRST_TAG - -- Type Construction ---------------------------------------------------------- From git at git.haskell.org Wed Mar 8 20:45:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Mar 2017 20:45:07 +0000 (UTC) Subject: [commit: ghc] master: Comments only [ci skip] (fdb594e) Message-ID: <20170308204507.9953B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fdb594ed3286088c1a46c95f29e277fcc60c0a01/ghc >--------------------------------------------------------------- commit fdb594ed3286088c1a46c95f29e277fcc60c0a01 Author: Reid Barton Date: Wed Mar 8 15:42:49 2017 -0500 Comments only [ci skip] >--------------------------------------------------------------- fdb594ed3286088c1a46c95f29e277fcc60c0a01 compiler/iface/IfaceSyn.hs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/compiler/iface/IfaceSyn.hs b/compiler/iface/IfaceSyn.hs index 1c30476..5db8c99 100644 --- a/compiler/iface/IfaceSyn.hs +++ b/compiler/iface/IfaceSyn.hs @@ -1566,6 +1566,7 @@ instance Binary IfaceDecl where putByte bh 0 putIfaceTopBndr bh name lazyPut bh (ty, details, idinfo) + -- See Note [Lazy deserialization of IfaceId] put_ bh (IfaceData a1 a2 a3 a4 a5 a6 a7 a8 a9) = do putByte bh 2 @@ -1656,6 +1657,7 @@ instance Binary IfaceDecl where case h of 0 -> do name <- get bh ~(ty, details, idinfo) <- lazyGet bh + -- See Note [Lazy deserialization of IfaceId] return (IfaceId name ty details idinfo) 1 -> error "Binary.get(TyClDecl): ForeignType" 2 -> do a1 <- getIfaceTopBndr bh @@ -1729,6 +1731,31 @@ instance Binary IfaceDecl where ifBody = IfAbstractClass }) _ -> panic (unwords ["Unknown IfaceDecl tag:", show h]) +{- Note [Lazy deserialization of IfaceId] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The use of lazyPut and lazyGet in the IfaceId Binary instance is +purely for performance reasons, to avoid deserializing details about +identifiers that will never be used. It's not involved in tying the +knot in the type checker. It saved ~1% of the total build time of GHC. + +When we read an interface file, we extend the PTE, a mapping of Names +to TyThings, with the declarations we have read. The extension of the +PTE is strict in the Names, but not in the TyThings themselves. +LoadIface.loadDecl calculates the list of (Name, TyThing) bindings to +add to the PTE. For an IfaceId, there's just one binding to add; and +the ty, details, and idinfo fields of an IfaceId are used only in the +TyThing. So by reading those fields lazily we may be able to save the +work of ever having to deserialize them (into IfaceType, etc.). + +For IfaceData and IfaceClass, loadDecl creates extra implicit bindings +(the constructors and field selectors of the data declaration, or the +methods of the class), whose Names depend on more than just the Name +of the type constructor or class itself. So deserializing them lazily +would be more involved. Similar comments apply to the other +constructors of IfaceDecl with the additional point that they probably +represent a small proportion of all declarations. +-} + instance Binary IfaceFamTyConFlav where put_ bh IfaceDataFamilyTyCon = putByte bh 0 put_ bh IfaceOpenSynFamilyTyCon = putByte bh 1 From git at git.haskell.org Wed Mar 8 21:30:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Mar 2017 21:30:33 +0000 (UTC) Subject: [commit: ghc] master: Fix strictness for catchSTM (6a94b8b) Message-ID: <20170308213033.A412D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6a94b8bba999ce111a8195ab398291dce5bcef2d/ghc >--------------------------------------------------------------- commit 6a94b8bba999ce111a8195ab398291dce5bcef2d Author: David Feuer Date: Wed Mar 8 16:30:08 2017 -0500 Fix strictness for catchSTM * Fix demand analysist for `catchSTM#`. * Add more notes on demand analysis of `catch`-like functions. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3283 >--------------------------------------------------------------- 6a94b8bba999ce111a8195ab398291dce5bcef2d compiler/basicTypes/Demand.hs | 81 ++++++++++++++++++++++++++++++++--------- compiler/prelude/primops.txt.pp | 11 +++++- 2 files changed, 73 insertions(+), 19 deletions(-) diff --git a/compiler/basicTypes/Demand.hs b/compiler/basicTypes/Demand.hs index 1ba25c6..e3984d7 100644 --- a/compiler/basicTypes/Demand.hs +++ b/compiler/basicTypes/Demand.hs @@ -124,10 +124,11 @@ mkJointDmds ss as = zipWithEqual "mkJointDmds" mkJointDmd ss as Note [Exceptions and strictness] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Exceptions need rather careful treatment, especially because of 'catch'. -See Trac #10712. +Exceptions need rather careful treatment, especially because of 'catch' +('catch#'), 'catchSTM' ('catchSTM#'), and 'orElse' ('catchRetry#'). +See Trac #11555, #10712 and #13330, and for some more background, #11222. -There are two main pieces. +There are three main pieces. * The Termination type includes ThrowsExn, meaning "under the given demand this expression either diverges or throws an exception". @@ -139,31 +140,77 @@ There are two main pieces. result of the argument. If the ExnStr flag is ExnStr, we squash ThrowsExn to topRes. (This is done in postProcessDmdResult.) -Here is the kay example +Here is the key example - catch# (\s -> throwIO exn s) blah + catchRetry# (\s -> retry# s) blah -We analyse the argument (\s -> raiseIO# exn s) with demand +We analyse the argument (\s -> retry# s) with demand Str ExnStr (SCall HeadStr) i.e. with the ExnStr flag set. - First we analyse the argument with the "clean-demand" (SCall HeadStr), getting a DmdResult of ThrowsExn from the saturated - application of raiseIO#. + application of retry#. - Then we apply the post-processing for the shell, squashing the ThrowsExn to topRes. This also applies uniformly to free variables. Consider - let r = \st -> raiseIO# blah st - in catch# (\s -> ...(r s')..) handler st - -If we give the first argument of catch a strict signature, we'll get -a demand 'C(S)' for 'r'; that is, 'r' is definitely called with one -argument, which indeed it is. But when we post-process the free-var -demands on catch#'s argument (in postProcessDmdEnv), we'll give 'r' -a demand of (Str ExnStr (SCall HeadStr)); and if we feed that into r's -RHS (which would be reasonable) we'll squash the exception just as if -we'd inlined 'r'. + let r = \st -> retry# st + in catchRetry# (\s -> ...(r s')..) handler st + +If we give the first argument of catch a strict signature, we'll get a demand +'C(S)' for 'r'; that is, 'r' is definitely called with one argument, which +indeed it is. But when we post-process the free-var demands on catchRetry#'s +argument (in postProcessDmdEnv), we'll give 'r' a demand of (Str ExnStr (SCall +HeadStr)); and if we feed that into r's RHS (which would be reasonable) we'll +squash the retry just as if we'd inlined 'r'. + +* We don't try to get clever about 'catch#' and 'catchSTM#' at the moment. We +previously (#11222) tried to take advantage of the fact that 'catch#' calls its +first argument eagerly. See especially commit +9915b6564403a6d17651e9969e9ea5d7d7e78e7f. We analyzed that first argument with +a strict demand, and then performed a post-processing step at the end to change +ThrowsExn to TopRes. The trouble, I believe, is that to use this approach +correctly, we'd need somewhat different information about that argument. +Diverges, ThrowsExn (i.e., diverges or throws an exception), and Dunno are the +wrong split here. In order to evaluate part of the argument speculatively, +we'd need to know that it *does not throw an exception*. That is, that it +either diverges or succeeds. But we don't currently have a way to talk about +that. Abstractly and approximately, + +catch# m f s = case ORACLE m s of + DivergesOrSucceeds -> m s + Fails exc -> f exc s + +where the magical ORACLE determines whether or not (m s) throws an exception +when run, and if so which one. If we want, we can safely consider (catch# m f s) +strict in anything that both branches are strict in (by performing demand +analysis for 'catch#' in the same way we do for case). We could also safely +consider it strict in anything demanded by (m s) that is guaranteed not to +throw an exception under that demand, but I don't know if we have the means +to express that. + +My mind keeps turning to this model (not as an actual change to the type, but +as a way to think about what's going on in the analysis): + +newtype IO a = IO {unIO :: State# s -> (# s, (# SomeException | a #) #)} +instance Monad IO where + return a = IO $ \s -> (# s, (# | a #) #) + IO m >>= f = IO $ \s -> case m s of + (# s', (# e | #) #) -> (# s', e #) + (# s', (# | a #) #) -> unIO (f a) s +raiseIO# e s = (# s, (# e | #) #) +catch# m f s = case m s of + (# s', (# e | #) #) -> f e s' + res -> res + +Thinking about it this way seems likely to be productive for analyzing IO +exception behavior, but imprecise exceptions and asynchronous exceptions remain +quite slippery beasts. Can we incorporate them? I think we can. We can imagine +applying 'seq#' to evaluate @m s@, determining whether it throws an imprecise +or asynchronous exception or whether it succeeds or throws an IO exception. +This confines the peculiarities to 'seq#', which is indeed rather essentially +peculiar. -} -- Vanilla strictness domain diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 76cfe67..1d10223 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -1972,7 +1972,7 @@ section "Exceptions" -- The outer case just decides whether to mask exceptions, but we don't want -- thereby to hide the strictness in 'ma'! Hence the use of strictApply1Dmd. -- --- For catch, we must be extra careful; see +-- For catch, catchSTM, and catchRetry, we must be extra careful; see -- Note [Exceptions and strictness] in Demand primop CatchOp "catch#" GenPrimOp @@ -2010,6 +2010,13 @@ primop RaiseOp "raise#" GenPrimOp -- f x y | x>0 = raiseIO blah -- | y>0 = return 1 -- | otherwise = return 2 +-- +-- TODO Check that the above notes on @f@ are valid. The function successfully +-- produces an IO exception when compiled without optimization. If we analyze +-- it as strict in @y@, won't we change that behavior under optimization? +-- I thought the rule was that it was okay to replace one valid imprecise +-- exception with another, but not to replace a precise exception with +-- an imprecise one (dfeuer, 2017-03-05). primop RaiseIOOp "raiseIO#" GenPrimOp a -> State# RealWorld -> (# State# RealWorld, b #) @@ -2099,7 +2106,7 @@ primop CatchSTMOp "catchSTM#" GenPrimOp -> (b -> State# RealWorld -> (# State# RealWorld, a #) ) -> (State# RealWorld -> (# State# RealWorld, a #) ) with - strictness = { \ _arity -> mkClosedStrictSig [ catchArgDmd + strictness = { \ _arity -> mkClosedStrictSig [ lazyApply1Dmd , lazyApply2Dmd , topDmd ] topRes } -- See Note [Strictness for mask/unmask/catch] From git at git.haskell.org Wed Mar 8 23:34:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Mar 2017 23:34:20 +0000 (UTC) Subject: [commit: ghc] master: Bump haskeline submodule to fix Windows build. (a02b80f) Message-ID: <20170308233420.7ADF83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a02b80fe5542e4538eda964e23a0fa80f38a2455/ghc >--------------------------------------------------------------- commit a02b80fe5542e4538eda964e23a0fa80f38a2455 Author: Tamar Christina Date: Wed Mar 8 23:33:17 2017 +0000 Bump haskeline submodule to fix Windows build. >--------------------------------------------------------------- a02b80fe5542e4538eda964e23a0fa80f38a2455 libraries/haskeline | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/haskeline b/libraries/haskeline index 39168d2..91f6afd 160000 --- a/libraries/haskeline +++ b/libraries/haskeline @@ -1 +1 @@ -Subproject commit 39168d2feaebb0c16b8415727283a031afc7c721 +Subproject commit 91f6afd971fde46423237bfa5215e95365017f99 From git at git.haskell.org Wed Mar 8 23:39:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Mar 2017 23:39:38 +0000 (UTC) Subject: [commit: ghc] branch 'wip/raiseIO-conservative' created Message-ID: <20170308233938.62AE43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/raiseIO-conservative Referencing: da4687f63ffe5a6162e3d7856aa53de048dd0f42 From git at git.haskell.org Wed Mar 8 23:39:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Mar 2017 23:39:41 +0000 (UTC) Subject: [commit: ghc] wip/raiseIO-conservative: Make raiseIO# produce topRes (da4687f) Message-ID: <20170308233941.26F633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/raiseIO-conservative Link : http://ghc.haskell.org/trac/ghc/changeset/da4687f63ffe5a6162e3d7856aa53de048dd0f42/ghc >--------------------------------------------------------------- commit da4687f63ffe5a6162e3d7856aa53de048dd0f42 Author: David Feuer Date: Wed Mar 8 16:34:18 2017 -0500 Make raiseIO# produce topRes Summary: Make `raiseIO#` produce `topRes` instead of `ExnRes`. `ExnRes` leads to demand analysis being too aggressive, IMO, allowing imprecise exceptions produced by `throw` to replace exceptions thrown by `throwIO` that would like to think of as precise. This fixes that, but is certanly much more conservative than we would ideally like. Let's see how bad it is. Fixes Trac #13380 Reviewers: austin, bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3301 >--------------------------------------------------------------- da4687f63ffe5a6162e3d7856aa53de048dd0f42 compiler/prelude/primops.txt.pp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 1d10223..64971a3 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -2005,11 +2005,9 @@ primop RaiseOp "raise#" GenPrimOp -- must be *precise* - we don't want the strictness analyser turning -- one kind of bottom into another, as it is allowed to do in pure code. -- --- But we *do* want to know that it returns bottom after --- being applied to two arguments, so that this function is strict in y --- f x y | x>0 = raiseIO blah --- | y>0 = return 1 --- | otherwise = return 2 +-- We currently produce topRes, which is much too conservative (interfering +-- with dead code elimination, unfortunately), but nothing else we currently +-- have on tap is actually correct. -- -- TODO Check that the above notes on @f@ are valid. The function successfully -- produces an IO exception when compiled without optimization. If we analyze @@ -2021,7 +2019,7 @@ primop RaiseOp "raise#" GenPrimOp primop RaiseIOOp "raiseIO#" GenPrimOp a -> State# RealWorld -> (# State# RealWorld, b #) with - strictness = { \ _arity -> mkClosedStrictSig [topDmd, topDmd] exnRes } + strictness = { \ _arity -> mkClosedStrictSig [topDmd, topDmd] topRes } out_of_line = True has_side_effects = True From git at git.haskell.org Thu Mar 9 00:16:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 00:16:24 +0000 (UTC) Subject: [commit: ghc] master: Allow compilation of C/C++/ObjC/ObjC++ files with module from TH (0fac488) Message-ID: <20170309001624.9CCC63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0fac488cca04a07224926e35be9c45ee2d0e1631/ghc >--------------------------------------------------------------- commit 0fac488cca04a07224926e35be9c45ee2d0e1631 Author: Francesco Mazzoli Date: Tue Mar 7 23:39:51 2017 -0500 Allow compilation of C/C++/ObjC/ObjC++ files with module from TH The main goal is to easily allow the inline-c project (and similar projects such as inline-java) to emit C/C++ files to be compiled and linked with the current module. Moreover, `addCStub` is removed, since it's quite fragile. Most notably, the C stubs end up in the file generated by `CodeOutput.outputForeignStubs`, which is tuned towards generating a file for stubs coming from `capi` and Haskell-to-C exports. Reviewers: simonmar, austin, goldfire, facundominguez, dfeuer, bgamari Reviewed By: dfeuer, bgamari Subscribers: snowleopard, rwbarton, dfeuer, thomie, duncan, mboes Differential Revision: https://phabricator.haskell.org/D3280 >--------------------------------------------------------------- 0fac488cca04a07224926e35be9c45ee2d0e1631 compiler/deSugar/Desugar.hs | 8 +- compiler/main/CodeOutput.hs | 27 ++++- compiler/main/DriverPhases.hs | 12 +-- compiler/main/DriverPipeline.hs | 115 ++++++++++++--------- compiler/main/HscMain.hs | 13 ++- compiler/main/HscTypes.hs | 5 + compiler/main/PipelineMonad.hs | 16 +-- compiler/main/TidyPgm.hs | 2 + compiler/typecheck/TcRnMonad.hs | 4 +- compiler/typecheck/TcRnTypes.hs | 6 +- compiler/typecheck/TcSplice.hs | 15 +-- libraries/ghc-boot-th/GHC/ForeignSrcLang/Type.hs | 10 ++ libraries/ghc-boot-th/ghc-boot-th.cabal.in | 1 + libraries/ghc-boot/GHC/ForeignSrcLang.hs | 12 +++ libraries/ghc-boot/ghc-boot.cabal.in | 1 + libraries/ghci/GHCi/Message.hs | 7 +- libraries/ghci/GHCi/TH.hs | 2 +- libraries/ghci/ghci.cabal.in | 1 + .../template-haskell/Language/Haskell/TH/Syntax.hs | 29 +++--- testsuite/tests/th/T13366.hs | 39 +++++++ testsuite/tests/th/T13366.stdout | 4 + testsuite/tests/th/TH_addCStub1.hs | 22 ---- testsuite/tests/th/TH_addCStub1.stdout | 2 - testsuite/tests/th/TH_addCStub2.hs | 22 ---- testsuite/tests/th/all.T | 6 +- 25 files changed, 221 insertions(+), 160 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 0fac488cca04a07224926e35be9c45ee2d0e1631 From git at git.haskell.org Thu Mar 9 00:16:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 00:16:27 +0000 (UTC) Subject: [commit: ghc] master: base: Import Data.Int in KQueue (de62f58) Message-ID: <20170309001627.634933A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/de62f587463f6377df1e69e11504578833dfe653/ghc >--------------------------------------------------------------- commit de62f587463f6377df1e69e11504578833dfe653 Author: Ben Gamari Date: Wed Mar 8 18:24:03 2017 -0500 base: Import Data.Int in KQueue This was broken in the ecb880caea441b6dd7f75a555546e55abe11c233. >--------------------------------------------------------------- de62f587463f6377df1e69e11504578833dfe653 libraries/base/GHC/Event/KQueue.hsc | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/base/GHC/Event/KQueue.hsc b/libraries/base/GHC/Event/KQueue.hsc index 0d5350e..b3ac331 100644 --- a/libraries/base/GHC/Event/KQueue.hsc +++ b/libraries/base/GHC/Event/KQueue.hsc @@ -28,6 +28,7 @@ available = False import Data.Bits (Bits(..), FiniteBits(..)) import Data.Word (Word16, Word32) +import Data.Int (Int16) import Foreign.C.Error (throwErrnoIfMinus1, eINTR, eINVAL, eNOTSUP, getErrno, throwErrno) import Foreign.C.Types From git at git.haskell.org Thu Mar 9 00:16:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 00:16:30 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump allocations of T4029 (87a2d37) Message-ID: <20170309001630.192533A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/87a2d37ca464ce87d39359807cd43706d89f3a0b/ghc >--------------------------------------------------------------- commit 87a2d37ca464ce87d39359807cd43706d89f3a0b Author: Ben Gamari Date: Tue Mar 7 23:51:19 2017 -0500 testsuite: Bump allocations of T4029 >--------------------------------------------------------------- 87a2d37ca464ce87d39359807cd43706d89f3a0b testsuite/tests/perf/space_leaks/all.T | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/perf/space_leaks/all.T b/testsuite/tests/perf/space_leaks/all.T index 67283ec..fa93d72 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -69,7 +69,7 @@ test('T4029', # 2017-03-03: 65 (amd64/Linux) Share Typeable KindReps or more # lazy interface file reading stats_num_field('max_bytes_used', - [(wordsize(64), 19172360, 5)]), + [(wordsize(64), 20476360, 5)]), # 2016-02-26: 24071720 (amd64/Linux) INITIAL # 2016-04-21: 25542832 (amd64/Linux) # 2016-05-23: 25247216 (amd64/Linux) Use -G1 @@ -84,6 +84,7 @@ test('T4029', # 2017-02-20: 22016200 (amd64/Linux) Better reading of iface files # 2017-03-03: 19172360 (amd64/Linux) Share Typeable KindReps or more # lazy interface file reading + # 2017-03-07: 20476360 (amd64/Linux) It's not entirely clear extra_hc_opts('+RTS -G1 -RTS' ), ], ghci_script, From git at git.haskell.org Thu Mar 9 08:37:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 08:37:24 +0000 (UTC) Subject: [commit: ghc] master: KQueue.hsc: fix build failure on FreeBSD (9e15db4) Message-ID: <20170309083724.D14993A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9e15db49b57df992184d342830ea830aabc626c9/ghc >--------------------------------------------------------------- commit 9e15db49b57df992184d342830ea830aabc626c9 Author: Sergei Trofimovich Date: Thu Mar 9 08:35:58 2017 +0000 KQueue.hsc: fix build failure on FreeBSD Build failed as: libraries/base/GHC/Event/KQueue.hsc:192:25: error: Not in scope: type constructor or class ‘Int16’ | 192 | newtype Filter = Filter Int16 | ^^^^^ If was caused by an import tweak from Word16 to Int16. Adjust imports to make KQueue compile cleanly. Signed-off-by: Sergei Trofimovich Test Plan: build on freebsd Reviewers: bgamari, austin, hvr Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3300 >--------------------------------------------------------------- 9e15db49b57df992184d342830ea830aabc626c9 libraries/base/GHC/Event/KQueue.hsc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/base/GHC/Event/KQueue.hsc b/libraries/base/GHC/Event/KQueue.hsc index b3ac331..7476c93 100644 --- a/libraries/base/GHC/Event/KQueue.hsc +++ b/libraries/base/GHC/Event/KQueue.hsc @@ -27,6 +27,7 @@ available = False #else import Data.Bits (Bits(..), FiniteBits(..)) +import qualified Data.Int as I import Data.Word (Word16, Word32) import Data.Int (Int16) import Foreign.C.Error (throwErrnoIfMinus1, eINTR, eINVAL, @@ -188,9 +189,9 @@ newtype Flag = Flag Word16 } #if SIZEOF_KEV_FILTER == 4 /*kevent.filter: int32_t or int16_t. */ -newtype Filter = Filter Int32 +newtype Filter = Filter I.Int32 #else -newtype Filter = Filter Int16 +newtype Filter = Filter I.Int16 #endif deriving (Bits, FiniteBits, Eq, Num, Show, Storable) From git at git.haskell.org Thu Mar 9 09:40:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 09:40:36 +0000 (UTC) Subject: [commit: ghc] master: Comments only [ci skip] (9ff0574) Message-ID: <20170309094036.544CC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9ff05742de1ec1838c0fd358b194b29c8b3ed10b/ghc >--------------------------------------------------------------- commit 9ff05742de1ec1838c0fd358b194b29c8b3ed10b Author: Gabor Greif Date: Thu Mar 9 10:22:28 2017 +0100 Comments only [ci skip] >--------------------------------------------------------------- 9ff05742de1ec1838c0fd358b194b29c8b3ed10b compiler/coreSyn/PprCore.hs | 2 +- compiler/iface/TcIface.hs | 2 +- compiler/simplCore/Simplify.hs | 4 ++-- compiler/typecheck/FunDeps.hs | 2 +- compiler/typecheck/TcTypeable.hs | 2 +- libraries/template-haskell/Language/Haskell/TH/Syntax.hs | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler/coreSyn/PprCore.hs b/compiler/coreSyn/PprCore.hs index ddece8d..28d3552 100644 --- a/compiler/coreSyn/PprCore.hs +++ b/compiler/coreSyn/PprCore.hs @@ -338,7 +338,7 @@ Furthermore, a dead case-binder is completely ignored, while otherwise, dead binders are printed as "_". -} --- THese instances are sadly orphans +-- These instances are sadly orphans instance OutputableBndr Var where pprBndr = pprCoreBinder diff --git a/compiler/iface/TcIface.hs b/compiler/iface/TcIface.hs index 2d30f52..3a6a407 100644 --- a/compiler/iface/TcIface.hs +++ b/compiler/iface/TcIface.hs @@ -255,7 +255,7 @@ mergeIfaceDecl d1 d2 -- -- A module that defines T as representational in both arguments -- would successfully fill both signatures, so it would be better --- if if we merged the roles of these types in some nontrivial +-- if we merged the roles of these types in some nontrivial -- way. -- -- However, we have to be very careful about how we go about diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 969fb3e..b63e745 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -1814,7 +1814,7 @@ tryRules env rules fn args call_cont -- many args the rule consumed occ_anald_rhs = occurAnalyseExpr rule_rhs - -- See Note [Occurence-analyse after rule firing] + -- See Note [Occurrence-analyse after rule firing] ; dump dflags rule rule_rhs ; return (Just (occ_anald_rhs, cont')) }}} where @@ -1847,7 +1847,7 @@ tryRules env rules fn args call_cont = liftIO . dumpSDoc dflags alwaysQualify flag "" $ sep [text hdr, nest 4 details] -{- Note [Occurence-analyse after rule firing] +{- Note [Occurrence-analyse after rule firing] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ After firing a rule, we occurrence-analyse the instantiated RHS before simplifying it. Usually this doesn't make much difference, but it can diff --git a/compiler/typecheck/FunDeps.hs b/compiler/typecheck/FunDeps.hs index 058a971..981702f 100644 --- a/compiler/typecheck/FunDeps.hs +++ b/compiler/typecheck/FunDeps.hs @@ -52,7 +52,7 @@ Each functional dependency with one variable in the RHS is responsible for generating a single equality. For instance: class C a b | a -> b The constraints ([Wanted] C Int Bool) and [Wanted] C Int alpha -will generate the folloing FunDepEqn +will generate the following FunDepEqn FDEqn { fd_qtvs = [] , fd_eqs = [Pair Bool alpha] , fd_pred1 = C Int Bool diff --git a/compiler/typecheck/TcTypeable.hs b/compiler/typecheck/TcTypeable.hs index b67ae54..8dfad6d 100644 --- a/compiler/typecheck/TcTypeable.hs +++ b/compiler/typecheck/TcTypeable.hs @@ -125,7 +125,7 @@ There are many wrinkles: reduce the number of bindings we need to produce, we generate their KindReps once in GHC.Types. These are referred to as "built-in" KindReps below. -* Even though KindReps aren't inlined this scheme still has more of an effect on +* Even though KindReps aren't inlined, this scheme still has more of an effect on compilation time than I'd like. This is especially true in the case of families of type constructors (e.g. tuples and unboxed sums). The problem is particularly bad in the case of sums, since each arity-N tycon brings with it diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs index 466834a..8be48aa 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs @@ -784,7 +784,7 @@ package `text` we find packConstr :: Constr packConstr = mkConstr textDataType "pack" [] Prefix -Here `packConstr` isn't a real data constructor, it's an ordiary +Here `packConstr` isn't a real data constructor, it's an ordinary function. Two complications * In such a case, we must take care to build the Name using From git at git.haskell.org Thu Mar 9 13:51:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 13:51:18 +0000 (UTC) Subject: [commit: ghc] master: get-win32-tarballs: Rework handling of hashing (3b40450) Message-ID: <20170309135118.967A43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3b40450436db1c927d88dbe7c6bad33f35dd4b1a/ghc >--------------------------------------------------------------- commit 3b40450436db1c927d88dbe7c6bad33f35dd4b1a Author: Ben Gamari Date: Wed Mar 8 21:25:32 2017 -0500 get-win32-tarballs: Rework handling of hashing This pulls out the hashes into a separate file, making them far easier to update. >--------------------------------------------------------------- 3b40450436db1c927d88dbe7c6bad33f35dd4b1a mk/get-win32-tarballs.sh | 57 +++++++++++++++++++----------------------------- mk/win32-tarballs.md5sum | 27 +++++++++++++++++++++++ 2 files changed, 49 insertions(+), 35 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 3b40450436db1c927d88dbe7c6bad33f35dd4b1a From git at git.haskell.org Thu Mar 9 13:51:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 13:51:21 +0000 (UTC) Subject: [commit: ghc] master: Update crt to latest. (06c8ce4) Message-ID: <20170309135121.577913A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/06c8ce449f7c89eeafe4f9a6e8c545272327f528/ghc >--------------------------------------------------------------- commit 06c8ce449f7c89eeafe4f9a6e8c545272327f528 Author: Tamar Christina Date: Tue Mar 7 23:40:03 2017 -0500 Update crt to latest. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3292 >--------------------------------------------------------------- 06c8ce449f7c89eeafe4f9a6e8c545272327f528 mk/get-win32-tarballs.sh | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/mk/get-win32-tarballs.sh b/mk/get-win32-tarballs.sh index 839ed0f..a481062 100755 --- a/mk/get-win32-tarballs.sh +++ b/mk/get-win32-tarballs.sh @@ -35,6 +35,16 @@ download_file() { fi fi + if test "$sigs" = "1" + then + echo "Downloading ${description} (signature) to ${dest_dir}..." + local curl_cmd="curl -L ${file_url}.sig -o ${dest_file}.sig --create-dirs -# ${extra_curl_opts}" + $curl_cmd || { + rm -f "${dest_file}.sig" + fail "ERROR: Download failed." + } + fi + if test "$verify" = "1" then echo "${file_md5} *${dest_file}" | md5sum --quiet -c - || @@ -43,7 +53,14 @@ download_file() { } download_mingw() { - local mingw_url="$1" + if test "$mingw_arch" = "sources" + then + local mingw_url=`echo "$1" | sed -e 's/-any\.pkg\.tar\.xz/\.src\.tar\.gz/' \ + -e 's/-sources-/-/' \ + -e 's/-libwinpthread-git-/-winpthreads-git-/' ` + else + local mingw_url="$1" + fi local file_md5sum_x86="$2" local file_md5sum_x64="$3" @@ -74,7 +91,7 @@ download_tarballs() { local package_prefix="mingw-w64" local format_url="${mingw_base_url}/${mingw_arch}/${package_prefix}-${mingw_arch}" - download_mingw "${format_url}-crt-git-5.0.0.4745.d2384c2-1-any.pkg.tar.xz" "03c9e74ce17702b0f13db8cb2c7ca8ca" "035f08a61ced0b81bb6c09974f7be897" + download_mingw "${format_url}-crt-git-5.0.0.4795.e3d96cb1-1-any.pkg.tar.xz" "534bb4756482f3271308576cdadfe5dc" "3780a25a6f20eef9b143f47f4b615e39" download_mingw "${format_url}-winpthreads-git-5.0.0.4741.2c8939a-1-any.pkg.tar.xz" "155845f8c897f0c70adee83cfa9ec30c" "ba417ad9fb7cd3ee56e713b2b070adb9" download_mingw "${format_url}-headers-git-5.0.0.4747.0f8f626-1-any.pkg.tar.xz" "b724d1aaae73c329022ad22374481817" "e8065928b81c9b379286515913eccd68" download_mingw "${format_url}-libwinpthread-git-5.0.0.4741.2c8939a-1-any.pkg.tar.xz" "65b18b67eef3c3d5e5707577dfa8f831" "c280f60a4b80ed6722ce4d9b4f6c550e" @@ -130,6 +147,7 @@ case $1 in download) download=1 verify=1 + sigs=0 ;; fetch) download=1 @@ -157,6 +175,7 @@ case $2 in download_x86_64 ;; mirror) + sigs=1 download_i386 download_x86_64 verify=0 From git at git.haskell.org Thu Mar 9 13:51:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 13:51:24 +0000 (UTC) Subject: [commit: ghc] master: get-win32-tarballs: Use haskell.org mirror (8fa1d5a) Message-ID: <20170309135124.280B43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8fa1d5a1a94003aa5028a2bce1301f2baa5ff4d0/ghc >--------------------------------------------------------------- commit 8fa1d5a1a94003aa5028a2bce1301f2baa5ff4d0 Author: Ben Gamari Date: Tue Mar 7 23:46:50 2017 -0500 get-win32-tarballs: Use haskell.org mirror >--------------------------------------------------------------- 8fa1d5a1a94003aa5028a2bce1301f2baa5ff4d0 mk/get-win32-tarballs.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mk/get-win32-tarballs.sh b/mk/get-win32-tarballs.sh index a481062..f43b24e 100755 --- a/mk/get-win32-tarballs.sh +++ b/mk/get-win32-tarballs.sh @@ -87,7 +87,8 @@ download_mingw() { } download_tarballs() { - local mingw_base_url="http://repo.msys2.org/mingw" + #local mingw_base_url="http://repo.msys2.org/mingw" + local mingw_base_url="https://downloads.haskell.org/~ghc/mingw" local package_prefix="mingw-w64" local format_url="${mingw_base_url}/${mingw_arch}/${package_prefix}-${mingw_arch}" From git at git.haskell.org Thu Mar 9 15:14:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 15:14:02 +0000 (UTC) Subject: [commit: ghc] master: Add a comment to the mapFB rules (665cefe) Message-ID: <20170309151402.036983A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/665cefe80d112ed2e4fb9617d277a1466e83f9bd/ghc >--------------------------------------------------------------- commit 665cefe80d112ed2e4fb9617d277a1466e83f9bd Author: Joachim Breitner Date: Thu Mar 9 16:13:08 2017 +0100 Add a comment to the mapFB rules to amend 2fa44217c1d9722227297eefb0d6c6aed7e128ca. >--------------------------------------------------------------- 665cefe80d112ed2e4fb9617d277a1466e83f9bd libraries/base/GHC/Base.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index 6f9d454..a678c22 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -964,10 +964,12 @@ mapFB c f = \x ys -> c (f x) ys -- (along with build's unfolding) else we'd get an infinite loop -- in the rules. Hence the activation control below. -- --- The "mapFB" rule optimises compositions of map. --- -- This same pattern is followed by many other functions: -- e.g. append, filter, iterate, repeat, etc. +-- +-- The "mapFB" rule optimises compositions of map and +-- the "mapFB/id" rule get rids of 'map id' calls. +-- (Any similarity to the Functor laws for [] is expected.) {-# RULES "map" [~1] forall f xs. map f xs = build (\c n -> foldr (mapFB c f) n xs) From git at git.haskell.org Thu Mar 9 15:59:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 15:59:49 +0000 (UTC) Subject: [commit: nofib] master: Simon’s notes: Refer mailing list about binary-tree (9a1b1a0) Message-ID: <20170309155949.8ABE23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9a1b1a0cd06bde5f49314567b4860522e43d60a5/nofib >--------------------------------------------------------------- commit 9a1b1a0cd06bde5f49314567b4860522e43d60a5 Author: Joachim Breitner Date: Thu Mar 9 16:59:38 2017 +0100 Simon’s notes: Refer mailing list about binary-tree >--------------------------------------------------------------- 9a1b1a0cd06bde5f49314567b4860522e43d60a5 Simon-nofib-notes | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Simon-nofib-notes b/Simon-nofib-notes index 2b4654c..2fe8aca 100644 --- a/Simon-nofib-notes +++ b/Simon-nofib-notes @@ -384,3 +384,15 @@ which leads to numerous file opens/closes. Allocations will rise with the new I/O subsystem in 5.02 because the I/O buffer will be re-allocated on the heap for each open, whereas previously it would be allocated on the C heap and therefore not show up in the stats. + +--------------------------------------- + Shootout suite +--------------------------------------- + +binary-tree +~~~~~~~~~~~ + +In May 2016, a series of seemingly unrelated commits changed the runtime +performance of this up and down by ~3%. Maybe a performance cliff. Mailinglist +thread: +https://mail.haskell.org/pipermail/ghc-devs/2017-March/013886.html From git at git.haskell.org Thu Mar 9 16:13:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 16:13:25 +0000 (UTC) Subject: [commit: ghc] master: get-win32-tarballs: More reworking of tarball maintenance (7b80168) Message-ID: <20170309161325.378073A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7b80168bc11ba1fa3ef7ebfcdf3b4d67f467b0dc/ghc >--------------------------------------------------------------- commit 7b80168bc11ba1fa3ef7ebfcdf3b4d67f467b0dc Author: Ben Gamari Date: Thu Mar 9 09:25:50 2017 -0500 get-win32-tarballs: More reworking of tarball maintenance This fixes fetching of signatures and sources for inconsistently named msys2 tarballs. >--------------------------------------------------------------- 7b80168bc11ba1fa3ef7ebfcdf3b4d67f467b0dc mk/get-win32-tarballs.sh | 23 ++++++++++++++++------- mk/win32-tarballs.md5sum | 12 ++++++++++++ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/mk/get-win32-tarballs.sh b/mk/get-win32-tarballs.sh index 769beb0..f51a304 100755 --- a/mk/get-win32-tarballs.sh +++ b/mk/get-win32-tarballs.sh @@ -34,10 +34,11 @@ download_file() { fi fi - if test "$sigs" = "1" + local sig_file="${dest_file}.sig" + if test "$sigs" = "1" -a ! -f "$sig_file" then echo "Downloading ${description} (signature) to ${dest_dir}..." - local curl_cmd="curl -L ${file_url}.sig -o ${dest_file}.sig --create-dirs -# ${extra_curl_opts}" + local curl_cmd="curl -L ${file_url}.sig -o ${sig_file} --create-dirs -# ${extra_curl_opts}" $curl_cmd || { rm -f "${dest_file}.sig" fail "ERROR: Download failed." @@ -46,7 +47,7 @@ download_file() { if test "$verify" = "1" then - grep "${dest_file}" mk/win32-tarballs.md5sum | md5sum --quiet -c - || + grep "${dest_file}$" mk/win32-tarballs.md5sum | md5sum --quiet -c - || fail "ERROR: ${description} appears to be corrupted, please delete it and try again." fi } @@ -74,8 +75,8 @@ download_mingw() { } download_tarballs() { - local mingw_base_url="http://repo.msys2.org/mingw" - #local mingw_base_url="https://downloads.haskell.org/~ghc/mingw" + #local mingw_base_url="http://repo.msys2.org/mingw" + local mingw_base_url="https://downloads.haskell.org/~ghc/mingw" local package_prefix="mingw-w64" local format_url="${mingw_base_url}/${mingw_arch}/${package_prefix}-${mingw_arch}" @@ -85,14 +86,22 @@ download_tarballs() { download_mingw "${format_url}-libwinpthread-git-5.0.0.4741.2c8939a-1-any.pkg.tar.xz" download_mingw "${format_url}-zlib-1.2.8-9-any.pkg.tar.xz" download_mingw "${format_url}-isl-0.17.1-1-any.pkg.tar.xz" - download_mingw "${format_url}-mpc-1.0.3-2-any.pkg.tar.xz" download_mingw "${format_url}-mpfr-3.1.4.p3-4-any.pkg.tar.xz" download_mingw "${format_url}-gmp-6.1.1-1-any.pkg.tar.xz" - download_mingw "${format_url}-gcc-libs-6.2.0-2-any.pkg.tar.xz" download_mingw "${format_url}-binutils-2.27-2-any.pkg.tar.xz" download_mingw "${format_url}-libidn-1.32-3-any.pkg.tar.xz" download_mingw "${format_url}-gcc-6.2.0-2-any.pkg.tar.xz" + # Upstream is unfortunately quite inconsistent in naming + if test "$mingw_arch" != "sources"; then + download_mingw "${format_url}-mpc-1.0.3-2-any.pkg.tar.xz" + download_mingw "${format_url}-gcc-libs-6.2.0-2-any.pkg.tar.xz" + else + local format_url="${mingw_base_url}/${mingw_arch}/${package_prefix}" + download_mingw "${format_url}-i686-mpc-1.0.3-2.src.tar.gz" + download_mingw "${format_url}-x86_64-mpc-1.0.3-2.src.tar.gz" + fi + download_file "https://github.com/ghc/ghc-tarballs/blob/master/perl/ghc-perl-1.tar.gz?raw=true" "ghc-tarballs/perl/ghc-perl-1.tar.gz" "Windows Perl binary distributions" "--insecure" if ! test "$missing_files" = "0" diff --git a/mk/win32-tarballs.md5sum b/mk/win32-tarballs.md5sum index 2ff0f5b..c65272b 100644 --- a/mk/win32-tarballs.md5sum +++ b/mk/win32-tarballs.md5sum @@ -11,6 +11,18 @@ d263d1362dee0c24df80b461eb2ec489 ghc-tarballs/mingw-w64/x86/mingw-w64-i686-binu 9ecd264a3da0f0f6af8b392c1b183a7b ghc-tarballs/mingw-w64/x86/mingw-w64-i686-libidn-1.32-3-any.pkg.tar.xz e8cc05fc566ddc6c16266da9aec2ddd3 ghc-tarballs/mingw-w64/x86/mingw-w64-i686-gmp-6.1.1-1-any.pkg.tar.xz 719e76fa7a54a8676d2e60af3bb13c45 ghc-tarballs/mingw-w64/x86/mingw-w64-i686-mpc-1.0.3-2-any.pkg.tar.xz +af26624e5337a1bbb2cc21eb69c79583 ghc-tarballs/mingw-w64/sources/mingw-w64-libidn-1.32-3.src.tar.gz +5c24d319656ed61e517dfa0fee7e475c ghc-tarballs/mingw-w64/sources/mingw-w64-i686-mpc-1.0.3-2.src.tar.gz +7640270cffcd384f8dc44c19f502cb53 ghc-tarballs/mingw-w64/sources/mingw-w64-gmp-6.1.1-1.src.tar.gz +33ff8b589d36fbd49f287f283a58ffe5 ghc-tarballs/mingw-w64/sources/mingw-w64-headers-git-5.0.0.4747.0f8f626-1.src.tar.gz +d0b3537c3f56b6f396b3dc23a905d186 ghc-tarballs/mingw-w64/sources/mingw-w64-crt-git-5.0.0.4795.e3d96cb1-1.src.tar.gz +dfa5ea68e92146b3066e6808847ff247 ghc-tarballs/mingw-w64/sources/mingw-w64-gcc-6.2.0-2.src.tar.gz +d6e1c36ea8f308aeba179bca976c817d ghc-tarballs/mingw-w64/sources/mingw-w64-binutils-2.27-2.src.tar.gz +32078e2a67e34ff6c0b1795fe6ed9d36 ghc-tarballs/mingw-w64/sources/mingw-w64-zlib-1.2.8-9.src.tar.gz +fd3f5c0829f52bb84873a2712d19e151 ghc-tarballs/mingw-w64/sources/mingw-w64-winpthreads-git-5.0.0.4741.2c8939a-1.src.tar.gz +9a247c15405f83152f4bb9cf339ed741 ghc-tarballs/mingw-w64/sources/mingw-w64-mpfr-3.1.4.p3-4.src.tar.gz +e0b495821486711fc113de0d9c648498 ghc-tarballs/mingw-w64/sources/mingw-w64-isl-0.17.1-1.src.tar.gz +d4261042f502998006c57f0e6517998e ghc-tarballs/mingw-w64/sources/mingw-w64-x86_64-mpc-1.0.3-2.src.tar.gz 3780a25a6f20eef9b143f47f4b615e39 ghc-tarballs/mingw-w64/x86_64/mingw-w64-x86_64-crt-git-5.0.0.4795.e3d96cb1-1-any.pkg.tar.xz ba417ad9fb7cd3ee56e713b2b070adb9 ghc-tarballs/mingw-w64/x86_64/mingw-w64-x86_64-winpthreads-git-5.0.0.4741.2c8939a-1-any.pkg.tar.xz 39c8b3b8e56b3b0bdef86cf32f1e09ba ghc-tarballs/mingw-w64/x86_64/mingw-w64-x86_64-isl-0.17.1-1-any.pkg.tar.xz From git at git.haskell.org Thu Mar 9 16:13:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 16:13:28 +0000 (UTC) Subject: [commit: ghc] master: Make raiseIO# produce topRes (7b087ae) Message-ID: <20170309161328.0AD223A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7b087aeba45a7a70a5553ef4c116ee67660423e8/ghc >--------------------------------------------------------------- commit 7b087aeba45a7a70a5553ef4c116ee67660423e8 Author: David Feuer Date: Thu Mar 9 10:34:42 2017 -0500 Make raiseIO# produce topRes Make `raiseIO#` produce `topRes` instead of `ExnRes`. `ExnRes` leads to demand analysis being too aggressive, IMO, allowing imprecise exceptions produced by `throw` to replace exceptions thrown by `throwIO` that would like to think of as precise. This fixes that, but is certanly much more conservative than we would ideally like. Let's see how bad it is. Fixes Trac #13380 Reviewers: austin, bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3301 >--------------------------------------------------------------- 7b087aeba45a7a70a5553ef4c116ee67660423e8 compiler/prelude/primops.txt.pp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 1d10223..64971a3 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -2005,11 +2005,9 @@ primop RaiseOp "raise#" GenPrimOp -- must be *precise* - we don't want the strictness analyser turning -- one kind of bottom into another, as it is allowed to do in pure code. -- --- But we *do* want to know that it returns bottom after --- being applied to two arguments, so that this function is strict in y --- f x y | x>0 = raiseIO blah --- | y>0 = return 1 --- | otherwise = return 2 +-- We currently produce topRes, which is much too conservative (interfering +-- with dead code elimination, unfortunately), but nothing else we currently +-- have on tap is actually correct. -- -- TODO Check that the above notes on @f@ are valid. The function successfully -- produces an IO exception when compiled without optimization. If we analyze @@ -2021,7 +2019,7 @@ primop RaiseOp "raise#" GenPrimOp primop RaiseIOOp "raiseIO#" GenPrimOp a -> State# RealWorld -> (# State# RealWorld, b #) with - strictness = { \ _arity -> mkClosedStrictSig [topDmd, topDmd] exnRes } + strictness = { \ _arity -> mkClosedStrictSig [topDmd, topDmd] topRes } out_of_line = True has_side_effects = True From git at git.haskell.org Thu Mar 9 16:13:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 16:13:30 +0000 (UTC) Subject: [commit: ghc] master: llvm backend: Put string constants in .rodata.str.* sections (#13265) (90009cf) Message-ID: <20170309161330.BD10C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/90009cf62bcebf875e68af625dbdbfc3c2f71717/ghc >--------------------------------------------------------------- commit 90009cf62bcebf875e68af625dbdbfc3c2f71717 Author: Reid Barton Date: Thu Mar 9 10:42:49 2017 -0500 llvm backend: Put string constants in .rodata.str.* sections (#13265) The .cstring.* sections don't get merged by the linker (bfd or gold). That's bad, and especially bad in #13265 where it caused the number of sections to exceed what is apparently an internal limit in ld.bfd. Test Plan: I can only test this on Linux, and I am guessing at what the correct behavior is on Mac OS and Windows (and AIX I suppose). Testers on other platforms would be much appreciated, though I understand that the LLVM backend is broken on Mac OS currently for other reasons (#13378). Reviewers: olsner, austin, xnyhps, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3282 >--------------------------------------------------------------- 90009cf62bcebf875e68af625dbdbfc3c2f71717 compiler/llvmGen/LlvmCodeGen/Data.hs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/compiler/llvmGen/LlvmCodeGen/Data.hs b/compiler/llvmGen/LlvmCodeGen/Data.hs index 0f0ca6e..9bb5a75 100644 --- a/compiler/llvmGen/LlvmCodeGen/Data.hs +++ b/compiler/llvmGen/LlvmCodeGen/Data.hs @@ -16,6 +16,7 @@ import BlockId import CLabel import Cmm import DynFlags +import Platform import FastString import Outputable @@ -46,8 +47,11 @@ genLlvmData (sec, Statics lbl xs) = do struct = Just $ LMStaticStruc static tyAlias link = if (externallyVisibleCLabel lbl) then ExternallyVisible else Internal + align = case sec of + Section CString _ -> Just 1 + _ -> Nothing const = if isSecConstant sec then Constant else Global - varDef = LMGlobalVar label tyAlias link lmsec Nothing const + varDef = LMGlobalVar label tyAlias link lmsec align const globDef = LMGlobal varDef struct return ([globDef], [tyAlias]) @@ -65,15 +69,17 @@ isSecConstant (Section t _) = case t of (OtherSection _) -> False -- | Format the section type part of a Cmm Section -llvmSectionType :: SectionType -> FastString -llvmSectionType t = case t of +llvmSectionType :: Platform -> SectionType -> FastString +llvmSectionType p t = case t of Text -> fsLit ".text" ReadOnlyData -> fsLit ".rodata" RelocatableReadOnlyData -> fsLit ".data.rel.ro" ReadOnlyData16 -> fsLit ".rodata.cst16" Data -> fsLit ".data" UninitialisedData -> fsLit ".bss" - CString -> fsLit ".cstring" + CString -> case platformOS p of + OSMinGW32 -> fsLit ".rdata" + _ -> fsLit ".rodata.str" (OtherSection _) -> panic "llvmSectionType: unknown section type" -- | Format a Cmm Section into a LLVM section name @@ -81,11 +87,12 @@ llvmSection :: Section -> LlvmM LMSection llvmSection (Section t suffix) = do dflags <- getDynFlags let splitSect = gopt Opt_SplitSections dflags + platform = targetPlatform dflags if not splitSect then return Nothing else do lmsuffix <- strCLabel_llvm suffix - return (Just (concatFS [llvmSectionType t, fsLit ".", lmsuffix])) + return (Just (concatFS [llvmSectionType platform t, fsLit ".", lmsuffix])) -- ---------------------------------------------------------------------------- -- * Generate static data From git at git.haskell.org Thu Mar 9 16:13:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 16:13:33 +0000 (UTC) Subject: [commit: ghc] master: configure.ac: Bump version to 8.3 (5dce216) Message-ID: <20170309161333.779153A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5dce2160a1b361eba7d0109d314246c8ec97878b/ghc >--------------------------------------------------------------- commit 5dce2160a1b361eba7d0109d314246c8ec97878b Author: Ben Gamari Date: Thu Mar 9 10:48:13 2017 -0500 configure.ac: Bump version to 8.3 >--------------------------------------------------------------- 5dce2160a1b361eba7d0109d314246c8ec97878b configure.ac | 2 +- iserv/iserv-bin.cabal | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 949c3d0..8846523 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,7 @@ dnl # see what flags are available. (Better yet, read the documentation!) # -AC_INIT([The Glorious Glasgow Haskell Compilation System], [8.1], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) +AC_INIT([The Glorious Glasgow Haskell Compilation System], [8.3], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) # Set this to YES for a released version, otherwise NO : ${RELEASE=NO} diff --git a/iserv/iserv-bin.cabal b/iserv/iserv-bin.cabal index eb33277..5307e7f 100644 --- a/iserv/iserv-bin.cabal +++ b/iserv/iserv-bin.cabal @@ -24,7 +24,7 @@ Executable iserv bytestring >= 0.10 && < 0.11, containers >= 0.5 && < 0.6, deepseq >= 1.4 && < 1.5, - ghci == 8.1 + ghci == 8.3 if os(windows) Cpp-Options: -DWINDOWS From git at git.haskell.org Thu Mar 9 17:16:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 17:16:30 +0000 (UTC) Subject: [commit: ghc] master: integerConstantFolding: no longer broken with -DDEBUG (#1106) (712c45d) Message-ID: <20170309171630.4CB7A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/712c45d035797a392e33bba3f8ec4293af61ecab/ghc >--------------------------------------------------------------- commit 712c45d035797a392e33bba3f8ec4293af61ecab Author: Joachim Breitner Date: Thu Mar 9 18:13:32 2017 +0100 integerConstantFolding: no longer broken with -DDEBUG (#1106) >--------------------------------------------------------------- 712c45d035797a392e33bba3f8ec4293af61ecab testsuite/tests/lib/integer/all.T | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/testsuite/tests/lib/integer/all.T b/testsuite/tests/lib/integer/all.T index ca785f9..e9b19eb 100644 --- a/testsuite/tests/lib/integer/all.T +++ b/testsuite/tests/lib/integer/all.T @@ -3,8 +3,7 @@ test('integerConversions', normal, compile_and_run, ['']) # skip ghci as it doesn't support unboxed tuples test('integerGmpInternals', [reqlib('integer-gmp'), omit_ways('ghci')], compile_and_run, ['']) test('plusMinusInteger', [reqlib('integer-gmp'), omit_ways('ghci')], compile_and_run, ['']) -test('integerConstantFolding', - [when(compiler_debugged(), expect_broken(11006))], run_command, +test('integerConstantFolding', [], run_command, ['$MAKE -s --no-print-directory integerConstantFolding']) test('fromToInteger', [], run_command, ['$MAKE -s --no-print-directory fromToInteger']) From git at git.haskell.org Thu Mar 9 18:00:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 18:00:39 +0000 (UTC) Subject: [commit: ghc] master: Revert "configure.ac: Bump version to 8.3" (a6f9c44) Message-ID: <20170309180039.7488A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a6f9c44c3eb8162b84ee603f9de64974b95aa093/ghc >--------------------------------------------------------------- commit a6f9c44c3eb8162b84ee603f9de64974b95aa093 Author: Ben Gamari Date: Thu Mar 9 12:59:16 2017 -0500 Revert "configure.ac: Bump version to 8.3" This reverts commit 5dce2160a1b361eba7d0109d314246c8ec97878b as it didn't build. >--------------------------------------------------------------- a6f9c44c3eb8162b84ee603f9de64974b95aa093 configure.ac | 2 +- iserv/iserv-bin.cabal | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 8846523..949c3d0 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,7 @@ dnl # see what flags are available. (Better yet, read the documentation!) # -AC_INIT([The Glorious Glasgow Haskell Compilation System], [8.3], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) +AC_INIT([The Glorious Glasgow Haskell Compilation System], [8.1], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) # Set this to YES for a released version, otherwise NO : ${RELEASE=NO} diff --git a/iserv/iserv-bin.cabal b/iserv/iserv-bin.cabal index 5307e7f..eb33277 100644 --- a/iserv/iserv-bin.cabal +++ b/iserv/iserv-bin.cabal @@ -24,7 +24,7 @@ Executable iserv bytestring >= 0.10 && < 0.11, containers >= 0.5 && < 0.6, deepseq >= 1.4 && < 1.5, - ghci == 8.3 + ghci == 8.1 if os(windows) Cpp-Options: -DWINDOWS From git at git.haskell.org Thu Mar 9 21:02:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 21:02:04 +0000 (UTC) Subject: [commit: ghc] master: Fix test results for T13380 (37a415e) Message-ID: <20170309210204.BBF6B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/37a415e23cb68bf74d942453817a546c2652a457/ghc >--------------------------------------------------------------- commit 37a415e23cb68bf74d942453817a546c2652a457 Author: David Feuer Date: Thu Mar 9 16:01:50 2017 -0500 Fix test results for T13380 They were `expect_broken` without any output. Add the actual output and remove the `expect_broken`. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3306 >--------------------------------------------------------------- 37a415e23cb68bf74d942453817a546c2652a457 testsuite/tests/stranal/should_run/T13380.stderr | 1 + testsuite/tests/stranal/should_run/all.T | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/stranal/should_run/T13380.stderr b/testsuite/tests/stranal/should_run/T13380.stderr new file mode 100644 index 0000000..6fa8811 --- /dev/null +++ b/testsuite/tests/stranal/should_run/T13380.stderr @@ -0,0 +1 @@ +T13380: user error (What) diff --git a/testsuite/tests/stranal/should_run/all.T b/testsuite/tests/stranal/should_run/all.T index 0764746..a07900b 100644 --- a/testsuite/tests/stranal/should_run/all.T +++ b/testsuite/tests/stranal/should_run/all.T @@ -14,4 +14,4 @@ test('T11076', normal, multimod_compile_and_run, ['T11076.hs', 'T11076_prim.cmm' test('T11555a', normal, compile_and_run, ['']) test('T12368', exit_code(1), compile_and_run, ['']) test('T12368a', exit_code(1), compile_and_run, ['']) -test('T13380', [expect_broken(13380), exit_code(1)], compile_and_run, ['']) +test('T13380', exit_code(1), compile_and_run, ['']) From git at git.haskell.org Thu Mar 9 22:41:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 22:41:39 +0000 (UTC) Subject: [commit: ghc] branch 'wip/strictify-catches' created Message-ID: <20170309224139.59DE73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/strictify-catches Referencing: 16f03f1c83de3c7e70cb62a0d95abc0488dd32a1 From git at git.haskell.org Thu Mar 9 22:41:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 22:41:42 +0000 (UTC) Subject: [commit: ghc] wip/strictify-catches: Try strictifying catches (16f03f1) Message-ID: <20170309224142.25BA73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/strictify-catches Link : http://ghc.haskell.org/trac/ghc/changeset/16f03f1c83de3c7e70cb62a0d95abc0488dd32a1/ghc >--------------------------------------------------------------- commit 16f03f1c83de3c7e70cb62a0d95abc0488dd32a1 Author: David Feuer Date: Thu Mar 9 15:50:36 2017 -0500 Try strictifying catches * Make `catchException` and `catchAny` lazy like they probably should be. * Manually strictify some things surrounding `catch` in the libraries. >--------------------------------------------------------------- 16f03f1c83de3c7e70cb62a0d95abc0488dd32a1 libraries/base/Control/Concurrent.hs | 4 ++-- libraries/base/GHC/Conc/Sync.hs | 8 -------- libraries/base/GHC/IO.hs | 29 +++++------------------------ libraries/base/GHC/IO/Handle/FD.hs | 6 +++--- libraries/base/GHC/IO/Handle/Internals.hs | 5 ++--- libraries/base/GHC/IO/Handle/Text.hs | 7 +++---- libraries/base/GHC/TopHandler.hs | 4 ++-- 7 files changed, 17 insertions(+), 46 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 16f03f1c83de3c7e70cb62a0d95abc0488dd32a1 From git at git.haskell.org Thu Mar 9 22:53:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 22:53:01 +0000 (UTC) Subject: [commit: ghc] master: configure.ac: Ensure that we handle case of non-present --target (b09bf4b) Message-ID: <20170309225301.0896E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b09bf4b0c0b01c1c53e972e52ceaeb28de66ae07/ghc >--------------------------------------------------------------- commit b09bf4b0c0b01c1c53e972e52ceaeb28de66ae07 Author: Ben Gamari Date: Thu Mar 9 16:19:56 2017 -0500 configure.ac: Ensure that we handle case of non-present --target @rwbarton pointed out that this could be an issue during review, but I assumed from my point sample of three test builds that this wouldn't be necessary. Sadly, none of these builds were on Windows, which indeed does fail. Strangely, only Simon and Harbormaster have been able to replicate the issue (which apparently manifests as libffi thinking it's building for unix). I've been completely unable to replicate the failure in my own builds, neither locally nor on the Harbormaster machine. Test Plan: Validate on Windows Reviewers: austin, Phyx, hvr Reviewed By: Phyx Subscribers: thomie, rwbarton, erikd Differential Revision: https://phabricator.haskell.org/D3304 >--------------------------------------------------------------- b09bf4b0c0b01c1c53e972e52ceaeb28de66ae07 configure.ac | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 949c3d0..9864f32 100644 --- a/configure.ac +++ b/configure.ac @@ -446,7 +446,13 @@ fi # all be taken care of for us if we configured the subprojects using # AC_CONFIG_DIR, but unfortunately Cabal needs to be the one to do the # configuration. -TargetPlatformFull="${target_alias}" +if test -z "${target_alias}" +then + # --target wasn't given; use result from AC_CANONICAL_TARGET + TargetPlatformFull="${target}" +else + TargetPlatformFull="${target_alias}" +fi AC_SUBST(CrossCompiling) AC_SUBST(CrossCompilePrefix) AC_SUBST(TargetPlatformFull) From git at git.haskell.org Thu Mar 9 22:53:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 22:53:03 +0000 (UTC) Subject: [commit: ghc] master: Data.Typeable: Export splitTyConApp, typeRepArgs, and typeRepTyCon (6b15dfe) Message-ID: <20170309225303.B35773A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6b15dfe85052c40f0cedf9bdbb0c9943a4977492/ghc >--------------------------------------------------------------- commit 6b15dfe85052c40f0cedf9bdbb0c9943a4977492 Author: Ben Gamari Date: Thu Mar 9 16:20:38 2017 -0500 Data.Typeable: Export splitTyConApp, typeRepArgs, and typeRepTyCon Test Plan: Validate Reviewers: austin, hvr, RyanGlScott Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3294 >--------------------------------------------------------------- 6b15dfe85052c40f0cedf9bdbb0c9943a4977492 libraries/base/Data/Typeable.hs | 26 ++++++++++++++++++-------- libraries/base/Data/Typeable/Internal.hs | 2 ++ libraries/base/Type/Reflection.hs | 2 ++ libraries/base/Type/Reflection/Unsafe.hs | 17 ++++++++++------- libraries/base/changelog.md | 7 +++++++ 5 files changed, 39 insertions(+), 15 deletions(-) diff --git a/libraries/base/Data/Typeable.hs b/libraries/base/Data/Typeable.hs index 8a6422e..d4b28f1 100644 --- a/libraries/base/Data/Typeable.hs +++ b/libraries/base/Data/Typeable.hs @@ -65,13 +65,15 @@ module Data.Typeable -- * Type representations , TypeRep - , typeRepTyCon , rnfTypeRep , showsTypeRep , mkFunTy -- * Observing type representations , funResultTy + , splitTyConApp + , typeRepArgs + , typeRepTyCon , I.typeRepFingerprint -- * Type constructors @@ -81,6 +83,7 @@ module Data.Typeable , I.tyConModule , I.tyConName , I.rnfTyCon + , I.tyConFingerprint -- * For backwards compatibility , typeOf1, typeOf2, typeOf3, typeOf4, typeOf5, typeOf6, typeOf7 @@ -149,10 +152,6 @@ gcast2 :: forall c t t' a b. (Typeable t, Typeable t') => c (t a b) -> Maybe (c (t' a b)) gcast2 x = fmap (\Refl -> x) (eqT :: Maybe (t :~: t')) --- | Observe the type constructor of a quantified type representation. -typeRepTyCon :: TypeRep -> TyCon -typeRepTyCon = I.typeRepXTyCon - -- | Applies a type to a function type. Returns: @Just u@ if the first argument -- represents a function of type @t -> u@ and the second argument represents a -- function of type @t at . Otherwise, returns @Nothing at . @@ -173,9 +172,20 @@ mkFunTy (I.SomeTypeRep arg) (I.SomeTypeRep res) | otherwise = error $ "mkFunTy: Attempted to construct function type from non-lifted "++ "type: arg="++show arg++", res="++show res - where liftedTy = I.typeRep :: I.TypeRep * - -- TODO: We should be able to support this but the kind of (->) must be - -- generalized + where liftedTy = I.typeRep :: I.TypeRep Type + +-- | Splits a type constructor application. Note that if the type constructor is +-- polymorphic, this will not return the kinds that were used. +splitTyConApp :: TypeRep -> (TyCon, [TypeRep]) +splitTyConApp (I.SomeTypeRep x) = I.splitApps x + +-- | Observe the argument types of a type representation +typeRepArgs :: TypeRep -> [TypeRep] +typeRepArgs ty = case splitTyConApp ty of (_, args) -> args + +-- | Observe the type constructor of a quantified type representation. +typeRepTyCon :: TypeRep -> TyCon +typeRepTyCon = I.typeRepXTyCon -- | Force a 'TypeRep' to normal form. rnfTypeRep :: TypeRep -> () diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index 85a356c..f4e690b 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -45,6 +45,7 @@ module Data.Typeable.Internal ( -- * TyCon TyCon, -- Abstract tyConPackage, tyConModule, tyConName, tyConKindArgs, tyConKindRep, + tyConFingerprint, KindRep(.., KindRepTypeLit), TypeLitSort(..), rnfTyCon, @@ -58,6 +59,7 @@ module Data.Typeable.Internal ( rnfTypeRep, eqTypeRep, typeRepKind, + splitApps, -- * SomeTypeRep SomeTypeRep(..), diff --git a/libraries/base/Type/Reflection.hs b/libraries/base/Type/Reflection.hs index 59f16ac..dc1c3cf 100644 --- a/libraries/base/Type/Reflection.hs +++ b/libraries/base/Type/Reflection.hs @@ -45,6 +45,7 @@ module Type.Reflection , I.rnfTypeRep , I.eqTypeRep , I.typeRepKind + , I.splitApps -- ** Quantified -- @@ -61,6 +62,7 @@ module Type.Reflection , I.tyConModule , I.tyConName , I.rnfTyCon + , I.tyConFingerprint -- * Module names , I.Module diff --git a/libraries/base/Type/Reflection/Unsafe.hs b/libraries/base/Type/Reflection/Unsafe.hs index 4e367f5..4cffd89 100644 --- a/libraries/base/Type/Reflection/Unsafe.hs +++ b/libraries/base/Type/Reflection/Unsafe.hs @@ -4,19 +4,22 @@ -- Copyright : (c) The University of Glasgow, CWI 2001--2015 -- License : BSD-style (see the file libraries/base/LICENSE) -- --- The representations of the types TyCon and TypeRep, and the --- function mkTyCon which is used by derived instances of Typeable to --- construct a TyCon. +-- The representations of the types 'TyCon' and 'TypeRep', and the function +-- 'mkTyCon' which is used by derived instances of 'Typeable' to construct +-- 'TyCon's. -- --- Be warned, these functions can be used to construct ill-typed +-- Be warned, these functions can be used to construct ill-kinded -- type representations. -- ----------------------------------------------------------------------------- module Type.Reflection.Unsafe ( - tyConKindRep, tyConKindArgs, - KindRep(..), TypeLitSort(..), - mkTrCon, mkTrApp, mkTyCon + -- * Type representations + TypeRep, mkTrApp, mkTyCon + -- * Kind representations + , KindRep(..), TypeLitSort(..) + -- * Type constructors + , TyCon, mkTrCon, tyConKindRep, tyConKindArgs, ) where import Data.Typeable.Internal diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 2c9d029..abae5ae 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -77,6 +77,13 @@ `Data.Foldable` to use `foldl1` instead of `foldr1`. This makes them run in constant space when applied to lists. (#10830) + * `mkFunTy`, `mkAppTy`, and `mkTyConApp` from `Data.Typeable` no longer exist. + This functionality is superceded by the interfaces provided by + `Data.Reflection`. + + * `mkTyCon3` is no longer exported by `Data.Typeable`. This function is + replaced by `Type.Reflection.Unsafe.mkTyCon`. + ## 4.9.0.0 *May 2016* * Bundled with GHC 8.0 From git at git.haskell.org Thu Mar 9 23:12:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 23:12:38 +0000 (UTC) Subject: [commit: ghc] master: Fix typo in base changelog (2b5b9dc) Message-ID: <20170309231238.199873A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2b5b9dc69e5d0af20b6e7be31638c2e3a1bb765f/ghc >--------------------------------------------------------------- commit 2b5b9dc69e5d0af20b6e7be31638c2e3a1bb765f Author: Ryan Scott Date: Thu Mar 9 18:10:56 2017 -0500 Fix typo in base changelog Replace `Data.Reflection` with `Type.Reflection`. >--------------------------------------------------------------- 2b5b9dc69e5d0af20b6e7be31638c2e3a1bb765f libraries/base/changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index abae5ae..f2ea265 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -79,7 +79,7 @@ * `mkFunTy`, `mkAppTy`, and `mkTyConApp` from `Data.Typeable` no longer exist. This functionality is superceded by the interfaces provided by - `Data.Reflection`. + `Type.Reflection`. * `mkTyCon3` is no longer exported by `Data.Typeable`. This function is replaced by `Type.Reflection.Unsafe.mkTyCon`. From git at git.haskell.org Thu Mar 9 23:40:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 23:40:36 +0000 (UTC) Subject: [commit: ghc] branch 'wip/interleave-rw' created Message-ID: <20170309234036.21BB23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/interleave-rw Referencing: 544b6b14ae8636f7d2a7feb15bac2610499ba345 From git at git.haskell.org Thu Mar 9 23:40:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Mar 2017 23:40:38 +0000 (UTC) Subject: [commit: ghc] wip/interleave-rw: Use runRW# to implement unsafeInterleaveIO (544b6b1) Message-ID: <20170309234038.CD50A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/interleave-rw Link : http://ghc.haskell.org/trac/ghc/changeset/544b6b14ae8636f7d2a7feb15bac2610499ba345/ghc >--------------------------------------------------------------- commit 544b6b14ae8636f7d2a7feb15bac2610499ba345 Author: David Feuer Date: Thu Mar 9 18:39:16 2017 -0500 Use runRW# to implement unsafeInterleaveIO Summary: Instead of holding on to the past, let's start a new timeline. This seems a lot cleaner, and may even allow inlining. Fixes Trac #13405 Reviewers: austin, hvr, bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3308 >--------------------------------------------------------------- 544b6b14ae8636f7d2a7feb15bac2610499ba345 libraries/base/GHC/IO/Unsafe.hs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libraries/base/GHC/IO/Unsafe.hs b/libraries/base/GHC/IO/Unsafe.hs index 7523535..2a5a87f 100644 --- a/libraries/base/GHC/IO/Unsafe.hs +++ b/libraries/base/GHC/IO/Unsafe.hs @@ -130,14 +130,11 @@ unsafeInterleaveIO m = unsafeDupableInterleaveIO (noDuplicate >> m) -- a readMVar, but it seems wrong for unsafeInterleaveIO to sometimes -- share and sometimes not (plus it probably breaks the noDuplicate). -- So now, we do not inline unsafeDupableInterleaveIO. - -{-# NOINLINE unsafeDupableInterleaveIO #-} +{-# INLINE unsafeDupableInterleaveIO #-} unsafeDupableInterleaveIO :: IO a -> IO a unsafeDupableInterleaveIO (IO m) - = IO ( \ s -> let - r = case m s of (# _, res #) -> res - in - (# s, r #)) + = IO ( \ s -> + (# s, runRW# (\s2 -> case m s2 of (# _, res #) -> res) #)) {-| Ensures that the suspensions under evaluation by the current thread From git at git.haskell.org Fri Mar 10 02:13:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Mar 2017 02:13:25 +0000 (UTC) Subject: [commit: ghc] master: configure.ac: Bump version to 8.3 (a6e06c7) Message-ID: <20170310021325.66C623A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a6e06c7b6ac9d0eb54f09721dbac9b1bed4c8c32/ghc >--------------------------------------------------------------- commit a6e06c7b6ac9d0eb54f09721dbac9b1bed4c8c32 Author: Ben Gamari Date: Thu Mar 9 13:01:03 2017 -0500 configure.ac: Bump version to 8.3 Bumps haddock submodule >--------------------------------------------------------------- a6e06c7b6ac9d0eb54f09721dbac9b1bed4c8c32 configure.ac | 2 +- iserv/iserv-bin.cabal | 2 +- libraries/template-haskell/Language/Haskell/TH/Lib.hs | 2 +- libraries/template-haskell/template-haskell.cabal | 2 +- utils/haddock | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 9864f32..736c124 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,7 @@ dnl # see what flags are available. (Better yet, read the documentation!) # -AC_INIT([The Glorious Glasgow Haskell Compilation System], [8.1], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) +AC_INIT([The Glorious Glasgow Haskell Compilation System], [8.3], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) # Set this to YES for a released version, otherwise NO : ${RELEASE=NO} diff --git a/iserv/iserv-bin.cabal b/iserv/iserv-bin.cabal index eb33277..5307e7f 100644 --- a/iserv/iserv-bin.cabal +++ b/iserv/iserv-bin.cabal @@ -24,7 +24,7 @@ Executable iserv bytestring >= 0.10 && < 0.11, containers >= 0.5 && < 0.6, deepseq >= 1.4 && < 1.5, - ghci == 8.1 + ghci == 8.3 if os(windows) Cpp-Options: -DWINDOWS diff --git a/libraries/template-haskell/Language/Haskell/TH/Lib.hs b/libraries/template-haskell/Language/Haskell/TH/Lib.hs index a3cbc8e..860ccc3 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Lib.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Lib.hs @@ -608,7 +608,7 @@ closedTypeFamilyD tc tvs result injectivity eqns = -- 3. remove the FamFlavour data type from Syntax module -- 4. make sure that all references to FamFlavour are gone from DsMeta, -- Convert, TcSplice (follows from 3) -#if __GLASGOW_HASKELL__ >= 802 +#if __GLASGOW_HASKELL__ >= 804 #error Remove deprecated familyNoKindD, familyKindD, closedTypeFamilyNoKindD and closedTypeFamilyKindD #endif diff --git a/libraries/template-haskell/template-haskell.cabal b/libraries/template-haskell/template-haskell.cabal index 71e5e02..dfb3b07 100644 --- a/libraries/template-haskell/template-haskell.cabal +++ b/libraries/template-haskell/template-haskell.cabal @@ -50,7 +50,7 @@ Library build-depends: base >= 4.8 && < 4.11, - ghc-boot-th == 8.1, + ghc-boot-th == 8.3, pretty == 1.1.* -- We need to set the unit ID to template-haskell (without a diff --git a/utils/haddock b/utils/haddock index dbbdabf..9acb289 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit dbbdabfd3842f70c78d4c64e10f75f47fe5c0f5d +Subproject commit 9acb2890cdb4369f3bb7fda899ff4d3526040e7d From git at git.haskell.org Fri Mar 10 07:44:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Mar 2017 07:44:23 +0000 (UTC) Subject: [commit: ghc] wip/interleave-rw: Simplify further (89fe57e) Message-ID: <20170310074423.96FE53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/interleave-rw Link : http://ghc.haskell.org/trac/ghc/changeset/89fe57ebd63fbb06dd2b15a962791b2f7f9b20fa/ghc >--------------------------------------------------------------- commit 89fe57ebd63fbb06dd2b15a962791b2f7f9b20fa Author: David Feuer Date: Fri Mar 10 02:43:08 2017 -0500 Simplify further If I'm not very badly mistaken, ``` unsafeInterleaveIO = pure . unsafePerformIO unsafeDupableInterleaveIO = pure . unsafeDupablePerformIO ``` Assuming this is right, we can just define them like that. >--------------------------------------------------------------- 89fe57ebd63fbb06dd2b15a962791b2f7f9b20fa libraries/base/GHC/IO/Unsafe.hs | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/libraries/base/GHC/IO/Unsafe.hs b/libraries/base/GHC/IO/Unsafe.hs index 2a5a87f..0d98d70 100644 --- a/libraries/base/GHC/IO/Unsafe.hs +++ b/libraries/base/GHC/IO/Unsafe.hs @@ -108,33 +108,17 @@ unsafeDupablePerformIO (IO m) = case runRW# m of (# _, a #) -> a When passed a value of type @IO a@, the 'IO' will only be performed when the value of the @a@ is demanded. This is used to implement lazy file reading, see 'System.IO.hGetContents'. + +@ unsafeInterleaveIO m === pure (unsafePerformIO m) @ -} {-# INLINE unsafeInterleaveIO #-} unsafeInterleaveIO :: IO a -> IO a -unsafeInterleaveIO m = unsafeDupableInterleaveIO (noDuplicate >> m) +unsafeInterleaveIO m = pure (unsafePerformIO m) --- We used to believe that INLINE on unsafeInterleaveIO was safe, --- because the state from this IO thread is passed explicitly to the --- interleaved IO, so it cannot be floated out and shared. --- --- HOWEVER, if the compiler figures out that r is used strictly here, --- then it will eliminate the thunk and the side effects in m will no --- longer be shared in the way the programmer was probably expecting, --- but can be performed many times. In #5943, this broke our --- definition of fixIO, which contains --- --- ans <- unsafeInterleaveIO (takeMVar m) --- --- after inlining, we lose the sharing of the takeMVar, so the second --- time 'ans' was demanded we got a deadlock. We could fix this with --- a readMVar, but it seems wrong for unsafeInterleaveIO to sometimes --- share and sometimes not (plus it probably breaks the noDuplicate). --- So now, we do not inline unsafeDupableInterleaveIO. +-- | @ unsafeDupableInterleaveIO m = pure (unsafeDupablePerformIO m) @ {-# INLINE unsafeDupableInterleaveIO #-} unsafeDupableInterleaveIO :: IO a -> IO a -unsafeDupableInterleaveIO (IO m) - = IO ( \ s -> - (# s, runRW# (\s2 -> case m s2 of (# _, res #) -> res) #)) +unsafeDupableInterleaveIO m = pure (unsafeDupablePerformIO m) {-| Ensures that the suspensions under evaluation by the current thread From git at git.haskell.org Fri Mar 10 09:56:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Mar 2017 09:56:47 +0000 (UTC) Subject: [commit: ghc] master: implement missing Fabs{32, 64} on i386 NCG and UNREG (46246a6) Message-ID: <20170310095647.A5FE83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/46246a6d57c35ebf12032d13a4cd7ff18f713770/ghc >--------------------------------------------------------------- commit 46246a6d57c35ebf12032d13a4cd7ff18f713770 Author: Sergei Trofimovich Date: Fri Mar 10 09:30:10 2017 +0000 implement missing Fabs{32,64} on i386 NCG and UNREG Noticed breakage as build failure on i386 freebsd build bot: http://haskell.inf.elte.hu/builders/freebsd-i386-head/1267/10.html ghc-stage1: panic! (the 'impossible' happened) (GHC version 8.1.20170310 for i386-portbld-freebsd): outOfLineCmmOp: MO_F64_Fabs not supported here Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 46246a6d57c35ebf12032d13a4cd7ff18f713770 compiler/cmm/PprC.hs | 4 ++-- compiler/nativeGen/X86/CodeGen.hs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs index 6a84e30..aa21174 100644 --- a/compiler/cmm/PprC.hs +++ b/compiler/cmm/PprC.hs @@ -754,7 +754,7 @@ pprCallishMachOp_for_C mop MO_F64_Log -> text "log" MO_F64_Exp -> text "exp" MO_F64_Sqrt -> text "sqrt" - MO_F64_Fabs -> unsupported + MO_F64_Fabs -> text "fabs" MO_F32_Pwr -> text "powf" MO_F32_Sin -> text "sinf" MO_F32_Cos -> text "cosf" @@ -768,7 +768,7 @@ pprCallishMachOp_for_C mop MO_F32_Log -> text "logf" MO_F32_Exp -> text "expf" MO_F32_Sqrt -> text "sqrtf" - MO_F32_Fabs -> unsupported + MO_F32_Fabs -> text "fabsf" MO_WriteBarrier -> text "write_barrier" MO_Memcpy _ -> text "memcpy" MO_Memset _ -> text "memset" diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs index 704514e..562303c 100644 --- a/compiler/nativeGen/X86/CodeGen.hs +++ b/compiler/nativeGen/X86/CodeGen.hs @@ -2623,7 +2623,7 @@ outOfLineCmmOp mop res args fn = case mop of MO_F32_Sqrt -> fsLit "sqrtf" - MO_F32_Fabs -> unsupported + MO_F32_Fabs -> fsLit "fabsf" MO_F32_Sin -> fsLit "sinf" MO_F32_Cos -> fsLit "cosf" MO_F32_Tan -> fsLit "tanf" @@ -2640,7 +2640,7 @@ outOfLineCmmOp mop res args MO_F32_Pwr -> fsLit "powf" MO_F64_Sqrt -> fsLit "sqrt" - MO_F64_Fabs -> unsupported + MO_F64_Fabs -> fsLit "fabs" MO_F64_Sin -> fsLit "sin" MO_F64_Cos -> fsLit "cos" MO_F64_Tan -> fsLit "tan" From git at git.haskell.org Fri Mar 10 14:38:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Mar 2017 14:38:10 +0000 (UTC) Subject: [commit: packages/array] master: Update test output to track GHC head (1b9a443) Message-ID: <20170310143810.32D093A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array On branch : master Link : http://git.haskell.org/packages/array.git/commitdiff/1b9a4430bbd6799f341a829f2d24ffc20e77ba2f >--------------------------------------------------------------- commit 1b9a4430bbd6799f341a829f2d24ffc20e77ba2f Author: Simon Peyton Jones Date: Fri Mar 10 14:37:00 2017 +0000 Update test output to track GHC head >--------------------------------------------------------------- 1b9a4430bbd6799f341a829f2d24ffc20e77ba2f tests/T9220.stdout | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/T9220.stdout b/tests/T9220.stdout index 7513284..71582f2 100644 --- a/tests/T9220.stdout +++ b/tests/T9220.stdout @@ -5,10 +5,6 @@ data Data.Array.Base.UArray i e {-# UNPACK #-}Int GHC.Prim.ByteArray# -- Defined in ‘Data.Array.Base’ -instance (GHC.Arr.Ix ix, Show ix, Show e, - Data.Array.Base.IArray Data.Array.Base.UArray e) => - Show (Data.Array.Base.UArray ix e) - -- Defined in ‘Data.Array.Base’ instance (GHC.Arr.Ix ix, Eq e, Data.Array.Base.IArray Data.Array.Base.UArray e) => Eq (Data.Array.Base.UArray ix e) @@ -17,6 +13,10 @@ instance (GHC.Arr.Ix ix, Ord e, Data.Array.Base.IArray Data.Array.Base.UArray e) => Ord (Data.Array.Base.UArray ix e) -- Defined in ‘Data.Array.Base’ +instance (GHC.Arr.Ix ix, Show ix, Show e, + Data.Array.Base.IArray Data.Array.Base.UArray e) => + Show (Data.Array.Base.UArray ix e) + -- Defined in ‘Data.Array.Base’ type role Data.Array.IO.Internals.IOUArray nominal nominal newtype Data.Array.IO.Internals.IOUArray i e = Data.Array.IO.Internals.IOUArray (Data.Array.Base.STUArray From git at git.haskell.org Fri Mar 10 16:05:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Mar 2017 16:05:54 +0000 (UTC) Subject: [commit: ghc] master: Do not generate a data-con wrapper for !Int# (900cfdc) Message-ID: <20170310160554.0A66E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/900cfdc2700ad9e8c7a12dd25bb0396e5e7651df/ghc >--------------------------------------------------------------- commit 900cfdc2700ad9e8c7a12dd25bb0396e5e7651df Author: Simon Peyton Jones Date: Thu Mar 9 15:58:32 2017 +0000 Do not generate a data-con wrapper for !Int# See Note [Data con wrappers and unlifted types] in MkId. We were being totally stupid! See Trac #1600 comment:66 >--------------------------------------------------------------- 900cfdc2700ad9e8c7a12dd25bb0396e5e7651df compiler/basicTypes/DataCon.hs | 2 +- compiler/basicTypes/MkId.hs | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/compiler/basicTypes/DataCon.hs b/compiler/basicTypes/DataCon.hs index 43bcf75..c6bb8eb 100644 --- a/compiler/basicTypes/DataCon.hs +++ b/compiler/basicTypes/DataCon.hs @@ -504,7 +504,7 @@ data HsSrcBang = -- Bangs of data constructor arguments as generated by the compiler -- after consulting HsSrcBang, flags, etc. data HsImplBang - = HsLazy -- ^ Lazy field + = HsLazy -- ^ Lazy field, or one with an unlifted type | HsStrict -- ^ Strict but not unpacked field | HsUnpack (Maybe Coercion) -- ^ Strict and unpacked field diff --git a/compiler/basicTypes/MkId.hs b/compiler/basicTypes/MkId.hs index 890a4bf..6be2b5c 100644 --- a/compiler/basicTypes/MkId.hs +++ b/compiler/basicTypes/MkId.hs @@ -657,6 +657,18 @@ the interface file. The HsImplBangs passed are in 1-1 correspondence with the dataConOrigArgTys of the DataCon. +Note [Data con wrappers and unlifted types] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider + data T = MkT !Int# + +We certainly do not want to make a wrapper + $WMkT x = case x of y { DEFAULT -> MkT y } + +For a start, it's still to generate a no-op. But worse, since wrappers +are currently injected at TidyCore, we don't even optimise it away! +So the stupid case expression stays there. This actually happened for +the Integer data type (see Trac #1600 comment:66)! -} ------------------------- @@ -673,7 +685,7 @@ dataConSrcToImplBang -> HsImplBang dataConSrcToImplBang dflags fam_envs arg_ty - (HsSrcBang ann unpk NoSrcStrict) + (HsSrcBang ann unpk NoSrcStrict) | xopt LangExt.StrictData dflags -- StrictData => strict field = dataConSrcToImplBang dflags fam_envs arg_ty (HsSrcBang ann unpk SrcStrict) @@ -684,7 +696,11 @@ dataConSrcToImplBang _ _ _ (HsSrcBang _ _ SrcLazy) = HsLazy dataConSrcToImplBang dflags fam_envs arg_ty - (HsSrcBang _ unpk_prag SrcStrict) + (HsSrcBang _ unpk_prag SrcStrict) + | isUnliftedType arg_ty + = HsLazy -- For !Int#, say, use HsLazy + -- See Note [Data con wrappers and unlifted types] + | not (gopt Opt_OmitInterfacePragmas dflags) -- Don't unpack if -fomit-iface-pragmas -- Don't unpack if we aren't optimising; rather arbitrarily, -- we use -fomit-iface-pragmas as the indication From git at git.haskell.org Fri Mar 10 16:05:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Mar 2017 16:05:57 +0000 (UTC) Subject: [commit: ghc] master: Deal with JoinIds before void types (bc0f3ab) Message-ID: <20170310160557.5DDF23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bc0f3abd0914808e33f84229818ab90842611bdd/ghc >--------------------------------------------------------------- commit bc0f3abd0914808e33f84229818ab90842611bdd Author: Simon Peyton Jones Date: Fri Mar 10 11:12:12 2017 +0000 Deal with JoinIds before void types Trac #13394, comment:4 showed up another place where we were testing for the representation of of a type; and it turned out to be a JoinId which can be rep-polymorphic. Just putting the test in the right places solves this easily. >--------------------------------------------------------------- bc0f3abd0914808e33f84229818ab90842611bdd compiler/codeGen/StgCmmExpr.hs | 7 ++++--- testsuite/tests/polykinds/{T13394.hs => T13394a.hs} | 2 +- testsuite/tests/polykinds/all.T | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/codeGen/StgCmmExpr.hs b/compiler/codeGen/StgCmmExpr.hs index 395e8d6..39edd05 100644 --- a/compiler/codeGen/StgCmmExpr.hs +++ b/compiler/codeGen/StgCmmExpr.hs @@ -701,7 +701,6 @@ cgConApp con stg_args ; emitReturn [idInfoToAmode idinfo] } cgIdApp :: Id -> [StgArg] -> FCode ReturnKind -cgIdApp fun_id [] | isVoidTy (idType fun_id) = emitReturn [] cgIdApp fun_id args = do dflags <- getDynFlags fun_info <- getCgIdInfo fun_id @@ -719,9 +718,11 @@ cgIdApp fun_id args = do v_args = length $ filter (isVoidTy . stgArgType) args node_points dflags = nodeMustPointToIt dflags lf_info case getCallMethod dflags fun_name cg_fun_id lf_info n_args v_args (cg_loc fun_info) self_loop_info of - -- A value in WHNF, so we can just return it. - ReturnIt -> emitReturn [fun] -- ToDo: does ReturnIt guarantee tagged? + ReturnIt + | isVoidTy (idType fun_id) -> emitReturn [] + | otherwise -> emitReturn [fun] + -- ToDo: does ReturnIt guarantee tagged? EnterIt -> ASSERT( null args ) -- Discarding arguments emitEnter fun diff --git a/testsuite/tests/polykinds/T13394.hs b/testsuite/tests/polykinds/T13394a.hs similarity index 84% copy from testsuite/tests/polykinds/T13394.hs copy to testsuite/tests/polykinds/T13394a.hs index 88c482a..e79bf79 100644 --- a/testsuite/tests/polykinds/T13394.hs +++ b/testsuite/tests/polykinds/T13394a.hs @@ -12,4 +12,4 @@ newtype ProperName = newtype ModuleName = ModuleName [ProperName] pattern TypeDataSymbol :: ModuleName -pattern TypeDataSymbol = ModuleName [ProperName "Type"] +pattern TypeDataSymbol = ModuleName [ProperName "Type", ProperName "Data"] diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index 8dd27b0..e8a0fac 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -155,4 +155,5 @@ test('T12718', normal, compile, ['']) test('T12444', normal, compile_fail, ['']) test('T12885', normal, compile, ['']) test('T13267', normal, compile_fail, ['']) +test('T13394a', normal, compile, ['']) test('T13394', normal, compile, ['']) From git at git.haskell.org Fri Mar 10 16:06:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Mar 2017 16:06:01 +0000 (UTC) Subject: [commit: ghc] master: Fix TcSimplify.decideQuantification for kind variables (7e96526) Message-ID: <20170310160601.1BD353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7e96526ac2ef5987ecb03217d3d616b6281c1441/ghc >--------------------------------------------------------------- commit 7e96526ac2ef5987ecb03217d3d616b6281c1441 Author: Simon Peyton Jones Date: Fri Mar 10 11:20:00 2017 +0000 Fix TcSimplify.decideQuantification for kind variables TcSimplify.decideQuantification was doing the Wrong Thing when "growing" the type variables to quantify over. We were trying to do this on a tyvar set where we'd split off the dependent type varaibles; and we just got it wrong. A kind variable wasn't being generalised properly, with confusing knock on consequences. All this led to Trac #13371 and Trac #13393. This commit tidies it all up: * The type TcDepVars is renamed as CandidateQTvs; and splitDepVarsOfType to candidateQTyVarsOfType * The code in TcSimplify.decideQuantification is simpler. It no longer does the tricky "grow" stuff over TcDepVars. Instead it use ordinary VarSets (thereby eliminating the nasty growThetaTyVarsDSet) and uses that to filter the result of candidateQTyVarsOfType. * I documented that candidateQTyVarsOfType returns the type variables in a good order in which to quantify, and rewrote it to use an accumulator pattern, so that we would predicatably get left-to-right ordering. In doing all this I also made UniqDFM behave a little more nicely: * When inserting an element that is there already, keep the old tag, while still overwriting with the new value. * This means that when doing udfmToList we get back elements in the order they were originally inserted, rather than in reverse order. It's not a big deal, but in a subsequent commit I use it to improve the order of type variables in inferred types. All this led to a lot of error message wibbles: - changing the order of quantified variables - changing the order in which instances are listed in GHCi - changing the tidying of variables in typechecker erors There's a submodule update for 'array' because one of its tests has an error-message change. I may not have associated all of them with the correct commit. >--------------------------------------------------------------- 7e96526ac2ef5987ecb03217d3d616b6281c1441 compiler/typecheck/TcMType.hs | 16 +-- compiler/typecheck/TcSimplify.hs | 58 ++++------ compiler/typecheck/TcType.hs | 121 ++++++++++++--------- compiler/utils/UniqDFM.hs | 42 ++++--- libraries/array | 2 +- testsuite/tests/ado/ado004.stderr | 24 ++-- .../tests/determinism/determ021/determ021.stdout | 4 +- testsuite/tests/driver/werror.stderr | 2 +- testsuite/tests/gadt/gadt7.stderr | 16 +-- .../tests/ghci.debugger/scripts/break026.stdout | 20 ++-- testsuite/tests/ghci/scripts/T11524a.stdout | 8 +- testsuite/tests/ghci/scripts/T11975.stdout | 2 +- testsuite/tests/ghci/scripts/T12550.stdout | 28 ++--- testsuite/tests/ghci/scripts/T4175.stdout | 32 +++--- testsuite/tests/ghci/scripts/T6018ghcifail.stderr | 6 +- testsuite/tests/ghci/scripts/T7627.stdout | 26 ++--- testsuite/tests/ghci/scripts/T7939.stdout | 4 +- testsuite/tests/ghci/scripts/T8469.stdout | 10 +- testsuite/tests/ghci/scripts/T8535.stdout | 2 +- testsuite/tests/ghci/scripts/T9881.stdout | 16 +-- testsuite/tests/ghci/scripts/ghci011.stdout | 38 +++---- testsuite/tests/ghci/scripts/ghci020.stdout | 2 +- testsuite/tests/ghci/should_run/T10145.stdout | 2 +- testsuite/tests/ghci/should_run/T12549.stdout | 2 +- .../indexed-types/should_compile/T3017.stderr | 2 +- .../tests/indexed-types/should_fail/T1897b.stderr | 2 +- .../tests/indexed-types/should_fail/T8518.stderr | 8 +- .../tests/indexed-types/should_fail/T9662.stderr | 4 +- testsuite/tests/module/mod72.stderr | 2 +- .../tests/parser/should_fail/readFail003.stderr | 6 +- .../should_compile/ExtraConstraints3.stderr | 86 +++++++-------- .../partial-sigs/should_compile/Meltdown.stderr | 2 +- .../partial-sigs/should_compile/NamedTyVar.stderr | 2 +- .../partial-sigs/should_compile/SkipMany.stderr | 2 +- .../partial-sigs/should_compile/T10438.stderr | 4 +- .../partial-sigs/should_compile/T11192.stderr | 10 +- .../partial-sigs/should_compile/Uncurry.stderr | 2 +- .../should_compile/UncurryNamed.stderr | 2 +- .../WarningWildcardInstantiations.stderr | 2 +- .../NamedExtraConstraintsWildcard.stderr | 4 +- .../should_fail/NamedWildcardsNotInMonotype.stderr | 4 +- .../tests/partial-sigs/should_fail/T10045.stderr | 10 +- .../partial-sigs/should_fail/TidyClash.stderr | 12 +- .../partial-sigs/should_fail/TidyClash2.stderr | 36 +++--- .../tests/patsyn/should_compile/T11213.stderr | 4 +- testsuite/tests/polykinds/T13371.hs | 42 +++++++ testsuite/tests/polykinds/T13393.hs | 66 +++++++++++ testsuite/tests/polykinds/T13393.stderr | 25 +++++ testsuite/tests/polykinds/T7438.stderr | 14 +-- testsuite/tests/polykinds/T7524.stderr | 2 +- testsuite/tests/polykinds/all.T | 2 + testsuite/tests/rename/should_fail/T2993.stderr | 2 +- .../tests/simplCore/should_compile/T3234.stderr | 2 +- .../tests/typecheck/should_compile/tc141.stderr | 16 +-- .../tests/typecheck/should_compile/tc231.stderr | 2 +- .../tests/typecheck/should_fail/T12177.stderr | 16 +-- .../tests/typecheck/should_fail/T6018fail.stderr | 8 +- .../typecheck/should_fail/T6018failclosed.stderr | 4 +- testsuite/tests/typecheck/should_fail/T7734.stderr | 12 +- testsuite/tests/typecheck/should_fail/T8142.stderr | 2 +- testsuite/tests/typecheck/should_fail/T8883.stderr | 2 +- testsuite/tests/typecheck/should_fail/mc25.stderr | 8 +- .../tests/typecheck/should_fail/tcfail049.stderr | 2 +- .../tests/typecheck/should_fail/tcfail050.stderr | 2 +- 64 files changed, 533 insertions(+), 385 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 7e96526ac2ef5987ecb03217d3d616b6281c1441 From git at git.haskell.org Fri Mar 10 16:06:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Mar 2017 16:06:03 +0000 (UTC) Subject: [commit: ghc] master: Improve error messages for skolems (48d1866) Message-ID: <20170310160603.E29233A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/48d1866e9051e52b80c9c88547bd66d66483f1d5/ghc >--------------------------------------------------------------- commit 48d1866e9051e52b80c9c88547bd66d66483f1d5 Author: Simon Peyton Jones Date: Fri Mar 10 11:46:50 2017 +0000 Improve error messages for skolems In error messages like this • Couldn't match type ‘c’ with ‘f0 (a -> b)’ ‘c’ is a rigid type variable bound by the type signature for: f :: ((a -> b) -> b) -> forall c. c -> a we need to take case both to actually show that 'forall c', and to make sure that its name lines with the 'c' in the error message. This has been shaky for some time, and this commit puts it on solid ground. See TcRnTypes: Note [SigSkol SkolemInfo] The main changes are * SigSkol gets an extra field that records the way in which the type signature was skolemised. * The type in SigSkol is now the /un/-skolemised version * pprSkolemInfo uses the info to make the tidy type line up nicely Lots of error message wibbles! >--------------------------------------------------------------- 48d1866e9051e52b80c9c88547bd66d66483f1d5 compiler/typecheck/Inst.hs | 52 ++++++++++--------- compiler/typecheck/TcBinds.hs | 4 +- compiler/typecheck/TcErrors.hs | 19 +++---- compiler/typecheck/TcExpr.hs | 4 +- compiler/typecheck/TcMType.hs | 58 ++++++++++++++++------ compiler/typecheck/TcRnDriver.hs | 2 +- compiler/typecheck/TcRnTypes.hs | 45 ++++++++++++++--- compiler/typecheck/TcSimplify.hs | 2 +- compiler/typecheck/TcUnify.hs | 17 +++---- compiler/types/TyCoRep.hs | 3 +- testsuite/tests/ado/ado005.stderr | 42 +++++++++------- .../tests/backpack/should_fail/bkpfail24.stderr | 2 +- .../tests/backpack/should_fail/bkpfail44.stderr | 2 +- testsuite/tests/deriving/should_fail/T5287.stderr | 2 +- .../should_compile/PushedInAsGivens.stderr | 2 +- .../indexed-types/should_compile/T3208b.stderr | 4 +- .../tests/indexed-types/should_fail/T2664.stderr | 3 +- .../tests/indexed-types/should_fail/T4093a.stderr | 2 +- .../tests/indexed-types/should_fail/T4093b.stderr | 3 +- .../tests/indexed-types/should_fail/T7194.stderr | 2 +- testsuite/tests/monadfail/MonadFailErrors.stderr | 4 +- testsuite/tests/monadfail/MonadFailWarnings.stderr | 4 +- .../should_fail/overloadedlabelsfail01.stderr | 2 +- testsuite/tests/parser/should_fail/T7848.stderr | 2 +- .../partial-sigs/should_compile/T10403.stderr | 2 +- testsuite/tests/polykinds/T7230.stderr | 4 +- testsuite/tests/polykinds/T7594.stderr | 2 +- .../tests/typecheck/should_compile/T7220a.stderr | 7 ++- .../tests/typecheck/should_compile/T9834.stderr | 4 +- .../tests/typecheck/should_compile/T9939.stderr | 8 +-- .../tests/typecheck/should_compile/tc168.stderr | 8 +-- .../typecheck/should_fail/ClassOperator.stderr | 8 +-- .../tests/typecheck/should_fail/T10534.stderr | 2 +- .../tests/typecheck/should_fail/T11947a.stderr | 2 +- .../tests/typecheck/should_fail/T11948.stderr | 2 +- .../tests/typecheck/should_fail/T12151.stderr | 2 +- .../tests/typecheck/should_fail/T12918b.stderr | 2 +- .../tests/typecheck/should_fail/T1897a.stderr | 2 +- testsuite/tests/typecheck/should_fail/T2714.stderr | 8 +-- testsuite/tests/typecheck/should_fail/T3592.stderr | 4 +- testsuite/tests/typecheck/should_fail/T5300.stderr | 7 ++- testsuite/tests/typecheck/should_fail/T7279.stderr | 2 +- testsuite/tests/typecheck/should_fail/T7437.stderr | 4 +- testsuite/tests/typecheck/should_fail/T7453.stderr | 6 +-- testsuite/tests/typecheck/should_fail/T7869.stderr | 2 +- .../tests/typecheck/should_fail/tcfail032.stderr | 2 +- .../tests/typecheck/should_fail/tcfail034.stderr | 4 +- .../tests/typecheck/should_fail/tcfail067.stderr | 14 +++--- .../tests/typecheck/should_fail/tcfail072.stderr | 2 +- .../tests/typecheck/should_fail/tcfail080.stderr | 2 +- .../tests/typecheck/should_fail/tcfail097.stderr | 5 +- .../tests/typecheck/should_fail/tcfail098.stderr | 2 +- .../tests/typecheck/should_fail/tcfail102.stderr | 2 +- .../tests/typecheck/should_fail/tcfail116.stderr | 2 +- .../tests/typecheck/should_fail/tcfail125.stderr | 2 +- .../tests/typecheck/should_fail/tcfail142.stderr | 5 +- .../tests/typecheck/should_fail/tcfail171.stderr | 2 +- .../tests/typecheck/should_fail/tcfail198.stderr | 2 +- .../tests/typecheck/should_fail/tcfail208.stderr | 2 +- .../tests/warnings/should_compile/PluralS.stderr | 6 ++- .../wcompat-warnings/WCompatWarningsOn.stderr | 4 +- 61 files changed, 250 insertions(+), 178 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 48d1866e9051e52b80c9c88547bd66d66483f1d5 From git at git.haskell.org Fri Mar 10 16:06:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Mar 2017 16:06:07 +0000 (UTC) Subject: [commit: ghc] master: Fix constraint simplification in rules (af6ed4a) Message-ID: <20170310160607.5F6CD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/af6ed4a62c77e57f544243aa72bba51a1cff6808/ghc >--------------------------------------------------------------- commit af6ed4a62c77e57f544243aa72bba51a1cff6808 Author: Simon Peyton Jones Date: Fri Mar 10 12:09:52 2017 +0000 Fix constraint simplification in rules Trac #13381 showed that we were losing track of a wanted constraint when simplifying the LHS constraints for a RULE. This patch fixes it, makes the code a bit simpler, and better documented. >--------------------------------------------------------------- af6ed4a62c77e57f544243aa72bba51a1cff6808 compiler/typecheck/TcRules.hs | 153 +++++++++++---------- testsuite/tests/typecheck/should_compile/T13381.hs | 22 +++ .../tests/typecheck/should_compile/T13381.stderr | 14 ++ testsuite/tests/typecheck/should_compile/all.T | 1 + 4 files changed, 114 insertions(+), 76 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 af6ed4a62c77e57f544243aa72bba51a1cff6808 From git at git.haskell.org Fri Mar 10 16:06:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Mar 2017 16:06:10 +0000 (UTC) Subject: [commit: ghc] master: Define TcSimplify.simplifyTopImplic and use it (2d3cb34) Message-ID: <20170310160610.1D2CF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2d3cb34a603ed0008b551cbc3e16b69d7f6dbbe6/ghc >--------------------------------------------------------------- commit 2d3cb34a603ed0008b551cbc3e16b69d7f6dbbe6 Author: Simon Peyton Jones Date: Fri Mar 10 12:50:05 2017 +0000 Define TcSimplify.simplifyTopImplic and use it A very small refactoring >--------------------------------------------------------------- 2d3cb34a603ed0008b551cbc3e16b69d7f6dbbe6 compiler/typecheck/TcDerivInfer.hs | 2 +- compiler/typecheck/TcPatSyn.hs | 7 ++----- compiler/typecheck/TcSimplify.hs | 14 ++++++++++++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/compiler/typecheck/TcDerivInfer.hs b/compiler/typecheck/TcDerivInfer.hs index 4ac0741..93dcf43 100644 --- a/compiler/typecheck/TcDerivInfer.hs +++ b/compiler/typecheck/TcDerivInfer.hs @@ -666,7 +666,7 @@ simplifyDeriv pred tvs thetas -- See Note [Error reporting for deriving clauses] -- See also Note [Exotic derived instance contexts], which are caught -- in this line of code. - ; _ <- simplifyTop $ mkImplicWC leftover_implic + ; simplifyTopImplic leftover_implic ; return (substTheta subst_skol min_theta) } diff --git a/compiler/typecheck/TcPatSyn.hs b/compiler/typecheck/TcPatSyn.hs index cbeb231..15895b5 100644 --- a/compiler/typecheck/TcPatSyn.hs +++ b/compiler/typecheck/TcPatSyn.hs @@ -168,7 +168,7 @@ tcCheckPatSynDecl psb at PSB{ psb_id = lname@(L _ name), psb_args = details ; args' <- zipWithM (tc_arg subst) arg_names arg_tys ; return (ex_tvs', prov_dicts, args') } - ; let skol_info = SigSkol (PatSynCtxt name) (mkPhiTy req_theta pat_ty) + ; let skol_info = SigSkol (PatSynCtxt name) pat_ty [] -- The type here is a bit bogus, but we do not print -- the type for PatSynCtxt, so it doesn't matter -- See TcRnTypes Note [Skolem info for pattern synonyms] @@ -176,10 +176,7 @@ tcCheckPatSynDecl psb at PSB{ psb_id = lname@(L _ name), psb_args = details -- Solve the constraints now, because we are about to make a PatSyn, -- which should not contain unification variables and the like (Trac #10997) - ; empty_binds <- simplifyTop (mkImplicWC implics) - - -- Since all the inputs are implications the returned bindings will be empty - ; MASSERT2( isEmptyBag empty_binds, ppr empty_binds ) + ; simplifyTopImplic implics -- ToDo: in the bidirectional case, check that the ex_tvs' are all distinct -- Otherwise we may get a type error when typechecking the builder, diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index e2598b5..d3fd768 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -5,7 +5,7 @@ module TcSimplify( growThetaTyVars, simplifyAmbiguityCheck, simplifyDefault, - simplifyTop, captureTopConstraints, + simplifyTop, simplifyTopImplic, captureTopConstraints, simplifyInteractive, solveEqualities, simplifyWantedsTcM, tcCheckSatisfiability, @@ -81,6 +81,15 @@ captureTopConstraints thing_inside -- This call to reportUnsolved is the reason -- this function is here instead of TcRnMonad +simplifyTopImplic :: Bag Implication -> TcM () +simplifyTopImplic implics + = do { empty_binds <- simplifyTop (mkImplicWC implics) + + -- Since all the inputs are implications the returned bindings will be empty + ; MASSERT2( isEmptyBag empty_binds, ppr empty_binds ) + + ; return () } + simplifyTop :: WantedConstraints -> TcM (Bag EvBind) -- Simplify top-level constraints -- Usually these will be implications, @@ -729,7 +738,7 @@ simplifyInfer rhs_tclvl infer_mode sigs name_taus wanteds , text "psig_theta =" <+> ppr psig_theta , text "bound_theta =" <+> ppr bound_theta , text "full_theta =" <+> ppr full_theta - , text "qtvs =" <+> ppr qtvs + , text "all_qtvs =" <+> ppr all_qtvs , text "implic =" <+> ppr implic ] ; return ( qtvs, full_theta_vars, TcEvBinds ev_binds_var ) } @@ -878,6 +887,7 @@ decideQuantification infer_mode name_taus psig_theta candidates (vcat [ text "infer_mode:" <+> ppr infer_mode , text "gbl_cand:" <+> ppr gbl_cand , text "quant_cand:" <+> ppr quant_cand + , text "zonked_taus:" <+> ppr zonked_taus , text "gbl_tvs:" <+> ppr gbl_tvs , text "mono_tvs:" <+> ppr mono_tvs , text "cand_tvs" <+> ppr cand_tvs From git at git.haskell.org Fri Mar 10 16:06:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Mar 2017 16:06:12 +0000 (UTC) Subject: [commit: ghc] master: Drop redundant import (4eeb327) Message-ID: <20170310160612.D4BCA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4eeb327369b635463dbdc77f2e4eacb02da16f03/ghc >--------------------------------------------------------------- commit 4eeb327369b635463dbdc77f2e4eacb02da16f03 Author: Simon Peyton Jones Date: Fri Mar 10 12:50:59 2017 +0000 Drop redundant import >--------------------------------------------------------------- 4eeb327369b635463dbdc77f2e4eacb02da16f03 compiler/typecheck/TcTyDecls.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/typecheck/TcTyDecls.hs b/compiler/typecheck/TcTyDecls.hs index 2933890..1b81ec7 100644 --- a/compiler/typecheck/TcTyDecls.hs +++ b/compiler/typecheck/TcTyDecls.hs @@ -49,7 +49,6 @@ import Id import IdInfo import VarEnv import VarSet -import NameSet ( NameSet, unitNameSet, extendNameSet, elemNameSet ) import Coercion ( ltRole ) import BasicTypes import SrcLoc From git at git.haskell.org Fri Mar 10 16:06:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Mar 2017 16:06:15 +0000 (UTC) Subject: [commit: ghc] master: Comments only (2209d5e) Message-ID: <20170310160615.A46C83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2209d5e644b28f614c876b95ac5c627eb5a81fa2/ghc >--------------------------------------------------------------- commit 2209d5e644b28f614c876b95ac5c627eb5a81fa2 Author: Simon Peyton Jones Date: Fri Mar 10 14:40:25 2017 +0000 Comments only >--------------------------------------------------------------- 2209d5e644b28f614c876b95ac5c627eb5a81fa2 libraries/base/GHC/Base.hs | 53 +++++++++++++++++++++++++++++----------------- libraries/base/GHC/List.hs | 5 +---- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index a678c22..8548da6 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -951,25 +951,40 @@ mapFB :: (elt -> lst -> lst) -> (a -> elt) -> a -> lst -> lst {-# INLINE [0] mapFB #-} -- See Note [Inline FB functions] in GHC.List mapFB c f = \x ys -> c (f x) ys --- The rules for map work like this. --- --- Up to (but not including) phase 1, we use the "map" rule to --- rewrite all saturated applications of map with its build/fold --- form, hoping for fusion to happen. --- In phase 1 and 0, we switch off that rule, inline build, and --- switch on the "mapList" rule, which rewrites the foldr/mapFB --- thing back into plain map. --- --- It's important that these two rules aren't both active at once --- (along with build's unfolding) else we'd get an infinite loop --- in the rules. Hence the activation control below. --- --- This same pattern is followed by many other functions: --- e.g. append, filter, iterate, repeat, etc. --- --- The "mapFB" rule optimises compositions of map and --- the "mapFB/id" rule get rids of 'map id' calls. --- (Any similarity to the Functor laws for [] is expected.) +{- Note [The rules for map] +~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The rules for map work like this. + +* Up to (but not including) phase 1, we use the "map" rule to + rewrite all saturated applications of map with its build/fold + form, hoping for fusion to happen. + + In phase 1 and 0, we switch off that rule, inline build, and + switch on the "mapList" rule, which rewrites the foldr/mapFB + thing back into plain map. + + It's important that these two rules aren't both active at once + (along with build's unfolding) else we'd get an infinite loop + in the rules. Hence the activation control below. + +* This same pattern is followed by many other functions: + e.g. append, filter, iterate, repeat, etc. in GHC.List + + See also Note [Inline FB functions] in GHC.List + +* The "mapFB" rule optimises compositions of map + +* The "mapFB/id" rule get rids of 'map id' calls. + You might think that (mapFB c id) will turn into c simply + when mapFB is inlined; but before that happens the "mapList" + rule turns + (foldr (mapFB (:) id) [] a + back into + map id + Which is not very cleveer. + +* Any similarity to the Functor laws for [] is expected. +-} {-# RULES "map" [~1] forall f xs. map f xs = build (\c n -> foldr (mapFB c f) n xs) diff --git a/libraries/base/GHC/List.hs b/libraries/base/GHC/List.hs index 3eab407..018c0a7 100644 --- a/libraries/base/GHC/List.hs +++ b/libraries/base/GHC/List.hs @@ -203,13 +203,10 @@ We hope that one of the two measure kick in: in CoreArity. The oneShot annotations used in this module are correct, as we only use them in -argumets to foldr, where we know how the arguments are called. --} +arguments to foldr, where we know how the arguments are called. -{- Note [Inline FB functions] ~~~~~~~~~~~~~~~~~~~~~~~~~~ - After fusion rules successfully fire, we are usually left with one or more calls to list-producing functions abstracted over cons and nil. Here we call them FB functions because their names usually end with 'FB'. It's a good idea to From git at git.haskell.org Fri Mar 10 17:11:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Mar 2017 17:11:37 +0000 (UTC) Subject: [commit: ghc] branch 'ghc-8.2' created Message-ID: <20170310171137.9F0133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : ghc-8.2 Referencing: 2e3dec1663796b403c55f68f1f336d37cc1a8652 From git at git.haskell.org Fri Mar 10 17:11:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Mar 2017 17:11:40 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: configure.ac: Bump version to 8.2.0 (2e3dec1) Message-ID: <20170310171140.65D913A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/2e3dec1663796b403c55f68f1f336d37cc1a8652/ghc >--------------------------------------------------------------- commit 2e3dec1663796b403c55f68f1f336d37cc1a8652 Author: Ben Gamari Date: Thu Mar 9 10:45:41 2017 -0500 configure.ac: Bump version to 8.2.0 Updates haddock submodule. >--------------------------------------------------------------- 2e3dec1663796b403c55f68f1f336d37cc1a8652 configure.ac | 2 +- iserv/iserv-bin.cabal | 2 +- libraries/template-haskell/Language/Haskell/TH/Lib.hs | 2 +- libraries/template-haskell/template-haskell.cabal | 2 +- utils/haddock | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 9864f32..496cd05 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,7 @@ dnl # see what flags are available. (Better yet, read the documentation!) # -AC_INIT([The Glorious Glasgow Haskell Compilation System], [8.1], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) +AC_INIT([The Glorious Glasgow Haskell Compilation System], [8.2.0], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) # Set this to YES for a released version, otherwise NO : ${RELEASE=NO} diff --git a/iserv/iserv-bin.cabal b/iserv/iserv-bin.cabal index eb33277..399b3d0 100644 --- a/iserv/iserv-bin.cabal +++ b/iserv/iserv-bin.cabal @@ -24,7 +24,7 @@ Executable iserv bytestring >= 0.10 && < 0.11, containers >= 0.5 && < 0.6, deepseq >= 1.4 && < 1.5, - ghci == 8.1 + ghci == 8.2.* if os(windows) Cpp-Options: -DWINDOWS diff --git a/libraries/template-haskell/Language/Haskell/TH/Lib.hs b/libraries/template-haskell/Language/Haskell/TH/Lib.hs index a3cbc8e..860ccc3 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Lib.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Lib.hs @@ -608,7 +608,7 @@ closedTypeFamilyD tc tvs result injectivity eqns = -- 3. remove the FamFlavour data type from Syntax module -- 4. make sure that all references to FamFlavour are gone from DsMeta, -- Convert, TcSplice (follows from 3) -#if __GLASGOW_HASKELL__ >= 802 +#if __GLASGOW_HASKELL__ >= 804 #error Remove deprecated familyNoKindD, familyKindD, closedTypeFamilyNoKindD and closedTypeFamilyKindD #endif diff --git a/libraries/template-haskell/template-haskell.cabal b/libraries/template-haskell/template-haskell.cabal index 71e5e02..ea1a750 100644 --- a/libraries/template-haskell/template-haskell.cabal +++ b/libraries/template-haskell/template-haskell.cabal @@ -50,7 +50,7 @@ Library build-depends: base >= 4.8 && < 4.11, - ghc-boot-th == 8.1, + ghc-boot-th == 8.2.*, pretty == 1.1.* -- We need to set the unit ID to template-haskell (without a diff --git a/utils/haddock b/utils/haddock index dbbdabf..db13d5f 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit dbbdabfd3842f70c78d4c64e10f75f47fe5c0f5d +Subproject commit db13d5f56d8e693b44bafc793d7b3bfac1c25b91 From git at git.haskell.org Fri Mar 10 22:26:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Mar 2017 22:26:58 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump T10359 allocations (18d94e9) Message-ID: <20170310222658.F16F43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/18d94e9cb6a6ecdbb2e1b1cf9abf1e7f6d14e7ea/ghc >--------------------------------------------------------------- commit 18d94e9cb6a6ecdbb2e1b1cf9abf1e7f6d14e7ea Author: Ben Gamari Date: Fri Mar 10 17:03:08 2017 -0500 testsuite: Bump T10359 allocations >--------------------------------------------------------------- 18d94e9cb6a6ecdbb2e1b1cf9abf1e7f6d14e7ea testsuite/tests/perf/should_run/all.T | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index 3bc620f..4c023ea 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -22,7 +22,9 @@ test('T12791', test('T10359', [stats_num_field('bytes allocated', - [(wordsize(64), 499512, 5), + [(wordsize(64), 450920, 5), + # previously 499512 (amd64/Linux) + # 2017-03-10 450920 (amd64/Linux) Don't generate wrapper for !Int# (wordsize(32), 351508, 5)]), only_ways(['normal']) ], From git at git.haskell.org Fri Mar 10 22:27:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Mar 2017 22:27:01 +0000 (UTC) Subject: [commit: ghc] master: Bump time submodule (8db7949) Message-ID: <20170310222701.A970D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8db79493cf578383b987cf25859324b8fccc3e1d/ghc >--------------------------------------------------------------- commit 8db79493cf578383b987cf25859324b8fccc3e1d Author: Ben Gamari Date: Fri Mar 10 17:03:21 2017 -0500 Bump time submodule Fixes 32-bit validation >--------------------------------------------------------------- 8db79493cf578383b987cf25859324b8fccc3e1d libraries/time | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/time b/libraries/time index 4eb06c0..4a4e2ce 160000 --- a/libraries/time +++ b/libraries/time @@ -1 +1 @@ -Subproject commit 4eb06c0e5381a5b5ad2186ac6ecff434cd711376 +Subproject commit 4a4e2ce6a1bf099393772737d848d900832ee84d From git at git.haskell.org Fri Mar 10 22:33:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Mar 2017 22:33:01 +0000 (UTC) Subject: [commit: ghc] master: Fix bkpcabal03 test. (3ca252b) Message-ID: <20170310223301.5190E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3ca252b1dde379d0ce1f18a34703a94084fb46d0/ghc >--------------------------------------------------------------- commit 3ca252b1dde379d0ce1f18a34703a94084fb46d0 Author: Edward Z. Yang Date: Fri Mar 10 14:32:25 2017 -0800 Fix bkpcabal03 test. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 3ca252b1dde379d0ce1f18a34703a94084fb46d0 testsuite/tests/backpack/cabal/bkpcabal03/Mod.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/backpack/cabal/bkpcabal03/Mod.hs b/testsuite/tests/backpack/cabal/bkpcabal03/Mod.hs index a0773b1..d446e6f 100644 --- a/testsuite/tests/backpack/cabal/bkpcabal03/Mod.hs +++ b/testsuite/tests/backpack/cabal/bkpcabal03/Mod.hs @@ -1,4 +1,4 @@ -module Foo where +module Mod where import A h :: Int h = g From git at git.haskell.org Sat Mar 11 13:34:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 11 Mar 2017 13:34:23 +0000 (UTC) Subject: [commit: ghc] master: dsGRHSs: Remove unused pattern variables argument (8d61a60) Message-ID: <20170311133423.0CFDD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8d61a605e7d1f2490cbe26c465f87f8bafe0d4fc/ghc >--------------------------------------------------------------- commit 8d61a605e7d1f2490cbe26c465f87f8bafe0d4fc Author: Ömer Sinan Ağacan Date: Sat Mar 11 16:33:54 2017 +0300 dsGRHSs: Remove unused pattern variables argument >--------------------------------------------------------------- 8d61a605e7d1f2490cbe26c465f87f8bafe0d4fc compiler/deSugar/DsGRHSs.hs | 6 +++--- compiler/deSugar/Match.hs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/deSugar/DsGRHSs.hs b/compiler/deSugar/DsGRHSs.hs index 0a66bd0..e664612 100644 --- a/compiler/deSugar/DsGRHSs.hs +++ b/compiler/deSugar/DsGRHSs.hs @@ -47,17 +47,17 @@ necessary. The type argument gives the type of the @ei at . dsGuarded :: GRHSs Id (LHsExpr Id) -> Type -> DsM CoreExpr dsGuarded grhss rhs_ty = do - match_result <- dsGRHSs PatBindRhs [] grhss rhs_ty + match_result <- dsGRHSs PatBindRhs grhss rhs_ty error_expr <- mkErrorAppDs nON_EXHAUSTIVE_GUARDS_ERROR_ID rhs_ty empty extractMatchResult match_result error_expr -- In contrast, @dsGRHSs@ produces a @MatchResult at . -dsGRHSs :: HsMatchContext Name -> [Pat Id] -- These are to build a MatchContext from +dsGRHSs :: HsMatchContext Name -> GRHSs Id (LHsExpr Id) -- Guarded RHSs -> Type -- Type of RHS -> DsM MatchResult -dsGRHSs hs_ctx _ (GRHSs grhss binds) rhs_ty +dsGRHSs hs_ctx (GRHSs grhss binds) rhs_ty = ASSERT( notNull grhss ) do { match_results <- mapM (dsGRHS hs_ctx rhs_ty) grhss ; let match_result1 = foldr1 combineMatchResults match_results diff --git a/compiler/deSugar/Match.hs b/compiler/deSugar/Match.hs index a4aa56e..92f78be 100644 --- a/compiler/deSugar/Match.hs +++ b/compiler/deSugar/Match.hs @@ -755,7 +755,7 @@ matchWrapper ctxt mb_scr (MG { mg_alts = L _ matches ; tm_cs <- genCaseTmCs2 mb_scr upats vars ; match_result <- addDictsDs dicts $ -- See Note [Type and Term Equality Propagation] addTmCsDs tm_cs $ -- See Note [Type and Term Equality Propagation] - dsGRHSs ctxt upats grhss rhs_ty + dsGRHSs ctxt grhss rhs_ty ; return (EqnInfo { eqn_pats = upats, eqn_rhs = match_result}) } handleWarnings = if isGenerated origin From git at git.haskell.org Sat Mar 11 19:47:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 11 Mar 2017 19:47:23 +0000 (UTC) Subject: [commit: ghc] master: Emit Core lint warnings on stderr, fix #13342 (7b095b9) Message-ID: <20170311194723.F3DBE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7b095b991879b29b26fce9e9d4accd3ba9366dc0/ghc >--------------------------------------------------------------- commit 7b095b991879b29b26fce9e9d4accd3ba9366dc0 Author: Ben Fiedler Date: Tue Mar 7 01:48:24 2017 +0100 Emit Core lint warnings on stderr, fix #13342 >--------------------------------------------------------------- 7b095b991879b29b26fce9e9d4accd3ba9366dc0 compiler/coreSyn/CoreLint.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index 93fcbe4..fb86242 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -318,9 +318,11 @@ displayLintResults dflags pass warns errs binds | not (isEmptyBag warns) , not (hasNoDebugOutput dflags) , showLintWarnings pass - = log_action dflags dflags NoReason Err.SevDump noSrcSpan + -- If the Core linter encounters an error, output to stderr instead of + -- stdout (#13342) + = log_action dflags dflags NoReason Err.SevInfo noSrcSpan (defaultDumpStyle dflags) - (lint_banner "warnings" (ppr pass) $$ Err.pprMessageBag warns) + (lint_banner "warnings" (ppr pass) $$ Err.pprMessageBag (mapBag ($$ blankLine) warns)) | otherwise = return () where From git at git.haskell.org Sat Mar 11 20:50:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 11 Mar 2017 20:50:44 +0000 (UTC) Subject: [commit: ghc] master: Observe #13267 in release notes (740ecda) Message-ID: <20170311205044.F397F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/740ecda32116abe84b6d7d4786b3e2ad9c8ba2a4/ghc >--------------------------------------------------------------- commit 740ecda32116abe84b6d7d4786b3e2ad9c8ba2a4 Author: Ryan Scott Date: Sat Mar 11 15:46:20 2017 -0500 Observe #13267 in release notes I noticed some code in the wild that broke due to the validity checking introduced in #13267, so we should be proactive and warn about it in the 8.2 release notes. >--------------------------------------------------------------- 740ecda32116abe84b6d7d4786b3e2ad9c8ba2a4 docs/users_guide/8.2.1-notes.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/users_guide/8.2.1-notes.rst b/docs/users_guide/8.2.1-notes.rst index b3dd2de..9a7236b 100644 --- a/docs/users_guide/8.2.1-notes.rst +++ b/docs/users_guide/8.2.1-notes.rst @@ -167,6 +167,16 @@ Compiler "StillWorks" forall x. f (Just x) = e +- Type synonyms can no longer appear in the class position of an instance. + This means something like this is no longer allowed: :: + + type ReadShow a = (Read a, Show a) + instance Read Foo + instance Show Foo + instance ReadShow Foo -- illegal + + See :ghc-ticket:`13267`. + GHCi ~~~~ From git at git.haskell.org Sat Mar 11 22:20:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 11 Mar 2017 22:20:18 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: implement missing Fabs{32, 64} on i386 NCG and UNREG (98ac934) Message-ID: <20170311222018.2FB3C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/98ac93463db59f802dd79b44b0b7b16f7760826e/ghc >--------------------------------------------------------------- commit 98ac93463db59f802dd79b44b0b7b16f7760826e Author: Sergei Trofimovich Date: Fri Mar 10 09:30:10 2017 +0000 implement missing Fabs{32,64} on i386 NCG and UNREG Noticed breakage as build failure on i386 freebsd build bot: http://haskell.inf.elte.hu/builders/freebsd-i386-head/1267/10.html ghc-stage1: panic! (the 'impossible' happened) (GHC version 8.1.20170310 for i386-portbld-freebsd): outOfLineCmmOp: MO_F64_Fabs not supported here Signed-off-by: Sergei Trofimovich (cherry picked from commit 46246a6d57c35ebf12032d13a4cd7ff18f713770) >--------------------------------------------------------------- 98ac93463db59f802dd79b44b0b7b16f7760826e compiler/cmm/PprC.hs | 4 ++-- compiler/nativeGen/X86/CodeGen.hs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs index 6a84e30..aa21174 100644 --- a/compiler/cmm/PprC.hs +++ b/compiler/cmm/PprC.hs @@ -754,7 +754,7 @@ pprCallishMachOp_for_C mop MO_F64_Log -> text "log" MO_F64_Exp -> text "exp" MO_F64_Sqrt -> text "sqrt" - MO_F64_Fabs -> unsupported + MO_F64_Fabs -> text "fabs" MO_F32_Pwr -> text "powf" MO_F32_Sin -> text "sinf" MO_F32_Cos -> text "cosf" @@ -768,7 +768,7 @@ pprCallishMachOp_for_C mop MO_F32_Log -> text "logf" MO_F32_Exp -> text "expf" MO_F32_Sqrt -> text "sqrtf" - MO_F32_Fabs -> unsupported + MO_F32_Fabs -> text "fabsf" MO_WriteBarrier -> text "write_barrier" MO_Memcpy _ -> text "memcpy" MO_Memset _ -> text "memset" diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs index 704514e..562303c 100644 --- a/compiler/nativeGen/X86/CodeGen.hs +++ b/compiler/nativeGen/X86/CodeGen.hs @@ -2623,7 +2623,7 @@ outOfLineCmmOp mop res args fn = case mop of MO_F32_Sqrt -> fsLit "sqrtf" - MO_F32_Fabs -> unsupported + MO_F32_Fabs -> fsLit "fabsf" MO_F32_Sin -> fsLit "sinf" MO_F32_Cos -> fsLit "cosf" MO_F32_Tan -> fsLit "tanf" @@ -2640,7 +2640,7 @@ outOfLineCmmOp mop res args MO_F32_Pwr -> fsLit "powf" MO_F64_Sqrt -> fsLit "sqrt" - MO_F64_Fabs -> unsupported + MO_F64_Fabs -> fsLit "fabs" MO_F64_Sin -> fsLit "sin" MO_F64_Cos -> fsLit "cos" MO_F64_Tan -> fsLit "tan" From git at git.haskell.org Sat Mar 11 22:20:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 11 Mar 2017 22:20:20 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump time submodule (812743d) Message-ID: <20170311222020.DD58B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/812743dcff274b738a1cfb2344ea4507c6f7a617/ghc >--------------------------------------------------------------- commit 812743dcff274b738a1cfb2344ea4507c6f7a617 Author: Ben Gamari Date: Fri Mar 10 17:03:21 2017 -0500 Bump time submodule Fixes 32-bit validation (cherry picked from commit 8db79493cf578383b987cf25859324b8fccc3e1d) >--------------------------------------------------------------- 812743dcff274b738a1cfb2344ea4507c6f7a617 libraries/time | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/time b/libraries/time index 4eb06c0..4a4e2ce 160000 --- a/libraries/time +++ b/libraries/time @@ -1 +1 @@ -Subproject commit 4eb06c0e5381a5b5ad2186ac6ecff434cd711376 +Subproject commit 4a4e2ce6a1bf099393772737d848d900832ee84d From git at git.haskell.org Sun Mar 12 18:57:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Mar 2017 18:57:20 +0000 (UTC) Subject: [commit: ghc] master: Remove `runs` function which already exists in base (e5453a0) Message-ID: <20170312185720.CDB1D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e5453a0e69911f135c192219189104bd0d2e3b5d/ghc >--------------------------------------------------------------- commit e5453a0e69911f135c192219189104bd0d2e3b5d Author: Ömer Sinan Ağacan Date: Sun Mar 12 21:56:31 2017 +0300 Remove `runs` function which already exists in base Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3320 >--------------------------------------------------------------- e5453a0e69911f135c192219189104bd0d2e3b5d compiler/deSugar/Match.hs | 4 ++-- compiler/deSugar/MatchCon.hs | 8 ++++---- compiler/simplCore/CoreMonad.hs | 3 +-- compiler/utils/ListSetOps.hs | 21 ++------------------- 4 files changed, 9 insertions(+), 27 deletions(-) diff --git a/compiler/deSugar/Match.hs b/compiler/deSugar/Match.hs index 92f78be..692db8b 100644 --- a/compiler/deSugar/Match.hs +++ b/compiler/deSugar/Match.hs @@ -39,7 +39,6 @@ import Coercion ( eqCoercion ) import TcType ( toTcTypeBag ) import TyCon( isNewTyCon ) import TysWiredIn -import ListSetOps import SrcLoc import Maybes import Util @@ -52,6 +51,7 @@ import UniqDFM import Control.Monad( when, unless ) import qualified Data.Map as Map +import Data.List (groupBy) {- ************************************************************************ @@ -887,7 +887,7 @@ groupEquations :: DynFlags -> [EquationInfo] -> [[(PatGroup, EquationInfo)]] -- (b) none of the gi are empty -- The ordering of equations is unchanged groupEquations dflags eqns - = runs same_gp [(patGroup dflags (firstPat eqn), eqn) | eqn <- eqns] + = groupBy same_gp [(patGroup dflags (firstPat eqn), eqn) | eqn <- eqns] where same_gp :: (PatGroup,EquationInfo) -> (PatGroup,EquationInfo) -> Bool (pg1,_) `same_gp` (pg2,_) = pg1 `sameGroup` pg2 diff --git a/compiler/deSugar/MatchCon.hs b/compiler/deSugar/MatchCon.hs index 4a7d1cd..0e1aa80 100644 --- a/compiler/deSugar/MatchCon.hs +++ b/compiler/deSugar/MatchCon.hs @@ -22,7 +22,6 @@ import DsMonad import DsUtils import MkCore ( mkCoreLets ) import Util -import ListSetOps ( runs ) import Id import NameEnv import FieldLabel ( flSelector ) @@ -30,6 +29,7 @@ import SrcLoc import DynFlags import Outputable import Control.Monad(liftM) +import Data.List (groupBy) {- We are confronted with the first column of patterns in a set of @@ -153,8 +153,8 @@ matchOneConLike vars ty (eqn1 : eqns) -- All eqns for a single constructor -- Divide into sub-groups; see Note [Record patterns] ; let groups :: [[(ConArgPats, EquationInfo)]] - groups = runs compatible_pats [ (pat_args (firstPat eqn), eqn) - | eqn <- eqn1:eqns ] + groups = groupBy compatible_pats [ (pat_args (firstPat eqn), eqn) + | eqn <- eqn1:eqns ] ; match_results <- mapM (match_group arg_vars) groups @@ -245,7 +245,7 @@ Now consider: In the first we must test y first; in the second we must test x first. So we must divide even the equations for a single constructor T into sub-goups, based on whether they match the same field in the -same order. That's what the (runs compatible_pats) grouping. +same order. That's what the (groupBy compatible_pats) grouping. All non-record patterns are "compatible" in this sense, because the positional patterns (T a b) and (a `T` b) all match the arguments diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs index ac3e2c4..209d0f8 100644 --- a/compiler/simplCore/CoreMonad.hs +++ b/compiler/simplCore/CoreMonad.hs @@ -76,7 +76,6 @@ import UniqFM ( UniqFM, mapUFM, filterUFM ) import MonadUtils import NameCache import SrcLoc -import ListSetOps ( runs ) import Data.List import Data.Ord import Data.Dynamic @@ -348,7 +347,7 @@ pprTickCounts counts where groups :: [[(Tick,Int)]] -- Each group shares a comon tag -- toList returns common tags adjacent - groups = runs same_tag (Map.toList counts) + groups = groupBy same_tag (Map.toList counts) same_tag (tick1,_) (tick2,_) = tickToTag tick1 == tickToTag tick2 pprTickGroup :: [(Tick, Int)] -> SDoc diff --git a/compiler/utils/ListSetOps.hs b/compiler/utils/ListSetOps.hs index eaa79bd..e5315dd 100644 --- a/compiler/utils/ListSetOps.hs +++ b/compiler/utils/ListSetOps.hs @@ -14,7 +14,7 @@ module ListSetOps ( Assoc, assoc, assocMaybe, assocUsing, assocDefault, assocDefaultUsing, -- Duplicate handling - hasNoDups, runs, removeDups, findDupsEq, + hasNoDups, removeDups, findDupsEq, equivClasses, -- Indexing @@ -111,27 +111,10 @@ equivClasses :: (a -> a -> Ordering) -- Comparison equivClasses _ [] = [] equivClasses _ stuff@[_] = [stuff] -equivClasses cmp items = runs eq (sortBy cmp items) +equivClasses cmp items = groupBy eq (sortBy cmp items) where eq a b = case cmp a b of { EQ -> True; _ -> False } -{- -The first cases in @equivClasses@ above are just to cut to the point -more quickly... - - at runs@ groups a list into a list of lists, each sublist being a run of -identical elements of the input list. It is passed a predicate @p@ which -tells when two elements are equal. --} - -runs :: (a -> a -> Bool) -- Equality - -> [a] - -> [[a]] - -runs _ [] = [] -runs p (x:xs) = case (span (p x) xs) of - (first, rest) -> (x:first) : (runs p rest) - removeDups :: (a -> a -> Ordering) -- Comparison function -> [a] -> ([a], -- List with no duplicates From git at git.haskell.org Mon Mar 13 18:34:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 18:34:45 +0000 (UTC) Subject: [commit: ghc] master: KQueue: Eliminate redundant import (2f2622c) Message-ID: <20170313183445.E203C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2f2622c601136a62e465dcd3b3b02db8156734b6/ghc >--------------------------------------------------------------- commit 2f2622c601136a62e465dcd3b3b02db8156734b6 Author: Ben Gamari Date: Sun Mar 12 18:06:34 2017 -0400 KQueue: Eliminate redundant import At long last fixes OS X build. >--------------------------------------------------------------- 2f2622c601136a62e465dcd3b3b02db8156734b6 libraries/base/GHC/Event/KQueue.hsc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libraries/base/GHC/Event/KQueue.hsc b/libraries/base/GHC/Event/KQueue.hsc index 7476c93..f26d199 100644 --- a/libraries/base/GHC/Event/KQueue.hsc +++ b/libraries/base/GHC/Event/KQueue.hsc @@ -27,9 +27,8 @@ available = False #else import Data.Bits (Bits(..), FiniteBits(..)) -import qualified Data.Int as I +import Data.Int import Data.Word (Word16, Word32) -import Data.Int (Int16) import Foreign.C.Error (throwErrnoIfMinus1, eINTR, eINVAL, eNOTSUP, getErrno, throwErrno) import Foreign.C.Types @@ -189,9 +188,9 @@ newtype Flag = Flag Word16 } #if SIZEOF_KEV_FILTER == 4 /*kevent.filter: int32_t or int16_t. */ -newtype Filter = Filter I.Int32 +newtype Filter = Filter Int32 #else -newtype Filter = Filter I.Int16 +newtype Filter = Filter Int16 #endif deriving (Bits, FiniteBits, Eq, Num, Show, Storable) From git at git.haskell.org Mon Mar 13 18:34:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 18:34:51 +0000 (UTC) Subject: [commit: ghc] master: Don't reference elSupremum in haddock for Lifetime Monoid (2c78def) Message-ID: <20170313183451.622F83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2c78def693c5c7a3f796a64444ffa4a7e2825d59/ghc >--------------------------------------------------------------- commit 2c78def693c5c7a3f796a64444ffa4a7e2825d59 Author: Chris Martin Date: Sun Mar 12 15:15:17 2017 -0400 Don't reference elSupremum in haddock for Lifetime Monoid Reviewers: austin, hvr, bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3325 >--------------------------------------------------------------- 2c78def693c5c7a3f796a64444ffa4a7e2825d59 libraries/base/GHC/Event/Internal.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/base/GHC/Event/Internal.hs b/libraries/base/GHC/Event/Internal.hs index 7024714..f6eb8ef 100644 --- a/libraries/base/GHC/Event/Internal.hs +++ b/libraries/base/GHC/Event/Internal.hs @@ -99,7 +99,7 @@ elSupremum OneShot OneShot = OneShot elSupremum _ _ = MultiShot {-# INLINE elSupremum #-} --- | @mappend@ == @elSupremum@ +-- | @mappend@ takes the longer of two lifetimes. -- -- @since 4.8.0.0 instance Monoid Lifetime where From git at git.haskell.org Mon Mar 13 18:34:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 18:34:48 +0000 (UTC) Subject: [commit: ghc] master: Replace debugging trace with a proper WARN (9297c6f) Message-ID: <20170313183448.A70E63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9297c6f3177f549f230cac33a79ec0dc9d8bee70/ghc >--------------------------------------------------------------- commit 9297c6f3177f549f230cac33a79ec0dc9d8bee70 Author: Matthew Pickering Date: Sun Mar 12 15:15:05 2017 -0400 Replace debugging trace with a proper WARN Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3326 >--------------------------------------------------------------- 9297c6f3177f549f230cac33a79ec0dc9d8bee70 compiler/utils/Outputable.hs-boot | 4 ++++ compiler/utils/Util.hs | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/compiler/utils/Outputable.hs-boot b/compiler/utils/Outputable.hs-boot index e5e8895..980c186 100644 --- a/compiler/utils/Outputable.hs-boot +++ b/compiler/utils/Outputable.hs-boot @@ -3,3 +3,7 @@ module Outputable where data SDoc showSDocUnsafe :: SDoc -> String + +warnPprTrace :: Bool -> String -> Int -> SDoc -> a -> a + +text :: String -> SDoc diff --git a/compiler/utils/Util.hs b/compiler/utils/Util.hs index 5c09959..30026c5 100644 --- a/compiler/utils/Util.hs +++ b/compiler/utils/Util.hs @@ -164,6 +164,10 @@ import qualified Data.Set as Set import Data.Time +#ifdef DEBUG +import {-# SOURCE #-} Outputable ( warnPprTrace, text ) +#endif + infixr 9 `thenCmp` {- @@ -558,7 +562,7 @@ isIn msg x ys elem100 :: Eq a => Int -> a -> [a] -> Bool elem100 _ _ [] = False elem100 i x (y:ys) - | i > 100 = trace ("Over-long elem in " ++ msg) (x `elem` (y:ys)) + | i > 100 = WARN(True, text ("Over-long elem in " ++ msg)) (x `elem` (y:ys)) | otherwise = x == y || elem100 (i + 1) x ys isn'tIn msg x ys @@ -567,7 +571,7 @@ isn'tIn msg x ys notElem100 :: Eq a => Int -> a -> [a] -> Bool notElem100 _ _ [] = True notElem100 i x (y:ys) - | i > 100 = trace ("Over-long notElem in " ++ msg) (x `notElem` (y:ys)) + | i > 100 = WARN(True, text ("Over-long notElem in " ++ msg)) (x `notElem` (y:ys)) | otherwise = x /= y && notElem100 (i + 1) x ys # endif /* DEBUG */ From git at git.haskell.org Mon Mar 13 18:34:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 18:34:54 +0000 (UTC) Subject: [commit: ghc] master: Elaborate further on ZipList Applicative docs (ae0ccf8) Message-ID: <20170313183454.1BF7E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ae0ccf8c16f5ed394ab01a1863abd98a7a44ab60/ghc >--------------------------------------------------------------- commit ae0ccf8c16f5ed394ab01a1863abd98a7a44ab60 Author: Chris Martin Date: Sun Mar 12 15:15:29 2017 -0400 Elaborate further on ZipList Applicative docs I was initially confused when I read "zipWithn" in the haddock for ZipList, went looking for a function named "zipWithn", and found that it didn't exist. This expands the docs to clarify that we're referring to the family of functions [zipWith, zipWith3, zipWith4, ...], capitalizes the letter "n" in "zipWithN" in attempt to make that more readable, and gives an example. I also moved this documentation from ZipList itself to the Applicative instance, so that it will show up in both the Ziplist documentation and in the list of Applicative instances. Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3324 >--------------------------------------------------------------- ae0ccf8c16f5ed394ab01a1863abd98a7a44ab60 libraries/base/Control/Applicative.hs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/libraries/base/Control/Applicative.hs b/libraries/base/Control/Applicative.hs index 406f086..9045bcd 100644 --- a/libraries/base/Control/Applicative.hs +++ b/libraries/base/Control/Applicative.hs @@ -99,16 +99,24 @@ instance (ArrowZero a, ArrowPlus a) => Alternative (WrappedArrow a b) where empty = WrapArrow zeroArrow WrapArrow u <|> WrapArrow v = WrapArrow (u <+> v) --- | Lists, but with an 'Applicative' functor based on zipping, so that --- --- @f '<$>' 'ZipList' xs1 '<*>' ... '<*>' 'ZipList' xsn = 'ZipList' (zipWithn f xs1 ... xsn)@ --- +-- | Lists, but with an 'Applicative' functor based on zipping. newtype ZipList a = ZipList { getZipList :: [a] } deriving ( Show, Eq, Ord, Read, Functor , Foldable, Generic, Generic1) -- See Data.Traversable for Traversable instance due to import loops --- | @since 2.01 +-- | +-- > f '<$>' 'ZipList' xs1 '<*>' ... '<*>' 'ZipList' xsN +-- = 'ZipList' (zipWithN f xs1 ... xsN) +-- +-- where @zipWithN@ refers to the @zipWith@ function of the appropriate arity +-- (@zipWith@, @zipWith3@, @zipWith4@, ...). For example: +-- +-- > (\a b c -> stimes c [a, b]) <$> ZipList "abcd" <*> ZipList "567" <*> ZipList [1..] +-- > = ZipList (zipWith3 (\a b c -> stimes c [a, b]) "abcd" "567" [1..]) +-- > = ZipList {getZipList = ["a5","b6b6","c7c7c7"]} +-- +-- @since 2.01 instance Applicative ZipList where pure x = ZipList (repeat x) liftA2 f (ZipList xs) (ZipList ys) = ZipList (zipWith f xs ys) From git at git.haskell.org Mon Mar 13 21:06:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:06:34 +0000 (UTC) Subject: [commit: ghc] master: unlit: replace the SHEBANG with an empty line (c77b767) Message-ID: <20170313210634.CA2663A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c77b767098be53087e0b06ba23d613dd7c3bcf8e/ghc >--------------------------------------------------------------- commit c77b767098be53087e0b06ba23d613dd7c3bcf8e Author: Phil Ruffwind Date: Mon Mar 13 15:17:47 2017 -0400 unlit: replace the SHEBANG with an empty line This corrects the line numbers for literate code after a shebang. Fixes #13414. Test Plan: validate Reviewers: austin, bgamari, trofi Reviewed By: bgamari, trofi Subscribers: trofi, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3333 >--------------------------------------------------------------- c77b767098be53087e0b06ba23d613dd7c3bcf8e testsuite/tests/parser/should_fail/T13414.lhs | 3 +++ testsuite/tests/parser/should_fail/T13414.stderr | 2 ++ testsuite/tests/parser/should_fail/all.T | 1 + utils/unlit/unlit.c | 3 +++ 4 files changed, 9 insertions(+) diff --git a/testsuite/tests/parser/should_fail/T13414.lhs b/testsuite/tests/parser/should_fail/T13414.lhs new file mode 100644 index 0000000..fe6b960 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T13414.lhs @@ -0,0 +1,3 @@ +#!/usr/bin/env runhaskell +> module T13414 where +> main = invalid_ident_ diff --git a/testsuite/tests/parser/should_fail/T13414.stderr b/testsuite/tests/parser/should_fail/T13414.stderr new file mode 100644 index 0000000..f5b0001 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T13414.stderr @@ -0,0 +1,2 @@ + +T13414.lhs:3:10: error: Variable not in scope: invalid_ident_ diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T index 1496fec..b897484 100644 --- a/testsuite/tests/parser/should_fail/all.T +++ b/testsuite/tests/parser/should_fail/all.T @@ -97,3 +97,4 @@ test('T12051', normal, compile_fail, ['']) test('T12429', normal, compile_fail, ['']) test('T12811', normal, compile_fail, ['']) test('T13260', normal, compile_fail, ['']) +test('T13414', literate, compile_fail, ['']) diff --git a/utils/unlit/unlit.c b/utils/unlit/unlit.c index c0e3b98..9a697eb 100644 --- a/utils/unlit/unlit.c +++ b/utils/unlit/unlit.c @@ -296,6 +296,9 @@ static void unlit(char *file, FILE *istream, FILE *ostream) } } #endif + if (this == SHEBANG) { + myputc('\n', ostream); + } } while(this!=ENDFILE); if (defnsread==0) From git at git.haskell.org Mon Mar 13 21:06:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:06:37 +0000 (UTC) Subject: [commit: ghc] master: Add `-fmax-errors` flag (70274b4) Message-ID: <20170313210637.91EFE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/70274b4f8003fde0fa3e4094a10dfae880579786/ghc >--------------------------------------------------------------- commit 70274b4f8003fde0fa3e4094a10dfae880579786 Author: Charles Cooper Date: Mon Mar 13 15:17:58 2017 -0400 Add `-fmax-errors` flag This commit adds a command line option to limit the number of errors displayed. It also moves the documentation for `reverse-errors` into the `Warnings` section. https://ghc.haskell.org/trac/ghc/ticket/13326 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3323 >--------------------------------------------------------------- 70274b4f8003fde0fa3e4094a10dfae880579786 compiler/main/DynFlags.hs | 12 ++++++++++-- compiler/main/ErrUtils.hs | 6 +++++- utils/mkUserGuidePart/Options/Misc.hs | 7 ------- utils/mkUserGuidePart/Options/Warnings.hs | 13 +++++++++++++ 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index e96bf69..e95796d 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -935,7 +935,10 @@ data DynFlags = DynFlags { maxInlineMemsetInsns :: Int, -- | Reverse the order of error messages in GHC/GHCi - reverseErrors :: Bool, + reverseErrors :: Bool, + + -- | Limit the maximum number of errors to show + maxErrors :: Maybe Int, -- | Unique supply configuration for testing build determinism initialUnique :: Int, @@ -1684,7 +1687,8 @@ defaultDynFlags mySettings = initialUnique = 0, uniqueIncrement = 1, - reverseErrors = False + reverseErrors = False, + maxErrors = Nothing } defaultWays :: Settings -> [Way] @@ -2798,6 +2802,10 @@ dynamic_flags_deps = [ "Use -fno-force-recomp instead" , make_dep_flag defGhcFlag "no-recomp" (NoArg $ setGeneralFlag Opt_ForceRecomp) "Use -fforce-recomp instead" + , make_ord_flag defFlag "fmax-errors" + (intSuffix (\n d -> d { maxErrors = Just (max 1 n) })) + , make_ord_flag defFlag "fno-max-errors" + (noArg (\d -> d { maxErrors = Nothing })) , make_ord_flag defFlag "freverse-errors" (noArg (\d -> d {reverseErrors = True} )) , make_ord_flag defFlag "fno-reverse-errors" diff --git a/compiler/main/ErrUtils.hs b/compiler/main/ErrUtils.hs index d73628a..8e71847 100644 --- a/compiler/main/ErrUtils.hs +++ b/compiler/main/ErrUtils.hs @@ -378,11 +378,15 @@ pprLocErrMsg (ErrMsg { errMsgSpan = s mkLocMessage sev s (formatErrDoc dflags doc) sortMsgBag :: Maybe DynFlags -> Bag ErrMsg -> [ErrMsg] -sortMsgBag dflags = sortBy (maybeFlip $ comparing errMsgSpan) . bagToList +sortMsgBag dflags = maybeLimit . sortBy (maybeFlip cmp) . bagToList where maybeFlip :: (a -> a -> b) -> (a -> a -> b) maybeFlip | fromMaybe False (fmap reverseErrors dflags) = flip | otherwise = id + cmp = comparing errMsgSpan + maybeLimit = case join (fmap maxErrors dflags) of + Nothing -> id + Just err_limit -> take err_limit ghcExit :: DynFlags -> Int -> IO () ghcExit dflags val diff --git a/utils/mkUserGuidePart/Options/Misc.hs b/utils/mkUserGuidePart/Options/Misc.hs index 57e8808..c542fa3 100644 --- a/utils/mkUserGuidePart/Options/Misc.hs +++ b/utils/mkUserGuidePart/Options/Misc.hs @@ -29,13 +29,6 @@ miscOptions = "the main thread, rather than a forked thread." , flagType = DynamicFlag } - , flag { flagName = "-freverse-errors" - , flagDescription = - "Display errors in GHC/GHCi sorted by reverse order of "++ - "source code line numbers." - , flagType = DynamicFlag - , flagReverse = "-fno-reverse-errors" - } , flag { flagName = "-flocal-ghci-history" , flagDescription = "Use current directory for the GHCi command history "++ diff --git a/utils/mkUserGuidePart/Options/Warnings.hs b/utils/mkUserGuidePart/Options/Warnings.hs index f242fb0..48ee32c 100644 --- a/utils/mkUserGuidePart/Options/Warnings.hs +++ b/utils/mkUserGuidePart/Options/Warnings.hs @@ -90,6 +90,19 @@ warningsOptions = , flagType = DynamicFlag , flagReverse = "-fno-helpful-errors" } + , flag { flagName = "-freverse-errors" + , flagDescription = + "Display errors in GHC/GHCi sorted by reverse order of "++ + "source code line numbers." + , flagType = DynamicFlag + , flagReverse = "-fno-reverse-errors" + } + , flag { flagName = "-fmax-errors" + , flagDescription = + "Limit the number of errors displayed in GHC/GHCi." + , flagType = DynamicFlag + , flagReverse = "-fno-max-errors" + } , flag { flagName = "-Wdeprecated-flags" , flagDescription = "warn about uses of commandline flags that are deprecated" From git at git.haskell.org Mon Mar 13 21:06:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:06:41 +0000 (UTC) Subject: [commit: ghc] master: Add COLUMN pragma (e61b4a4) Message-ID: <20170313210641.153BE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e61b4a4169da17cd7b77f9dc09e3627eff1ff559/ghc >--------------------------------------------------------------- commit e61b4a4169da17cd7b77f9dc09e3627eff1ff559 Author: Phil Ruffwind Date: Mon Mar 13 15:18:22 2017 -0400 Add COLUMN pragma Test Plan: validate Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3313 >--------------------------------------------------------------- e61b4a4169da17cd7b77f9dc09e3627eff1ff559 compiler/parser/Lexer.x | 18 ++++++++++++++++- docs/users_guide/glasgow_exts.rst | 23 ++++++++++++++++++++++ .../tests/parser/should_compile/ColumnPragma.hs | 6 ++++++ .../parser/should_compile/ColumnPragma.stderr | 3 +++ testsuite/tests/parser/should_compile/all.T | 1 + 5 files changed, 50 insertions(+), 1 deletion(-) diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index 6f91f44..3d6fa16 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -318,6 +318,10 @@ $tab { warnTab } -- NOTE: accept -} at the end of a LINE pragma, for compatibility -- with older versions of GHC which generated these. +-- Haskell-style column pragmas, of the form +-- {-# COLUMN #-} + @decimal $whitechar* "#-}" { setColumn } + <0,option_prags> { "{-#" $whitechar* $pragmachar+ $whitechar+ $pragmachar+ / { known_pragma twoWordPrags } @@ -1390,6 +1394,17 @@ setLine code span buf len = do pushLexState code lexToken +setColumn :: Action +setColumn span buf len = do + let column = + case reads (lexemeToString buf len) of + [(column, _)] -> column + _ -> error "setColumn: expected integer" -- shouldn't happen + setSrcLoc (mkRealSrcLoc (srcSpanFile span) (srcSpanEndLine span) + (fromIntegral (column :: Integer))) + _ <- popLexState + lexToken + setFile :: Int -> Action setFile code span buf len = do let file = mkFastString (go (lexemeToString (stepOn buf) (len-2))) @@ -2751,7 +2766,8 @@ oneWordPrags = Map.fromList [ ("overlapping", strtoken (\s -> IToverlapping_prag (SourceText s))), ("incoherent", strtoken (\s -> ITincoherent_prag (SourceText s))), ("ctype", strtoken (\s -> ITctype (SourceText s))), - ("complete", strtoken (\s -> ITcomplete_prag (SourceText s))) + ("complete", strtoken (\s -> ITcomplete_prag (SourceText s))), + ("column", begin column_prag) ] twoWordPrags = Map.fromList([ diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 3366705..43175ba 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -12771,6 +12771,29 @@ position for the duration of the splice and are limited to the splice. Note that because Template Haskell splices abstract syntax, the file positions are not automatically advanced. +.. _column-pragma: + +``COLUMN`` pragma +--------------- + +.. index:: + single: COLUMN; pragma + single: pragma; COLUMN + +This is the analogue of the ``LINE`` pragma and is likewise intended for +use in automatically generated Haskell code. It lets you specify the +column number of the original code; for example + +:: + + foo = do + {-# COLUMN 42 #-}pure () + pure () + +This adjusts all column numbers immediately after the pragma to start +at 42. The presence of this pragma only affects the quality of the +diagnostics and does not change the syntax of the code itself. + .. _rules: ``RULES`` pragma diff --git a/testsuite/tests/parser/should_compile/ColumnPragma.hs b/testsuite/tests/parser/should_compile/ColumnPragma.hs new file mode 100644 index 0000000..8044d1b --- /dev/null +++ b/testsuite/tests/parser/should_compile/ColumnPragma.hs @@ -0,0 +1,6 @@ +main :: IO () +main = do + -- force an "unrecognized pragma" warning + -- to check if the column number is correct + {-# COLUMN 1000 #-}print "Hello" {-# NONEXISTENTPRAGMA #-} + print "world" diff --git a/testsuite/tests/parser/should_compile/ColumnPragma.stderr b/testsuite/tests/parser/should_compile/ColumnPragma.stderr new file mode 100644 index 0000000..4dcfbd1 --- /dev/null +++ b/testsuite/tests/parser/should_compile/ColumnPragma.stderr @@ -0,0 +1,3 @@ + +ColumnPragma.hs:5:1015: warning: [-Wunrecognised-pragmas (in -Wdefault)] + Unrecognised pragma diff --git a/testsuite/tests/parser/should_compile/all.T b/testsuite/tests/parser/should_compile/all.T index 512836d..2059979 100644 --- a/testsuite/tests/parser/should_compile/all.T +++ b/testsuite/tests/parser/should_compile/all.T @@ -91,6 +91,7 @@ test('mc16', normal, compile, ['']) test('EmptyDecls', normal, compile, ['']) test('ParserLambdaCase', [], compile, ['']) +test('ColumnPragma', normal, compile, ['']) test('T5243', [], multimod_compile, ['T5243', '']) test('T7118', normal, compile, ['']) test('T7776', normal, compile, ['']) From git at git.haskell.org Mon Mar 13 21:06:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:06:43 +0000 (UTC) Subject: [commit: ghc] master: Maybe Monoid doc: "is no semigroup" -> "used to be no semigroup" (72ab738) Message-ID: <20170313210643.C47643A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/72ab738caf7539b12c88b7b0b23096d31cc0ab0f/ghc >--------------------------------------------------------------- commit 72ab738caf7539b12c88b7b0b23096d31cc0ab0f Author: Chris Martin Date: Mon Mar 13 15:18:33 2017 -0400 Maybe Monoid doc: "is no semigroup" -> "used to be no semigroup" Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3312 >--------------------------------------------------------------- 72ab738caf7539b12c88b7b0b23096d31cc0ab0f libraries/base/GHC/Base.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index 8548da6..3c3dbd3 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -317,8 +317,8 @@ instance Monoid Ordering where -- : \"Any semigroup @S@ may be -- turned into a monoid simply by adjoining an element @e@ not in @S@ -- and defining @e*e = e@ and @e*s = s = s*e@ for all @s ∈ S at .\" Since --- there is no \"Semigroup\" typeclass providing just 'mappend', we --- use 'Monoid' instead. +-- there used to be no \"Semigroup\" typeclass providing just 'mappend', +-- we use 'Monoid' instead. -- -- @since 2.01 instance Monoid a => Monoid (Maybe a) where From git at git.haskell.org Mon Mar 13 21:06:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:06:46 +0000 (UTC) Subject: [commit: ghc] master: Broaden demand analysis IO hack notes (dd3b06a) Message-ID: <20170313210646.7B65F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dd3b06aa2d44fa160e36097ce90c4574160bd4eb/ghc >--------------------------------------------------------------- commit dd3b06aa2d44fa160e36097ce90c4574160bd4eb Author: David Feuer Date: Mon Mar 13 15:18:49 2017 -0400 Broaden demand analysis IO hack notes The I/O hack for demand analysis has broader and arguably more important implications than the note expressed. Broaden it. [skip ci] Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: carter, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3307 >--------------------------------------------------------------- dd3b06aa2d44fa160e36097ce90c4574160bd4eb compiler/stranal/DmdAnal.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs index 9271eda..25a4f8b 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/stranal/DmdAnal.hs @@ -344,10 +344,14 @@ dmdAnalAlt env dmd case_bndr (con,bndrs,rhs) {- Note [IO hack in the demand analyser] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There's a hack here for I/O operations. Consider - case foo x s of { (# s, r #) -> y } -Is this strict in 'y'? Normally yes, but what if 'foo' is an I/O -operation that simply terminates the program (not in an erroneous way)? -In that case we should not evaluate 'y' before the call to 'foo'. + + case foo x s of { (# s', r #) -> y } + +Is this strict in 'y'? Often not! If foo x s performs some observable action +(including raising an exception with raiseIO#, modifying a mutable variable, or +even ending the program normally), then we must not force 'y' (which may fail +to terminate) until we have performed foo x s. + Hackish solution: spot the IO-like situation and add a virtual branch, as if we had case foo x s of From git at git.haskell.org Mon Mar 13 21:06:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:06:49 +0000 (UTC) Subject: [commit: ghc] master: Make exports from Data.Typeable and Type.Reflection consistent (11ea370) Message-ID: <20170313210649.3CC513A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/11ea370107c5b354918ff885c582299fadfe5ea9/ghc >--------------------------------------------------------------- commit 11ea370107c5b354918ff885c582299fadfe5ea9 Author: Ryan Scott Date: Mon Mar 13 15:19:03 2017 -0400 Make exports from Data.Typeable and Type.Reflection consistent This fixes some idiosyncracies I noticed between `Data.Typeable` and `Type.Reflection`: * `showsTypeRep` (from `Data.Typeable`) had the type `SomeTypeRep -> ShowS`, despite the fact that `SomeTypeRep` isn't exported from `Data.Typeable`. I changed it to be `Data.Typeable.TypeRep -> ShowS`. * Similarly, `typeRepFingerprint` (reexported from `Data.Typeable`) had the type `SomeTypeRep -> Fingerprint`. I changed it to `Data.Typeable.TypeRep -> Fingerprint`. * `Type.Reflection` wasn't exporting `typeRepX` or `typeRepXFingerprint`, despite the fact that their counterparts were exported from `Data.Typeable`. `Type.Reflection` now exports them as well. * `withTypeable :: TypeRep (a :: k) -> (Typeable a => r) -> r` was being reexported from `Data.Typeable`. This is in spite of the fact that you can't actually use the type-indexed `TypeRep a` by importing `Data.Typeable` alone. I decided to remove this export from `Data.Typeable`. Reviewers: bgamari, austin, hvr Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3309 >--------------------------------------------------------------- 11ea370107c5b354918ff885c582299fadfe5ea9 libraries/base/Data/Typeable.hs | 13 ++++++++++--- libraries/base/Type/Reflection.hs | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libraries/base/Data/Typeable.hs b/libraries/base/Data/Typeable.hs index d4b28f1..33bbf86 100644 --- a/libraries/base/Data/Typeable.hs +++ b/libraries/base/Data/Typeable.hs @@ -45,7 +45,6 @@ module Data.Typeable Typeable , typeOf , typeRep - , I.withTypeable -- * Propositional equality , (:~:)(Refl) @@ -74,7 +73,7 @@ module Data.Typeable , splitTyConApp , typeRepArgs , typeRepTyCon - , I.typeRepFingerprint + , typeRepFingerprint -- * Type constructors , I.TyCon -- abstract, instance of: Eq, Show, Typeable @@ -97,6 +96,7 @@ import Data.Type.Equality import Data.Maybe import Data.Proxy +import GHC.Fingerprint.Type import GHC.Show import GHC.Base @@ -115,7 +115,7 @@ typeRep :: forall proxy a. Typeable a => proxy a -> TypeRep typeRep = I.typeRepX -- | Show a type representation -showsTypeRep :: I.SomeTypeRep -> ShowS +showsTypeRep :: TypeRep -> ShowS showsTypeRep = shows -- | The type-safe cast operation @@ -187,6 +187,13 @@ typeRepArgs ty = case splitTyConApp ty of (_, args) -> args typeRepTyCon :: TypeRep -> TyCon typeRepTyCon = I.typeRepXTyCon +-- | Takes a value of type @a@ and returns a concrete representation +-- of that type. +-- +-- @since 4.7.0.0 +typeRepFingerprint :: TypeRep -> Fingerprint +typeRepFingerprint = I.typeRepXFingerprint + -- | Force a 'TypeRep' to normal form. rnfTypeRep :: TypeRep -> () rnfTypeRep = I.rnfSomeTypeRep diff --git a/libraries/base/Type/Reflection.hs b/libraries/base/Type/Reflection.hs index dc1c3cf..232ae2c 100644 --- a/libraries/base/Type/Reflection.hs +++ b/libraries/base/Type/Reflection.hs @@ -52,7 +52,9 @@ module Type.Reflection -- "Data.Typeable" exports a variant of this interface (named differently -- for backwards compatibility). , I.SomeTypeRep(..) + , I.typeRepX , I.typeRepXTyCon + , I.typeRepXFingerprint , I.rnfSomeTypeRep -- * Type constructors From git at git.haskell.org Mon Mar 13 21:06:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:06:52 +0000 (UTC) Subject: [commit: ghc] master: Typeable: Fix remaining typeRepX referencds (a3e4f69) Message-ID: <20170313210652.049303A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a3e4f693e231ce85587865e0383e0403cd897a60/ghc >--------------------------------------------------------------- commit a3e4f693e231ce85587865e0383e0403cd897a60 Author: Ben Gamari Date: Mon Mar 13 15:20:40 2017 -0400 Typeable: Fix remaining typeRepX referencds What was previously known as TypeRepX is now known as SomeTypeRep. >--------------------------------------------------------------- a3e4f693e231ce85587865e0383e0403cd897a60 libraries/base/Data/Typeable.hs | 22 +++++++++++----------- libraries/base/Data/Typeable/Internal.hs | 20 ++++++++++---------- libraries/base/Type/Reflection.hs | 6 +++--- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/libraries/base/Data/Typeable.hs b/libraries/base/Data/Typeable.hs index 33bbf86..4268619 100644 --- a/libraries/base/Data/Typeable.hs +++ b/libraries/base/Data/Typeable.hs @@ -105,14 +105,14 @@ type TypeRep = I.SomeTypeRep -- | Observe a type representation for the type of a value. typeOf :: forall a. Typeable a => a -> TypeRep -typeOf _ = I.typeRepX (Proxy :: Proxy a) +typeOf _ = I.someTypeRep (Proxy :: Proxy a) -- | Takes a value of type @a@ and returns a concrete representation -- of that type. -- -- @since 4.7.0.0 typeRep :: forall proxy a. Typeable a => proxy a -> TypeRep -typeRep = I.typeRepX +typeRep = I.someTypeRep -- | Show a type representation showsTypeRep :: TypeRep -> ShowS @@ -185,14 +185,14 @@ typeRepArgs ty = case splitTyConApp ty of (_, args) -> args -- | Observe the type constructor of a quantified type representation. typeRepTyCon :: TypeRep -> TyCon -typeRepTyCon = I.typeRepXTyCon +typeRepTyCon = I.someTypeRepTyCon -- | Takes a value of type @a@ and returns a concrete representation -- of that type. -- -- @since 4.7.0.0 typeRepFingerprint :: TypeRep -> Fingerprint -typeRepFingerprint = I.typeRepXFingerprint +typeRepFingerprint = I.someTypeRepFingerprint -- | Force a 'TypeRep' to normal form. rnfTypeRep :: TypeRep -> () @@ -201,30 +201,30 @@ rnfTypeRep = I.rnfSomeTypeRep -- Keeping backwards-compatibility typeOf1 :: forall t (a :: *). Typeable t => t a -> TypeRep -typeOf1 _ = I.typeRepX (Proxy :: Proxy t) +typeOf1 _ = I.someTypeRep (Proxy :: Proxy t) typeOf2 :: forall t (a :: *) (b :: *). Typeable t => t a b -> TypeRep -typeOf2 _ = I.typeRepX (Proxy :: Proxy t) +typeOf2 _ = I.someTypeRep (Proxy :: Proxy t) typeOf3 :: forall t (a :: *) (b :: *) (c :: *). Typeable t => t a b c -> TypeRep -typeOf3 _ = I.typeRepX (Proxy :: Proxy t) +typeOf3 _ = I.someTypeRep (Proxy :: Proxy t) typeOf4 :: forall t (a :: *) (b :: *) (c :: *) (d :: *). Typeable t => t a b c d -> TypeRep -typeOf4 _ = I.typeRepX (Proxy :: Proxy t) +typeOf4 _ = I.someTypeRep (Proxy :: Proxy t) typeOf5 :: forall t (a :: *) (b :: *) (c :: *) (d :: *) (e :: *). Typeable t => t a b c d e -> TypeRep -typeOf5 _ = I.typeRepX (Proxy :: Proxy t) +typeOf5 _ = I.someTypeRep (Proxy :: Proxy t) typeOf6 :: forall t (a :: *) (b :: *) (c :: *) (d :: *) (e :: *) (f :: *). Typeable t => t a b c d e f -> TypeRep -typeOf6 _ = I.typeRepX (Proxy :: Proxy t) +typeOf6 _ = I.someTypeRep (Proxy :: Proxy t) typeOf7 :: forall t (a :: *) (b :: *) (c :: *) (d :: *) (e :: *) (f :: *) (g :: *). Typeable t => t a b c d e f g -> TypeRep -typeOf7 _ = I.typeRepX (Proxy :: Proxy t) +typeOf7 _ = I.someTypeRep (Proxy :: Proxy t) type Typeable1 (a :: * -> *) = Typeable a type Typeable2 (a :: * -> * -> *) = Typeable a diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index f4e690b..48da8dd 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -63,9 +63,9 @@ module Data.Typeable.Internal ( -- * SomeTypeRep SomeTypeRep(..), - typeRepX, - typeRepXTyCon, - typeRepXFingerprint, + someTypeRep, + someTypeRepTyCon, + someTypeRepFingerprint, rnfSomeTypeRep, -- * Construction @@ -250,7 +250,7 @@ mkTrCon :: forall k (a :: k). TyCon -> [SomeTypeRep] -> TypeRep a mkTrCon tc kind_vars = TrTyCon fpr tc kind_vars where fpr_tc = tyConFingerprint tc - fpr_kvs = map typeRepXFingerprint kind_vars + fpr_kvs = map someTypeRepFingerprint kind_vars fpr = fingerprintFingerprints (fpr_tc:fpr_kvs) -- | Construct a representation for a type application. @@ -298,8 +298,8 @@ pattern Con' con ks <- TrTyCon _ con ks ----------------- Observation --------------------- -- | Observe the type constructor of a quantified type representation. -typeRepXTyCon :: SomeTypeRep -> TyCon -typeRepXTyCon (SomeTypeRep t) = typeRepTyCon t +someTypeRepTyCon :: SomeTypeRep -> TyCon +someTypeRepTyCon (SomeTypeRep t) = typeRepTyCon t -- | Observe the type constructor of a type representation typeRepTyCon :: TypeRep a -> TyCon @@ -470,12 +470,12 @@ typeOf _ = typeRep -- of that type. -- -- @since 4.7.0.0 -typeRepX :: forall proxy a. Typeable a => proxy a -> SomeTypeRep -typeRepX _ = SomeTypeRep (typeRep :: TypeRep a) +someTypeRep :: forall proxy a. Typeable a => proxy a -> SomeTypeRep +someTypeRep _ = SomeTypeRep (typeRep :: TypeRep a) {-# INLINE typeRep #-} -typeRepXFingerprint :: SomeTypeRep -> Fingerprint -typeRepXFingerprint (SomeTypeRep t) = typeRepFingerprint t +someTypeRepFingerprint :: SomeTypeRep -> Fingerprint +someTypeRepFingerprint (SomeTypeRep t) = typeRepFingerprint t ----------------- Showing TypeReps -------------------- diff --git a/libraries/base/Type/Reflection.hs b/libraries/base/Type/Reflection.hs index 232ae2c..cb0337a 100644 --- a/libraries/base/Type/Reflection.hs +++ b/libraries/base/Type/Reflection.hs @@ -52,9 +52,9 @@ module Type.Reflection -- "Data.Typeable" exports a variant of this interface (named differently -- for backwards compatibility). , I.SomeTypeRep(..) - , I.typeRepX - , I.typeRepXTyCon - , I.typeRepXFingerprint + , I.someTypeRep + , I.someTypeRepTyCon + , I.someTypeRepFingerprint , I.rnfSomeTypeRep -- * Type constructors From git at git.haskell.org Mon Mar 13 21:06:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:06:57 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Fix peak_megabytes_allocated for T4029 (40a0c00) Message-ID: <20170313210657.6DBC93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/40a0c0095e06b0c445bdd2332f52ac2b86e59a2e/ghc >--------------------------------------------------------------- commit 40a0c0095e06b0c445bdd2332f52ac2b86e59a2e Author: Ben Gamari Date: Mon Mar 13 17:03:42 2017 -0400 testsuite: Fix peak_megabytes_allocated for T4029 It seems I must have dropped the update of the expected value during a conflict resolution. >--------------------------------------------------------------- 40a0c0095e06b0c445bdd2332f52ac2b86e59a2e testsuite/tests/perf/space_leaks/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/perf/space_leaks/all.T b/testsuite/tests/perf/space_leaks/all.T index fa93d72..d83b003 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -59,7 +59,7 @@ test('T4018', test('T4029', [stats_num_field('peak_megabytes_allocated', - [(wordsize(64), 76, 10)]), + [(wordsize(64), 65, 10)]), # 2016-02-26: 66 (amd64/Linux) INITIAL # 2016-05-23: 82 (amd64/Linux) Use -G1 # 2016-07-13: 92 (amd64/Linux) Changes to tidyType From git at git.haskell.org Mon Mar 13 21:06:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:06:54 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Fix use of wc in T13340 (cf74b67) Message-ID: <20170313210654.B590D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cf74b677e8a328785a95bd0a7b094daf25e6868a/ghc >--------------------------------------------------------------- commit cf74b677e8a328785a95bd0a7b094daf25e6868a Author: Ben Gamari Date: Mon Mar 13 17:00:01 2017 -0400 testsuite: Fix use of wc in T13340 As previously documented (88f5add0280788d424c9df5f751a73e73a1a4284) wc's output is inconsistent between Linux and BSDs. Use grep -c instead. >--------------------------------------------------------------- cf74b677e8a328785a95bd0a7b094daf25e6868a testsuite/tests/simplCore/should_compile/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile index 3276723..b190dfc 100644 --- a/testsuite/tests/simplCore/should_compile/Makefile +++ b/testsuite/tests/simplCore/should_compile/Makefile @@ -211,4 +211,4 @@ str-rules: # g should have been collapsed into one defininition by CSE. .PHONY: T13340 T13340: - '$(TEST_HC)' $(TEST_HC_OPTS) -c -O T13340.hs -ddump-simpl -dsuppress-all | grep '\+#' | wc -l + '$(TEST_HC)' $(TEST_HC_OPTS) -c -O T13340.hs -ddump-simpl -dsuppress-all | grep -c '\+#' From git at git.haskell.org Mon Mar 13 21:44:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:44:30 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Broaden demand analysis IO hack notes (4ff1374) Message-ID: <20170313214430.572823A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/4ff1374074e6fac48512c62f5baf9e1863883a23/ghc >--------------------------------------------------------------- commit 4ff1374074e6fac48512c62f5baf9e1863883a23 Author: David Feuer Date: Mon Mar 13 15:18:49 2017 -0400 Broaden demand analysis IO hack notes The I/O hack for demand analysis has broader and arguably more important implications than the note expressed. Broaden it. [skip ci] Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: carter, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3307 (cherry picked from commit dd3b06aa2d44fa160e36097ce90c4574160bd4eb) >--------------------------------------------------------------- 4ff1374074e6fac48512c62f5baf9e1863883a23 compiler/stranal/DmdAnal.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs index 9271eda..25a4f8b 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/stranal/DmdAnal.hs @@ -344,10 +344,14 @@ dmdAnalAlt env dmd case_bndr (con,bndrs,rhs) {- Note [IO hack in the demand analyser] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There's a hack here for I/O operations. Consider - case foo x s of { (# s, r #) -> y } -Is this strict in 'y'? Normally yes, but what if 'foo' is an I/O -operation that simply terminates the program (not in an erroneous way)? -In that case we should not evaluate 'y' before the call to 'foo'. + + case foo x s of { (# s', r #) -> y } + +Is this strict in 'y'? Often not! If foo x s performs some observable action +(including raising an exception with raiseIO#, modifying a mutable variable, or +even ending the program normally), then we must not force 'y' (which may fail +to terminate) until we have performed foo x s. + Hackish solution: spot the IO-like situation and add a virtual branch, as if we had case foo x s of From git at git.haskell.org Mon Mar 13 21:44:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:44:33 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Add `-fmax-errors` flag (6e4c238) Message-ID: <20170313214433.192253A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/6e4c238274bdd2aea38f833ef32ac028843468c6/ghc >--------------------------------------------------------------- commit 6e4c238274bdd2aea38f833ef32ac028843468c6 Author: Charles Cooper Date: Mon Mar 13 15:17:58 2017 -0400 Add `-fmax-errors` flag This commit adds a command line option to limit the number of errors displayed. It also moves the documentation for `reverse-errors` into the `Warnings` section. https://ghc.haskell.org/trac/ghc/ticket/13326 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3323 (cherry picked from commit 70274b4f8003fde0fa3e4094a10dfae880579786) >--------------------------------------------------------------- 6e4c238274bdd2aea38f833ef32ac028843468c6 compiler/main/DynFlags.hs | 12 ++++++++++-- compiler/main/ErrUtils.hs | 6 +++++- utils/mkUserGuidePart/Options/Misc.hs | 7 ------- utils/mkUserGuidePart/Options/Warnings.hs | 13 +++++++++++++ 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index e96bf69..e95796d 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -935,7 +935,10 @@ data DynFlags = DynFlags { maxInlineMemsetInsns :: Int, -- | Reverse the order of error messages in GHC/GHCi - reverseErrors :: Bool, + reverseErrors :: Bool, + + -- | Limit the maximum number of errors to show + maxErrors :: Maybe Int, -- | Unique supply configuration for testing build determinism initialUnique :: Int, @@ -1684,7 +1687,8 @@ defaultDynFlags mySettings = initialUnique = 0, uniqueIncrement = 1, - reverseErrors = False + reverseErrors = False, + maxErrors = Nothing } defaultWays :: Settings -> [Way] @@ -2798,6 +2802,10 @@ dynamic_flags_deps = [ "Use -fno-force-recomp instead" , make_dep_flag defGhcFlag "no-recomp" (NoArg $ setGeneralFlag Opt_ForceRecomp) "Use -fforce-recomp instead" + , make_ord_flag defFlag "fmax-errors" + (intSuffix (\n d -> d { maxErrors = Just (max 1 n) })) + , make_ord_flag defFlag "fno-max-errors" + (noArg (\d -> d { maxErrors = Nothing })) , make_ord_flag defFlag "freverse-errors" (noArg (\d -> d {reverseErrors = True} )) , make_ord_flag defFlag "fno-reverse-errors" diff --git a/compiler/main/ErrUtils.hs b/compiler/main/ErrUtils.hs index d73628a..8e71847 100644 --- a/compiler/main/ErrUtils.hs +++ b/compiler/main/ErrUtils.hs @@ -378,11 +378,15 @@ pprLocErrMsg (ErrMsg { errMsgSpan = s mkLocMessage sev s (formatErrDoc dflags doc) sortMsgBag :: Maybe DynFlags -> Bag ErrMsg -> [ErrMsg] -sortMsgBag dflags = sortBy (maybeFlip $ comparing errMsgSpan) . bagToList +sortMsgBag dflags = maybeLimit . sortBy (maybeFlip cmp) . bagToList where maybeFlip :: (a -> a -> b) -> (a -> a -> b) maybeFlip | fromMaybe False (fmap reverseErrors dflags) = flip | otherwise = id + cmp = comparing errMsgSpan + maybeLimit = case join (fmap maxErrors dflags) of + Nothing -> id + Just err_limit -> take err_limit ghcExit :: DynFlags -> Int -> IO () ghcExit dflags val diff --git a/utils/mkUserGuidePart/Options/Misc.hs b/utils/mkUserGuidePart/Options/Misc.hs index 57e8808..c542fa3 100644 --- a/utils/mkUserGuidePart/Options/Misc.hs +++ b/utils/mkUserGuidePart/Options/Misc.hs @@ -29,13 +29,6 @@ miscOptions = "the main thread, rather than a forked thread." , flagType = DynamicFlag } - , flag { flagName = "-freverse-errors" - , flagDescription = - "Display errors in GHC/GHCi sorted by reverse order of "++ - "source code line numbers." - , flagType = DynamicFlag - , flagReverse = "-fno-reverse-errors" - } , flag { flagName = "-flocal-ghci-history" , flagDescription = "Use current directory for the GHCi command history "++ diff --git a/utils/mkUserGuidePart/Options/Warnings.hs b/utils/mkUserGuidePart/Options/Warnings.hs index f242fb0..48ee32c 100644 --- a/utils/mkUserGuidePart/Options/Warnings.hs +++ b/utils/mkUserGuidePart/Options/Warnings.hs @@ -90,6 +90,19 @@ warningsOptions = , flagType = DynamicFlag , flagReverse = "-fno-helpful-errors" } + , flag { flagName = "-freverse-errors" + , flagDescription = + "Display errors in GHC/GHCi sorted by reverse order of "++ + "source code line numbers." + , flagType = DynamicFlag + , flagReverse = "-fno-reverse-errors" + } + , flag { flagName = "-fmax-errors" + , flagDescription = + "Limit the number of errors displayed in GHC/GHCi." + , flagType = DynamicFlag + , flagReverse = "-fno-max-errors" + } , flag { flagName = "-Wdeprecated-flags" , flagDescription = "warn about uses of commandline flags that are deprecated" From git at git.haskell.org Mon Mar 13 21:44:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:44:35 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Maybe Monoid doc: "is no semigroup" -> "used to be no semigroup" (820b88c) Message-ID: <20170313214435.C96CD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/820b88c2f91779843792896a1274e7133a31a3cc/ghc >--------------------------------------------------------------- commit 820b88c2f91779843792896a1274e7133a31a3cc Author: Chris Martin Date: Mon Mar 13 15:18:33 2017 -0400 Maybe Monoid doc: "is no semigroup" -> "used to be no semigroup" Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3312 (cherry picked from commit 72ab738caf7539b12c88b7b0b23096d31cc0ab0f) >--------------------------------------------------------------- 820b88c2f91779843792896a1274e7133a31a3cc libraries/base/GHC/Base.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index a678c22..d885c67 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -317,8 +317,8 @@ instance Monoid Ordering where -- : \"Any semigroup @S@ may be -- turned into a monoid simply by adjoining an element @e@ not in @S@ -- and defining @e*e = e@ and @e*s = s = s*e@ for all @s ∈ S at .\" Since --- there is no \"Semigroup\" typeclass providing just 'mappend', we --- use 'Monoid' instead. +-- there used to be no \"Semigroup\" typeclass providing just 'mappend', +-- we use 'Monoid' instead. -- -- @since 2.01 instance Monoid a => Monoid (Maybe a) where From git at git.haskell.org Mon Mar 13 21:44:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:44:42 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: unlit: replace the SHEBANG with an empty line (bd3c648) Message-ID: <20170313214442.4B25F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/bd3c648dc22e7e268c6390db822a704dc61b14b7/ghc >--------------------------------------------------------------- commit bd3c648dc22e7e268c6390db822a704dc61b14b7 Author: Phil Ruffwind Date: Mon Mar 13 15:17:47 2017 -0400 unlit: replace the SHEBANG with an empty line This corrects the line numbers for literate code after a shebang. Fixes #13414. Test Plan: validate Reviewers: austin, bgamari, trofi Reviewed By: bgamari, trofi Subscribers: trofi, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3333 (cherry picked from commit c77b767098be53087e0b06ba23d613dd7c3bcf8e) >--------------------------------------------------------------- bd3c648dc22e7e268c6390db822a704dc61b14b7 testsuite/tests/parser/should_fail/T13414.lhs | 3 +++ testsuite/tests/parser/should_fail/T13414.stderr | 2 ++ testsuite/tests/parser/should_fail/all.T | 1 + utils/unlit/unlit.c | 3 +++ 4 files changed, 9 insertions(+) diff --git a/testsuite/tests/parser/should_fail/T13414.lhs b/testsuite/tests/parser/should_fail/T13414.lhs new file mode 100644 index 0000000..fe6b960 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T13414.lhs @@ -0,0 +1,3 @@ +#!/usr/bin/env runhaskell +> module T13414 where +> main = invalid_ident_ diff --git a/testsuite/tests/parser/should_fail/T13414.stderr b/testsuite/tests/parser/should_fail/T13414.stderr new file mode 100644 index 0000000..f5b0001 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T13414.stderr @@ -0,0 +1,2 @@ + +T13414.lhs:3:10: error: Variable not in scope: invalid_ident_ diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T index 1496fec..b897484 100644 --- a/testsuite/tests/parser/should_fail/all.T +++ b/testsuite/tests/parser/should_fail/all.T @@ -97,3 +97,4 @@ test('T12051', normal, compile_fail, ['']) test('T12429', normal, compile_fail, ['']) test('T12811', normal, compile_fail, ['']) test('T13260', normal, compile_fail, ['']) +test('T13414', literate, compile_fail, ['']) diff --git a/utils/unlit/unlit.c b/utils/unlit/unlit.c index c0e3b98..9a697eb 100644 --- a/utils/unlit/unlit.c +++ b/utils/unlit/unlit.c @@ -296,6 +296,9 @@ static void unlit(char *file, FILE *istream, FILE *ostream) } } #endif + if (this == SHEBANG) { + myputc('\n', ostream); + } } while(this!=ENDFILE); if (defnsread==0) From git at git.haskell.org Mon Mar 13 21:44:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:44:39 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Add COLUMN pragma (2bd87cd) Message-ID: <20170313214439.3E2123A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/2bd87cd498a6dc3b7c37362f8645b00ba5262410/ghc >--------------------------------------------------------------- commit 2bd87cd498a6dc3b7c37362f8645b00ba5262410 Author: Phil Ruffwind Date: Mon Mar 13 15:18:22 2017 -0400 Add COLUMN pragma Test Plan: validate Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3313 (cherry picked from commit e61b4a4169da17cd7b77f9dc09e3627eff1ff559) >--------------------------------------------------------------- 2bd87cd498a6dc3b7c37362f8645b00ba5262410 compiler/parser/Lexer.x | 18 ++++++++++++++++- docs/users_guide/glasgow_exts.rst | 23 ++++++++++++++++++++++ .../tests/parser/should_compile/ColumnPragma.hs | 6 ++++++ .../parser/should_compile/ColumnPragma.stderr | 3 +++ testsuite/tests/parser/should_compile/all.T | 1 + 5 files changed, 50 insertions(+), 1 deletion(-) diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index 6f91f44..3d6fa16 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -318,6 +318,10 @@ $tab { warnTab } -- NOTE: accept -} at the end of a LINE pragma, for compatibility -- with older versions of GHC which generated these. +-- Haskell-style column pragmas, of the form +-- {-# COLUMN #-} + @decimal $whitechar* "#-}" { setColumn } + <0,option_prags> { "{-#" $whitechar* $pragmachar+ $whitechar+ $pragmachar+ / { known_pragma twoWordPrags } @@ -1390,6 +1394,17 @@ setLine code span buf len = do pushLexState code lexToken +setColumn :: Action +setColumn span buf len = do + let column = + case reads (lexemeToString buf len) of + [(column, _)] -> column + _ -> error "setColumn: expected integer" -- shouldn't happen + setSrcLoc (mkRealSrcLoc (srcSpanFile span) (srcSpanEndLine span) + (fromIntegral (column :: Integer))) + _ <- popLexState + lexToken + setFile :: Int -> Action setFile code span buf len = do let file = mkFastString (go (lexemeToString (stepOn buf) (len-2))) @@ -2751,7 +2766,8 @@ oneWordPrags = Map.fromList [ ("overlapping", strtoken (\s -> IToverlapping_prag (SourceText s))), ("incoherent", strtoken (\s -> ITincoherent_prag (SourceText s))), ("ctype", strtoken (\s -> ITctype (SourceText s))), - ("complete", strtoken (\s -> ITcomplete_prag (SourceText s))) + ("complete", strtoken (\s -> ITcomplete_prag (SourceText s))), + ("column", begin column_prag) ] twoWordPrags = Map.fromList([ diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 3366705..43175ba 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -12771,6 +12771,29 @@ position for the duration of the splice and are limited to the splice. Note that because Template Haskell splices abstract syntax, the file positions are not automatically advanced. +.. _column-pragma: + +``COLUMN`` pragma +--------------- + +.. index:: + single: COLUMN; pragma + single: pragma; COLUMN + +This is the analogue of the ``LINE`` pragma and is likewise intended for +use in automatically generated Haskell code. It lets you specify the +column number of the original code; for example + +:: + + foo = do + {-# COLUMN 42 #-}pure () + pure () + +This adjusts all column numbers immediately after the pragma to start +at 42. The presence of this pragma only affects the quality of the +diagnostics and does not change the syntax of the code itself. + .. _rules: ``RULES`` pragma diff --git a/testsuite/tests/parser/should_compile/ColumnPragma.hs b/testsuite/tests/parser/should_compile/ColumnPragma.hs new file mode 100644 index 0000000..8044d1b --- /dev/null +++ b/testsuite/tests/parser/should_compile/ColumnPragma.hs @@ -0,0 +1,6 @@ +main :: IO () +main = do + -- force an "unrecognized pragma" warning + -- to check if the column number is correct + {-# COLUMN 1000 #-}print "Hello" {-# NONEXISTENTPRAGMA #-} + print "world" diff --git a/testsuite/tests/parser/should_compile/ColumnPragma.stderr b/testsuite/tests/parser/should_compile/ColumnPragma.stderr new file mode 100644 index 0000000..4dcfbd1 --- /dev/null +++ b/testsuite/tests/parser/should_compile/ColumnPragma.stderr @@ -0,0 +1,3 @@ + +ColumnPragma.hs:5:1015: warning: [-Wunrecognised-pragmas (in -Wdefault)] + Unrecognised pragma diff --git a/testsuite/tests/parser/should_compile/all.T b/testsuite/tests/parser/should_compile/all.T index 512836d..2059979 100644 --- a/testsuite/tests/parser/should_compile/all.T +++ b/testsuite/tests/parser/should_compile/all.T @@ -91,6 +91,7 @@ test('mc16', normal, compile, ['']) test('EmptyDecls', normal, compile, ['']) test('ParserLambdaCase', [], compile, ['']) +test('ColumnPragma', normal, compile, ['']) test('T5243', [], multimod_compile, ['T5243', '']) test('T7118', normal, compile, ['']) test('T7776', normal, compile, ['']) From git at git.haskell.org Mon Mar 13 21:44:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:44:47 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Elaborate further on ZipList Applicative docs (0f944b2) Message-ID: <20170313214447.BE0573A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/0f944b227cbcd56365ad1cc49173d4a0c47bf857/ghc >--------------------------------------------------------------- commit 0f944b227cbcd56365ad1cc49173d4a0c47bf857 Author: Chris Martin Date: Sun Mar 12 15:15:29 2017 -0400 Elaborate further on ZipList Applicative docs I was initially confused when I read "zipWithn" in the haddock for ZipList, went looking for a function named "zipWithn", and found that it didn't exist. This expands the docs to clarify that we're referring to the family of functions [zipWith, zipWith3, zipWith4, ...], capitalizes the letter "n" in "zipWithN" in attempt to make that more readable, and gives an example. I also moved this documentation from ZipList itself to the Applicative instance, so that it will show up in both the Ziplist documentation and in the list of Applicative instances. Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3324 (cherry picked from commit ae0ccf8c16f5ed394ab01a1863abd98a7a44ab60) >--------------------------------------------------------------- 0f944b227cbcd56365ad1cc49173d4a0c47bf857 libraries/base/Control/Applicative.hs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/libraries/base/Control/Applicative.hs b/libraries/base/Control/Applicative.hs index 406f086..9045bcd 100644 --- a/libraries/base/Control/Applicative.hs +++ b/libraries/base/Control/Applicative.hs @@ -99,16 +99,24 @@ instance (ArrowZero a, ArrowPlus a) => Alternative (WrappedArrow a b) where empty = WrapArrow zeroArrow WrapArrow u <|> WrapArrow v = WrapArrow (u <+> v) --- | Lists, but with an 'Applicative' functor based on zipping, so that --- --- @f '<$>' 'ZipList' xs1 '<*>' ... '<*>' 'ZipList' xsn = 'ZipList' (zipWithn f xs1 ... xsn)@ --- +-- | Lists, but with an 'Applicative' functor based on zipping. newtype ZipList a = ZipList { getZipList :: [a] } deriving ( Show, Eq, Ord, Read, Functor , Foldable, Generic, Generic1) -- See Data.Traversable for Traversable instance due to import loops --- | @since 2.01 +-- | +-- > f '<$>' 'ZipList' xs1 '<*>' ... '<*>' 'ZipList' xsN +-- = 'ZipList' (zipWithN f xs1 ... xsN) +-- +-- where @zipWithN@ refers to the @zipWith@ function of the appropriate arity +-- (@zipWith@, @zipWith3@, @zipWith4@, ...). For example: +-- +-- > (\a b c -> stimes c [a, b]) <$> ZipList "abcd" <*> ZipList "567" <*> ZipList [1..] +-- > = ZipList (zipWith3 (\a b c -> stimes c [a, b]) "abcd" "567" [1..]) +-- > = ZipList {getZipList = ["a5","b6b6","c7c7c7"]} +-- +-- @since 2.01 instance Applicative ZipList where pure x = ZipList (repeat x) liftA2 f (ZipList xs) (ZipList ys) = ZipList (zipWith f xs ys) From git at git.haskell.org Mon Mar 13 21:44:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:44:45 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Make exports from Data.Typeable and Type.Reflection consistent (e8df4f8) Message-ID: <20170313214445.07C953A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/e8df4f8a27f020699e5a4b14c6191076cad863cc/ghc >--------------------------------------------------------------- commit e8df4f8a27f020699e5a4b14c6191076cad863cc Author: Ryan Scott Date: Mon Mar 13 15:19:03 2017 -0400 Make exports from Data.Typeable and Type.Reflection consistent This fixes some idiosyncracies I noticed between `Data.Typeable` and `Type.Reflection`: * `showsTypeRep` (from `Data.Typeable`) had the type `SomeTypeRep -> ShowS`, despite the fact that `SomeTypeRep` isn't exported from `Data.Typeable`. I changed it to be `Data.Typeable.TypeRep -> ShowS`. * Similarly, `typeRepFingerprint` (reexported from `Data.Typeable`) had the type `SomeTypeRep -> Fingerprint`. I changed it to `Data.Typeable.TypeRep -> Fingerprint`. * `Type.Reflection` wasn't exporting `typeRepX` or `typeRepXFingerprint`, despite the fact that their counterparts were exported from `Data.Typeable`. `Type.Reflection` now exports them as well. * `withTypeable :: TypeRep (a :: k) -> (Typeable a => r) -> r` was being reexported from `Data.Typeable`. This is in spite of the fact that you can't actually use the type-indexed `TypeRep a` by importing `Data.Typeable` alone. I decided to remove this export from `Data.Typeable`. Reviewers: bgamari, austin, hvr Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3309 (cherry picked from commit 11ea370107c5b354918ff885c582299fadfe5ea9) >--------------------------------------------------------------- e8df4f8a27f020699e5a4b14c6191076cad863cc libraries/base/Data/Typeable.hs | 13 ++++++++++--- libraries/base/Type/Reflection.hs | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libraries/base/Data/Typeable.hs b/libraries/base/Data/Typeable.hs index d4b28f1..33bbf86 100644 --- a/libraries/base/Data/Typeable.hs +++ b/libraries/base/Data/Typeable.hs @@ -45,7 +45,6 @@ module Data.Typeable Typeable , typeOf , typeRep - , I.withTypeable -- * Propositional equality , (:~:)(Refl) @@ -74,7 +73,7 @@ module Data.Typeable , splitTyConApp , typeRepArgs , typeRepTyCon - , I.typeRepFingerprint + , typeRepFingerprint -- * Type constructors , I.TyCon -- abstract, instance of: Eq, Show, Typeable @@ -97,6 +96,7 @@ import Data.Type.Equality import Data.Maybe import Data.Proxy +import GHC.Fingerprint.Type import GHC.Show import GHC.Base @@ -115,7 +115,7 @@ typeRep :: forall proxy a. Typeable a => proxy a -> TypeRep typeRep = I.typeRepX -- | Show a type representation -showsTypeRep :: I.SomeTypeRep -> ShowS +showsTypeRep :: TypeRep -> ShowS showsTypeRep = shows -- | The type-safe cast operation @@ -187,6 +187,13 @@ typeRepArgs ty = case splitTyConApp ty of (_, args) -> args typeRepTyCon :: TypeRep -> TyCon typeRepTyCon = I.typeRepXTyCon +-- | Takes a value of type @a@ and returns a concrete representation +-- of that type. +-- +-- @since 4.7.0.0 +typeRepFingerprint :: TypeRep -> Fingerprint +typeRepFingerprint = I.typeRepXFingerprint + -- | Force a 'TypeRep' to normal form. rnfTypeRep :: TypeRep -> () rnfTypeRep = I.rnfSomeTypeRep diff --git a/libraries/base/Type/Reflection.hs b/libraries/base/Type/Reflection.hs index dc1c3cf..232ae2c 100644 --- a/libraries/base/Type/Reflection.hs +++ b/libraries/base/Type/Reflection.hs @@ -52,7 +52,9 @@ module Type.Reflection -- "Data.Typeable" exports a variant of this interface (named differently -- for backwards compatibility). , I.SomeTypeRep(..) + , I.typeRepX , I.typeRepXTyCon + , I.typeRepXFingerprint , I.rnfSomeTypeRep -- * Type constructors From git at git.haskell.org Mon Mar 13 21:44:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:44:50 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Typeable: Fix remaining typeRepX referencds (a09efe4) Message-ID: <20170313214450.7FFF63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/a09efe416b334098fdf4b41a4e2fd4e442e76250/ghc >--------------------------------------------------------------- commit a09efe416b334098fdf4b41a4e2fd4e442e76250 Author: Ben Gamari Date: Mon Mar 13 15:20:40 2017 -0400 Typeable: Fix remaining typeRepX referencds What was previously known as TypeRepX is now known as SomeTypeRep. (cherry picked from commit a3e4f693e231ce85587865e0383e0403cd897a60) >--------------------------------------------------------------- a09efe416b334098fdf4b41a4e2fd4e442e76250 libraries/base/Data/Typeable.hs | 22 +++++++++++----------- libraries/base/Data/Typeable/Internal.hs | 20 ++++++++++---------- libraries/base/Type/Reflection.hs | 6 +++--- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/libraries/base/Data/Typeable.hs b/libraries/base/Data/Typeable.hs index 33bbf86..4268619 100644 --- a/libraries/base/Data/Typeable.hs +++ b/libraries/base/Data/Typeable.hs @@ -105,14 +105,14 @@ type TypeRep = I.SomeTypeRep -- | Observe a type representation for the type of a value. typeOf :: forall a. Typeable a => a -> TypeRep -typeOf _ = I.typeRepX (Proxy :: Proxy a) +typeOf _ = I.someTypeRep (Proxy :: Proxy a) -- | Takes a value of type @a@ and returns a concrete representation -- of that type. -- -- @since 4.7.0.0 typeRep :: forall proxy a. Typeable a => proxy a -> TypeRep -typeRep = I.typeRepX +typeRep = I.someTypeRep -- | Show a type representation showsTypeRep :: TypeRep -> ShowS @@ -185,14 +185,14 @@ typeRepArgs ty = case splitTyConApp ty of (_, args) -> args -- | Observe the type constructor of a quantified type representation. typeRepTyCon :: TypeRep -> TyCon -typeRepTyCon = I.typeRepXTyCon +typeRepTyCon = I.someTypeRepTyCon -- | Takes a value of type @a@ and returns a concrete representation -- of that type. -- -- @since 4.7.0.0 typeRepFingerprint :: TypeRep -> Fingerprint -typeRepFingerprint = I.typeRepXFingerprint +typeRepFingerprint = I.someTypeRepFingerprint -- | Force a 'TypeRep' to normal form. rnfTypeRep :: TypeRep -> () @@ -201,30 +201,30 @@ rnfTypeRep = I.rnfSomeTypeRep -- Keeping backwards-compatibility typeOf1 :: forall t (a :: *). Typeable t => t a -> TypeRep -typeOf1 _ = I.typeRepX (Proxy :: Proxy t) +typeOf1 _ = I.someTypeRep (Proxy :: Proxy t) typeOf2 :: forall t (a :: *) (b :: *). Typeable t => t a b -> TypeRep -typeOf2 _ = I.typeRepX (Proxy :: Proxy t) +typeOf2 _ = I.someTypeRep (Proxy :: Proxy t) typeOf3 :: forall t (a :: *) (b :: *) (c :: *). Typeable t => t a b c -> TypeRep -typeOf3 _ = I.typeRepX (Proxy :: Proxy t) +typeOf3 _ = I.someTypeRep (Proxy :: Proxy t) typeOf4 :: forall t (a :: *) (b :: *) (c :: *) (d :: *). Typeable t => t a b c d -> TypeRep -typeOf4 _ = I.typeRepX (Proxy :: Proxy t) +typeOf4 _ = I.someTypeRep (Proxy :: Proxy t) typeOf5 :: forall t (a :: *) (b :: *) (c :: *) (d :: *) (e :: *). Typeable t => t a b c d e -> TypeRep -typeOf5 _ = I.typeRepX (Proxy :: Proxy t) +typeOf5 _ = I.someTypeRep (Proxy :: Proxy t) typeOf6 :: forall t (a :: *) (b :: *) (c :: *) (d :: *) (e :: *) (f :: *). Typeable t => t a b c d e f -> TypeRep -typeOf6 _ = I.typeRepX (Proxy :: Proxy t) +typeOf6 _ = I.someTypeRep (Proxy :: Proxy t) typeOf7 :: forall t (a :: *) (b :: *) (c :: *) (d :: *) (e :: *) (f :: *) (g :: *). Typeable t => t a b c d e f g -> TypeRep -typeOf7 _ = I.typeRepX (Proxy :: Proxy t) +typeOf7 _ = I.someTypeRep (Proxy :: Proxy t) type Typeable1 (a :: * -> *) = Typeable a type Typeable2 (a :: * -> * -> *) = Typeable a diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index f4e690b..48da8dd 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -63,9 +63,9 @@ module Data.Typeable.Internal ( -- * SomeTypeRep SomeTypeRep(..), - typeRepX, - typeRepXTyCon, - typeRepXFingerprint, + someTypeRep, + someTypeRepTyCon, + someTypeRepFingerprint, rnfSomeTypeRep, -- * Construction @@ -250,7 +250,7 @@ mkTrCon :: forall k (a :: k). TyCon -> [SomeTypeRep] -> TypeRep a mkTrCon tc kind_vars = TrTyCon fpr tc kind_vars where fpr_tc = tyConFingerprint tc - fpr_kvs = map typeRepXFingerprint kind_vars + fpr_kvs = map someTypeRepFingerprint kind_vars fpr = fingerprintFingerprints (fpr_tc:fpr_kvs) -- | Construct a representation for a type application. @@ -298,8 +298,8 @@ pattern Con' con ks <- TrTyCon _ con ks ----------------- Observation --------------------- -- | Observe the type constructor of a quantified type representation. -typeRepXTyCon :: SomeTypeRep -> TyCon -typeRepXTyCon (SomeTypeRep t) = typeRepTyCon t +someTypeRepTyCon :: SomeTypeRep -> TyCon +someTypeRepTyCon (SomeTypeRep t) = typeRepTyCon t -- | Observe the type constructor of a type representation typeRepTyCon :: TypeRep a -> TyCon @@ -470,12 +470,12 @@ typeOf _ = typeRep -- of that type. -- -- @since 4.7.0.0 -typeRepX :: forall proxy a. Typeable a => proxy a -> SomeTypeRep -typeRepX _ = SomeTypeRep (typeRep :: TypeRep a) +someTypeRep :: forall proxy a. Typeable a => proxy a -> SomeTypeRep +someTypeRep _ = SomeTypeRep (typeRep :: TypeRep a) {-# INLINE typeRep #-} -typeRepXFingerprint :: SomeTypeRep -> Fingerprint -typeRepXFingerprint (SomeTypeRep t) = typeRepFingerprint t +someTypeRepFingerprint :: SomeTypeRep -> Fingerprint +someTypeRepFingerprint (SomeTypeRep t) = typeRepFingerprint t ----------------- Showing TypeReps -------------------- diff --git a/libraries/base/Type/Reflection.hs b/libraries/base/Type/Reflection.hs index 232ae2c..cb0337a 100644 --- a/libraries/base/Type/Reflection.hs +++ b/libraries/base/Type/Reflection.hs @@ -52,9 +52,9 @@ module Type.Reflection -- "Data.Typeable" exports a variant of this interface (named differently -- for backwards compatibility). , I.SomeTypeRep(..) - , I.typeRepX - , I.typeRepXTyCon - , I.typeRepXFingerprint + , I.someTypeRep + , I.someTypeRepTyCon + , I.someTypeRepFingerprint , I.rnfSomeTypeRep -- * Type constructors From git at git.haskell.org Mon Mar 13 21:44:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:44:56 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Observe #13267 in release notes (3ab6684) Message-ID: <20170313214456.0A72F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/3ab6684bdf4abf700cc9b43aaa3d42c38c8ae291/ghc >--------------------------------------------------------------- commit 3ab6684bdf4abf700cc9b43aaa3d42c38c8ae291 Author: Ryan Scott Date: Sat Mar 11 15:46:20 2017 -0500 Observe #13267 in release notes I noticed some code in the wild that broke due to the validity checking introduced in #13267, so we should be proactive and warn about it in the 8.2 release notes. (cherry picked from commit 740ecda32116abe84b6d7d4786b3e2ad9c8ba2a4) >--------------------------------------------------------------- 3ab6684bdf4abf700cc9b43aaa3d42c38c8ae291 docs/users_guide/8.2.1-notes.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/users_guide/8.2.1-notes.rst b/docs/users_guide/8.2.1-notes.rst index b3dd2de..9a7236b 100644 --- a/docs/users_guide/8.2.1-notes.rst +++ b/docs/users_guide/8.2.1-notes.rst @@ -167,6 +167,16 @@ Compiler "StillWorks" forall x. f (Just x) = e +- Type synonyms can no longer appear in the class position of an instance. + This means something like this is no longer allowed: :: + + type ReadShow a = (Read a, Show a) + instance Read Foo + instance Show Foo + instance ReadShow Foo -- illegal + + See :ghc-ticket:`13267`. + GHCi ~~~~ From git at git.haskell.org Mon Mar 13 21:44:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 21:44:53 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Don't reference elSupremum in haddock for Lifetime Monoid (3ad58a6) Message-ID: <20170313214453.4D7093A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/3ad58a6f9b4d0ed8fcbd50f900bffb2cefdaf842/ghc >--------------------------------------------------------------- commit 3ad58a6f9b4d0ed8fcbd50f900bffb2cefdaf842 Author: Chris Martin Date: Sun Mar 12 15:15:17 2017 -0400 Don't reference elSupremum in haddock for Lifetime Monoid Reviewers: austin, hvr, bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3325 (cherry picked from commit 2c78def693c5c7a3f796a64444ffa4a7e2825d59) >--------------------------------------------------------------- 3ad58a6f9b4d0ed8fcbd50f900bffb2cefdaf842 libraries/base/GHC/Event/Internal.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/base/GHC/Event/Internal.hs b/libraries/base/GHC/Event/Internal.hs index 7024714..f6eb8ef 100644 --- a/libraries/base/GHC/Event/Internal.hs +++ b/libraries/base/GHC/Event/Internal.hs @@ -99,7 +99,7 @@ elSupremum OneShot OneShot = OneShot elSupremum _ _ = MultiShot {-# INLINE elSupremum #-} --- | @mappend@ == @elSupremum@ +-- | @mappend@ takes the longer of two lifetimes. -- -- @since 4.8.0.0 instance Monoid Lifetime where From git at git.haskell.org Mon Mar 13 23:44:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 23:44:39 +0000 (UTC) Subject: [commit: nofib] master: real: enable linear (2eed957) Message-ID: <20170313234439.8108F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2eed957fa3a63b759a292311a45e7ff01c6352e1/nofib >--------------------------------------------------------------- commit 2eed957fa3a63b759a292311a45e7ff01c6352e1 Author: Michal Terepeta Date: Mon Mar 13 18:31:50 2017 -0400 real: enable linear This also tweaks a parameter in the benchmark so that it takes a reasonable amount of time to run ( ~1.1s on my machine) and adds the `.stdout` file. The `Makefile` required some tweaking to make sure that the modules are compiled in the right order. Signed-off-by: Michal Terepeta Test Plan: compile & run nofib Reviewers: bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D3157 >--------------------------------------------------------------- 2eed957fa3a63b759a292311a45e7ff01c6352e1 real/Makefile | 4 ++-- real/linear/Main.lhs | 2 +- real/linear/Makefile | 6 +++++ real/linear/linear.stdout | 56 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 3 deletions(-) diff --git a/real/Makefile b/real/Makefile index b3f1f87..11e98aa 100644 --- a/real/Makefile +++ b/real/Makefile @@ -2,10 +2,10 @@ TOP = .. include $(TOP)/mk/boilerplate.mk SUBDIRS = anna bspt cacheprof compress compress2 fem fluid fulsom gamteb gg \ - grep hidden hpg infer lift maillist mkhprog parser pic prolog \ + grep hidden hpg infer lift linear maillist mkhprog parser pic prolog \ reptile rsa scs symalg veritas -OTHER_SUBDIRS = PolyGP linear rx +OTHER_SUBDIRS = PolyGP rx include $(TOP)/mk/target.mk diff --git a/real/linear/Main.lhs b/real/linear/Main.lhs index 37b7e48..7bf0eca 100644 --- a/real/linear/Main.lhs +++ b/real/linear/Main.lhs @@ -129,7 +129,7 @@ main resps \begin{code} main = putStr result where - result = test bilu test_data 4 conv2 + result = test bilu test_data 16 conv2 test_data = hard_data diff --git a/real/linear/Makefile b/real/linear/Makefile index cf44ea3..dee7f12 100644 --- a/real/linear/Makefile +++ b/real/linear/Makefile @@ -1,5 +1,11 @@ TOP = ../.. include $(TOP)/mk/boilerplate.mk -include opts.mk +# It's necessary to specify the HS_SRCS so that the current make-based system +# compiles the modules in the right order (otherwise it starts with AbsCg, which +# fails due to missing .hi files) +# TODO(michalt): This should go away once we switch to the Shake-based system +HS_SRCS = Utils.lhs Misc.lhs Densematrix.lhs AbsDensematrix.lhs Matrix.lhs Cg.lhs Input.lhs Matlib.lhs Absmatlib.lhs AbsCg.lhs Main.lhs + include $(TOP)/mk/target.mk diff --git a/real/linear/linear.stdout b/real/linear/linear.stdout new file mode 100644 index 0000000..b2ab958 --- /dev/null +++ b/real/linear/linear.stdout @@ -0,0 +1,56 @@ +START +Iteration norm (x-soln) norm r +========= ============= ======= + 0 1024.0 332.47906 + 1 487.77692 320.67267 + 2 380.0222 7.2986073 + 3 89.108864 2.6207294 + 4 92.27595 2.0028818 + 5 56.788265 0.9246741 + 6 48.743073 0.7287846 + 7 40.723335 0.49839145 + 8 25.916683 0.22327241 + 9 25.981207 0.22294453 + 10 21.511564 0.12464476 + 11 18.227795 8.796385e-2 + 12 18.504082 7.399316e-2 + 13 16.93208 2.9566484e-2 + 14 16.300467 2.7726116e-2 + 15 18.767685 1.8923977e-2 + 16 17.218872 1.5457665e-2 + 17 17.826754 1.5359238e-2 + 18 18.14604 1.179346e-2 + 19 17.047215 1.1319233e-2 + 20 18.234877 1.1098935e-2 + 21 17.02114 9.928966e-3 + 22 9.368839 7.1590673e-3 + 23 9.379931 6.936198e-3 + 24 6.0347986 4.5933104e-3 + 25 3.6565864 3.2746575e-3 + 26 3.6596847 3.0588645e-3 + 27 2.2099524 1.649105e-3 + 28 1.8611239 1.4196584e-3 + 29 1.9219794 1.3830797e-3 + 30 1.6037003 9.4637414e-4 + 31 1.3180441 7.9798966e-4 + 32 1.3740739 7.7578315e-4 + 33 1.251271 6.54156e-4 + 34 0.88109696 5.174503e-4 + 35 0.89911026 5.157987e-4 + 36 0.73470736 4.4457804e-4 + 37 0.37132028 3.0794018e-4 + 38 0.377424 3.0732254e-4 + 39 0.42432526 2.877599e-4 + 40 0.41230243 2.6800556e-4 + 41 0.43262625 2.6495897e-4 + 42 0.43946514 2.4427296e-4 + 43 0.41381273 2.3941029e-4 + 44 0.43486106 2.3694332e-4 + 45 0.3935155 2.138149e-4 + 46 0.36464012 2.1057764e-4 + 47 0.37146172 2.0192607e-4 + 48 0.32298154 1.8111535e-4 + 49 0.2705077 1.7049188e-4 + + +END \ No newline at end of file From git at git.haskell.org Mon Mar 13 23:44:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 23:44:41 +0000 (UTC) Subject: [commit: nofib] master: fibheaps: Ensure we link against array (4f149ed) Message-ID: <20170313234441.8A8053A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4f149ed3cc5e8a67a6b5737ec03653f6b4b7a87e/nofib >--------------------------------------------------------------- commit 4f149ed3cc5e8a67a6b5737ec03653f6b4b7a87e Author: Ben Gamari Date: Mon Mar 13 18:34:35 2017 -0400 fibheaps: Ensure we link against array Summary: I'm not sure how this worked previously, but we clearly need to link against array here. Test Plan: Build it Reviewers: michalt, O26 nofib Reviewed By: michalt, O26 nofib Differential Revision: https://phabricator.haskell.org/D3295 >--------------------------------------------------------------- 4f149ed3cc5e8a67a6b5737ec03653f6b4b7a87e gc/fibheaps/Makefile | 1 + spectral/fibheaps/Makefile | 2 ++ 2 files changed, 3 insertions(+) diff --git a/gc/fibheaps/Makefile b/gc/fibheaps/Makefile index b618d80..9cadde2 100644 --- a/gc/fibheaps/Makefile +++ b/gc/fibheaps/Makefile @@ -3,6 +3,7 @@ include $(TOP)/mk/boilerplate.mk NORM_OPTS = 300000 +SRC_HC_OPTS += -package array SRC_RUNTEST_OPTS += +RTS -K64m -RTS ifeq "$(HEAP)" "LARGE" diff --git a/spectral/fibheaps/Makefile b/spectral/fibheaps/Makefile index 05b3d4d..28c8022 100644 --- a/spectral/fibheaps/Makefile +++ b/spectral/fibheaps/Makefile @@ -1,6 +1,8 @@ TOP = ../.. include $(TOP)/mk/boilerplate.mk +​SRC_HC_OPTS += -package array + FAST_OPTS = 5000 NORM_OPTS = 5000 SLOW_OPTS = 60000 From git at git.haskell.org Mon Mar 13 23:44:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 23:44:43 +0000 (UTC) Subject: [commit: nofib] master: real: remove PolyGP (435f60a) Message-ID: <20170313234443.98D193A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/435f60aa98979939f975933497b49e6afc6574a9/nofib >--------------------------------------------------------------- commit 435f60aa98979939f975933497b49e6afc6574a9 Author: Michal Terepeta Date: Mon Mar 13 18:36:32 2017 -0400 real: remove PolyGP The benchmark doesn't compile and was not enabled. I tried fixing it, but it seems to take excessive amount of time & memory (didn't finish in 60s, which required over 10GiB of RAM). Sounds like another candidate for removal. Signed-off-by: Michal Terepeta Test Plan: build & run Reviewers: bgamari Differential Revision: https://phabricator.haskell.org/D3329 >--------------------------------------------------------------- 435f60aa98979939f975933497b49e6afc6574a9 real/Makefile | 1 - real/PolyGP/Auxil.hs | 238 ------------------------- real/PolyGP/Create.hs | 287 ------------------------------ real/PolyGP/Eval.hs | 436 ---------------------------------------------- real/PolyGP/Evolve.hs | 152 ---------------- real/PolyGP/Header.hs | 60 ------- real/PolyGP/Local.hs | 125 ------------- real/PolyGP/Main.hs | 27 --- real/PolyGP/Makefile | 6 - real/PolyGP/Para | 6 - real/PolyGP/PolyGP.stderr | 87 --------- real/PolyGP/PolyGP.stdout | 3 - real/PolyGP/Unify.hs | 253 --------------------------- 13 files changed, 1681 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 435f60aa98979939f975933497b49e6afc6574a9 From git at git.haskell.org Mon Mar 13 23:44:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 23:44:45 +0000 (UTC) Subject: [commit: nofib] master: spectral: remove compreals (6b234b1) Message-ID: <20170313234445.A5BE13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6b234b1c5b466961fe670d54f788706142275329/nofib >--------------------------------------------------------------- commit 6b234b1c5b466961fe670d54f788706142275329 Author: Michal Terepeta Date: Mon Mar 13 18:37:14 2017 -0400 spectral: remove compreals It's been disabled for a long time and there's no input to actually run it. Signed-off-by: Michal Terepeta Test Plan: build & run Reviewers: bgamari Differential Revision: https://phabricator.haskell.org/D3330 >--------------------------------------------------------------- 6b234b1c5b466961fe670d54f788706142275329 spectral/Makefile | 3 +- spectral/compreals/ContinuedFractions.lhs | 458 ---------- spectral/compreals/Doc.lhs | 13 - spectral/compreals/Main.lhs | 100 --- spectral/compreals/QRationals.lhs | 95 --- spectral/compreals/RealReals.lhs | 373 --------- spectral/compreals/Transcendentals.lhs | 448 ---------- spectral/compreals/paper.tex | 1296 ----------------------------- 8 files changed, 1 insertion(+), 2785 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 6b234b1c5b466961fe670d54f788706142275329 From git at git.haskell.org Mon Mar 13 23:44:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 23:44:49 +0000 (UTC) Subject: [commit: nofib] master: real/Makefile: remove the mention of ebnf2ps (62a599e) Message-ID: <20170313234449.BC6693A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/62a599ef95af0acc91a6424c53944b75ceee0b98/nofib >--------------------------------------------------------------- commit 62a599ef95af0acc91a6424c53944b75ceee0b98 Author: Michal Terepeta Date: Mon Mar 13 18:31:44 2017 -0400 real/Makefile: remove the mention of ebnf2ps Summary: The ebnf2ps benchmark has been removed. It's mentioned in the `Makefile` due to how git merged multiple commits touching the file. This commit removes it. Signed-off-by: Michal Terepeta Test Plan: compile & run nofib Reviewers: bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D3156 >--------------------------------------------------------------- 62a599ef95af0acc91a6424c53944b75ceee0b98 real/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/real/Makefile b/real/Makefile index dfc9b4f..b3f1f87 100644 --- a/real/Makefile +++ b/real/Makefile @@ -5,7 +5,7 @@ SUBDIRS = anna bspt cacheprof compress compress2 fem fluid fulsom gamteb gg \ grep hidden hpg infer lift maillist mkhprog parser pic prolog \ reptile rsa scs symalg veritas -OTHER_SUBDIRS = PolyGP ebnf2ps linear rx +OTHER_SUBDIRS = PolyGP linear rx include $(TOP)/mk/target.mk From git at git.haskell.org Mon Mar 13 23:44:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 23:44:51 +0000 (UTC) Subject: [commit: nofib] master: spectral: remove triangle (88ebedd) Message-ID: <20170313234451.CB1573A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/88ebedd41e0be4d52fba7c4df344f4bb7f3f3085/nofib >--------------------------------------------------------------- commit 88ebedd41e0be4d52fba7c4df344f4bb7f3f3085 Author: Michal Terepeta Date: Mon Mar 13 18:39:24 2017 -0400 spectral: remove triangle The benchmark hasn't been enabled and doesn't compile. Fixing it is easy, but it runs very quickly with the default parameter `5` (takes ~0.04s). When I bumped the parameter to `6`, it didn't finish within ~90s CPU time (and 5GiB of RAM). So it seems unlikely to be useful - let's just remove it. Signed-off-by: Michal Terepeta Test Plan: run nofib Reviewers: dfeuer, bgamari Reviewed By: bgamari Subscribers: dfeuer Differential Revision: https://phabricator.haskell.org/D3085 >--------------------------------------------------------------- 88ebedd41e0be4d52fba7c4df344f4bb7f3f3085 spectral/Makefile | 2 +- spectral/triangle/Main.hs | 176 ------------------- spectral/triangle/Makefile | 5 - spectral/triangle/triangle.stdout | 352 -------------------------------------- 4 files changed, 1 insertion(+), 534 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 88ebedd41e0be4d52fba7c4df344f4bb7f3f3085 From git at git.haskell.org Mon Mar 13 23:44:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 23:44:53 +0000 (UTC) Subject: [commit: nofib] master: spectral: remove salishan (ad17f73) Message-ID: <20170313234453.E0F633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ad17f7344aaf4f1ff96d31851dcf595cdb47689b/nofib >--------------------------------------------------------------- commit ad17f7344aaf4f1ff96d31851dcf595cdb47689b Author: Michal Terepeta Date: Mon Mar 13 18:34:44 2017 -0400 spectral: remove salishan There's no Haskell code in `spectral/salishan`, so let's just remove it. Signed-off-by: Michal Terepeta Test Plan: build & run Reviewers: bgamari Subscribers: snowleopard Differential Revision: https://phabricator.haskell.org/D3321 >--------------------------------------------------------------- ad17f7344aaf4f1ff96d31851dcf595cdb47689b spectral/Makefile | 3 +- spectral/salishan/ada.tex | 3862 --------------- spectral/salishan/doctors/sisal/doctors.if1 | 316 -- spectral/salishan/doctors/sisal/doctors.sis | 125 - spectral/salishan/hamming/sisal/hamming.if1 | 180 - spectral/salishan/hamming/sisal/hamming.sis | 59 - spectral/salishan/haskell.tex | 1290 ----- spectral/salishan/id.tex | 6010 ----------------------- spectral/salishan/occam.tex | 2112 -------- spectral/salishan/paraffins/sisal/paraffins.if1 | 986 ---- spectral/salishan/paraffins/sisal/paraffins.sis | 142 - spectral/salishan/scheme.tex | 2020 -------- spectral/salishan/skyline/sisal/skyline.if1 | 833 ---- spectral/salishan/skyline/sisal/skyline.in | 11 - spectral/salishan/skyline/sisal/skyline.sis | 142 - spectral/salishan/unity.tex | 1327 ----- 16 files changed, 1 insertion(+), 19417 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 ad17f7344aaf4f1ff96d31851dcf595cdb47689b From git at git.haskell.org Mon Mar 13 23:44:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 23:44:47 +0000 (UTC) Subject: [commit: nofib] master: spectral: fix secretary (313812d) Message-ID: <20170313234447.B0A343A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/313812d319e009d698bc1a4d2e8ac26d4dfe3c0a/nofib >--------------------------------------------------------------- commit 313812d319e009d698bc1a4d2e8ac26d4dfe3c0a Author: Michal Terepeta Date: Mon Mar 13 18:35:46 2017 -0400 spectral: fix secretary This should fix the benchmark by: - Not importing `IOExts`. - Using `randomRs` with a predictable seed instead of `randomRIOs` to make the runs reproducible (the latter is using global RNG). - Bumping one of the parameter to make it run for a bit longer (2s instead of 0.4s). Signed-off-by: Michal Terepeta Test Plan: build & run Reviewers: bgamari Differential Revision: https://phabricator.haskell.org/D3328 >--------------------------------------------------------------- 313812d319e009d698bc1a4d2e8ac26d4dfe3c0a spectral/Makefile | 4 ++-- spectral/secretary/Main.lhs | 30 ++++++++++-------------------- spectral/secretary/Makefile | 2 +- spectral/secretary/secretary.stdout | 2 +- 4 files changed, 14 insertions(+), 24 deletions(-) diff --git a/spectral/Makefile b/spectral/Makefile index e60718d..c66d3bd 100644 --- a/spectral/Makefile +++ b/spectral/Makefile @@ -5,10 +5,10 @@ SUBDIRS = ansi atom awards banner boyer boyer2 calendar cichelli circsim \ clausify constraints cryptarithm1 cryptarithm2 cse eliza expert \ fft2 fibheaps fish gcd hartel integer knights lambda last-piece lcss life \ mandel mandel2 mate minimax multiplier para power pretty primetest \ - puzzle rewrite scc simple sorting sphere treejoin + puzzle rewrite scc secretary simple sorting sphere treejoin # compreals no suitable test data -OTHER_SUBDIRS = compreals lambda last-piece secretary triangle +OTHER_SUBDIRS = compreals lambda last-piece triangle include $(TOP)/mk/target.mk diff --git a/spectral/secretary/Main.lhs b/spectral/secretary/Main.lhs index f922caa..03ac1f5 100644 --- a/spectral/secretary/Main.lhs +++ b/spectral/secretary/Main.lhs @@ -16,27 +16,19 @@ import System.Random import Data.List import System.IO import Control.Monad -import IOExts type Process = [Integer] -> Bool --- added by SimonM -randomRIOs :: Random a => (a,a) -> IO [a] -randomRIOs rng - = do rs <- unsafeInterleaveIO (randomRIOs rng) - r <- randomRIO rng - return (r:rs) - --- modified for Haskell 98 by SimonM -simulate :: Int -> Integer -> Process -> IO Double -simulate n m proc = - do tries <- sequence [ fmap proc (randomRIOs (1,m)) | _ <- [1..n] ] - return (length (filter id tries) // n) - where - n // m = fromInt n / fromInt m +-- Modified for Haskell 98 by SimonM +-- (2017-03): Modified by michalt to fix build and avoid global RNG +simulate :: Int -> Integer -> Process -> Double +simulate n m proc = length (filter id tries) // n + where + tries = [ proc (randomRs (1,m) (mkStdGen seed)) | seed <- [1..n] ] + n // m = fromIntegral n / fromIntegral m -sim :: Int -> IO Double -sim k = simulate 1000 100 proc +sim :: Int -> Double +sim k = simulate 5000 100 proc where proc rs = [best] == take 1 afterk where @@ -46,9 +38,7 @@ sim k = simulate 1000 100 proc afterk = dropWhile (< bestk) (drop k xs) main :: IO () -main = - do ps <- sequence [ sim k | k <- [35..39] ] - print ps +main = print [ sim k | k <- [35..39] ] \end{code} When I run this module with ghc-4.01, I get _wrong_ results, and a bus diff --git a/spectral/secretary/Makefile b/spectral/secretary/Makefile index 86edad6..ad87e31 100644 --- a/spectral/secretary/Makefile +++ b/spectral/secretary/Makefile @@ -1,5 +1,5 @@ TOP = ../.. include $(TOP)/mk/boilerplate.mk -include opts.mk -SRC_HC_OPTS += -fglasgow-exts +SRC_HC_OPTS += -package random include $(TOP)/mk/target.mk diff --git a/spectral/secretary/secretary.stdout b/spectral/secretary/secretary.stdout index e279cd0..64eae4b 100644 --- a/spectral/secretary/secretary.stdout +++ b/spectral/secretary/secretary.stdout @@ -1 +1 @@ -[0.368,0.386,0.357,0.38,0.392] +[0.356,0.356,0.358,0.3596,0.3594] From git at git.haskell.org Mon Mar 13 23:44:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 23:44:55 +0000 (UTC) Subject: [commit: nofib] master: real: remove `rx` (02707a6) Message-ID: <20170313234455.F1D153A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/02707a65d32269801664bdc1a35ff79a32c50e68/nofib >--------------------------------------------------------------- commit 02707a65d32269801664bdc1a35ff79a32c50e68 Author: Michal Terepeta Date: Mon Mar 13 18:33:19 2017 -0400 real: remove `rx` The benchmark doesn't compile, but even when fixed, it doesn't seem very useful - it runs in mere ~100ms and there aren't easy knobs to make it run for longer. Considering that this hasn't been used for some time, it seems ok to simply remove it. Also, removing it will make the initial version of Shake-based build system easier. Signed-off-by: Michal Terepeta Test Plan: compile & run nofib Reviewers: goldfire, bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D3159 >--------------------------------------------------------------- 02707a65d32269801664bdc1a35ff79a32c50e68 real/Makefile | 2 +- real/rx/CHANGELOG | 16 -- real/rx/Makefile | 5 - real/rx/TODO | 20 -- real/rx/copying.html | 341 ------------------------ real/rx/copyright.html | 53 ---- real/rx/doc/Makefile | 33 --- real/rx/doc/rxdoc.lit | 26 -- real/rx/doc/rxuser.lit | 611 -------------------------------------------- real/rx/examples/Makefile | 35 --- real/rx/examples/basic.lit | 72 ------ real/rx/examples/check.lit | 12 - real/rx/index.html | 81 ------ real/rx/link.html | 49 ---- real/rx/online.html | 169 ------------ real/rx/rx-MAIL | 30 --- real/rx/src/BackwardS.hs | 121 --------- real/rx/src/CBackwardS.hs | 189 -------------- real/rx/src/CForwardS.hs | 183 ------------- real/rx/src/CharSeq.hs | 122 --------- real/rx/src/Command.hs | 72 ------ real/rx/src/Cross.hs | 49 ---- real/rx/src/Defaults.hs | 51 ---- real/rx/src/Exp2FA.hs | 39 --- real/rx/src/ExpParse.hs | 233 ----------------- real/rx/src/FA.hs | 170 ------------ real/rx/src/FA2Exp.hs | 111 -------- real/rx/src/FAcheat.hs | 32 --- real/rx/src/FAcmpct.hs | 40 --- real/rx/src/FAcon.hs | 46 ---- real/rx/src/FAconv.hs | 71 ----- real/rx/src/FAdet.hs | 99 ------- real/rx/src/FAhom.hs | 73 ------ real/rx/src/FAintersect.hs | 65 ----- real/rx/src/FAkeepcons.hs | 46 ---- real/rx/src/FAkeepst.hs | 52 ---- real/rx/src/FAlquotient.hs | 93 ------- real/rx/src/FAmap.hs | 41 --- real/rx/src/FAmin.hs | 122 --------- real/rx/src/FAminus.hs | 36 --- real/rx/src/FAneg.hs | 40 --- real/rx/src/FArquotient.hs | 96 ------- real/rx/src/FAstar.hs | 71 ----- real/rx/src/FAsubtrans.hs | 98 ------- real/rx/src/FAtimes.hs | 61 ----- real/rx/src/FAtypes.hs | 85 ------ real/rx/src/FAunify.hs | 46 ---- real/rx/src/FAunion.hs | 67 ----- real/rx/src/FAuseful.hs | 108 -------- real/rx/src/FiniteMap.hs | 505 ------------------------------------ real/rx/src/ForwardS.hs | 132 ---------- real/rx/src/Gen.hs | 58 ----- real/rx/src/Gram2FA.hs | 175 ------------- real/rx/src/Grammar.hs | 14 - real/rx/src/Heave.hs | 288 --------------------- real/rx/src/Heuristic.hs | 46 ---- real/rx/src/IdStack.hs | 92 ------- real/rx/src/Ids.hs | 283 -------------------- real/rx/src/Instance.hs | 64 ----- real/rx/src/Lex.hs | 76 ------ real/rx/src/Loop.hs | 77 ------ real/rx/src/Makefile | 6 - real/rx/src/Maybes.hs | 198 -------------- real/rx/src/Options.hs | 94 ------- real/rx/src/PI.hs | 170 ------------ real/rx/src/Parse.hs | 272 -------------------- real/rx/src/Prec.hs | 80 ------ real/rx/src/Pretty.hs | 350 ------------------------- real/rx/src/PrettyClass.hs | 125 --------- real/rx/src/RX.hs | 22 -- real/rx/src/Reader.hs | 38 --- real/rx/src/Reuse.hs | 70 ----- real/rx/src/SaturnS.hs | 182 ------------- real/rx/src/Semantik.hs | 202 --------------- real/rx/src/Set.hs | 124 --------- real/rx/src/Sorters.hs | 138 ---------- real/rx/src/State.hs | 39 --- real/rx/src/Stuff.hs | 134 ---------- real/rx/src/Syntax.hs | 218 ---------------- real/rx/src/TA.hs | 63 ----- real/rx/src/Trace.hs | 1 - real/rx/src/WrapSubtrans.hs | 39 --- real/rx/template.html | 37 --- 83 files changed, 1 insertion(+), 8794 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 02707a65d32269801664bdc1a35ff79a32c50e68 From git at git.haskell.org Mon Mar 13 23:44:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 23:44:58 +0000 (UTC) Subject: [commit: nofib] master: spectral: enable mate (02c8ea5) Message-ID: <20170313234458.077DD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/02c8ea5755b50569e977bc30ab490a8ea575cd6c/nofib >--------------------------------------------------------------- commit 02c8ea5755b50569e977bc30ab490a8ea575cd6c Author: Michal Terepeta Date: Mon Mar 13 18:34:12 2017 -0400 spectral: enable mate Summary: This also adds the `mate.stdout` file with the expected result. Signed-off-by: Michal Terepeta Test Plan: compile & run nofib Reviewers: bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D3161 >--------------------------------------------------------------- 02c8ea5755b50569e977bc30ab490a8ea575cd6c spectral/Makefile | 6 +++--- spectral/mate/Makefile | 5 ++++- spectral/mate/README | 11 +++++++++++ spectral/mate/{holzhausen.soln => mate.stdout} | 0 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/spectral/Makefile b/spectral/Makefile index 6187c33..c056f4c 100644 --- a/spectral/Makefile +++ b/spectral/Makefile @@ -4,12 +4,12 @@ include $(TOP)/mk/boilerplate.mk SUBDIRS = ansi atom awards banner boyer boyer2 calendar cichelli circsim \ clausify constraints cryptarithm1 cryptarithm2 cse eliza expert \ fft2 fibheaps fish gcd hartel integer knights lambda last-piece lcss life \ - mandel mandel2 minimax multiplier para power pretty primetest puzzle \ - rewrite scc simple sorting sphere treejoin + mandel mandel2 mate minimax multiplier para power pretty primetest \ + puzzle rewrite scc simple sorting sphere treejoin # compreals no suitable test data # salishan no Haskell code! -OTHER_SUBDIRS = compreals lambda last-piece mate salishan secretary triangle +OTHER_SUBDIRS = compreals lambda last-piece salishan secretary triangle include $(TOP)/mk/target.mk diff --git a/spectral/mate/Makefile b/spectral/mate/Makefile index 4775ac0..d2812b9 100644 --- a/spectral/mate/Makefile +++ b/spectral/mate/Makefile @@ -1,7 +1,10 @@ TOP = ../.. include $(TOP)/mk/boilerplate.mk -# Arguments for the test program +# It's necessary to specify those manually so that the current make-based system +# compiles them in the right order. +# TODO(michalt): This should go away once we move to the Shake-based system. +HS_SRCS = Board.hs Move.hs Problem.hs Solution.hs Main.hs PROG_ARGS = holzhausen.prob # Other problems diff --git a/spectral/mate/README b/spectral/mate/README index 79911b7..c378cec 100644 --- a/spectral/mate/README +++ b/spectral/mate/README @@ -1,3 +1,14 @@ +UPDATE(2017.02) +--------------- + +Currently `make` will run the `holzhausen.prob` (specified in the `Makefile`), +the output is simply copied to `mate.stdout` +(`cp holzhausen.soln mate.stdout`). +If you want to change the benchmark, you need to update both of these. + +ORIGINAL README +--------------- + Mate solves chess end-game problems of the form "White to move and mate in N". For example problems (standard input) and solutions (standard output) see *.in and *.out. diff --git a/spectral/mate/holzhausen.soln b/spectral/mate/mate.stdout similarity index 100% copy from spectral/mate/holzhausen.soln copy to spectral/mate/mate.stdout From git at git.haskell.org Mon Mar 13 23:45:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 23:45:26 +0000 (UTC) Subject: [commit: ghc] master: Bump nofib submodule (ed28170) Message-ID: <20170313234526.CE3AE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ed2817046c0dce979cea728b41eb640bc106a4cd/ghc >--------------------------------------------------------------- commit ed2817046c0dce979cea728b41eb640bc106a4cd Author: Ben Gamari Date: Mon Mar 13 18:41:26 2017 -0400 Bump nofib submodule >--------------------------------------------------------------- ed2817046c0dce979cea728b41eb640bc106a4cd nofib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nofib b/nofib index 3ac6f2d..88ebedd 160000 --- a/nofib +++ b/nofib @@ -1 +1 @@ -Subproject commit 3ac6f2db09254c52a87f3f1c79798f27d390e899 +Subproject commit 88ebedd41e0be4d52fba7c4df344f4bb7f3f3085 From git at git.haskell.org Mon Mar 13 23:45:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Mar 2017 23:45:29 +0000 (UTC) Subject: [commit: ghc] master: Fix #13382: Put join ceiling underneath lambdas (08e73cc) Message-ID: <20170313234529.989C63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/08e73ccf4c75a7d7a8b8167d2ccf8bc505fe1130/ghc >--------------------------------------------------------------- commit 08e73ccf4c75a7d7a8b8167d2ccf8bc505fe1130 Author: Luke Maurer Date: Mon Mar 13 18:49:25 2017 -0400 Fix #13382: Put join ceiling underneath lambdas Test Plan: No new test (bug is latent) Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3285 >--------------------------------------------------------------- 08e73ccf4c75a7d7a8b8167d2ccf8bc505fe1130 compiler/simplCore/SetLevels.hs | 3 ++- testsuite/tests/perf/compiler/all.T | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 8822019..90e1d53 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -1167,7 +1167,8 @@ lvlFloatRhs abs_vars dest_lvl env rec is_bot mb_join_arity rhs (body_env, bndrs') | Just _ <- mb_join_arity = lvlJoinBndrs env1 dest_lvl rec all_bndrs | otherwise - = lvlLamBndrs (placeJoinCeiling env1) dest_lvl all_bndrs + = case lvlLamBndrs env1 dest_lvl all_bndrs of + (env2, bndrs') -> (placeJoinCeiling env2, bndrs') -- The important thing here is that we call lvlLamBndrs on -- all these binders at once (abs_vars and bndrs), so they -- all get the same major level. Otherwise we create stupid diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 5a7614b..8b4ac08 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -746,10 +746,12 @@ test('T9675', # 2015-07-11 56 (x86/Linux, 64-bit machine) use +RTS -G1 ]), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 731171072, 10) + [(wordsize(64), 656137960, 10) # 2014-10-13 544489040 # 2015-10-28 608284152 emit Typeable at definition site # 2017-02-17 731171072 Type-indexed Typeable + # 2017-03-13 656137960 Put join ceiling underneath lambdas? + ,(wordsize(32), 279480696, 10) # 2015-07-11 279480696 (x86/Linux, 64-bit machine) use +RTS -G1 ]), From git at git.haskell.org Tue Mar 14 11:40:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Mar 2017 11:40:53 +0000 (UTC) Subject: [commit: ghc] master: Typos in manual and comments (50512c6) Message-ID: <20170314114053.EF8353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/50512c6b2bd878f0be5e1c7b85cadf22094aaa5a/ghc >--------------------------------------------------------------- commit 50512c6b2bd878f0be5e1c7b85cadf22094aaa5a Author: Gabor Greif Date: Tue Mar 14 12:38:50 2017 +0100 Typos in manual and comments >--------------------------------------------------------------- 50512c6b2bd878f0be5e1c7b85cadf22094aaa5a compiler/basicTypes/Demand.hs | 2 +- compiler/ghci/ByteCodeGen.hs | 2 +- compiler/nativeGen/RegAlloc/Graph/Stats.hs | 4 ++-- compiler/simplCore/SimplEnv.hs | 2 +- compiler/typecheck/FunDeps.hs | 2 +- compiler/typecheck/TcBinds.hs | 12 ++++++------ compiler/typecheck/TcPat.hs | 2 +- compiler/typecheck/TcRules.hs | 2 +- compiler/typecheck/TcSigs.hs | 2 +- compiler/typecheck/TcTypeable.hs | 2 +- compiler/typecheck/TcValidity.hs | 2 +- compiler/types/TyCoRep.hs | 2 +- compiler/utils/GraphColor.hs | 2 +- compiler/utils/GraphOps.hs | 2 +- docs/rts/rts.tex | 2 +- libraries/base/GHC/Base.hs | 4 ++-- libraries/ghc-compact/GHC/Compact.hs | 2 +- testsuite/tests/profiling/should_run/heapprof001.hs | 2 +- testsuite/tests/safeHaskell/overlapping/SH_Overlap3.hs | 2 +- 19 files changed, 26 insertions(+), 26 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 50512c6b2bd878f0be5e1c7b85cadf22094aaa5a From git at git.haskell.org Tue Mar 14 13:55:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Mar 2017 13:55:46 +0000 (UTC) Subject: [commit: ghc] master: Fix CaseIdentity optimisation AGAIN (82b4059) Message-ID: <20170314135546.21DB13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/82b40598ea7a9c00abdeae37bc47896f880fbbdc/ghc >--------------------------------------------------------------- commit 82b40598ea7a9c00abdeae37bc47896f880fbbdc Author: Simon Peyton Jones Date: Tue Mar 14 13:52:48 2017 +0000 Fix CaseIdentity optimisation AGAIN In this commit commit 02ac2974ce8e537372bff8d9e0a6efb461ed2c59 Author: Simon Peyton Jones Date: Wed Nov 16 10:37:47 2011 +0000 Fix CaseIdentity optimisaion In fixing one bug I'd introduced another; case x of { T -> T; F -> F } wasn't getting optmised! Trivial to fix. I introduced yet another! This line of code in SimplUtils.mkCase1 check_eq (Var v) (DataAlt con) [] = v == dataConWorkId con -- Optimisation only is patently false when arg_tys is non-empty. Astonishing that it has not shown up before now. Easily fixed though. This was all shown up by Trac #13417, which is now fixed. Merge to 8.0, 8.2. >--------------------------------------------------------------- 82b40598ea7a9c00abdeae37bc47896f880fbbdc compiler/simplCore/SimplUtils.hs | 18 +++++++++--------- testsuite/tests/simplCore/should_compile/T13417.hs | 8 ++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index 0fe262b..49bb6c4 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -1886,21 +1886,21 @@ mkCase1 _dflags scrut case_bndr _ alts@((_,_,rhs1) : _) -- Identity case ticks = concatMap (stripTicksT tickishFloatable . thdOf3) (tail alts) identity_alt (con, args, rhs) = check_eq rhs con args - check_eq (Cast rhs co) con args + check_eq (Cast rhs co) con args -- See Note [RHS casts] = not (any (`elemVarSet` tyCoVarsOfCo co) args) && check_eq rhs con args - -- See Note [RHS casts] - check_eq (Lit lit) (LitAlt lit') _ = lit == lit' + check_eq (Tick t e) alt args + = tickishFloatable t && check_eq e alt args + + check_eq (Lit lit) (LitAlt lit') _ = lit == lit' check_eq (Var v) _ _ | v == case_bndr = True - check_eq (Var v) (DataAlt con) [] = v == dataConWorkId con + check_eq (Var v) (DataAlt con) args + | null arg_tys, null args = v == dataConWorkId con -- Optimisation only - check_eq (Tick t e) alt args = tickishFloatable t && - check_eq e alt args check_eq rhs (DataAlt con) args = cheapEqExpr' tickishFloatable rhs $ - mkConApp con (arg_tys ++ - varsToCoreExprs args) + mkConApp2 con arg_tys args check_eq _ _ _ = False - arg_tys = map Type (tyConAppArgs (idType case_bndr)) + arg_tys = tyConAppArgs (idType case_bndr) -- Note [RHS casts] -- ~~~~~~~~~~~~~~~~ diff --git a/testsuite/tests/simplCore/should_compile/T13417.hs b/testsuite/tests/simplCore/should_compile/T13417.hs new file mode 100644 index 0000000..a919291 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T13417.hs @@ -0,0 +1,8 @@ +module T13417 where + +-- Amazingly this crashed GHC 8.0.2 + +data T a = E7 + +cons7 :: T a -> T b +cons7 E7 = E7 diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 7bad786..5265569 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -250,3 +250,4 @@ test('T13317', test('T13340', normal, run_command, ['$MAKE -s --no-print-directory T13340']) test('T13338', only_ways(['optasm']), compile, ['-dcore-lint']) test('T13367', normal, run_command, ['$MAKE -s --no-print-directory T13367']) +test('T13417', normal, compile, ['-O']) From git at git.haskell.org Tue Mar 14 14:12:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Mar 2017 14:12:59 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix CaseIdentity optimisation AGAIN (d2d13a4) Message-ID: <20170314141259.33D0B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/d2d13a4f6750e30389552974bd7465712d522735/ghc >--------------------------------------------------------------- commit d2d13a4f6750e30389552974bd7465712d522735 Author: Simon Peyton Jones Date: Tue Mar 14 13:52:48 2017 +0000 Fix CaseIdentity optimisation AGAIN In this commit commit 02ac2974ce8e537372bff8d9e0a6efb461ed2c59 Author: Simon Peyton Jones Date: Wed Nov 16 10:37:47 2011 +0000 Fix CaseIdentity optimisaion In fixing one bug I'd introduced another; case x of { T -> T; F -> F } wasn't getting optmised! Trivial to fix. I introduced yet another! This line of code in SimplUtils.mkCase1 check_eq (Var v) (DataAlt con) [] = v == dataConWorkId con -- Optimisation only is patently false when arg_tys is non-empty. Astonishing that it has not shown up before now. Easily fixed though. This was all shown up by Trac #13417, which is now fixed. Merge to 8.0, 8.2. (cherry picked from commit 82b40598ea7a9c00abdeae37bc47896f880fbbdc) >--------------------------------------------------------------- d2d13a4f6750e30389552974bd7465712d522735 compiler/simplCore/SimplUtils.hs | 18 +++++++++--------- testsuite/tests/simplCore/should_compile/T13417.hs | 8 ++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index a3eb357..ab270c5 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -1821,21 +1821,21 @@ mkCase1 _dflags scrut case_bndr _ alts@((_,_,rhs1) : _) -- Identity case ticks = concatMap (stripTicksT tickishFloatable . thdOf3) (tail alts) identity_alt (con, args, rhs) = check_eq rhs con args - check_eq (Cast rhs co) con args + check_eq (Cast rhs co) con args -- See Note [RHS casts] = not (any (`elemVarSet` tyCoVarsOfCo co) args) && check_eq rhs con args - -- See Note [RHS casts] - check_eq (Lit lit) (LitAlt lit') _ = lit == lit' + check_eq (Tick t e) alt args + = tickishFloatable t && check_eq e alt args + + check_eq (Lit lit) (LitAlt lit') _ = lit == lit' check_eq (Var v) _ _ | v == case_bndr = True - check_eq (Var v) (DataAlt con) [] = v == dataConWorkId con + check_eq (Var v) (DataAlt con) args + | null arg_tys, null args = v == dataConWorkId con -- Optimisation only - check_eq (Tick t e) alt args = tickishFloatable t && - check_eq e alt args check_eq rhs (DataAlt con) args = cheapEqExpr' tickishFloatable rhs $ - mkConApp con (arg_tys ++ - varsToCoreExprs args) + mkConApp2 con arg_tys args check_eq _ _ _ = False - arg_tys = map Type (tyConAppArgs (idType case_bndr)) + arg_tys = tyConAppArgs (idType case_bndr) -- Note [RHS casts] -- ~~~~~~~~~~~~~~~~ diff --git a/testsuite/tests/simplCore/should_compile/T13417.hs b/testsuite/tests/simplCore/should_compile/T13417.hs new file mode 100644 index 0000000..a919291 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T13417.hs @@ -0,0 +1,8 @@ +module T13417 where + +-- Amazingly this crashed GHC 8.0.2 + +data T a = E7 + +cons7 :: T a -> T b +cons7 E7 = E7 diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index c276834..38d4303 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -237,3 +237,4 @@ test('T12076', extra_clean(['T12076a.hi', 'T12076a.o']), multimod_compile, ['T12 test('T12076lit', normal, compile, ['-O']) test('T12076sat', normal, compile, ['-O']) test('par01', only_ways(['optasm']), compile, ['-ddump-prep -dsuppress-uniques -O2']) +test('T13417', normal, compile, ['-O']) From git at git.haskell.org Tue Mar 14 14:43:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Mar 2017 14:43:54 +0000 (UTC) Subject: [commit: ghc] master: Introduce and use mkLetRec, mkLetNonRec (1217df4) Message-ID: <20170314144354.AC7403A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1217df489dee61b6921582d76df1cbf89f361007/ghc >--------------------------------------------------------------- commit 1217df489dee61b6921582d76df1cbf89f361007 Author: Ben Gamari Date: Mon Mar 13 19:46:38 2017 -0400 Introduce and use mkLetRec, mkLetNonRec Test Plan: Validate Reviewers: austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3303 >--------------------------------------------------------------- 1217df489dee61b6921582d76df1cbf89f361007 compiler/coreSyn/CoreSyn.hs | 12 ++++- compiler/deSugar/DsBinds.hs | 3 +- testsuite/tests/callarity/unittest/CallArity1.hs | 61 +++++++++++------------- 3 files changed, 41 insertions(+), 35 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 1217df489dee61b6921582d76df1cbf89f361007 From git at git.haskell.org Tue Mar 14 14:43:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Mar 2017 14:43:57 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump allocations for T4029 (34f9172) Message-ID: <20170314144357.5FF803A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/34f9172fe456b4125ad527f9386aa23e2dfe98c6/ghc >--------------------------------------------------------------- commit 34f9172fe456b4125ad527f9386aa23e2dfe98c6 Author: Ben Gamari Date: Tue Mar 14 10:04:40 2017 -0400 testsuite: Bump allocations for T4029 Both the OS X build machine and my local builds have been failing. Unfortunately, our x86_64 Linux machine has been succeeding. >--------------------------------------------------------------- 34f9172fe456b4125ad527f9386aa23e2dfe98c6 testsuite/tests/perf/space_leaks/all.T | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/perf/space_leaks/all.T b/testsuite/tests/perf/space_leaks/all.T index d83b003..212a100 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -69,7 +69,7 @@ test('T4029', # 2017-03-03: 65 (amd64/Linux) Share Typeable KindReps or more # lazy interface file reading stats_num_field('max_bytes_used', - [(wordsize(64), 20476360, 5)]), + [(wordsize(64), 18208944, 5)]), # 2016-02-26: 24071720 (amd64/Linux) INITIAL # 2016-04-21: 25542832 (amd64/Linux) # 2016-05-23: 25247216 (amd64/Linux) Use -G1 @@ -85,6 +85,7 @@ test('T4029', # 2017-03-03: 19172360 (amd64/Linux) Share Typeable KindReps or more # lazy interface file reading # 2017-03-07: 20476360 (amd64/Linux) It's not entirely clear + # 2017-03-14: 18208944 (amd64/Darwin) Again, not clear extra_hc_opts('+RTS -G1 -RTS' ), ], ghci_script, From git at git.haskell.org Tue Mar 14 15:31:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Mar 2017 15:31:40 +0000 (UTC) Subject: [commit: ghc] master: Further document :type +v's role in analyzing -XTypeApplications in GHCi (b335f50) Message-ID: <20170314153140.C07C93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b335f506f1d3a766de849e015f6732ae130247a4/ghc >--------------------------------------------------------------- commit b335f506f1d3a766de849e015f6732ae130247a4 Author: Ryan Scott Date: Tue Mar 14 10:58:41 2017 -0400 Further document :type +v's role in analyzing -XTypeApplications in GHCi Summary: The section on `-XTypeApplications` in the users' guide isn't terribly clear on how to view the visibility of a function type signature's type variables in GHCi properly (i.e., using the `:type +v` GHCi command). This adds some more exposition that demonstrates how to use `:type +v` (and why you don't want to use `:type`). Fixes #13401. Test Plan: Eyeball it Reviewers: bgamari, austin, goldfire, crockeea Reviewed By: goldfire, crockeea Subscribers: rwbarton, thomie, crockeea Differential Revision: https://phabricator.haskell.org/D3310 >--------------------------------------------------------------- b335f506f1d3a766de849e015f6732ae130247a4 docs/users_guide/ghci.rst | 2 +- docs/users_guide/glasgow_exts.rst | 43 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/docs/users_guide/ghci.rst b/docs/users_guide/ghci.rst index 864ae80..2d27c26 100644 --- a/docs/users_guide/ghci.rst +++ b/docs/users_guide/ghci.rst @@ -2724,7 +2724,7 @@ commonly used commands. *X> :type length length :: Foldable t => t a -> Int -.. ghci-cmd:: :type +v ⟨expression⟩ +.. ghci-cmd:: :type +v; ⟨expression⟩ Infers and prints the type of ⟨expression⟩, but without fiddling with type variables or class constraints. This is useful when you diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 43175ba..c6f7f5e 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -9341,9 +9341,46 @@ Here are the details: - When printing types with :ghc-flag:`-fprint-explicit-foralls` enabled, type variables not available for visible type application are printed - in braces. Thus, if you write ``myLength = length`` without a type - signature, ``myLength``'s inferred type will be - ``forall {f} {a}. Foldable f => f a -> Int``. + in braces. We can observe this behavior in a GHCi session: :: + + > :set -XTypeApplications -fprint-explicit-foralls + > let myLength1 :: Foldable f => f a -> Int; myLength1 = length + > :type +v myLength1 + myLength1 :: forall (f :: * -> *) a. Foldable f => f a -> Int + > let myLength2 = length + > :type +v myLength2 + myLength2 :: forall {a} {t :: * -> *}. Foldable t => t a -> Int + > :type +v myLength2 @[] + + :1:1: error: + • Cannot apply expression of type ‘t0 a0 -> Int’ + to a visible type argument ‘[]’ + • In the expression: myLength2 @[] + + Notice that since ``myLength1`` was defined with an explicit type signature, + :ghci-cmd:`:type +v` reports that all of its type variables are available + for type application. On the other hand, ``myLength2`` was not given a type + signature. As a result, all of its type variables are surrounded with braces, + and trying to use visible type application with ``myLength2`` fails. + + Also note the use of :ghci-cmd:`:type +v` in the GHCi session above instead + of :ghci-cmd:`:type`. This is because :ghci-cmd:`:type` gives you the type + that would be inferred for a variable assigned to the expression provided + (that is, the type of ``x`` in ``let x = ``). As we saw above with + ``myLength2``, this type will have no variables available to visible type + application. On the other hand, :ghci-cmd:`:type +v` gives you the actual + type of the expression provided. To illustrate this: :: + + > :type myLength1 + myLength1 :: forall {a} {f :: * -> *}. Foldable f => f a -> Int + > :type myLength2 + myLength2 :: forall {a} {t :: * -> *}. Foldable t => t a -> Int + + Using :ghci-cmd:`:type` might lead one to conclude that none of the type + variables in ``myLength1``'s type signature are available for type + application. This isn't true, however! Be sure to use :ghci-cmd:`:type +v` + if you want the most accurate information with respect to visible type + application properties. - Data constructors declared with GADT syntax follow different rules for the time being; it is expected that these will be brought in line From git at git.haskell.org Tue Mar 14 15:31:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Mar 2017 15:31:44 +0000 (UTC) Subject: [commit: ghc] master: Allow associated types to pattern-match in non-class-bound variables (67345cc) Message-ID: <20170314153144.ABFE13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/67345ccf51538acf2b6452c738ba641b119f5a5e/ghc >--------------------------------------------------------------- commit 67345ccf51538acf2b6452c738ba641b119f5a5e Author: Ryan Scott Date: Tue Mar 14 10:58:58 2017 -0400 Allow associated types to pattern-match in non-class-bound variables Summary: After 8136a5cbfcd24647f897a2fae9fcbda0b1624035 (#11450), if you have a class with an associated type: ``` class C a where type T a b ``` And you try to create an instance of `C` like this: ``` instance C Int where type T Int Char = Bool ``` Then it is rejected, since you're trying to instantiate the variable ``b`` with something other than a type variable. But this restriction proves quite onerous in practice, as it prevents you from doing things like this: ``` class C a where type T a (b :: Identity c) :: c instance C Int where type T Int ('Identity x) = x ``` You have to resort to an auxiliary type family in order to define this now, which becomes extremely tiring. This lifts this restriction and fixes #13398, in which it was discovered that adding this restriction broke code in the wild. Test Plan: ./validate Reviewers: simonpj, bgamari, austin Reviewed By: simonpj Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3302 >--------------------------------------------------------------- 67345ccf51538acf2b6452c738ba641b119f5a5e compiler/typecheck/TcValidity.hs | 60 +++++++++++--------- docs/users_guide/8.2.1-notes.rst | 19 +++++++ docs/users_guide/glasgow_exts.rst | 66 ++++++---------------- testsuite/tests/ghci/scripts/T4175.hs | 4 +- testsuite/tests/ghci/scripts/T4175.stdout | 9 +-- testsuite/tests/ghci/scripts/T6018ghcifail.stderr | 13 ++--- .../tests/indexed-types/should_compile/T13398a.hs | 19 +++++++ .../tests/indexed-types/should_compile/T13398b.hs | 12 ++++ testsuite/tests/indexed-types/should_compile/all.T | 2 + .../indexed-types/should_fail/SimpleFail10.hs | 3 +- .../indexed-types/should_fail/SimpleFail10.stderr | 11 ---- testsuite/tests/indexed-types/should_fail/all.T | 2 +- testsuite/tests/th/T9692.hs | 2 +- testsuite/tests/th/T9692.stderr | 4 +- .../tests/typecheck/should_fail/T6018fail.stderr | 13 ++--- 15 files changed, 125 insertions(+), 114 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 67345ccf51538acf2b6452c738ba641b119f5a5e From git at git.haskell.org Tue Mar 14 19:13:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Mar 2017 19:13:05 +0000 (UTC) Subject: [commit: ghc] master: Fix Windows GCC driver (4b673e8) Message-ID: <20170314191305.4BFD73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4b673e804fb8598dac02596f107544c7f2ea263b/ghc >--------------------------------------------------------------- commit 4b673e804fb8598dac02596f107544c7f2ea263b Author: Tamar Christina Date: Tue Mar 14 13:31:36 2017 -0400 Fix Windows GCC driver In Windows 10 Insiders build 15019+ which will probably be released mainstream somewhere this year Microsoft seems to have started being stricter with API calls. The call to `FreeConsole` just after `CreateProcess` is making Windows treat the process as an interactive process. In which case it tries to use the `Desktop session` but fails resulting in the cryptic error reported. I don't understand why the call to `FreeConsole` was there and it doesn't seem to be needed, so removed. This fixes #13411 Test Plan: ./validate, alternative just do anything with ghc which requires compilation. Reviewers: austin, bgamari, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D3319 >--------------------------------------------------------------- 4b673e804fb8598dac02596f107544c7f2ea263b driver/utils/cwrapper.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/driver/utils/cwrapper.c b/driver/utils/cwrapper.c index 5105924..da6cec4 100644 --- a/driver/utils/cwrapper.c +++ b/driver/utils/cwrapper.c @@ -130,11 +130,9 @@ __attribute__((noreturn)) int run (char *exePath, &pi) ) { die("Unable to start %s (error code: %lu)\n", exePath, GetLastError()); } - /* Disable handling of console events in the parent by dropping its - * connection to the console. This has the (minor) downside of not being - * able to subsequently emit any error messages to the console. - */ - FreeConsole(); + + /* Synchronize input and wait for target to be ready. */ + WaitForInputIdle(pi.hProcess, INFINITE); switch (WaitForSingleObject(pi.hProcess, INFINITE) ) { case WAIT_OBJECT_0: From git at git.haskell.org Tue Mar 14 19:13:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Mar 2017 19:13:08 +0000 (UTC) Subject: [commit: ghc] master: Fix #13337. (e0c433c) Message-ID: <20170314191308.B91113A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e0c433c81182c934ee4c4cc5c6cf25a1b6fb8d83/ghc >--------------------------------------------------------------- commit e0c433c81182c934ee4c4cc5c6cf25a1b6fb8d83 Author: Richard Eisenberg Date: Tue Mar 14 13:32:00 2017 -0400 Fix #13337. The big change is the introduction of solveSomeEqualities. This is just like solveEqualities, but it doesn't fail if there are unsolved equalities when it's all done. Anything unsolved is re-emitted. This is appropriate if we are not kind-generalizing, so this new form is used when decideKindGeneralizationPlan says not to. We initially thought that any use of solveEqualities would be tied to kind generalization, but this isn't true. For example, we need to solveEqualities a bunch in the "tc" pass in TcTyClsDecls (which is really desugaring). These equalities are all surely going to be soluble (if they weren't the "kc" pass would fail), but we still need to solve them again. Perhaps if the "kc" pass produced type- checked output that is then desugared, solveEqualities really would be tied only to kind generalization. Updates haddock submodule. Test Plan: ./validate, typecheck/should_compile/T13337 Reviewers: simonpj, bgamari, austin Reviewed By: simonpj Subscribers: RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3315 >--------------------------------------------------------------- e0c433c81182c934ee4c4cc5c6cf25a1b6fb8d83 compiler/hsSyn/Convert.hs | 2 +- compiler/hsSyn/HsDecls.hs | 2 +- compiler/hsSyn/HsTypes.hs | 15 ++-- compiler/rename/RnSource.hs | 3 +- compiler/rename/RnTypes.hs | 14 +++- compiler/typecheck/TcBinds.hs | 3 +- compiler/typecheck/TcForeign.hs | 2 +- compiler/typecheck/TcHsType.hs | 79 +++++++++++++--------- compiler/typecheck/TcSimplify.hs | 62 ++++++++++++++++- compiler/typecheck/TcTyClsDecls.hs | 3 +- .../parser/should_compile/DumpParsedAst.stderr | 6 +- .../parser/should_compile/DumpRenamedAst.stderr | 6 +- .../tests/partial-sigs/should_fail/T11976.stderr | 7 ++ .../tests/partial-sigs/should_fail/T12634.stderr | 9 ++- testsuite/tests/typecheck/should_compile/T13337.hs | 16 +++++ testsuite/tests/typecheck/should_compile/all.T | 1 + utils/haddock | 2 +- 17 files changed, 177 insertions(+), 55 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 e0c433c81182c934ee4c4cc5c6cf25a1b6fb8d83 From git at git.haskell.org Tue Mar 14 20:45:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Mar 2017 20:45:38 +0000 (UTC) Subject: [commit: ghc] master: Shortcut a test in exprIsOk (d357f52) Message-ID: <20170314204538.3E4353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d357f526582e3c4cd4fbda5d73695fc81121b69a/ghc >--------------------------------------------------------------- commit d357f526582e3c4cd4fbda5d73695fc81121b69a Author: David Feuer Date: Tue Mar 14 16:43:37 2017 -0400 Shortcut a test in exprIsOk `exprIsOk` didn't shortcut properly when checking `case` (it used `foldl` inappropriately). Fix that. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3343 >--------------------------------------------------------------- d357f526582e3c4cd4fbda5d73695fc81121b69a compiler/coreSyn/CoreUtils.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs index dce7ef9..3dfb52f 100644 --- a/compiler/coreSyn/CoreUtils.hs +++ b/compiler/coreSyn/CoreUtils.hs @@ -1130,8 +1130,8 @@ exprIsOk ok_app e go _ (Type {}) = True go _ (Coercion {}) = True go n (Cast e _) = go n e - go n (Case scrut _ _ alts) = foldl (&&) (ok scrut) - [ go n rhs | (_,_,rhs) <- alts ] + go n (Case scrut _ _ alts) = ok scrut && + and [ go n rhs | (_,_,rhs) <- alts ] go n (Tick t e) | tickishCounts t = False | otherwise = go n e go n (Lam x e) | isRuntimeVar x = n==0 || go (n-1) e From git at git.haskell.org Tue Mar 14 23:54:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Mar 2017 23:54:28 +0000 (UTC) Subject: [commit: ghc] master: Reimplement minusList using Set (5d9378e) Message-ID: <20170314235428.A0A923A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5d9378efdaa9aafaac2c9180c7156bca31297c30/ghc >--------------------------------------------------------------- commit 5d9378efdaa9aafaac2c9180c7156bca31297c30 Author: David Feuer Date: Tue Mar 14 19:53:39 2017 -0400 Reimplement minusList using Set `minusList ms ns` was `O(m*n)`. Now it's `O((m + n) log n)`, which should be a bit better. Reviewers: austin, bgamari, mpickering Reviewed By: mpickering Subscribers: mpickering, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3341 >--------------------------------------------------------------- 5d9378efdaa9aafaac2c9180c7156bca31297c30 compiler/coreSyn/CoreSyn.hs | 14 ++++++++++++++ compiler/utils/ListSetOps.hs | 30 +++++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index a51ec69..ad504ac 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -307,6 +307,20 @@ data AltCon | DEFAULT -- ^ Trivial alternative: @case e of { _ -> ... }@ deriving (Eq, Data) +-- This instance is a bit shady. It can only be used to compare AltCons for +-- a single type constructor. Fortunately, it seems quite unlikely that we'll +-- ever need to compare AltCons for different type constructors. +instance Ord AltCon where + compare (DataAlt con1) (DataAlt con2) = + ASSERT( dataConTyCon con1 == dataConTyCon con2 ) + compare (dataConTag con1) (dataConTag con2) + compare (DataAlt _) _ = LT + compare _ (DataAlt _) = GT + compare (LitAlt l1) (LitAlt l2) = compare l1 l2 + compare (LitAlt _) DEFAULT = LT + compare DEFAULT DEFAULT = EQ + compare DEFAULT _ = GT + -- | Binding, used for top level bindings in a module and local bindings in a @let at . -- If you edit this type, you may need to update the GHC formalism diff --git a/compiler/utils/ListSetOps.hs b/compiler/utils/ListSetOps.hs index e5315dd..88af48e 100644 --- a/compiler/utils/ListSetOps.hs +++ b/compiler/utils/ListSetOps.hs @@ -27,6 +27,7 @@ import Outputable import Util import Data.List +import qualified Data.Set as S getNth :: Outputable a => [a] -> Int -> a getNth xs n = ASSERT2( xs `lengthExceeds` n, ppr n $$ ppr xs ) @@ -48,9 +49,32 @@ unionLists xs ys = WARN(length xs > 100 || length ys > 100, ppr xs $$ ppr ys) [x | x <- xs, isn'tIn "unionLists" x ys] ++ ys -minusList :: (Eq a) => [a] -> [a] -> [a] --- Everything in the first list that is not in the second list: -minusList xs ys = [ x | x <- xs, isn'tIn "minusList" x ys] +-- | Calculate the set difference of two lists. This is +-- /O((m + n) log n)/, where we subtract a list of /n/ elements +-- from a list of /m/ elements. +-- +-- Extremely short cases are handled specially: +-- When /m/ or /n/ is 0, this takes /O(1)/ time. When /m/ is 1, +-- it takes /O(n)/ time. +minusList :: Ord a => [a] -> [a] -> [a] +-- There's no point building a set to perform just one lookup, so we handle +-- extremely short lists specially. It might actually be better to use +-- an O(m*n) algorithm when m is a little longer (perhaps up to 4 or even 5). +-- The tipping point will be somewhere in the area of where /m/ and /log n/ +-- become comparable, but we probably don't want to work too hard on this. +minusList [] _ = [] +minusList xs@[x] ys + | x `elem` ys = [] + | otherwise = xs +-- Using an empty set or a singleton would also be silly, so let's not. +minusList xs [] = xs +minusList xs [y] = filter (/= y) xs +-- When each list has at least two elements, we build a set from the +-- second argument, allowing us to filter the first argument fairly +-- efficiently. +minusList xs ys = filter (`S.notMember` yss) xs + where + yss = S.fromList ys {- ************************************************************************ From git at git.haskell.org Wed Mar 15 13:17:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 13:17:27 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix #13382: Put join ceiling underneath lambdas (7ace4f0) Message-ID: <20170315131727.ED0643A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/7ace4f0c377d0dd851283eefa8f473322d67afed/ghc >--------------------------------------------------------------- commit 7ace4f0c377d0dd851283eefa8f473322d67afed Author: Luke Maurer Date: Mon Mar 13 18:49:25 2017 -0400 Fix #13382: Put join ceiling underneath lambdas Test Plan: No new test (bug is latent) Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3285 (cherry picked from commit 08e73ccf4c75a7d7a8b8167d2ccf8bc505fe1130) >--------------------------------------------------------------- 7ace4f0c377d0dd851283eefa8f473322d67afed compiler/simplCore/SetLevels.hs | 3 ++- testsuite/tests/perf/compiler/all.T | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 8822019..90e1d53 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -1167,7 +1167,8 @@ lvlFloatRhs abs_vars dest_lvl env rec is_bot mb_join_arity rhs (body_env, bndrs') | Just _ <- mb_join_arity = lvlJoinBndrs env1 dest_lvl rec all_bndrs | otherwise - = lvlLamBndrs (placeJoinCeiling env1) dest_lvl all_bndrs + = case lvlLamBndrs env1 dest_lvl all_bndrs of + (env2, bndrs') -> (placeJoinCeiling env2, bndrs') -- The important thing here is that we call lvlLamBndrs on -- all these binders at once (abs_vars and bndrs), so they -- all get the same major level. Otherwise we create stupid diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 5a7614b..8b4ac08 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -746,10 +746,12 @@ test('T9675', # 2015-07-11 56 (x86/Linux, 64-bit machine) use +RTS -G1 ]), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 731171072, 10) + [(wordsize(64), 656137960, 10) # 2014-10-13 544489040 # 2015-10-28 608284152 emit Typeable at definition site # 2017-02-17 731171072 Type-indexed Typeable + # 2017-03-13 656137960 Put join ceiling underneath lambdas? + ,(wordsize(32), 279480696, 10) # 2015-07-11 279480696 (x86/Linux, 64-bit machine) use +RTS -G1 ]), From git at git.haskell.org Wed Mar 15 13:17:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 13:17:34 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Allow associated types to pattern-match in non-class-bound variables (82366c4) Message-ID: <20170315131734.E7EB73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/82366c4c1501d57dd8490818ef6e0709aca8836f/ghc >--------------------------------------------------------------- commit 82366c4c1501d57dd8490818ef6e0709aca8836f Author: Ryan Scott Date: Tue Mar 14 10:58:58 2017 -0400 Allow associated types to pattern-match in non-class-bound variables Summary: After 8136a5cbfcd24647f897a2fae9fcbda0b1624035 (#11450), if you have a class with an associated type: ``` class C a where type T a b ``` And you try to create an instance of `C` like this: ``` instance C Int where type T Int Char = Bool ``` Then it is rejected, since you're trying to instantiate the variable ``b`` with something other than a type variable. But this restriction proves quite onerous in practice, as it prevents you from doing things like this: ``` class C a where type T a (b :: Identity c) :: c instance C Int where type T Int ('Identity x) = x ``` You have to resort to an auxiliary type family in order to define this now, which becomes extremely tiring. This lifts this restriction and fixes #13398, in which it was discovered that adding this restriction broke code in the wild. Test Plan: ./validate Reviewers: simonpj, bgamari, austin Reviewed By: simonpj Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3302 (cherry picked from commit 67345ccf51538acf2b6452c738ba641b119f5a5e) >--------------------------------------------------------------- 82366c4c1501d57dd8490818ef6e0709aca8836f compiler/typecheck/TcValidity.hs | 60 +++++++++++--------- docs/users_guide/8.2.1-notes.rst | 19 +++++++ docs/users_guide/glasgow_exts.rst | 66 ++++++---------------- testsuite/tests/ghci/scripts/T4175.hs | 4 +- testsuite/tests/ghci/scripts/T4175.stdout | 9 +-- testsuite/tests/ghci/scripts/T6018ghcifail.stderr | 13 ++--- .../tests/indexed-types/should_compile/T13398a.hs | 19 +++++++ .../tests/indexed-types/should_compile/T13398b.hs | 12 ++++ testsuite/tests/indexed-types/should_compile/all.T | 2 + .../indexed-types/should_fail/SimpleFail10.hs | 3 +- .../indexed-types/should_fail/SimpleFail10.stderr | 11 ---- testsuite/tests/indexed-types/should_fail/all.T | 2 +- testsuite/tests/th/T9692.hs | 2 +- testsuite/tests/th/T9692.stderr | 4 +- .../tests/typecheck/should_fail/T6018fail.stderr | 13 ++--- 15 files changed, 125 insertions(+), 114 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 82366c4c1501d57dd8490818ef6e0709aca8836f From git at git.haskell.org Wed Mar 15 13:17:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 13:17:31 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix CaseIdentity optimisation AGAIN (dfd8f29) Message-ID: <20170315131731.293B43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/dfd8f29eced6c2750b68bfa5d076306d0688eb09/ghc >--------------------------------------------------------------- commit dfd8f29eced6c2750b68bfa5d076306d0688eb09 Author: Simon Peyton Jones Date: Tue Mar 14 13:52:48 2017 +0000 Fix CaseIdentity optimisation AGAIN In this commit commit 02ac2974ce8e537372bff8d9e0a6efb461ed2c59 Author: Simon Peyton Jones Date: Wed Nov 16 10:37:47 2011 +0000 Fix CaseIdentity optimisaion In fixing one bug I'd introduced another; case x of { T -> T; F -> F } wasn't getting optmised! Trivial to fix. I introduced yet another! This line of code in SimplUtils.mkCase1 check_eq (Var v) (DataAlt con) [] = v == dataConWorkId con -- Optimisation only is patently false when arg_tys is non-empty. Astonishing that it has not shown up before now. Easily fixed though. This was all shown up by Trac #13417, which is now fixed. Merge to 8.0, 8.2. >--------------------------------------------------------------- dfd8f29eced6c2750b68bfa5d076306d0688eb09 compiler/simplCore/SimplUtils.hs | 18 +++++++++--------- testsuite/tests/simplCore/should_compile/T13417.hs | 8 ++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index 0fe262b..49bb6c4 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -1886,21 +1886,21 @@ mkCase1 _dflags scrut case_bndr _ alts@((_,_,rhs1) : _) -- Identity case ticks = concatMap (stripTicksT tickishFloatable . thdOf3) (tail alts) identity_alt (con, args, rhs) = check_eq rhs con args - check_eq (Cast rhs co) con args + check_eq (Cast rhs co) con args -- See Note [RHS casts] = not (any (`elemVarSet` tyCoVarsOfCo co) args) && check_eq rhs con args - -- See Note [RHS casts] - check_eq (Lit lit) (LitAlt lit') _ = lit == lit' + check_eq (Tick t e) alt args + = tickishFloatable t && check_eq e alt args + + check_eq (Lit lit) (LitAlt lit') _ = lit == lit' check_eq (Var v) _ _ | v == case_bndr = True - check_eq (Var v) (DataAlt con) [] = v == dataConWorkId con + check_eq (Var v) (DataAlt con) args + | null arg_tys, null args = v == dataConWorkId con -- Optimisation only - check_eq (Tick t e) alt args = tickishFloatable t && - check_eq e alt args check_eq rhs (DataAlt con) args = cheapEqExpr' tickishFloatable rhs $ - mkConApp con (arg_tys ++ - varsToCoreExprs args) + mkConApp2 con arg_tys args check_eq _ _ _ = False - arg_tys = map Type (tyConAppArgs (idType case_bndr)) + arg_tys = tyConAppArgs (idType case_bndr) -- Note [RHS casts] -- ~~~~~~~~~~~~~~~~ diff --git a/testsuite/tests/simplCore/should_compile/T13417.hs b/testsuite/tests/simplCore/should_compile/T13417.hs new file mode 100644 index 0000000..a919291 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T13417.hs @@ -0,0 +1,8 @@ +module T13417 where + +-- Amazingly this crashed GHC 8.0.2 + +data T a = E7 + +cons7 :: T a -> T b +cons7 E7 = E7 diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 7bad786..5265569 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -250,3 +250,4 @@ test('T13317', test('T13340', normal, run_command, ['$MAKE -s --no-print-directory T13340']) test('T13338', only_ways(['optasm']), compile, ['-dcore-lint']) test('T13367', normal, run_command, ['$MAKE -s --no-print-directory T13367']) +test('T13417', normal, compile, ['-O']) From git at git.haskell.org Wed Mar 15 13:17:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 13:17:40 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Improve error messages for skolems (026189a) Message-ID: <20170315131740.6FC2A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/026189aa7249b405faf1d9cb1e1dea4ad0daedb1/ghc >--------------------------------------------------------------- commit 026189aa7249b405faf1d9cb1e1dea4ad0daedb1 Author: Simon Peyton Jones Date: Fri Mar 10 11:46:50 2017 +0000 Improve error messages for skolems In error messages like this • Couldn't match type ‘c’ with ‘f0 (a -> b)’ ‘c’ is a rigid type variable bound by the type signature for: f :: ((a -> b) -> b) -> forall c. c -> a we need to take case both to actually show that 'forall c', and to make sure that its name lines with the 'c' in the error message. This has been shaky for some time, and this commit puts it on solid ground. See TcRnTypes: Note [SigSkol SkolemInfo] The main changes are * SigSkol gets an extra field that records the way in which the type signature was skolemised. * The type in SigSkol is now the /un/-skolemised version * pprSkolemInfo uses the info to make the tidy type line up nicely Lots of error message wibbles! (cherry-picked from 48d1866e9051e52b80c9c88547bd66d66483f1d5) >--------------------------------------------------------------- 026189aa7249b405faf1d9cb1e1dea4ad0daedb1 compiler/typecheck/Inst.hs | 52 ++++++++++--------- compiler/typecheck/TcBinds.hs | 4 +- compiler/typecheck/TcErrors.hs | 19 +++---- compiler/typecheck/TcExpr.hs | 4 +- compiler/typecheck/TcMType.hs | 58 ++++++++++++++++------ compiler/typecheck/TcRnDriver.hs | 2 +- compiler/typecheck/TcRnTypes.hs | 45 ++++++++++++++--- compiler/typecheck/TcSimplify.hs | 2 +- compiler/typecheck/TcUnify.hs | 17 +++---- compiler/types/TyCoRep.hs | 3 +- testsuite/tests/ado/ado005.stderr | 42 +++++++++------- .../tests/backpack/should_fail/bkpfail24.stderr | 2 +- .../tests/backpack/should_fail/bkpfail44.stderr | 2 +- testsuite/tests/deriving/should_fail/T5287.stderr | 2 +- .../should_compile/PushedInAsGivens.stderr | 2 +- .../indexed-types/should_compile/T3208b.stderr | 4 +- .../tests/indexed-types/should_fail/T2664.stderr | 3 +- .../tests/indexed-types/should_fail/T4093a.stderr | 2 +- .../tests/indexed-types/should_fail/T4093b.stderr | 3 +- .../tests/indexed-types/should_fail/T7194.stderr | 2 +- testsuite/tests/monadfail/MonadFailErrors.stderr | 4 +- testsuite/tests/monadfail/MonadFailWarnings.stderr | 4 +- .../should_fail/overloadedlabelsfail01.stderr | 2 +- testsuite/tests/parser/should_fail/T7848.stderr | 2 +- .../partial-sigs/should_compile/T10403.stderr | 2 +- testsuite/tests/polykinds/T7230.stderr | 4 +- testsuite/tests/polykinds/T7594.stderr | 2 +- .../tests/typecheck/should_compile/T7220a.stderr | 7 ++- .../tests/typecheck/should_compile/T9834.stderr | 4 +- .../tests/typecheck/should_compile/T9939.stderr | 8 +-- .../tests/typecheck/should_compile/tc168.stderr | 8 +-- .../typecheck/should_fail/ClassOperator.stderr | 8 +-- .../tests/typecheck/should_fail/T10534.stderr | 2 +- .../tests/typecheck/should_fail/T11947a.stderr | 2 +- .../tests/typecheck/should_fail/T11948.stderr | 2 +- .../tests/typecheck/should_fail/T12151.stderr | 2 +- .../tests/typecheck/should_fail/T12918b.stderr | 2 +- .../tests/typecheck/should_fail/T1897a.stderr | 2 +- testsuite/tests/typecheck/should_fail/T2714.stderr | 8 +-- testsuite/tests/typecheck/should_fail/T3592.stderr | 4 +- testsuite/tests/typecheck/should_fail/T5300.stderr | 7 ++- testsuite/tests/typecheck/should_fail/T7279.stderr | 2 +- testsuite/tests/typecheck/should_fail/T7437.stderr | 4 +- testsuite/tests/typecheck/should_fail/T7453.stderr | 6 +-- testsuite/tests/typecheck/should_fail/T7869.stderr | 2 +- .../tests/typecheck/should_fail/tcfail032.stderr | 2 +- .../tests/typecheck/should_fail/tcfail034.stderr | 4 +- .../tests/typecheck/should_fail/tcfail067.stderr | 14 +++--- .../tests/typecheck/should_fail/tcfail072.stderr | 2 +- .../tests/typecheck/should_fail/tcfail080.stderr | 2 +- .../tests/typecheck/should_fail/tcfail097.stderr | 5 +- .../tests/typecheck/should_fail/tcfail098.stderr | 2 +- .../tests/typecheck/should_fail/tcfail102.stderr | 2 +- .../tests/typecheck/should_fail/tcfail116.stderr | 2 +- .../tests/typecheck/should_fail/tcfail125.stderr | 2 +- .../tests/typecheck/should_fail/tcfail142.stderr | 5 +- .../tests/typecheck/should_fail/tcfail171.stderr | 2 +- .../tests/typecheck/should_fail/tcfail198.stderr | 2 +- .../tests/typecheck/should_fail/tcfail208.stderr | 2 +- .../tests/warnings/should_compile/PluralS.stderr | 6 ++- .../wcompat-warnings/WCompatWarningsOn.stderr | 4 +- 61 files changed, 250 insertions(+), 178 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 026189aa7249b405faf1d9cb1e1dea4ad0daedb1 From git at git.haskell.org Wed Mar 15 13:17:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 13:17:37 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Define TcSimplify.simplifyTopImplic and use it (8a526c1) Message-ID: <20170315131737.9EABC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/8a526c1ca4dc78a851dbbda183e51509d2677d44/ghc >--------------------------------------------------------------- commit 8a526c1ca4dc78a851dbbda183e51509d2677d44 Author: Simon Peyton Jones Date: Fri Mar 10 12:50:05 2017 +0000 Define TcSimplify.simplifyTopImplic and use it A very small refactoring (cherry picked from commit 2d3cb34a603ed0008b551cbc3e16b69d7f6dbbe6) >--------------------------------------------------------------- 8a526c1ca4dc78a851dbbda183e51509d2677d44 compiler/typecheck/TcDerivInfer.hs | 2 +- compiler/typecheck/TcPatSyn.hs | 7 ++----- compiler/typecheck/TcSimplify.hs | 14 ++++++++++++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/compiler/typecheck/TcDerivInfer.hs b/compiler/typecheck/TcDerivInfer.hs index 4ac0741..93dcf43 100644 --- a/compiler/typecheck/TcDerivInfer.hs +++ b/compiler/typecheck/TcDerivInfer.hs @@ -666,7 +666,7 @@ simplifyDeriv pred tvs thetas -- See Note [Error reporting for deriving clauses] -- See also Note [Exotic derived instance contexts], which are caught -- in this line of code. - ; _ <- simplifyTop $ mkImplicWC leftover_implic + ; simplifyTopImplic leftover_implic ; return (substTheta subst_skol min_theta) } diff --git a/compiler/typecheck/TcPatSyn.hs b/compiler/typecheck/TcPatSyn.hs index cbeb231..15895b5 100644 --- a/compiler/typecheck/TcPatSyn.hs +++ b/compiler/typecheck/TcPatSyn.hs @@ -168,7 +168,7 @@ tcCheckPatSynDecl psb at PSB{ psb_id = lname@(L _ name), psb_args = details ; args' <- zipWithM (tc_arg subst) arg_names arg_tys ; return (ex_tvs', prov_dicts, args') } - ; let skol_info = SigSkol (PatSynCtxt name) (mkPhiTy req_theta pat_ty) + ; let skol_info = SigSkol (PatSynCtxt name) pat_ty [] -- The type here is a bit bogus, but we do not print -- the type for PatSynCtxt, so it doesn't matter -- See TcRnTypes Note [Skolem info for pattern synonyms] @@ -176,10 +176,7 @@ tcCheckPatSynDecl psb at PSB{ psb_id = lname@(L _ name), psb_args = details -- Solve the constraints now, because we are about to make a PatSyn, -- which should not contain unification variables and the like (Trac #10997) - ; empty_binds <- simplifyTop (mkImplicWC implics) - - -- Since all the inputs are implications the returned bindings will be empty - ; MASSERT2( isEmptyBag empty_binds, ppr empty_binds ) + ; simplifyTopImplic implics -- ToDo: in the bidirectional case, check that the ex_tvs' are all distinct -- Otherwise we may get a type error when typechecking the builder, diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index 6db5fa4..887bbae 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -5,7 +5,7 @@ module TcSimplify( growThetaTyVars, simplifyAmbiguityCheck, simplifyDefault, - simplifyTop, captureTopConstraints, + simplifyTop, simplifyTopImplic, captureTopConstraints, simplifyInteractive, solveEqualities, simplifyWantedsTcM, tcCheckSatisfiability, @@ -81,6 +81,15 @@ captureTopConstraints thing_inside -- This call to reportUnsolved is the reason -- this function is here instead of TcRnMonad +simplifyTopImplic :: Bag Implication -> TcM () +simplifyTopImplic implics + = do { empty_binds <- simplifyTop (mkImplicWC implics) + + -- Since all the inputs are implications the returned bindings will be empty + ; MASSERT2( isEmptyBag empty_binds, ppr empty_binds ) + + ; return () } + simplifyTop :: WantedConstraints -> TcM (Bag EvBind) -- Simplify top-level constraints -- Usually these will be implications, @@ -729,7 +738,7 @@ simplifyInfer rhs_tclvl infer_mode sigs name_taus wanteds , text "psig_theta =" <+> ppr psig_theta , text "bound_theta =" <+> ppr bound_theta , text "full_theta =" <+> ppr full_theta - , text "qtvs =" <+> ppr qtvs + , text "all_qtvs =" <+> ppr all_qtvs , text "implic =" <+> ppr implic ] ; return ( qtvs, full_theta_vars, TcEvBinds ev_binds_var ) } @@ -869,6 +878,7 @@ decideQuantification infer_mode name_taus psig_theta candidates (vcat [ text "infer_mode:" <+> ppr infer_mode , text "gbl_cand:" <+> ppr gbl_cand , text "quant_cand:" <+> ppr quant_cand + , text "zonked_taus:" <+> ppr zonked_taus , text "gbl_tvs:" <+> ppr gbl_tvs , text "mono_tvs:" <+> ppr mono_tvs , text "tau_tvs_plus:" <+> ppr tau_tvs_plus From git at git.haskell.org Wed Mar 15 13:17:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 13:17:43 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Update test output (bb51a99) Message-ID: <20170315131743.25B893A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/bb51a99bb553d80d0f8458de2e228a814ca3f86e/ghc >--------------------------------------------------------------- commit bb51a99bb553d80d0f8458de2e228a814ca3f86e Author: Ben Gamari Date: Tue Mar 14 23:45:44 2017 -0400 Update test output >--------------------------------------------------------------- bb51a99bb553d80d0f8458de2e228a814ca3f86e .../partial-sigs/should_fail/NamedExtraConstraintsWildcard.stderr | 2 +- .../partial-sigs/should_fail/NamedWildcardsNotInMonotype.stderr | 2 +- testsuite/tests/typecheck/should_compile/tc141.stderr | 4 ++-- testsuite/tests/typecheck/should_compile/tc168.stderr | 8 ++++---- testsuite/tests/typecheck/should_fail/T2714.stderr | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/testsuite/tests/partial-sigs/should_fail/NamedExtraConstraintsWildcard.stderr b/testsuite/tests/partial-sigs/should_fail/NamedExtraConstraintsWildcard.stderr index 43ba8cc..e0b5c17 100644 --- a/testsuite/tests/partial-sigs/should_fail/NamedExtraConstraintsWildcard.stderr +++ b/testsuite/tests/partial-sigs/should_fail/NamedExtraConstraintsWildcard.stderr @@ -3,7 +3,7 @@ NamedExtraConstraintsWildcard.hs:5:1: error: • Could not deduce: w0 from the context: (Eq a, w) bound by the inferred type for ‘foo’: - (Eq a, w) => a -> a + forall (w :: Constraint) a. (Eq a, w) => a -> a at NamedExtraConstraintsWildcard.hs:5:1-15 • In the ambiguity check for the inferred type for ‘foo’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes diff --git a/testsuite/tests/partial-sigs/should_fail/NamedWildcardsNotInMonotype.stderr b/testsuite/tests/partial-sigs/should_fail/NamedWildcardsNotInMonotype.stderr index 0f21053..b1d7e3c 100644 --- a/testsuite/tests/partial-sigs/should_fail/NamedWildcardsNotInMonotype.stderr +++ b/testsuite/tests/partial-sigs/should_fail/NamedWildcardsNotInMonotype.stderr @@ -3,7 +3,7 @@ NamedWildcardsNotInMonotype.hs:5:1: error: • Could not deduce (Eq w0) from the context: (Show a, Eq w, Eq a) bound by the inferred type for ‘foo’: - (Show a, Eq w, Eq a) => a -> a -> String + forall w a. (Show a, Eq w, Eq a) => a -> a -> String at NamedWildcardsNotInMonotype.hs:5:1-33 The type variable ‘w0’ is ambiguous • In the ambiguity check for the inferred type for ‘foo’ diff --git a/testsuite/tests/typecheck/should_compile/tc141.stderr b/testsuite/tests/typecheck/should_compile/tc141.stderr index 7d0f081..309fdfe 100644 --- a/testsuite/tests/typecheck/should_compile/tc141.stderr +++ b/testsuite/tests/typecheck/should_compile/tc141.stderr @@ -11,7 +11,7 @@ tc141.hs:11:31: error: because type variable ‘a2’ would escape its scope This (rigid, skolem) type variable is bound by an expression type signature: - a2 + forall a2. a2 at tc141.hs:11:34 • In the expression: q :: a In the expression: (q :: a, p) @@ -39,7 +39,7 @@ tc141.hs:15:18: error: because type variable ‘a2’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - v :: a2 + v :: forall a2. a2 at tc141.hs:14:14-19 • In the expression: b In an equation for ‘v’: v = b diff --git a/testsuite/tests/typecheck/should_compile/tc168.stderr b/testsuite/tests/typecheck/should_compile/tc168.stderr index d36c58d..fd45a28 100644 --- a/testsuite/tests/typecheck/should_compile/tc168.stderr +++ b/testsuite/tests/typecheck/should_compile/tc168.stderr @@ -1,12 +1,12 @@ tc168.hs:17:1: error: - • Could not deduce (C a (a1, b0)) - from the context: C a (a1, b) + • Could not deduce (C a1 (a, b0)) + from the context: C a1 (a, b) bound by the inferred type for ‘g’: - forall a a1 b. C a (a1, b) => a -> a1 + forall b a a1. C a1 (a, b) => a1 -> a at tc168.hs:17:1-16 The type variable ‘b0’ is ambiguous • In the ambiguity check for the inferred type for ‘g’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes When checking the inferred type - g :: forall a1 a2 b. C a1 (a2, b) => a1 -> a2 + g :: forall b a1 a2. C a2 (a1, b) => a2 -> a1 diff --git a/testsuite/tests/typecheck/should_fail/T2714.stderr b/testsuite/tests/typecheck/should_fail/T2714.stderr index 9b3fc34..c016586 100644 --- a/testsuite/tests/typecheck/should_fail/T2714.stderr +++ b/testsuite/tests/typecheck/should_fail/T2714.stderr @@ -1,10 +1,10 @@ T2714.hs:8:5: error: - • Couldn't match type ‘c’ with ‘f0 (a -> b)’ - ‘c’ is a rigid type variable bound by + • Couldn't match type ‘a’ with ‘f0 b’ + ‘a’ is a rigid type variable bound by the type signature for: - f :: ((a -> b) -> b) -> forall c. c -> a - at T2714.hs:8:1-9 + f :: forall a b. ((a -> b) -> b) -> forall c. c -> a + at T2714.hs:7:1-42 Expected type: ((a -> b) -> b) -> c -> a Actual type: ((a -> b) -> b) -> f0 (a -> b) -> f0 b • In the expression: ffmap From git at git.haskell.org Wed Mar 15 13:17:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 13:17:46 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix constraint simplification in rules (9869213) Message-ID: <20170315131746.823BA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/98692134c3aee35dd89992aff3c350f49543a67b/ghc >--------------------------------------------------------------- commit 98692134c3aee35dd89992aff3c350f49543a67b Author: Simon Peyton Jones Date: Fri Mar 10 12:09:52 2017 +0000 Fix constraint simplification in rules Trac #13381 showed that we were losing track of a wanted constraint when simplifying the LHS constraints for a RULE. This patch fixes it, makes the code a bit simpler, and better documented. (cherry picked from commit af6ed4a62c77e57f544243aa72bba51a1cff6808) >--------------------------------------------------------------- 98692134c3aee35dd89992aff3c350f49543a67b compiler/typecheck/TcRules.hs | 153 +++++++++++---------- testsuite/tests/typecheck/should_compile/T13381.hs | 22 +++ .../tests/typecheck/should_compile/T13381.stderr | 14 ++ testsuite/tests/typecheck/should_compile/all.T | 1 + 4 files changed, 114 insertions(+), 76 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 98692134c3aee35dd89992aff3c350f49543a67b From git at git.haskell.org Wed Mar 15 15:43:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 15:43:58 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix #13337. (109a242) Message-ID: <20170315154358.412B23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/109a2429493c2a2d5481b67f5b0c1086a959813e/ghc >--------------------------------------------------------------- commit 109a2429493c2a2d5481b67f5b0c1086a959813e Author: Richard Eisenberg Date: Tue Mar 14 13:32:00 2017 -0400 Fix #13337. The big change is the introduction of solveSomeEqualities. This is just like solveEqualities, but it doesn't fail if there are unsolved equalities when it's all done. Anything unsolved is re-emitted. This is appropriate if we are not kind-generalizing, so this new form is used when decideKindGeneralizationPlan says not to. We initially thought that any use of solveEqualities would be tied to kind generalization, but this isn't true. For example, we need to solveEqualities a bunch in the "tc" pass in TcTyClsDecls (which is really desugaring). These equalities are all surely going to be soluble (if they weren't the "kc" pass would fail), but we still need to solve them again. Perhaps if the "kc" pass produced type- checked output that is then desugared, solveEqualities really would be tied only to kind generalization. Updates haddock submodule. Test Plan: ./validate, typecheck/should_compile/T13337 Reviewers: simonpj, bgamari, austin Reviewed By: simonpj Subscribers: RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3315 (cherry picked from commit e0c433c81182c934ee4c4cc5c6cf25a1b6fb8d83) >--------------------------------------------------------------- 109a2429493c2a2d5481b67f5b0c1086a959813e compiler/hsSyn/Convert.hs | 2 +- compiler/hsSyn/HsDecls.hs | 2 +- compiler/hsSyn/HsTypes.hs | 15 ++-- compiler/rename/RnSource.hs | 3 +- compiler/rename/RnTypes.hs | 14 +++- compiler/typecheck/TcBinds.hs | 3 +- compiler/typecheck/TcForeign.hs | 2 +- compiler/typecheck/TcHsType.hs | 79 +++++++++++++--------- compiler/typecheck/TcSimplify.hs | 62 ++++++++++++++++- compiler/typecheck/TcTyClsDecls.hs | 3 +- .../parser/should_compile/DumpParsedAst.stderr | 6 +- .../parser/should_compile/DumpRenamedAst.stderr | 6 +- .../tests/partial-sigs/should_fail/T11976.stderr | 7 ++ .../tests/partial-sigs/should_fail/T12634.stderr | 9 ++- testsuite/tests/typecheck/should_compile/T13337.hs | 16 +++++ testsuite/tests/typecheck/should_compile/all.T | 1 + utils/haddock | 2 +- 17 files changed, 177 insertions(+), 55 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 109a2429493c2a2d5481b67f5b0c1086a959813e From git at git.haskell.org Wed Mar 15 15:44:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 15:44:00 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Sort out a few performance failures (e71c9c8) Message-ID: <20170315154400.EF5643A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/e71c9c863c3e7bddc795fceba8b48b06d3e664a4/ghc >--------------------------------------------------------------- commit e71c9c863c3e7bddc795fceba8b48b06d3e664a4 Author: Ben Gamari Date: Tue Mar 14 17:40:23 2017 -0400 testsuite: Sort out a few performance failures >--------------------------------------------------------------- e71c9c863c3e7bddc795fceba8b48b06d3e664a4 testsuite/tests/perf/compiler/all.T | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 8b4ac08..ca9f558 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -39,7 +39,7 @@ test('T1969', # 2013-11-13 17 (x86/Windows, 64bit machine) # 2015-07-11 21 (x86/Linux, 64bit machine) use +RTS -G1 # 2016-04-06 30 (x86/Linux, 64bit machine) - (wordsize(64), 83, 20)]), + (wordsize(64), 66, 20)]), # 28 (amd64/Linux) # 34 (amd64/Linux) # 2012-09-20 23 (amd64/Linux) @@ -54,6 +54,7 @@ test('T1969', # 2016-10-20 68, (amd64/Linux) allow top-level string literals # See the comment 16 on #8472. # 2017-02-17 83 (amd64/Linux) Type-indexed Typeable + # 2017-03-14 66 (amd64/Windows) Perhaps Typeable optimizations compiler_stats_num_field('max_bytes_used', [(platform('i386-unknown-mingw32'), 5719436, 20), # 2010-05-17 5717704 (x86/Windows) @@ -624,8 +625,9 @@ test('T5837', # 2014-12-08: 115905208 Constraint solver perf improvements (esp kick-out) # 2016-04-06: 24199320 (x86/Linux, 64-bit machine) TypeInType - (platform('x86_64-unknown-mingw32'), 59161648, 7), - # 2017-02-19 59161648 (x64/Windows) - Unknown + (platform('x86_64-unknown-mingw32'), 53787192, 7), + # 2017-02-19 59161648 (x64/Windows) - Unknown + # 2017-03-14 53787192 (x64/Windows) - Unknown (wordsize(64), 52625920, 7)]) # sample: 3926235424 (amd64/Linux, 15/2/2012) @@ -981,9 +983,10 @@ test('T12425', test('T12234', [ only_ways(['optasm']), compiler_stats_num_field('bytes allocated', - [(platform('x86_64-unknown-mingw32'), 89180624, 5), + [(platform('x86_64-unknown-mingw32'), 79820152, 5), # initial: 83032768 - # 2017-02-19 89180624 (x64/Windows) - Unknown + # 2017-02-19 89180624 (x64/Windows) - Unknown + # 2017-03-14 79820152 (x64/Windows) - Probably Early inline patch (wordsize(64), 80245640, 5), # initial: 72958288 # 2016-01-17: 76848856 (x86-64, Linux. drift?) From git at git.haskell.org Wed Mar 15 15:44:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 15:44:03 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Fix peak_megabytes_allocated for T4029 (e59b602) Message-ID: <20170315154403.AC9C03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/e59b602657d95a6ed6886416f5da3209e20e64d6/ghc >--------------------------------------------------------------- commit e59b602657d95a6ed6886416f5da3209e20e64d6 Author: Ben Gamari Date: Mon Mar 13 17:03:42 2017 -0400 testsuite: Fix peak_megabytes_allocated for T4029 It seems I must have dropped the update of the expected value during a conflict resolution. >--------------------------------------------------------------- e59b602657d95a6ed6886416f5da3209e20e64d6 testsuite/tests/perf/space_leaks/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/perf/space_leaks/all.T b/testsuite/tests/perf/space_leaks/all.T index fa93d72..d83b003 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -59,7 +59,7 @@ test('T4018', test('T4029', [stats_num_field('peak_megabytes_allocated', - [(wordsize(64), 76, 10)]), + [(wordsize(64), 65, 10)]), # 2016-02-26: 66 (amd64/Linux) INITIAL # 2016-05-23: 82 (amd64/Linux) Use -G1 # 2016-07-13: 92 (amd64/Linux) Changes to tidyType From git at git.haskell.org Wed Mar 15 15:44:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 15:44:06 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix Windows GCC driver (018ac7f) Message-ID: <20170315154406.6E66C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/018ac7f4b2f7345e28d21fb1f99b44dbc79f6e85/ghc >--------------------------------------------------------------- commit 018ac7f4b2f7345e28d21fb1f99b44dbc79f6e85 Author: Tamar Christina Date: Tue Mar 14 13:31:36 2017 -0400 Fix Windows GCC driver In Windows 10 Insiders build 15019+ which will probably be released mainstream somewhere this year Microsoft seems to have started being stricter with API calls. The call to `FreeConsole` just after `CreateProcess` is making Windows treat the process as an interactive process. In which case it tries to use the `Desktop session` but fails resulting in the cryptic error reported. I don't understand why the call to `FreeConsole` was there and it doesn't seem to be needed, so removed. This fixes #13411 Test Plan: ./validate, alternative just do anything with ghc which requires compilation. Reviewers: austin, bgamari, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D3319 (cherry picked from commit 4b673e804fb8598dac02596f107544c7f2ea263b) >--------------------------------------------------------------- 018ac7f4b2f7345e28d21fb1f99b44dbc79f6e85 driver/utils/cwrapper.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/driver/utils/cwrapper.c b/driver/utils/cwrapper.c index 5105924..da6cec4 100644 --- a/driver/utils/cwrapper.c +++ b/driver/utils/cwrapper.c @@ -130,11 +130,9 @@ __attribute__((noreturn)) int run (char *exePath, &pi) ) { die("Unable to start %s (error code: %lu)\n", exePath, GetLastError()); } - /* Disable handling of console events in the parent by dropping its - * connection to the console. This has the (minor) downside of not being - * able to subsequently emit any error messages to the console. - */ - FreeConsole(); + + /* Synchronize input and wait for target to be ready. */ + WaitForInputIdle(pi.hProcess, INFINITE); switch (WaitForSingleObject(pi.hProcess, INFINITE) ) { case WAIT_OBJECT_0: From git at git.haskell.org Wed Mar 15 15:44:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 15:44:09 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Further document :type +v's role in analyzing -XTypeApplications in GHCi (7596efd) Message-ID: <20170315154409.368DC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/7596efd6d253c28abc663e7fac2b01442832a89e/ghc >--------------------------------------------------------------- commit 7596efd6d253c28abc663e7fac2b01442832a89e Author: Ryan Scott Date: Tue Mar 14 10:58:41 2017 -0400 Further document :type +v's role in analyzing -XTypeApplications in GHCi Summary: The section on `-XTypeApplications` in the users' guide isn't terribly clear on how to view the visibility of a function type signature's type variables in GHCi properly (i.e., using the `:type +v` GHCi command). This adds some more exposition that demonstrates how to use `:type +v` (and why you don't want to use `:type`). Fixes #13401. Test Plan: Eyeball it Reviewers: bgamari, austin, goldfire, crockeea Reviewed By: goldfire, crockeea Subscribers: rwbarton, thomie, crockeea Differential Revision: https://phabricator.haskell.org/D3310 (cherry picked from commit b335f506f1d3a766de849e015f6732ae130247a4) >--------------------------------------------------------------- 7596efd6d253c28abc663e7fac2b01442832a89e docs/users_guide/ghci.rst | 2 +- docs/users_guide/glasgow_exts.rst | 43 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/docs/users_guide/ghci.rst b/docs/users_guide/ghci.rst index 864ae80..2d27c26 100644 --- a/docs/users_guide/ghci.rst +++ b/docs/users_guide/ghci.rst @@ -2724,7 +2724,7 @@ commonly used commands. *X> :type length length :: Foldable t => t a -> Int -.. ghci-cmd:: :type +v ⟨expression⟩ +.. ghci-cmd:: :type +v; ⟨expression⟩ Infers and prints the type of ⟨expression⟩, but without fiddling with type variables or class constraints. This is useful when you diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index ef2a735..0e8e956 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -9309,9 +9309,46 @@ Here are the details: - When printing types with :ghc-flag:`-fprint-explicit-foralls` enabled, type variables not available for visible type application are printed - in braces. Thus, if you write ``myLength = length`` without a type - signature, ``myLength``'s inferred type will be - ``forall {f} {a}. Foldable f => f a -> Int``. + in braces. We can observe this behavior in a GHCi session: :: + + > :set -XTypeApplications -fprint-explicit-foralls + > let myLength1 :: Foldable f => f a -> Int; myLength1 = length + > :type +v myLength1 + myLength1 :: forall (f :: * -> *) a. Foldable f => f a -> Int + > let myLength2 = length + > :type +v myLength2 + myLength2 :: forall {a} {t :: * -> *}. Foldable t => t a -> Int + > :type +v myLength2 @[] + + :1:1: error: + • Cannot apply expression of type ‘t0 a0 -> Int’ + to a visible type argument ‘[]’ + • In the expression: myLength2 @[] + + Notice that since ``myLength1`` was defined with an explicit type signature, + :ghci-cmd:`:type +v` reports that all of its type variables are available + for type application. On the other hand, ``myLength2`` was not given a type + signature. As a result, all of its type variables are surrounded with braces, + and trying to use visible type application with ``myLength2`` fails. + + Also note the use of :ghci-cmd:`:type +v` in the GHCi session above instead + of :ghci-cmd:`:type`. This is because :ghci-cmd:`:type` gives you the type + that would be inferred for a variable assigned to the expression provided + (that is, the type of ``x`` in ``let x = ``). As we saw above with + ``myLength2``, this type will have no variables available to visible type + application. On the other hand, :ghci-cmd:`:type +v` gives you the actual + type of the expression provided. To illustrate this: :: + + > :type myLength1 + myLength1 :: forall {a} {f :: * -> *}. Foldable f => f a -> Int + > :type myLength2 + myLength2 :: forall {a} {t :: * -> *}. Foldable t => t a -> Int + + Using :ghci-cmd:`:type` might lead one to conclude that none of the type + variables in ``myLength1``'s type signature are available for type + application. This isn't true, however! Be sure to use :ghci-cmd:`:type +v` + if you want the most accurate information with respect to visible type + application properties. - Data constructors declared with GADT syntax follow different rules for the time being; it is expected that these will be brought in line From git at git.haskell.org Wed Mar 15 17:17:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 17:17:19 +0000 (UTC) Subject: [commit: hsc2hs] master: Track column numbers (df6b31d) Message-ID: <20170315171719.425323A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hsc2hs On branch : master Link : http://git.haskell.org/hsc2hs.git/commitdiff/df6b31d701f8292c3845292004122b5e72f95cad >--------------------------------------------------------------- commit df6b31d701f8292c3845292004122b5e72f95cad Author: Phil Ruffwind Date: Wed Mar 15 11:54:45 2017 -0400 Track column numbers Summary: Keep track of column numbers and inform GHC whenever the column number could be potentially desynchronized from the original source code. This should fix GHC #13388 on Trac. Test Plan: validate Reviewers: O25 HSC2HS, hvr, bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D3314 >--------------------------------------------------------------- df6b31d701f8292c3845292004122b5e72f95cad C.hs | 76 ++++++++++++++++++++++++++++++++++++++++++++--------- CrossCodegen.hs | 79 ++++++++++++++++++++++++++++++-------------------------- DirectCodegen.hs | 8 +++--- Flags.hs | 7 +++++ HSCParser.hs | 39 +++++++++++++++++++++++----- Main.hs | 5 ++-- template-hsc.h | 3 +++ 7 files changed, 156 insertions(+), 61 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 df6b31d701f8292c3845292004122b5e72f95cad From git at git.haskell.org Wed Mar 15 17:17:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 17:17:31 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump hsc2hs submodule (59f72c9) Message-ID: <20170315171731.3C4AE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/59f72c9a5554848ff1d20997696a93f8b2640ed8/ghc >--------------------------------------------------------------- commit 59f72c9a5554848ff1d20997696a93f8b2640ed8 Author: Ben Gamari Date: Wed Mar 15 11:55:09 2017 -0400 Bump hsc2hs submodule Fixes #13388. Also updates the expected output for T12504, which previously contained a redundant LINE pragma. >--------------------------------------------------------------- 59f72c9a5554848ff1d20997696a93f8b2640ed8 testsuite/tests/hsc2hs/Makefile | 2 -- utils/hsc2hs | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/testsuite/tests/hsc2hs/Makefile b/testsuite/tests/hsc2hs/Makefile index 9b3ee98..fa668e7 100644 --- a/testsuite/tests/hsc2hs/Makefile +++ b/testsuite/tests/hsc2hs/Makefile @@ -46,8 +46,6 @@ T12504: '$(HSC2HS)' T12504/path/to/$@.hsc ifeq "$(WINDOWS)" "YES" grep '{-# LINE 1 \"T12504\\\\path\\\\to\\\\$@\.hsc\" #-}' T12504/path/to/$@.hs - grep '{-# LINE 2 \"T12504\\\\path\\\\to\\\\$@\.hsc\" #-}' T12504/path/to/$@.hs else grep '{-# LINE 1 \"T12504/path/to/$@\.hsc\" #-}' T12504/path/to/$@.hs - grep '{-# LINE 2 \"T12504/path/to/$@\.hsc\" #-}' T12504/path/to/$@.hs endif diff --git a/utils/hsc2hs b/utils/hsc2hs index 9e4da90..df6b31d 160000 --- a/utils/hsc2hs +++ b/utils/hsc2hs @@ -1 +1 @@ -Subproject commit 9e4da90b7f47c23a2989cba6083fc6ed3880790f +Subproject commit df6b31d701f8292c3845292004122b5e72f95cad From git at git.haskell.org Wed Mar 15 19:25:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 19:25:44 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump margin of T4029 to 15% (899fb88) Message-ID: <20170315192544.E07FE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/899fb8808da875ef191da367de4ff35d079124e1/ghc >--------------------------------------------------------------- commit 899fb8808da875ef191da367de4ff35d079124e1 Author: Ben Gamari Date: Wed Mar 15 13:34:48 2017 -0400 testsuite: Bump margin of T4029 to 15% This test has been fluctuating wildly recently. Moreover, it's not even clear to me that this is a particularly useful thing to be testing. >--------------------------------------------------------------- 899fb8808da875ef191da367de4ff35d079124e1 testsuite/tests/perf/space_leaks/all.T | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/perf/space_leaks/all.T b/testsuite/tests/perf/space_leaks/all.T index 212a100..f0080f9 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -69,7 +69,7 @@ test('T4029', # 2017-03-03: 65 (amd64/Linux) Share Typeable KindReps or more # lazy interface file reading stats_num_field('max_bytes_used', - [(wordsize(64), 18208944, 5)]), + [(wordsize(64), 18208944, 15)]), # 2016-02-26: 24071720 (amd64/Linux) INITIAL # 2016-04-21: 25542832 (amd64/Linux) # 2016-05-23: 25247216 (amd64/Linux) Use -G1 @@ -86,6 +86,7 @@ test('T4029', # lazy interface file reading # 2017-03-07: 20476360 (amd64/Linux) It's not entirely clear # 2017-03-14: 18208944 (amd64/Darwin) Again, not clear + # 2017-03-15: bumped margin to 15% due to instability extra_hc_opts('+RTS -G1 -RTS' ), ], ghci_script, From git at git.haskell.org Wed Mar 15 19:25:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 19:25:41 +0000 (UTC) Subject: [commit: ghc] master: Always build GHCi libs (a7be163) Message-ID: <20170315192541.D5DF23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a7be163196f452530b61cbb526631db946d20e8b/ghc >--------------------------------------------------------------- commit a7be163196f452530b61cbb526631db946d20e8b Author: Simon Marlow Date: Wed Mar 15 09:28:10 2017 -0400 Always build GHCi libs Since the introduction of -split-sections, using GHCi with the RTS linker is really slow: ``` $ time (echo :quit | ./inplace/bin/ghc-stage2 --interactive -fexternal-interpreter) GHCi, version 8.1.20170304: http://www.haskell.org/ghc/ :? for help Prelude> Leaving GHCi. real 0m3.793s ``` (when we use `-fexternal-interpreter` it uses the RTS linker by default, you can make it use the system linker by adding `-dynamic`) Building the GHCi libs doesn't take much time or space in the GHC build, but makes things much quicker for people using the RTS linker: ``` $ time (echo :quit | ./inplace/bin/ghc-stage2 --interactive -fexternal-interpreter) GHCi, version 8.1.20170304: http://www.haskell.org/ghc/ :? for help Prelude> Leaving GHCi. real 0m0.285s ``` So I propose that we build and ship them unconditionally. Test Plan: validate, perf tests above Reviewers: bgamari, austin, niteria, erikd, Phyx Reviewed By: bgamari Subscribers: rwbarton, thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3298 >--------------------------------------------------------------- a7be163196f452530b61cbb526631db946d20e8b rules/build-package-data.mk | 6 ++++-- rules/build-package-way.mk | 4 ---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk index 8f3a8e7..a20afbc 100644 --- a/rules/build-package-data.mk +++ b/rules/build-package-data.mk @@ -32,11 +32,13 @@ endif $1_$2_CONFIGURE_OPTS += --disable-library-for-ghci ifeq "$$(filter v,$$($1_$2_WAYS))" "v" $1_$2_CONFIGURE_OPTS += --enable-library-vanilla +# Build the GHCi lib even if GHCi is dynamic (and therefore won't use +# these by default), because they will be used by +# (a) ghci -fexternal-interpreter +# (b) statically-linked binaries that use the GHC package ifeq "$$(GhcWithInterpreter)" "YES" -ifneq "$$(DYNAMIC_GHC_PROGRAMS)" "YES" $1_$2_CONFIGURE_OPTS += --enable-library-for-ghci endif -endif else $1_$2_CONFIGURE_OPTS += --disable-library-vanilla endif diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk index 8f61a35..f230ef5 100644 --- a/rules/build-package-way.mk +++ b/rules/build-package-way.mk @@ -143,9 +143,6 @@ endif endif # Build the GHCi library -ifeq "$$(DYNAMIC_GHC_PROGRAMS)" "YES" -$1_$2_GHCI_LIB = $$($1_$2_dyn_LIB) -else ifeq "$3" "v" $1_$2_GHCI_LIB = $1/$2/build/HS$$($1_$2_COMPONENT_ID).$$($3_osuf) ifeq "$$($1_$2_BUILD_GHCI_LIB)" "YES" @@ -164,7 +161,6 @@ $(call all-target,$1_$2,$$($1_$2_GHCI_LIB)) endif endif # "$$($1_$2_BUILD_GHCI_LIB)" "YES" endif # "$3" "v" -endif # "$$(DYNAMIC_GHC_PROGRAMS)" "YES" $(call profEnd, build-package-way($1,$2,$3)) endef # build-package-way From git at git.haskell.org Wed Mar 15 19:25:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 19:25:48 +0000 (UTC) Subject: [commit: ghc] master: Introduce and use EnumSet in DynFlags (cc9d574) Message-ID: <20170315192548.AD3693A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cc9d574a578090d17d1597628e44371003cb19a7/ghc >--------------------------------------------------------------- commit cc9d574a578090d17d1597628e44371003cb19a7 Author: Ben Gamari Date: Wed Mar 15 14:30:33 2017 -0400 Introduce and use EnumSet in DynFlags This factors out a repeated pattern found in DynFlags, where we use an IntSet and Enum to represent sets of flags. Requires bump of haddock submodule. Test Plan: validate Reviewers: austin, goldfire Subscribers: rwbarton, thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3331 >--------------------------------------------------------------- cc9d574a578090d17d1597628e44371003cb19a7 compiler/ghc.cabal.in | 1 + compiler/ghc.mk | 1 + compiler/iface/FlagChecker.hs | 4 +-- compiler/main/DynFlags.hs | 64 ++++++++++++++++++++---------------------- compiler/parser/Lexer.x | 12 ++++---- compiler/typecheck/TcSplice.hs | 7 ++--- compiler/utils/EnumSet.hs | 33 ++++++++++++++++++++++ utils/haddock | 2 +- 8 files changed, 78 insertions(+), 46 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 cc9d574a578090d17d1597628e44371003cb19a7 From git at git.haskell.org Wed Mar 15 19:25:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 19:25:51 +0000 (UTC) Subject: [commit: ghc] master: Bump hsc2hs submodule (cec9070) Message-ID: <20170315192551.BEDED3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cec90709c9c8c2c2955f11b9ad29f4c99bd075db/ghc >--------------------------------------------------------------- commit cec90709c9c8c2c2955f11b9ad29f4c99bd075db Author: Ben Gamari Date: Wed Mar 15 11:55:09 2017 -0400 Bump hsc2hs submodule Fixes #13388. Also updates the expected output for T12504, which previously contained a redundant LINE pragma. >--------------------------------------------------------------- cec90709c9c8c2c2955f11b9ad29f4c99bd075db testsuite/tests/hsc2hs/Makefile | 2 -- utils/hsc2hs | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/testsuite/tests/hsc2hs/Makefile b/testsuite/tests/hsc2hs/Makefile index 9b3ee98..fa668e7 100644 --- a/testsuite/tests/hsc2hs/Makefile +++ b/testsuite/tests/hsc2hs/Makefile @@ -46,8 +46,6 @@ T12504: '$(HSC2HS)' T12504/path/to/$@.hsc ifeq "$(WINDOWS)" "YES" grep '{-# LINE 1 \"T12504\\\\path\\\\to\\\\$@\.hsc\" #-}' T12504/path/to/$@.hs - grep '{-# LINE 2 \"T12504\\\\path\\\\to\\\\$@\.hsc\" #-}' T12504/path/to/$@.hs else grep '{-# LINE 1 \"T12504/path/to/$@\.hsc\" #-}' T12504/path/to/$@.hs - grep '{-# LINE 2 \"T12504/path/to/$@\.hsc\" #-}' T12504/path/to/$@.hs endif diff --git a/utils/hsc2hs b/utils/hsc2hs index 9e4da90..df6b31d 160000 --- a/utils/hsc2hs +++ b/utils/hsc2hs @@ -1 +1 @@ -Subproject commit 9e4da90b7f47c23a2989cba6083fc6ed3880790f +Subproject commit df6b31d701f8292c3845292004122b5e72f95cad From git at git.haskell.org Wed Mar 15 19:25:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 19:25:54 +0000 (UTC) Subject: [commit: ghc] master: Decrease locked region size on Windows to fix ERROR_LOCK_INVALID_RANGE (7e273ea) Message-ID: <20170315192554.E52F13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7e273ea28fe3630a8fede75ed28f471b7be21b5f/ghc >--------------------------------------------------------------- commit 7e273ea28fe3630a8fede75ed28f471b7be21b5f Author: Andrzej Rybczak Date: Wed Mar 15 14:30:48 2017 -0400 Decrease locked region size on Windows to fix ERROR_LOCK_INVALID_RANGE Reviewers: austin, hvr, bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3345 >--------------------------------------------------------------- 7e273ea28fe3630a8fede75ed28f471b7be21b5f libraries/base/GHC/IO/Handle/Lock.hsc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/base/GHC/IO/Handle/Lock.hsc b/libraries/base/GHC/IO/Handle/Lock.hsc index d03e261..5608c18 100644 --- a/libraries/base/GHC/IO/Handle/Lock.hsc +++ b/libraries/base/GHC/IO/Handle/Lock.hsc @@ -128,10 +128,10 @@ lockImpl h ctx mode block = do -- We want to lock the whole file without looking up its size to be -- consistent with what flock does. According to documentation of LockFileEx -- "locking a region that goes beyond the current end-of-file position is - -- not an error", however e.g. Windows 10 doesn't accept maximum possible - -- value (a pair of MAXDWORDs) for mysterious reasons. Work around that by - -- leaving the highest bit set to 0. - fix $ \retry -> c_LockFileEx wh flags 0 0xffffffff 0x7fffffff ovrlpd >>= \case + -- not an error", however some versions of Windows seem to have issues with + -- large regions and set ERROR_INVALID_LOCK_RANGE in such case for + -- mysterious reasons. Work around that by setting only low 32 bits. + fix $ \retry -> c_LockFileEx wh flags 0 0xffffffff 0x0 ovrlpd >>= \case True -> return True False -> getLastError >>= \err -> if | not block && err == #{const ERROR_LOCK_VIOLATION} -> return False From git at git.haskell.org Wed Mar 15 19:25:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 19:25:58 +0000 (UTC) Subject: [commit: ghc] master: Introduce putLogMsg (086b514) Message-ID: <20170315192558.1C4B33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/086b514b199c122b638391f3aa2fbcf15cc10c06/ghc >--------------------------------------------------------------- commit 086b514b199c122b638391f3aa2fbcf15cc10c06 Author: Ben Gamari Date: Wed Mar 15 09:29:24 2017 -0400 Introduce putLogMsg This factors out the repetition of (log_action dflags dflags) and will hopefully allow us to someday better abstract log output. Test Plan: Validate Reviewers: austin, hvr, goldfire Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3334 >--------------------------------------------------------------- 086b514b199c122b638391f3aa2fbcf15cc10c06 compiler/coreSyn/CoreLint.hs | 6 +++--- compiler/deSugar/Coverage.hs | 2 +- compiler/ghci/Linker.hs | 17 ++++++++--------- compiler/iface/BinIface.hs | 13 ++++++------- compiler/iface/LoadIface.hs | 2 +- compiler/main/DriverPipeline.hs | 4 ++-- compiler/main/DynFlags.hs | 7 +++++++ compiler/main/ErrUtils.hs | 24 ++++++++++-------------- compiler/main/GhcMake.hs | 2 +- compiler/main/SysTools.hs | 4 ++-- compiler/main/TidyPgm.hs | 2 +- compiler/simplCore/CoreMonad.hs | 3 +-- compiler/simplCore/SimplCore.hs | 2 +- compiler/simplStg/SimplStg.hs | 2 +- compiler/typecheck/TcRnMonad.hs | 15 +++++++-------- 15 files changed, 52 insertions(+), 53 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 086b514b199c122b638391f3aa2fbcf15cc10c06 From git at git.haskell.org Wed Mar 15 21:50:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 21:50:10 +0000 (UTC) Subject: [commit: nofib] master: spectral: temporarily disable secretary (47f132d) Message-ID: <20170315215010.BC7DA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/47f132de28851f9e03b1a4afdd34069c8760c77f/nofib >--------------------------------------------------------------- commit 47f132de28851f9e03b1a4afdd34069c8760c77f Author: Michal Terepeta Date: Wed Mar 15 17:47:15 2017 -0400 spectral: temporarily disable secretary Summary: Unfortunately `secretary` requires `random` package to compile and this broke perf.haskell.org. Let's disable the benchmark for now until we have a good story for dealing with benchmarks that require packages. Signed-off-by: Michal Terepeta Test Plan: build & run Reviewers: bgamari, nomeata Reviewed By: nomeata Differential Revision: https://phabricator.haskell.org/D3347 >--------------------------------------------------------------- 47f132de28851f9e03b1a4afdd34069c8760c77f spectral/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spectral/Makefile b/spectral/Makefile index fbcfc5e..0922691 100644 --- a/spectral/Makefile +++ b/spectral/Makefile @@ -1,11 +1,12 @@ TOP = .. include $(TOP)/mk/boilerplate.mk +# TODO(michalt): Re-enable `secretary` (requires `random`) SUBDIRS = ansi atom awards banner boyer boyer2 calendar cichelli circsim \ clausify constraints cryptarithm1 cryptarithm2 cse eliza expert \ fft2 fibheaps fish gcd hartel integer knights lambda last-piece lcss life \ mandel mandel2 mate minimax multiplier para power pretty primetest \ - puzzle rewrite scc secretary simple sorting sphere treejoin + puzzle rewrite scc simple sorting sphere treejoin OTHER_SUBDIRS = lambda last-piece From git at git.haskell.org Wed Mar 15 21:50:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 21:50:12 +0000 (UTC) Subject: [commit: nofib] master: fibheaps/Makefile: remove some weird character (dd21f6b) Message-ID: <20170315215012.C84BF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dd21f6bb1da78953f6a7b6af047a4ba87f10ca69/nofib >--------------------------------------------------------------- commit dd21f6bb1da78953f6a7b6af047a4ba87f10ca69 Author: Michal Terepeta Date: Wed Mar 15 17:48:15 2017 -0400 fibheaps/Makefile: remove some weird character Summary: Because it's at the beginning of the line with `SRC_HC_OPTS`, it causes `make` ignore those options. This commit removes that character and makes everything work. Signed-off-by: Michal Terepeta Test Plan: manually verify that the options are passed to GHC Reviewers: bgamari, dfeuer Reviewed By: dfeuer Subscribers: dfeuer Differential Revision: https://phabricator.haskell.org/D3344 >--------------------------------------------------------------- dd21f6bb1da78953f6a7b6af047a4ba87f10ca69 spectral/fibheaps/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spectral/fibheaps/Makefile b/spectral/fibheaps/Makefile index 28c8022..bff8208 100644 --- a/spectral/fibheaps/Makefile +++ b/spectral/fibheaps/Makefile @@ -1,7 +1,7 @@ TOP = ../.. include $(TOP)/mk/boilerplate.mk -​SRC_HC_OPTS += -package array +SRC_HC_OPTS += -package array FAST_OPTS = 5000 NORM_OPTS = 5000 From git at git.haskell.org Wed Mar 15 21:50:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 21:50:14 +0000 (UTC) Subject: [commit: nofib] master: real/Makefile: remove OTHER_SUBDIRS (7d7bc03) Message-ID: <20170315215014.D3FF63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7d7bc03c385022c36c557be77c79c107633b4454/nofib >--------------------------------------------------------------- commit 7d7bc03c385022c36c557be77c79c107633b4454 Author: Michal Terepeta Date: Wed Mar 15 17:48:21 2017 -0400 real/Makefile: remove OTHER_SUBDIRS Summary: This removes the unnecessary `OTHER_SUBDIRS` variable, since the subdirectories mentioned there are already in `SUBDIRS` (the benchmarks have been enabled in previous commits). Signed-off-by: Michal Terepeta Test Plan: build & run Reviewers: bgamari, dfeuer Reviewed By: dfeuer Differential Revision: https://phabricator.haskell.org/D3342 >--------------------------------------------------------------- 7d7bc03c385022c36c557be77c79c107633b4454 spectral/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/spectral/Makefile b/spectral/Makefile index 0922691..6eb35a5 100644 --- a/spectral/Makefile +++ b/spectral/Makefile @@ -8,7 +8,5 @@ SUBDIRS = ansi atom awards banner boyer boyer2 calendar cichelli circsim \ mandel mandel2 mate minimax multiplier para power pretty primetest \ puzzle rewrite scc simple sorting sphere treejoin -OTHER_SUBDIRS = lambda last-piece - include $(TOP)/mk/target.mk From git at git.haskell.org Wed Mar 15 21:50:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 21:50:36 +0000 (UTC) Subject: [commit: ghc] master: Bump nofib submodule (1cbc7c3) Message-ID: <20170315215036.6004E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1cbc7c315fb6f224b68afdf80f336d91a0338508/ghc >--------------------------------------------------------------- commit 1cbc7c315fb6f224b68afdf80f336d91a0338508 Author: Ben Gamari Date: Wed Mar 15 17:48:50 2017 -0400 Bump nofib submodule >--------------------------------------------------------------- 1cbc7c315fb6f224b68afdf80f336d91a0338508 nofib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nofib b/nofib index 88ebedd..7d7bc03 160000 --- a/nofib +++ b/nofib @@ -1 +1 @@ -Subproject commit 88ebedd41e0be4d52fba7c4df344f4bb7f3f3085 +Subproject commit 7d7bc03c385022c36c557be77c79c107633b4454 From git at git.haskell.org Wed Mar 15 22:32:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 22:32:09 +0000 (UTC) Subject: [commit: hsc2hs] master: Make hsc_alignment work in clang (d7e49a6) Message-ID: <20170315223209.7E7483A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hsc2hs On branch : master Link : http://git.haskell.org/hsc2hs.git/commitdiff/d7e49a6d90dbd3d8d0bbace9410fe8411a1c77bb >--------------------------------------------------------------- commit d7e49a6d90dbd3d8d0bbace9410fe8411a1c77bb Author: Bartosz Nitka Date: Wed Mar 15 17:52:36 2017 -0400 Make hsc_alignment work in clang Summary: With the old definition clang gives this error: ``` error: '(anonymous struct at example.cpp:15:3)' cannot be defined in a type specifier ``` This makes it work under clang. Test Plan: Test with https://godbolt.org/g/kIBwyP and look at the assembly. Reviewers: O25 HSC2HS, hvr, austin, bgamari, mpickering Reviewed By: bgamari Subscribers: simonmar Differential Revision: https://phabricator.haskell.org/D3346 >--------------------------------------------------------------- d7e49a6d90dbd3d8d0bbace9410fe8411a1c77bb template-hsc.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/template-hsc.h b/template-hsc.h index 71832f5..dec0e43 100644 --- a/template-hsc.h +++ b/template-hsc.h @@ -88,8 +88,14 @@ void *hsc_stdout(void); #define hsc_size(t...) \ hsc_printf("(%ld)", (long) sizeof(t)); -#define hsc_alignment(t...) \ - hsc_printf("(%ld)", (long) offsetof(struct {char x__; t (y__); }, y__)); +#define hsc_alignment(x...) \ + do { \ + struct __anon_x__ { \ + char a; \ + x b; \ + }; \ + hsc_printf("%lu", (unsigned long)offsetof(struct __anon_x__, b)); \ + } while (0) #define hsc_enum(t, f, print_name, x) \ print_name; \ From git at git.haskell.org Wed Mar 15 22:32:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 22:32:29 +0000 (UTC) Subject: [commit: ghc] master: Bump hsc2hs submodule (ba43105) Message-ID: <20170315223229.118D73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ba4310510dde80301590f24c3f408aaabc256a7a/ghc >--------------------------------------------------------------- commit ba4310510dde80301590f24c3f408aaabc256a7a Author: Ben Gamari Date: Wed Mar 15 17:52:47 2017 -0400 Bump hsc2hs submodule >--------------------------------------------------------------- ba4310510dde80301590f24c3f408aaabc256a7a utils/hsc2hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/hsc2hs b/utils/hsc2hs index df6b31d..d7e49a6 160000 --- a/utils/hsc2hs +++ b/utils/hsc2hs @@ -1 +1 @@ -Subproject commit df6b31d701f8292c3845292004122b5e72f95cad +Subproject commit d7e49a6d90dbd3d8d0bbace9410fe8411a1c77bb From git at git.haskell.org Wed Mar 15 23:08:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 23:08:59 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump hsc2hs submodule (6ebfbdf) Message-ID: <20170315230859.506A83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/6ebfbdfb64cb8bb5c2ddaf2ad3ad350755c5eb2b/ghc >--------------------------------------------------------------- commit 6ebfbdfb64cb8bb5c2ddaf2ad3ad350755c5eb2b Author: Ben Gamari Date: Wed Mar 15 17:52:47 2017 -0400 Bump hsc2hs submodule (cherry picked from commit ba4310510dde80301590f24c3f408aaabc256a7a) >--------------------------------------------------------------- 6ebfbdfb64cb8bb5c2ddaf2ad3ad350755c5eb2b utils/hsc2hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/hsc2hs b/utils/hsc2hs index df6b31d..d7e49a6 160000 --- a/utils/hsc2hs +++ b/utils/hsc2hs @@ -1 +1 @@ -Subproject commit df6b31d701f8292c3845292004122b5e72f95cad +Subproject commit d7e49a6d90dbd3d8d0bbace9410fe8411a1c77bb From git at git.haskell.org Wed Mar 15 23:09:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Mar 2017 23:09:02 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Decrease locked region size on Windows to fix ERROR_LOCK_INVALID_RANGE (d18d3d9) Message-ID: <20170315230902.59D863A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/d18d3d9461cfae0f2926c011fc6c7581d4678bea/ghc >--------------------------------------------------------------- commit d18d3d9461cfae0f2926c011fc6c7581d4678bea Author: Andrzej Rybczak Date: Wed Mar 15 14:30:48 2017 -0400 Decrease locked region size on Windows to fix ERROR_LOCK_INVALID_RANGE Reviewers: austin, hvr, bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3345 (cherry picked from commit 7e273ea28fe3630a8fede75ed28f471b7be21b5f) >--------------------------------------------------------------- d18d3d9461cfae0f2926c011fc6c7581d4678bea libraries/base/GHC/IO/Handle/Lock.hsc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/base/GHC/IO/Handle/Lock.hsc b/libraries/base/GHC/IO/Handle/Lock.hsc index d03e261..5608c18 100644 --- a/libraries/base/GHC/IO/Handle/Lock.hsc +++ b/libraries/base/GHC/IO/Handle/Lock.hsc @@ -128,10 +128,10 @@ lockImpl h ctx mode block = do -- We want to lock the whole file without looking up its size to be -- consistent with what flock does. According to documentation of LockFileEx -- "locking a region that goes beyond the current end-of-file position is - -- not an error", however e.g. Windows 10 doesn't accept maximum possible - -- value (a pair of MAXDWORDs) for mysterious reasons. Work around that by - -- leaving the highest bit set to 0. - fix $ \retry -> c_LockFileEx wh flags 0 0xffffffff 0x7fffffff ovrlpd >>= \case + -- not an error", however some versions of Windows seem to have issues with + -- large regions and set ERROR_INVALID_LOCK_RANGE in such case for + -- mysterious reasons. Work around that by setting only low 32 bits. + fix $ \retry -> c_LockFileEx wh flags 0 0xffffffff 0x0 ovrlpd >>= \case True -> return True False -> getLastError >>= \err -> if | not block && err == #{const ERROR_LOCK_VIOLATION} -> return False From git at git.haskell.org Thu Mar 16 01:29:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Mar 2017 01:29:10 +0000 (UTC) Subject: [commit: ghc] master: Bump unix submodule (2fd283b) Message-ID: <20170316012910.483293A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2fd283bf46ed68ce31df56c82563765561957a77/ghc >--------------------------------------------------------------- commit 2fd283bf46ed68ce31df56c82563765561957a77 Author: Ben Gamari Date: Wed Mar 15 20:38:36 2017 -0400 Bump unix submodule >--------------------------------------------------------------- 2fd283bf46ed68ce31df56c82563765561957a77 libraries/unix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/unix b/libraries/unix index 821cb07..47bcb47 160000 --- a/libraries/unix +++ b/libraries/unix @@ -1 +1 @@ -Subproject commit 821cb07ecf235625b4bb06626d30e4b15f28df30 +Subproject commit 47bcb4751c47e4026a7458f94e542d2c7dbbf92d From git at git.haskell.org Thu Mar 16 17:20:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Mar 2017 17:20:58 +0000 (UTC) Subject: [commit: ghc] branch 'wip/cheap-build' created Message-ID: <20170316172058.0F7563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/cheap-build Referencing: f95f7a7afc07bc545aec7758b10a7931b1dc0381 From git at git.haskell.org Thu Mar 16 17:21:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Mar 2017 17:21:00 +0000 (UTC) Subject: [commit: ghc] wip/cheap-build: Use cheapBuild for enumerating Chars (5909cee) Message-ID: <20170316172100.C273B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/cheap-build Link : http://ghc.haskell.org/trac/ghc/changeset/5909ceed698c8d893bb01f0dc1fd814672e760f2/ghc >--------------------------------------------------------------- commit 5909ceed698c8d893bb01f0dc1fd814672e760f2 Author: Ben Gamari Date: Tue Aug 4 09:08:39 2015 +0200 Use cheapBuild for enumerating Chars >--------------------------------------------------------------- 5909ceed698c8d893bb01f0dc1fd814672e760f2 libraries/base/GHC/Enum.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/base/GHC/Enum.hs b/libraries/base/GHC/Enum.hs index feb4585..e2655c9 100644 --- a/libraries/base/GHC/Enum.hs +++ b/libraries/base/GHC/Enum.hs @@ -320,9 +320,9 @@ instance Enum Char where -- See Note [How the Enum rules work] {-# RULES -"eftChar" [~1] forall x y. eftChar x y = build (\c n -> eftCharFB c n x y) -"efdChar" [~1] forall x1 x2. efdChar x1 x2 = build (\ c n -> efdCharFB c n x1 x2) -"efdtChar" [~1] forall x1 x2 l. efdtChar x1 x2 l = build (\ c n -> efdtCharFB c n x1 x2 l) +"eftChar" [~1] forall x y. eftChar x y = cheapBuild (\c n -> eftCharFB c n x y) +"efdChar" [~1] forall x1 x2. efdChar x1 x2 = cheapBuild (\ c n -> efdCharFB c n x1 x2) +"efdtChar" [~1] forall x1 x2 l. efdtChar x1 x2 l = cheapBuild (\ c n -> efdtCharFB c n x1 x2 l) "eftCharList" [1] eftCharFB (:) [] = eftChar "efdCharList" [1] efdCharFB (:) [] = efdChar "efdtCharList" [1] efdtCharFB (:) [] = efdtChar From git at git.haskell.org Thu Mar 16 17:21:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Mar 2017 17:21:03 +0000 (UTC) Subject: [commit: ghc] wip/cheap-build: Use cheapBuild for enumerating Ints (8ec51e4) Message-ID: <20170316172103.808EB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/cheap-build Link : http://ghc.haskell.org/trac/ghc/changeset/8ec51e481fba2e053cb3eec33c1695cdb4a36f2c/ghc >--------------------------------------------------------------- commit 8ec51e481fba2e053cb3eec33c1695cdb4a36f2c Author: Ben Gamari Date: Tue Aug 4 09:09:13 2015 +0200 Use cheapBuild for enumerating Ints >--------------------------------------------------------------- 8ec51e481fba2e053cb3eec33c1695cdb4a36f2c libraries/base/GHC/Enum.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/base/GHC/Enum.hs b/libraries/base/GHC/Enum.hs index e2655c9..1df43b0 100644 --- a/libraries/base/GHC/Enum.hs +++ b/libraries/base/GHC/Enum.hs @@ -455,7 +455,7 @@ instance Enum Int where -- In particular, we have rules for deforestation {-# RULES -"eftInt" [~1] forall x y. eftInt x y = build (\ c n -> eftIntFB c n x y) +"eftInt" [~1] forall x y. eftInt x y = cheapBuild (\ c n -> eftIntFB c n x y) "eftIntList" [1] eftIntFB (:) [] = eftInt #-} @@ -497,7 +497,7 @@ eftIntFB c n x0 y | isTrue# (x0 ># y) = n -- See Note [How the Enum rules work] {-# RULES "efdtInt" [~1] forall x1 x2 y. - efdtInt x1 x2 y = build (\ c n -> efdtIntFB c n x1 x2 y) + efdtInt x1 x2 y = cheapBuild (\ c n -> efdtIntFB c n x1 x2 y) "efdtIntUpList" [1] efdtIntFB (:) [] = efdtInt #-} From git at git.haskell.org Thu Mar 16 17:21:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Mar 2017 17:21:06 +0000 (UTC) Subject: [commit: ghc] wip/cheap-build: Implement cheapBuild (f95f7a7) Message-ID: <20170316172106.637543A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/cheap-build Link : http://ghc.haskell.org/trac/ghc/changeset/f95f7a7afc07bc545aec7758b10a7931b1dc0381/ghc >--------------------------------------------------------------- commit f95f7a7afc07bc545aec7758b10a7931b1dc0381 Author: David Feuer Date: Mon Jan 30 21:38:12 2017 -0500 Implement cheapBuild Summary: Ben Gamari's `cheapBuild` patch with some extras Use cheapBuild for enumerating Chars Use cheapBuild for enumerating Ints Add cheapBuild rules for other consumers `GHC.List` fuses a number of functions other than `foldr` with `build`. Make those fuse with `cheapBuild` too. Reviewers: austin, hvr, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3047 >--------------------------------------------------------------- f95f7a7afc07bc545aec7758b10a7931b1dc0381 libraries/base/GHC/List.hs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libraries/base/GHC/List.hs b/libraries/base/GHC/List.hs index 018c0a7..8906a91 100644 --- a/libraries/base/GHC/List.hs +++ b/libraries/base/GHC/List.hs @@ -59,6 +59,8 @@ badHead = errorEmptyList "head" {-# RULES "head/build" forall (g::forall b.(a->b->b)->b->b) . head (build g) = g (\x _ -> x) badHead +"head/cheapBuild" forall (g::forall b.(a->b->b)->b->b) . + head (cheapBuild g) = g (\x _ -> x) badHead "head/augment" forall xs (g::forall b. (a->b->b) -> b -> b) . head (augment g xs) = g (\x _ -> x) (head xs) #-} @@ -730,6 +732,8 @@ and (x:xs) = x && and xs {-# RULES "and/build" forall (g::forall b.(Bool->b->b)->b->b) . and (build g) = g (&&) True +"and/cheapBuild" forall (g::forall b.(Bool->b->b)->b->b) . + and (cheapBuild g) = g (&&) True #-} #endif @@ -747,6 +751,8 @@ or (x:xs) = x || or xs {-# RULES "or/build" forall (g::forall b.(Bool->b->b)->b->b) . or (build g) = g (||) False +"or/cheapBuild" forall (g::forall b.(Bool->b->b)->b->b) . + or (cheapBuild g) = g (||) False #-} #endif @@ -767,6 +773,8 @@ any p (x:xs) = p x || any p xs {-# RULES "any/build" forall p (g::forall b.(a->b->b)->b->b) . any p (build g) = g ((||) . p) False +"any/cheapBuild" forall p (g::forall b.(a->b->b)->b->b) . + any p (cheapBuild g) = g ((||) . p) False #-} #endif @@ -786,6 +794,8 @@ all p (x:xs) = p x && all p xs {-# RULES "all/build" forall p (g::forall b.(a->b->b)->b->b) . all p (build g) = g ((&&) . p) True +"all/cheapBuild" forall p (g::forall b.(a->b->b)->b->b) . + all p (cheapBuild g) = g ((&&) . p) True #-} #endif @@ -803,6 +813,8 @@ elem x (y:ys) = x==y || elem x ys {-# RULES "elem/build" forall x (g :: forall b . Eq a => (a -> b -> b) -> b -> b) . elem x (build g) = g (\ y r -> (x == y) || r) False +"elem/cheapBuild" forall x (g :: forall b . Eq a => (a -> b -> b) -> b -> b) + . elem x (cheapBuild g) = g (\ y r -> (x == y) || r) False #-} #endif @@ -817,6 +829,8 @@ notElem x (y:ys)= x /= y && notElem x ys {-# RULES "notElem/build" forall x (g :: forall b . Eq a => (a -> b -> b) -> b -> b) . notElem x (build g) = g (\ y r -> (x /= y) && r) True +"notElem/cheapBuild" forall x (g :: forall b . Eq a => (a -> b -> b) -> b -> b) + . notElem x (cheapBuild g) = g (\ y r -> (x /= y) && r) True #-} #endif @@ -900,6 +914,8 @@ foldr2_left k _z x r (y:ys) = k x y (r ys) {-# RULES "foldr2/left" forall k z ys (g::forall b.(a->b->b)->b->b) . foldr2 k z (build g) ys = g (foldr2_left k z) (\_ -> z) ys +"foldr2/cheapleft" forall k z ys (g::forall b.(a->b->b)->b->b) . + foldr2 k z (cheapBuild g) ys = g (foldr2_left k z) (\_ -> z) ys #-} -- There used to be a foldr2/right rule, allowing foldr2 to fuse with a build -- form on the right. However, this causes trouble if the right list ends in From git at git.haskell.org Thu Mar 16 17:21:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Mar 2017 17:21:09 +0000 (UTC) Subject: [commit: ghc] wip/cheap-build: Implement cheapBuild (780c268) Message-ID: <20170316172109.26CF43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/cheap-build Link : http://ghc.haskell.org/trac/ghc/changeset/780c268fa9255e37c8d018705c5003fb42afdc32/ghc >--------------------------------------------------------------- commit 780c268fa9255e37c8d018705c5003fb42afdc32 Author: Ben Gamari Date: Tue Aug 4 09:07:11 2015 +0200 Implement cheapBuild >--------------------------------------------------------------- 780c268fa9255e37c8d018705c5003fb42afdc32 compiler/coreSyn/CoreUnfold.hs | 5 +++-- compiler/prelude/PrelNames.hs | 9 +++++--- libraries/base/GHC/Base.hs | 48 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/compiler/coreSyn/CoreUnfold.hs b/compiler/coreSyn/CoreUnfold.hs index 0e3efbf..d198062 100644 --- a/compiler/coreSyn/CoreUnfold.hs +++ b/compiler/coreSyn/CoreUnfold.hs @@ -746,8 +746,9 @@ funSize :: DynFlags -> [Id] -> Id -> Int -> Int -> ExprSize -- Size for functions that are not constructors or primops -- Note [Function applications] funSize dflags top_args fun n_val_args voids - | fun `hasKey` buildIdKey = buildSize - | fun `hasKey` augmentIdKey = augmentSize + | fun `hasKey` buildIdKey = buildSize + | fun `hasKey` cheapBuildIdKey = buildSize + | fun `hasKey` augmentIdKey = augmentSize | otherwise = SizeIs size arg_discount res_discount where some_val_args = n_val_args > 0 diff --git a/compiler/prelude/PrelNames.hs b/compiler/prelude/PrelNames.hs index e3ebd6a..bcb780d 100644 --- a/compiler/prelude/PrelNames.hs +++ b/compiler/prelude/PrelNames.hs @@ -319,7 +319,7 @@ basicKnownKeyNames -- List operations concatName, filterName, mapName, - zipName, foldrName, buildName, augmentName, appendName, + zipName, foldrName, buildName, cheapBuildName, augmentName, appendName, -- FFI primitive types that are not wired-in. stablePtrTyConName, ptrTyConName, funPtrTyConName, @@ -1051,7 +1051,8 @@ groupWithName :: Name groupWithName = varQual gHC_EXTS (fsLit "groupWith") groupWithIdKey -- Random PrelBase functions -fromStringName, otherwiseIdName, foldrName, buildName, augmentName, +fromStringName, otherwiseIdName, foldrName, + buildName, cheapBuildName, augmentName, mapName, appendName, assertName, breakpointName, breakpointCondName, breakpointAutoName, opaqueTyConName :: Name @@ -1059,6 +1060,7 @@ fromStringName = varQual dATA_STRING (fsLit "fromString") fromStringClassOpKey otherwiseIdName = varQual gHC_BASE (fsLit "otherwise") otherwiseIdKey foldrName = varQual gHC_BASE (fsLit "foldr") foldrIdKey buildName = varQual gHC_BASE (fsLit "build") buildIdKey +cheapBuildName = varQual gHC_BASE (fsLit "cheapBuild") cheapBuildIdKey augmentName = varQual gHC_BASE (fsLit "augment") augmentIdKey mapName = varQual gHC_BASE (fsLit "map") mapIdKey appendName = varQual gHC_BASE (fsLit "++") appendIdKey @@ -2051,7 +2053,7 @@ typeLitNatDataConKey = mkPreludeDataConUnique 108 -} wildCardKey, absentErrorIdKey, augmentIdKey, appendIdKey, - buildIdKey, errorIdKey, foldrIdKey, recSelErrorIdKey, + buildIdKey, cheapBuildIdKey, errorIdKey, foldrIdKey, recSelErrorIdKey, seqIdKey, irrefutPatErrorIdKey, eqStringIdKey, noMethodBindingErrorIdKey, nonExhaustiveGuardsErrorIdKey, runtimeErrorIdKey, patErrorIdKey, voidPrimIdKey, @@ -2085,6 +2087,7 @@ voidPrimIdKey = mkPreludeMiscIdUnique 21 typeErrorIdKey = mkPreludeMiscIdUnique 22 divIntIdKey = mkPreludeMiscIdUnique 23 modIntIdKey = mkPreludeMiscIdUnique 24 +cheapBuildIdKey = mkPreludeMiscIdUnique 25 unsafeCoerceIdKey, concatIdKey, filterIdKey, zipIdKey, bindIOIdKey, returnIOIdKey, newStablePtrIdKey, diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index ffcd7ff..c4afa83 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -188,6 +188,7 @@ not True = False otherwise = True build = errorWithoutStackTrace "urk" +cheapBuild = errorWithoutStackTrace "urk" foldr = errorWithoutStackTrace "urk" #endif @@ -879,6 +880,13 @@ build :: forall a. (forall b. (a -> b -> b) -> b -> b) -> [a] build g = g (:) [] +-- | 'cheapBuild' is just like build, except that the simplifier views +-- it as cheap to construct (similar to to a data constructor). +cheapBuild :: forall a. (forall b. (a -> b -> b) -> b -> b) -> [a] +{-# INLINE CONLIKE [1] cheapBuild #-} +cheapBuild g = g (:) [] +-- See Note [cheapBuild] + -- | A list producer that can be fused with 'foldr'. -- This function is merely -- @@ -893,14 +901,16 @@ augment :: forall a. (forall b. (a->b->b) -> b -> b) -> [a] -> [a] augment g xs = g (:) xs {-# RULES -"fold/build" forall k z (g::forall b. (a->b->b) -> b -> b) . - foldr k z (build g) = g k z +"fold/build" forall k z (g::forall b. (a->b->b) -> b -> b) . + foldr k z (build g) = g k z +"fold/cheapBuild" forall k z (g::forall b. (a->b->b) -> b -> b) . + foldr k z (cheapBuild g) = g k z -"foldr/augment" forall k z xs (g::forall b. (a->b->b) -> b -> b) . - foldr k z (augment g xs) = g k (foldr k z xs) +"foldr/augment" forall k z xs (g::forall b. (a->b->b) -> b -> b) . + foldr k z (augment g xs) = g k (foldr k z xs) -"foldr/id" foldr (:) [] = \x -> x -"foldr/app" [1] forall ys. foldr (:) ys = \xs -> xs ++ ys +"foldr/id" foldr (:) [] = \x -> x +"foldr/app" [1] forall ys. foldr (:) ys = \xs -> xs ++ ys -- Only activate this from phase 1, because that's -- when we disable the rule that expands (++) into foldr @@ -917,17 +927,41 @@ augment g xs = g (:) xs "foldr/cons/build" forall k z x (g::forall b. (a->b->b) -> b -> b) . foldr k z (x:build g) = k x (g k z) +"foldr/cons/cheapBuild" + forall k z x (g::forall b. (a->b->b) -> b -> b) . + foldr k z (x:cheapBuild g) = k x (g k z) "augment/build" forall (g::forall b. (a->b->b) -> b -> b) (h::forall b. (a->b->b) -> b -> b) . augment g (build h) = build (\c n -> g c (h c n)) +"augment/cheapBuild" + forall (g::forall b. (a->b->b) -> b -> b) + (h::forall b. (a->b->b) -> b -> b) . + augment g (cheapBuild h) = cheapBuild (\c n -> g c (h c n)) "augment/nil" forall (g::forall b. (a->b->b) -> b -> b) . - augment g [] = build g + augment g [] = build g #-} -- This rule is true, but not (I think) useful: -- augment g (augment h t) = augment (\cn -> g c (h c n)) t + +{- +Note [cheapBuild] +~~~~~~~~~~~~~~~~~ +cheapBuild is just like build, except that it is CONLIKE +It is used in situations where fusion is more imortant than sharing, +ie in situation where its argument function 'g' in (cheapBuild g) is +cheap. +Main example: enumerations of one kind or another: + f x = let xs = [x..] + go = \y. ....go y'....(map (h y) xs)... + in ... +Here we woud like to fuse the map with the [x..]. + +See Trac #7206. +-} + ---------------------------------------------- -- map ---------------------------------------------- From git at git.haskell.org Fri Mar 17 08:29:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Mar 2017 08:29:52 +0000 (UTC) Subject: [commit: ghc] master: GHC.Word: Move Read instances to GHC.Read (bc21ea0) Message-ID: <20170317082952.B4BB03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bc21ea0ac849916bd444a1d935d44a110b815e00/ghc >--------------------------------------------------------------- commit bc21ea0ac849916bd444a1d935d44a110b815e00 Author: Erik de Castro Lopo Date: Fri Mar 17 17:47:33 2017 +1100 GHC.Word: Move Read instances to GHC.Read Test Plan: Validate Reviewers: hvr, austin, bgamari Reviewed By: hvr Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3353 >--------------------------------------------------------------- bc21ea0ac849916bd444a1d935d44a110b815e00 libraries/base/Data/Word.hs | 1 + libraries/base/GHC/Read.hs | 25 ++++++++++++++++++++++++- libraries/base/GHC/Word.hs | 21 --------------------- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/libraries/base/Data/Word.hs b/libraries/base/Data/Word.hs index f20844f..b341f9c 100644 --- a/libraries/base/Data/Word.hs +++ b/libraries/base/Data/Word.hs @@ -31,6 +31,7 @@ module Data.Word ) where import GHC.Word +import GHC.Read () -- Need the `Read` instance for types defined in `GHC.Word`. {- $notes diff --git a/libraries/base/GHC/Read.hs b/libraries/base/GHC/Read.hs index ad505bb..49c0606 100644 --- a/libraries/base/GHC/Read.hs +++ b/libraries/base/GHC/Read.hs @@ -1,5 +1,5 @@ {-# LANGUAGE Trustworthy #-} -{-# LANGUAGE NoImplicitPrelude, StandaloneDeriving, ScopedTypeVariables #-} +{-# LANGUAGE CPP, NoImplicitPrelude, StandaloneDeriving, ScopedTypeVariables #-} {-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- @@ -42,6 +42,8 @@ module GHC.Read ) where +#include "MachDeps.h" + import qualified Text.ParserCombinators.ReadP as P import Text.ParserCombinators.ReadP @@ -66,6 +68,7 @@ import GHC.Float import GHC.Show import GHC.Base import GHC.Arr +import GHC.Word -- | @'readParen' 'True' p@ parses what @p@ parses, but surrounded with @@ -521,6 +524,26 @@ instance Read Word where readsPrec p s = [(fromInteger x, r) | (x, r) <- readsPrec p s] -- | @since 2.01 +instance Read Word8 where + readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s] + +-- | @since 2.01 +instance Read Word16 where + readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s] + +-- | @since 2.01 +instance Read Word32 where +#if WORD_SIZE_IN_BITS < 33 + readsPrec p s = [(fromInteger x, r) | (x, r) <- readsPrec p s] +#else + readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s] +#endif + +-- | @since 2.01 +instance Read Word64 where + readsPrec p s = [(fromInteger x, r) | (x, r) <- readsPrec p s] + +-- | @since 2.01 instance Read Integer where readPrec = readNumber convertInt readListPrec = readListPrecDefault diff --git a/libraries/base/GHC/Word.hs b/libraries/base/GHC/Word.hs index d4a5536..1df9d14 100644 --- a/libraries/base/GHC/Word.hs +++ b/libraries/base/GHC/Word.hs @@ -51,7 +51,6 @@ import GHC.Base import GHC.Enum import GHC.Num import GHC.Real -import GHC.Read import GHC.Arr import GHC.Show @@ -165,10 +164,6 @@ instance Ix Word8 where inRange (m,n) i = m <= i && i <= n -- | @since 2.01 -instance Read Word8 where - readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s] - --- | @since 2.01 instance Bits Word8 where {-# INLINE shift #-} {-# INLINE bit #-} @@ -353,10 +348,6 @@ instance Ix Word16 where inRange (m,n) i = m <= i && i <= n -- | @since 2.01 -instance Read Word16 where - readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s] - --- | @since 2.01 instance Bits Word16 where {-# INLINE shift #-} {-# INLINE bit #-} @@ -657,14 +648,6 @@ instance Ix Word32 where unsafeIndex (m,_) i = fromIntegral (i - m) inRange (m,n) i = m <= i && i <= n --- | @since 2.01 -instance Read Word32 where -#if WORD_SIZE_IN_BITS < 33 - readsPrec p s = [(fromInteger x, r) | (x, r) <- readsPrec p s] -#else - readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s] -#endif - -- | Reverse order of bytes in 'Word32'. -- -- @since 4.7.0.0 @@ -979,10 +962,6 @@ instance Ix Word64 where unsafeIndex (m,_) i = fromIntegral (i - m) inRange (m,n) i = m <= i && i <= n --- | @since 2.01 -instance Read Word64 where - readsPrec p s = [(fromInteger x, r) | (x, r) <- readsPrec p s] - -- | Reverse order of bytes in 'Word64'. -- -- @since 4.7.0.0 From git at git.haskell.org Fri Mar 17 08:48:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Mar 2017 08:48:40 +0000 (UTC) Subject: [commit: ghc] master: Save renamed syntax when signature merging. (b301f78) Message-ID: <20170317084840.60B2C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b301f78eee89726248cf2d142e005c6618dc839c/ghc >--------------------------------------------------------------- commit b301f78eee89726248cf2d142e005c6618dc839c Author: Edward Z. Yang Date: Mon Mar 13 02:22:06 2017 -0700 Save renamed syntax when signature merging. Summary: This is required to make Haddock work correctly. Comes with a Haddock submodule update for better rendering. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: bgamari, austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3335 >--------------------------------------------------------------- b301f78eee89726248cf2d142e005c6618dc839c compiler/typecheck/TcBackpack.hs | 32 ++++++++++++++++++++++ .../tests/backpack/should_fail/bkpfail35.stderr | 4 --- utils/haddock | 2 +- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/compiler/typecheck/TcBackpack.hs b/compiler/typecheck/TcBackpack.hs index 2b4b05c..6944286 100644 --- a/compiler/typecheck/TcBackpack.hs +++ b/compiler/typecheck/TcBackpack.hs @@ -495,7 +495,33 @@ mergeSignatures -- Note [Blank hsigs for all requirements] hsc_env <- getTopEnv dflags <- getDynFlags + + -- Copy over some things from the original TcGblEnv that + -- we want to preserve + updGblEnv (\env -> env { + -- Renamed imports/declarations are often used + -- by programs that use the GHC API, e.g., Haddock. + -- These won't get filled by the merging process (since + -- we don't actually rename the parsed module again) so + -- we need to take them directly from the previous + -- typechecking. + -- + -- NB: the export declarations aren't in their final + -- form yet. We'll fill those in when we reprocess + -- the export declarations. + tcg_rn_imports = tcg_rn_imports orig_tcg_env, + tcg_rn_decls = tcg_rn_decls orig_tcg_env, + -- Annotations + tcg_ann_env = tcg_ann_env orig_tcg_env, + -- Documentation header + tcg_doc_hdr = tcg_doc_hdr orig_tcg_env + -- tcg_dus? + -- tcg_th_used = tcg_th_used orig_tcg_env, + -- tcg_th_splice_used = tcg_th_splice_used orig_tcg_env + -- tcg_th_top_level_locs = tcg_th_top_level_locs orig_tcg_env + }) $ do tcg_env <- getGblEnv + let outer_mod = tcg_mod tcg_env inner_mod = tcg_semantic_mod tcg_env mod_name = moduleName (tcg_mod tcg_env) @@ -608,6 +634,7 @@ mergeSignatures (mb_lies, _) <- exports_from_avail mb_exports rdr_env (tcg_imports tcg_env) (tcg_semantic_mod tcg_env) + {- -- NB: This is commented out, because warns above is disabled. -- If you tried to explicitly export an identifier that has a warning -- attached to it, that's probably a mistake. Warn about it. case mb_lies of @@ -620,9 +647,14 @@ mergeSignatures text "Exported identifier" <+> quotes (ppr n) <+> text "will cause warnings if used.", parens (text "To suppress this warning, remove" <+> quotes (ppr n) <+> text "from the export list of this signature.") ] + -} failIfErrsM + -- Save the exports + setGblEnv tcg_env { tcg_rn_exports = mb_lies } $ do + tcg_env <- getGblEnv + -- STEP 4: Rename the interfaces ext_ifaces <- forM thinned_ifaces $ \((IndefModule iuid _), ireq_iface) -> tcRnModIface (indefUnitIdInsts iuid) (Just nsubst) ireq_iface diff --git a/testsuite/tests/backpack/should_fail/bkpfail35.stderr b/testsuite/tests/backpack/should_fail/bkpfail35.stderr index 6b21317..cbb2152 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail35.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail35.stderr @@ -3,10 +3,6 @@ [2 of 2] Compiling B ( p/B.hs, nothing ) [2 of 4] Processing q [1 of 1] Compiling A[sig] ( q/A.hsig, nothing ) - -bkpfail35.bkp:8:18: warning: - Exported identifier ‘x’ will cause warnings if used. - (To suppress this warning, remove ‘x’ from the export list of this signature.) [3 of 4] Processing aimpl Instantiating aimpl [1 of 1] Compiling A ( aimpl/A.hs, bkpfail35.out/aimpl/A.o ) diff --git a/utils/haddock b/utils/haddock index af9c09f..bf3c4d7 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit af9c09feac6fbecc50140f3aac1bb58888addc63 +Subproject commit bf3c4d72a0fda38561376eac7eda216158783267 From git at git.haskell.org Fri Mar 17 08:48:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Mar 2017 08:48:43 +0000 (UTC) Subject: [commit: ghc] master: GHC_STAGE1 isn't defined, use other form. (138434f) Message-ID: <20170317084843.167D93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/138434fbef32ec86733747bdbc57f6da73cad500/ghc >--------------------------------------------------------------- commit 138434fbef32ec86733747bdbc57f6da73cad500 Author: Edward Z. Yang Date: Fri Mar 10 14:33:39 2017 -0800 GHC_STAGE1 isn't defined, use other form. Summary: I don't really know why this stopped working for me, but it did on a recent clean. I don't know if this is right but it solved the problem for me. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: bgamari, austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3318 >--------------------------------------------------------------- 138434fbef32ec86733747bdbc57f6da73cad500 testsuite/timeout/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/timeout/Makefile b/testsuite/timeout/Makefile index b910a73..9626eae 100644 --- a/testsuite/timeout/Makefile +++ b/testsuite/timeout/Makefile @@ -51,7 +51,7 @@ boot all :: calibrate.out $(TIMEOUT_PROGRAM) calibrate.out: $(RM) -f TimeMe.o TimeMe.hi TimeMe TimeMe.exe - $(PYTHON) calibrate '$(GHC_STAGE1)' > $@ + $(PYTHON) calibrate '$(STAGE1_GHC)' > $@ # We use stage 1 to do the calibration, as stage 2 may not exist. # This isn't necessarily the compiler we'll be running the testsuite # with, but it's really the performance of the machine that we're From git at git.haskell.org Fri Mar 17 10:25:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Mar 2017 10:25:15 +0000 (UTC) Subject: [commit: ghc] master: Typos in manual and comments [ci skip] (7a38783) Message-ID: <20170317102515.3B0EF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7a38783b72f86afda14ada2155e63491ced2e7de/ghc >--------------------------------------------------------------- commit 7a38783b72f86afda14ada2155e63491ced2e7de Author: Gabor Greif Date: Fri Mar 17 10:20:42 2017 +0100 Typos in manual and comments [ci skip] >--------------------------------------------------------------- 7a38783b72f86afda14ada2155e63491ced2e7de compiler/coreSyn/CoreSubst.hs | 4 ++-- compiler/simplCore/SimplEnv.hs | 2 +- compiler/typecheck/TcGenFunctor.hs | 2 +- compiler/vectorise/Vectorise/Utils/Base.hs | 4 ++-- docs/users_guide/glasgow_exts.rst | 2 +- rts/Adjustor.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/coreSyn/CoreSubst.hs b/compiler/coreSyn/CoreSubst.hs index 590d870..f2485f3 100644 --- a/compiler/coreSyn/CoreSubst.hs +++ b/compiler/coreSyn/CoreSubst.hs @@ -1188,7 +1188,7 @@ simple_out_bind_pair env in_bndr mb_out_bndr out_rhs {- Note [Exported Ids and trivial RHSs] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -We obviously do no want to unconditinally inline an Id that is exported. +We obviously do not want to unconditionally inline an Id that is exported. In SimplUtils, Note [Top level and postInlineUnconditionally], we explain why we don't inline /any/ top-level things unconditionally, even trivial ones. But we do here! Why? In the simple optimiser @@ -1197,7 +1197,7 @@ trivial ones. But we do here! Why? In the simple optimiser * We do no call-site inlining Those differences obviate the reasons for not inlining a trivial rhs, -and increase the benefit for doing so. So we unconditaionlly inline trivial +and increase the benefit for doing so. So we unconditionally inline trivial rhss here. -} diff --git a/compiler/simplCore/SimplEnv.hs b/compiler/simplCore/SimplEnv.hs index 1379646..a1a973e 100644 --- a/compiler/simplCore/SimplEnv.hs +++ b/compiler/simplCore/SimplEnv.hs @@ -249,7 +249,7 @@ occurrences of 'wild-id' (with wildCardKey). The easy way to do that is to start of with a representative Id in the in-scope set -There can be be *occurrences* of wild-id. For example, +There can be *occurrences* of wild-id. For example, MkCore.mkCoreApp transforms e (a /# b) --> case (a /# b) of wild { DEFAULT -> e wild } This is ok provided 'wild' isn't free in 'e', and that's the delicate diff --git a/compiler/typecheck/TcGenFunctor.hs b/compiler/typecheck/TcGenFunctor.hs index 49129bf..e7bf394 100644 --- a/compiler/typecheck/TcGenFunctor.hs +++ b/compiler/typecheck/TcGenFunctor.hs @@ -860,7 +860,7 @@ constructor has the same type as the last type parameter: Only E1's argument is an occurrence of a universally quantified type variable that is syntactically equivalent to the last type parameter, so only E1's -argument will be be folded over in a derived Foldable instance. +argument will be folded over in a derived Foldable instance. See Trac #10447 for the original discussion on this feature. Also see https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/DeriveFunctor diff --git a/compiler/vectorise/Vectorise/Utils/Base.hs b/compiler/vectorise/Vectorise/Utils/Base.hs index 071fab9..4227109 100644 --- a/compiler/vectorise/Vectorise/Utils/Base.hs +++ b/compiler/vectorise/Vectorise/Utils/Base.hs @@ -222,7 +222,7 @@ pdataReprTyCon ty -- pdataReprTyConExact :: TyCon -> VM TyCon pdataReprTyConExact tycon - = do { -- look up the representation tycon; if there is a match at all, it will be be exact + = do { -- look up the representation tycon; if there is a match at all, it will be exact ; -- (i.e.,' _tys' will be distinct type variables) ; (ptycon, _tys) <- pdataReprTyCon (tycon `mkTyConApp` mkTyVarTys (tyConTyVars tycon)) ; return ptycon @@ -235,7 +235,7 @@ pdataReprTyConExact tycon -- pdatasReprTyConExact :: TyCon -> VM TyCon pdatasReprTyConExact tycon - = do { -- look up the representation tycon; if there is a match at all, it will be be exact + = do { -- look up the representation tycon; if there is a match at all, it will be exact ; (FamInstMatch { fim_instance = ptycon }) <- pdatasReprTyCon (tycon `mkTyConApp` mkTyVarTys (tyConTyVars tycon)) ; return $ dataFamInstRepTyCon ptycon } diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 0e8e956..8893a23 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -6309,7 +6309,7 @@ Overloaded lists ``IsList`` class). GHC supports *overloading of the list notation*. Let us recap the -notation for constructing lists. In Haskell, the list notation can be be +notation for constructing lists. In Haskell, the list notation can be used in the following seven ways: :: diff --git a/rts/Adjustor.c b/rts/Adjustor.c index 9f5a000..c7dcc8c 100644 --- a/rts/Adjustor.c +++ b/rts/Adjustor.c @@ -718,7 +718,7 @@ createAdjustor(int cconv, StgStablePtr hptr, To do this, we extend the *caller's* stack frame by 2 words and shift the output registers used for argument passing (%o0 - %o5, we are a *leaf* procedure because of the tail-jump) by 2 positions. This makes room in - %o0 and %o1 for the additinal arguments, namely hptr and a dummy (used + %o0 and %o1 for the additional arguments, namely hptr and a dummy (used for destination addr of jump on SPARC, return address on x86, ...). This shouldn't cause any problems for a C-like caller: alloca is implemented similarly, and local variables should be accessed via %fp, not %sp. In a From git at git.haskell.org Fri Mar 17 15:24:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Mar 2017 15:24:09 +0000 (UTC) Subject: [commit: ghc] master: Fix #12709 by not building bad applications (dca44ad) Message-ID: <20170317152409.BD83D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dca44adb9e14992e0aed49cdfd4b2baa2182073b/ghc >--------------------------------------------------------------- commit dca44adb9e14992e0aed49cdfd4b2baa2182073b Author: Richard Eisenberg Date: Thu Mar 16 10:34:29 2017 -0400 Fix #12709 by not building bad applications In an effort to report multiple levity polymorphism errors all at once, the desugarer does not fail when encountering bad levity polymorphism. But we must be careful not to build the bad applications, lest they try to satisfy the let/app invariant and call isUnliftedType on a levity polymorphic type. This protects calls to mkCoreAppDs appropriately. test case: typecheck/should_fail/T12709 >--------------------------------------------------------------- dca44adb9e14992e0aed49cdfd4b2baa2182073b compiler/coreSyn/MkCore.hs | 5 +++- compiler/deSugar/DsBinds.hs | 6 +++-- compiler/deSugar/DsExpr.hs | 24 +++++++++++------- compiler/deSugar/DsMonad.hs | 20 ++++++++++++--- compiler/deSugar/DsUtils.hs | 2 ++ testsuite/tests/typecheck/should_fail/T12709.hs | 29 ++++++++++++++++++++++ .../tests/typecheck/should_fail/T12709.stderr | 24 ++++++++++++++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 8 files changed, 96 insertions(+), 15 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 dca44adb9e14992e0aed49cdfd4b2baa2182073b From git at git.haskell.org Fri Mar 17 15:24:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Mar 2017 15:24:13 +0000 (UTC) Subject: [commit: ghc] master: Fix #13202 by failing more eagerly in tcRnStmt (fa13c13) Message-ID: <20170317152413.76A713A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fa13c136e6e666b9a1393c1c0041020ad842c069/ghc >--------------------------------------------------------------- commit fa13c136e6e666b9a1393c1c0041020ad842c069 Author: Richard Eisenberg Date: Thu Mar 16 11:38:05 2017 -0400 Fix #13202 by failing more eagerly in tcRnStmt test cases: ghci/scripts/T13202{,a} >--------------------------------------------------------------- fa13c136e6e666b9a1393c1c0041020ad842c069 compiler/typecheck/TcRnDriver.hs | 3 +++ testsuite/tests/ghci/scripts/T13202.script | 6 ++++++ testsuite/tests/ghci/scripts/T13202.stderr | 8 ++++++++ testsuite/tests/ghci/scripts/T13202a.script | 3 +++ testsuite/tests/ghci/scripts/T13202a.stderr | 6 ++++++ testsuite/tests/ghci/scripts/all.T | 2 ++ 6 files changed, 28 insertions(+) diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index cdf3278..b02fdf5 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -1877,6 +1877,9 @@ tcRnStmt hsc_env rdr_stmt zonked_expr <- zonkTopLExpr tc_expr ; zonked_ids <- zonkTopBndrs bound_ids ; + failIfErrsM ; -- we can't do the next step if there are levity polymorphism errors + -- test case: ghci/scripts/T13202{,a} + -- None of the Ids should be of unboxed type, because we -- cast them all to HValues in the end! mapM_ bad_unboxed (filter (isUnliftedType . idType) zonked_ids) ; diff --git a/testsuite/tests/ghci/scripts/T13202.script b/testsuite/tests/ghci/scripts/T13202.script new file mode 100644 index 0000000..5da0a32 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13202.script @@ -0,0 +1,6 @@ +import GHC.Exts +:set -XTypeApplications -XMagicHash -XTypeInType +data TypeRep (a :: k) = TypeRep +let typeRepKind = undefined :: TypeRep (a :: k) -> TypeRep k +let typeRep = undefined :: TypeRep (a :: k) +let x = typeRepKind (typeRep @(Maybe Int#)) diff --git a/testsuite/tests/ghci/scripts/T13202.stderr b/testsuite/tests/ghci/scripts/T13202.stderr new file mode 100644 index 0000000..33c1945 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13202.stderr @@ -0,0 +1,8 @@ + +:6:22: error: + • Cannot apply expression of type ‘TypeRep a0’ + to a visible type argument ‘(Maybe Int#)’ + • In the first argument of ‘typeRepKind’, namely + ‘(typeRep @(Maybe Int#))’ + In the expression: typeRepKind (typeRep @(Maybe Int#)) + In an equation for ‘x’: x = typeRepKind (typeRep @(Maybe Int#)) diff --git a/testsuite/tests/ghci/scripts/T13202a.script b/testsuite/tests/ghci/scripts/T13202a.script new file mode 100644 index 0000000..107d332 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13202a.script @@ -0,0 +1,3 @@ +import GHC.Records +:set -XTypeApplications -XDataKinds +let foo = getField @"name" diff --git a/testsuite/tests/ghci/scripts/T13202a.stderr b/testsuite/tests/ghci/scripts/T13202a.stderr new file mode 100644 index 0000000..93bc2bb --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13202a.stderr @@ -0,0 +1,6 @@ + +:3:5: error: + • Non type-variable argument in the constraint: HasField "name" r a + (Use FlexibleContexts to permit this) + • When checking the inferred type + foo :: forall r a. HasField "name" r a => r -> a diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 7f03cf8..20bc5ae 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -248,3 +248,5 @@ test('T12447', expect_broken(12447), ghci_script, ['T12447.script']) test('T10249', normal, ghci_script, ['T10249.script']) test('T12550', normal, ghci_script, ['T12550.script']) test('StaticPtr', normal, ghci_script, ['StaticPtr.script']) +test('T13202', normal, ghci_script, ['T13202.script']) +test('T13202a', normal, ghci_script, ['T13202a.script']) From git at git.haskell.org Fri Mar 17 15:24:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Mar 2017 15:24:16 +0000 (UTC) Subject: [commit: ghc] master: Comment coercion flattening [skip ci] (4dc9930) Message-ID: <20170317152416.36A763A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4dc993008a66d6a54909da462363a25e8449f000/ghc >--------------------------------------------------------------- commit 4dc993008a66d6a54909da462363a25e8449f000 Author: Richard Eisenberg Date: Fri Mar 3 14:23:24 2017 -0500 Comment coercion flattening [skip ci] >--------------------------------------------------------------- 4dc993008a66d6a54909da462363a25e8449f000 compiler/typecheck/TcFlatten.hs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcFlatten.hs b/compiler/typecheck/TcFlatten.hs index 700412b..933bacc 100644 --- a/compiler/typecheck/TcFlatten.hs +++ b/compiler/typecheck/TcFlatten.hs @@ -951,7 +951,7 @@ flatten_one (CastTy ty g) flatten_one (CoercionTy co) = first mkCoercionTy <$> flatten_co co -- | "Flatten" a coercion. Really, just flatten the types that it coerces --- between and then use transitivity. +-- between and then use transitivity. See Note [Flattening coercions] flatten_co :: Coercion -> FlatM (Coercion, Coercion) flatten_co co = do { let (Pair ty1 ty2, role) = coercionKindRole co @@ -980,6 +980,31 @@ flatten_ty_con_app tc tys ; return (mkTyConApp tc xis, mkTyConAppCo role tc cos) } {- +Note [Flattening coercions] +~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Because a flattened type has a flattened kind, we also must "flatten" +coercions as we walk through a type. Otherwise, the "from" type of +the coercion might not match the (now flattened) kind of the type +that it's casting. flatten_co does the work, taking a coercion of +type (ty1 ~ ty2) and flattening it to have type (fty1 ~ fty2), +where flatten(ty1) = fty1 and flatten(ty2) = fty2. + +In other words: + + If r1 is a role + co :: s ~r1 t + flatten_co co = (fco, kco) + r2 is the role in the FlatM + + then + fco :: fs ~r1 ft + fs, ft are flattened types + kco :: (fs ~r1 ft) ~r2 (s ~r1 t) + +The second return value of flatten_co is always a ProofIrrelCo. As +such, it doesn't contain any information the caller doesn't have and +might not be necessary in whatever comes next. + Note [Flattening synonyms] ~~~~~~~~~~~~~~~~~~~~~~~~~~ Not expanding synonyms aggressively improves error messages, and From git at git.haskell.org Fri Mar 17 15:24:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Mar 2017 15:24:19 +0000 (UTC) Subject: [commit: ghc] master: Remove solveSomeEqualities (3cfee57) Message-ID: <20170317152419.0A45A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3cfee57abf00f794e7962e2a60efd9d7d8baf06f/ghc >--------------------------------------------------------------- commit 3cfee57abf00f794e7962e2a60efd9d7d8baf06f Author: Richard Eisenberg Date: Thu Mar 16 15:56:37 2017 -0400 Remove solveSomeEqualities I had thought that it was necessary to solve kind-level equalities before validity-checking a type, but I was wrong. This patch simply deletes code. Hooray! >--------------------------------------------------------------- 3cfee57abf00f794e7962e2a60efd9d7d8baf06f compiler/typecheck/TcHsType.hs | 41 +++----------- compiler/typecheck/TcSimplify.hs | 62 +--------------------- .../tests/partial-sigs/should_fail/T11976.stderr | 7 --- 3 files changed, 8 insertions(+), 102 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 3cfee57abf00f794e7962e2a60efd9d7d8baf06f From git at git.haskell.org Fri Mar 17 15:24:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Mar 2017 15:24:22 +0000 (UTC) Subject: [commit: ghc] master: Test #13435 in typecheck/should_run/T13435 (66d174a) Message-ID: <20170317152422.7E1073A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/66d174a9650c3099e2e694f71b43c2dac89b21b1/ghc >--------------------------------------------------------------- commit 66d174a9650c3099e2e694f71b43c2dac89b21b1 Author: Richard Eisenberg Date: Fri Mar 17 11:22:19 2017 -0400 Test #13435 in typecheck/should_run/T13435 >--------------------------------------------------------------- 66d174a9650c3099e2e694f71b43c2dac89b21b1 testsuite/tests/typecheck/should_run/T13435.hs | 14 ++++++++++++++ testsuite/tests/typecheck/should_run/T13435.stdout | 1 + testsuite/tests/typecheck/should_run/all.T | 1 + 3 files changed, 16 insertions(+) diff --git a/testsuite/tests/typecheck/should_run/T13435.hs b/testsuite/tests/typecheck/should_run/T13435.hs new file mode 100644 index 0000000..95ee946 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T13435.hs @@ -0,0 +1,14 @@ +{-# Language FlexibleInstances, TypeFamilies, TypeInType, MagicHash #-} + +module Main where + +import Data.Kind +import GHC.Exts + +class Shw (a :: TYPE rep) where + shw :: a -> String + +instance Int# ~ a => Shw (a :: TYPE IntRep) where + shw a = "I#" ++ show (I# a) + +main = putStrLn (shw 3#) diff --git a/testsuite/tests/typecheck/should_run/T13435.stdout b/testsuite/tests/typecheck/should_run/T13435.stdout new file mode 100644 index 0000000..ae451c2 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T13435.stdout @@ -0,0 +1 @@ +I#3 diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index 61db61e..60b5fae 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -120,3 +120,4 @@ test('EtaExpandLevPoly', normal, compile_and_run, ['']) test('TestTypeableBinary', normal, compile_and_run, ['']) test('Typeable1', normal, compile_fail, ['']) test('TypeableEq', normal, compile_and_run, ['']) +test('T13435', normal, compile_and_run, ['']) From git at git.haskell.org Fri Mar 17 15:24:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Mar 2017 15:24:25 +0000 (UTC) Subject: [commit: ghc] master: Fix #13343 by not defaulting SigTvs (02cc8f0) Message-ID: <20170317152425.D5E173A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/02cc8f0c423e85033bdfd26f1492301b724930d8/ghc >--------------------------------------------------------------- commit 02cc8f0c423e85033bdfd26f1492301b724930d8 Author: Richard Eisenberg Date: Thu Mar 16 11:59:45 2017 -0400 Fix #13343 by not defaulting SigTvs test case: typecheck/should_compile/T13343 >--------------------------------------------------------------- 02cc8f0c423e85033bdfd26f1492301b724930d8 compiler/typecheck/TcMType.hs | 23 ++++++++++++++-------- testsuite/tests/typecheck/should_compile/T13343.hs | 7 +++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index 2abc800..decb6cb 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -998,31 +998,38 @@ zonkQuantifiedTyVar :: Bool -- True <=> this is a kind var and -XNoPolyKind zonkQuantifiedTyVar default_kind tv = case tcTyVarDetails tv of - SkolemTv {} -> do { kind <- zonkTcType (tyVarKind tv) - ; return $ Just (setTyVarKind tv kind) } + SkolemTv {} -> zonk_kind_and_return -- It might be a skolem type variable, -- for example from a user type signature - MetaTv { mtv_ref = ref } + MetaTv { mtv_ref = ref, mtv_info = info } -> do { when debugIsOn (check_empty ref) - ; zonk_meta_tv tv } + ; zonk_meta_tv info tv } _other -> pprPanic "zonkQuantifiedTyVar" (ppr tv) -- FlatSkol, RuntimeUnk where - zonk_meta_tv :: TcTyVar -> TcM (Maybe TcTyVar) - zonk_meta_tv tv - | isRuntimeRepVar tv -- Never quantify over a RuntimeRep var + zonk_kind_and_return = do { kind <- zonkTcType (tyVarKind tv) + ; return $ Just (setTyVarKind tv kind) } + + zonk_meta_tv :: MetaInfo -> TcTyVar -> TcM (Maybe TcTyVar) + zonk_meta_tv info tv + | isRuntimeRepVar tv && not_sig_tv -- Never quantify over a RuntimeRep var = do { writeMetaTyVar tv liftedRepTy ; return Nothing } - | default_kind -- -XNoPolyKinds and this is a kind var + | default_kind && not_sig_tv -- -XNoPolyKinds and this is a kind var = do { _ <- default_kind_var tv ; return Nothing } | otherwise = do { tv' <- skolemiseUnboundMetaTyVar tv ; return (Just tv') } + where + -- do not default SigTvs. This would violate the invariants on SigTvs + not_sig_tv = case info of SigTv -> False + _ -> True + default_kind_var :: TyVar -> TcM Type -- defaultKindVar is used exclusively with -XNoPolyKinds diff --git a/testsuite/tests/typecheck/should_compile/T13343.hs b/testsuite/tests/typecheck/should_compile/T13343.hs new file mode 100644 index 0000000..ab259e3 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T13343.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE TypeInType #-} +module Bug where + +import GHC.Exts + +type Bad = forall (v1 :: RuntimeRep) (a1 :: TYPE v). a1 diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index d2dd684..9caaf25 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -545,3 +545,4 @@ test('T12924', normal, compile, ['']) test('T12926', normal, compile, ['']) test('T13381', normal, compile_fail, ['']) test('T13337', normal, compile, ['']) +test('T13343', normal, compile, ['']) From git at git.haskell.org Fri Mar 17 17:47:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Mar 2017 17:47:49 +0000 (UTC) Subject: [commit: ghc] master: Improve Lint a little (567bc6b) Message-ID: <20170317174749.561EB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/567bc6bd194836233ce1576acd7a62b1867f6607/ghc >--------------------------------------------------------------- commit 567bc6bd194836233ce1576acd7a62b1867f6607 Author: Simon Peyton Jones Date: Fri Mar 17 08:54:39 2017 +0000 Improve Lint a little Better location info if the error is in an unfolding >--------------------------------------------------------------- 567bc6bd194836233ce1576acd7a62b1867f6607 compiler/coreSyn/CoreLint.hs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index 40386e4..0363d6b 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -582,7 +582,9 @@ lintSingleBinding top_lvl_flag rec_flag (binder,rhs) _ -> return () ; mapM_ (lintCoreRule binder binder_ty) (idCoreRules binder) - ; lintIdUnfolding binder binder_ty (idUnfolding binder) } + + ; addLoc (UnfoldingOf binder) $ + lintIdUnfolding binder binder_ty (idUnfolding binder) } -- We should check the unfolding, if any, but this is tricky because -- the unfolding is a SimplifiableCoreExpr. Give up for now. @@ -611,7 +613,7 @@ lintRhs bndr rhs ; return $ mkLamType var' body_ty } lint_join_lams n tot True _other - = failWithL $ mkBadJoinArityMsg bndr tot (tot-n) + = failWithL $ mkBadJoinArityMsg bndr tot (tot-n) rhs lint_join_lams _ _ False rhs = markAllJoinsBad $ lintCoreExpr rhs -- Future join point, not yet eta-expanded @@ -1940,6 +1942,7 @@ instance HasDynFlags LintM where data LintLocInfo = RhsOf Id -- The variable bound | LambdaBodyOf Id -- The lambda-binder + | UnfoldingOf Id -- Unfolding of a binder | BodyOfLetRec [Id] -- One of the binders | CaseAlt CoreAlt -- Case alternative | CasePat CoreAlt -- The *pattern* of the case alternative @@ -2127,6 +2130,9 @@ dumpLoc (RhsOf v) dumpLoc (LambdaBodyOf b) = (getSrcLoc b, brackets (text "in body of lambda with binder" <+> pp_binder b)) +dumpLoc (UnfoldingOf b) + = (getSrcLoc b, brackets (text "in the unfolding of" <+> pp_binder b)) + dumpLoc (BodyOfLetRec []) = (noSrcLoc, brackets (text "In body of a letrec with no binders")) @@ -2353,12 +2359,14 @@ mkInvalidJoinPointMsg var ty = hang (text "Join point has invalid type:") 2 (ppr var <+> dcolon <+> ppr ty) -mkBadJoinArityMsg :: Var -> Int -> Int -> SDoc -mkBadJoinArityMsg var ar nlams +mkBadJoinArityMsg :: Var -> Int -> Int -> CoreExpr -> SDoc +mkBadJoinArityMsg var ar nlams rhs = vcat [ text "Join point has too few lambdas", text "Join var:" <+> ppr var, text "Join arity:" <+> ppr ar, - text "Number of lambdas:" <+> ppr nlams ] + text "Number of lambdas:" <+> ppr nlams, + text "Rhs = " <+> ppr rhs + ] invalidJoinOcc :: Var -> SDoc invalidJoinOcc var From git at git.haskell.org Fri Mar 17 17:47:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Mar 2017 17:47:53 +0000 (UTC) Subject: [commit: ghc] master: No join-point from an INLINE function with wrong arity (a7dbafe) Message-ID: <20170317174753.84A3F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a7dbafe9292212f3cbc21be42eb326ab0701db7e/ghc >--------------------------------------------------------------- commit a7dbafe9292212f3cbc21be42eb326ab0701db7e Author: Simon Peyton Jones Date: Fri Mar 17 16:25:41 2017 +0000 No join-point from an INLINE function with wrong arity The main payload of this patch is NOT to make a join-point from a function with an INLINE pragma and the wrong arity; see Note [Join points and INLINE pragmas] in CoreOpt. This is what caused Trac #13413. But we must do the exact same thing in simpleOptExpr, which drove me to the following refactoring: * Move simpleOptExpr and simpleOptPgm from CoreSubst to a new module CoreOpt along with a few others (exprIsConApp_maybe, pushCoArg, etc) This eliminates a module loop altogether (delete CoreArity.hs-boot), and stops CoreSubst getting too huge. * Rename Simplify.matchOrConvertToJoinPoint to joinPointBinding_maybe Move it to the new CoreOpt Use it in simpleOptExpr as well as in Simplify * Define CoreArity.joinRhsArity and use it >--------------------------------------------------------------- a7dbafe9292212f3cbc21be42eb326ab0701db7e compiler/coreSyn/CoreArity.hs | 13 +- compiler/coreSyn/CoreArity.hs-boot | 6 - compiler/coreSyn/{CoreSubst.hs => CoreOpt.hs} | 900 +++------------- compiler/coreSyn/CoreSubst.hs | 1084 +------------------- compiler/coreSyn/CoreSyn.hs | 5 + compiler/coreSyn/CoreUnfold.hs | 2 +- compiler/deSugar/Desugar.hs | 4 +- compiler/deSugar/DsBinds.hs | 2 +- compiler/ghc.cabal.in | 1 + compiler/ghc.mk | 1 + compiler/main/GhcPlugins.hs | 3 +- compiler/prelude/PrelRules.hs | 2 +- compiler/simplCore/Simplify.hs | 30 +- compiler/specialise/Rules.hs | 1 + compiler/specialise/Specialise.hs | 3 +- testsuite/tests/simplCore/should_compile/T13413.hs | 19 + testsuite/tests/simplCore/should_compile/all.T | 1 + 17 files changed, 173 insertions(+), 1904 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 a7dbafe9292212f3cbc21be42eb326ab0701db7e From git at git.haskell.org Sat Mar 18 02:35:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Mar 2017 02:35:14 +0000 (UTC) Subject: [commit: ghc] master: Revert "GHC_STAGE1 isn't defined, use other form." (ad19104) Message-ID: <20170318023514.DD2543A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ad191042896ca0b31277e5192ef4acec63bc176a/ghc >--------------------------------------------------------------- commit ad191042896ca0b31277e5192ef4acec63bc176a Author: Edward Z. Yang Date: Fri Mar 17 19:33:53 2017 -0700 Revert "GHC_STAGE1 isn't defined, use other form." This reverts commit 138434fbef32ec86733747bdbc57f6da73cad500. >--------------------------------------------------------------- ad191042896ca0b31277e5192ef4acec63bc176a testsuite/timeout/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/timeout/Makefile b/testsuite/timeout/Makefile index 9626eae..b910a73 100644 --- a/testsuite/timeout/Makefile +++ b/testsuite/timeout/Makefile @@ -51,7 +51,7 @@ boot all :: calibrate.out $(TIMEOUT_PROGRAM) calibrate.out: $(RM) -f TimeMe.o TimeMe.hi TimeMe TimeMe.exe - $(PYTHON) calibrate '$(STAGE1_GHC)' > $@ + $(PYTHON) calibrate '$(GHC_STAGE1)' > $@ # We use stage 1 to do the calibration, as stage 2 may not exist. # This isn't necessarily the compiler we'll be running the testsuite # with, but it's really the performance of the machine that we're From git at git.haskell.org Sat Mar 18 06:57:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Mar 2017 06:57:51 +0000 (UTC) Subject: [commit: ghc] master: OccurAnal.hs: Fix "Adjusting for lambdas" note name (763f43e) Message-ID: <20170318065751.CE7C93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/763f43e6d31ade7a17bd03340ed02ddbd96fcd20/ghc >--------------------------------------------------------------- commit 763f43e6d31ade7a17bd03340ed02ddbd96fcd20 Author: Ömer Sinan Ağacan Date: Sat Mar 18 09:56:37 2017 +0300 OccurAnal.hs: Fix "Adjusting for lambdas" note name >--------------------------------------------------------------- 763f43e6d31ade7a17bd03340ed02ddbd96fcd20 compiler/simplCore/OccurAnal.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index c828249..baa5c24 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -732,8 +732,8 @@ It's not clear that this comes up often, however. TODO: Measure how often and add this analysis if necessary. ------------------------------------------------------------ -Note [Adjusting for lambdas] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Note [Adjusting right-hand sides] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There's a bit of a dance we need to do after analysing a lambda expression or a right-hand side. In particular, we need to From git at git.haskell.org Sun Mar 19 05:29:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 19 Mar 2017 05:29:15 +0000 (UTC) Subject: [commit: ghc] master: OccurAnal.hs: Add an assert for an invariant (e0f1054) Message-ID: <20170319052915.3C0473A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e0f1054ba3f27de9dcffdb9b493c88c265cba6d7/ghc >--------------------------------------------------------------- commit e0f1054ba3f27de9dcffdb9b493c88c265cba6d7 Author: Ömer Sinan Ağacan Date: Sun Mar 19 08:28:37 2017 +0300 OccurAnal.hs: Add an assert for an invariant Reviewers: austin, bgamari, dfeuer Reviewed By: bgamari, dfeuer Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3360 >--------------------------------------------------------------- e0f1054ba3f27de9dcffdb9b493c88c265cba6d7 compiler/simplCore/OccurAnal.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index baa5c24..6093f42 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -2606,7 +2606,8 @@ tagNonRecBinder lvl usage binder = let occ = lookupDetails usage binder will_be_join = decideJoinPointHood lvl usage [binder] - occ' | will_be_join = occ -- must already be marked AlwaysTailCalled + occ' | will_be_join = -- must already be marked AlwaysTailCalled + ASSERT(isAlwaysTailCalled occ) occ | otherwise = markNonTailCalled occ binder' = setBinderOcc occ' binder usage' = usage `delDetails` binder From git at git.haskell.org Sun Mar 19 18:48:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 19 Mar 2017 18:48:41 +0000 (UTC) Subject: [commit: ghc] master: Update link to paper about demand analyser in user guide (105a5f4) Message-ID: <20170319184841.2FCEA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/105a5f47e57910bef3c2e2c9637aea7a3f5d1314/ghc >--------------------------------------------------------------- commit 105a5f47e57910bef3c2e2c9637aea7a3f5d1314 Author: Matthew Pickering Date: Thu Mar 16 20:28:26 2017 -0400 Update link to paper about demand analyser in user guide Reviewers: austin, bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3354 >--------------------------------------------------------------- 105a5f47e57910bef3c2e2c9637aea7a3f5d1314 docs/users_guide/using-optimisation.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/users_guide/using-optimisation.rst b/docs/users_guide/using-optimisation.rst index e56c473..8f7d6b8 100644 --- a/docs/users_guide/using-optimisation.rst +++ b/docs/users_guide/using-optimisation.rst @@ -678,11 +678,8 @@ list. :default: on - Switch on the strictness analyser. There is a very - old paper about GHC's strictness analyser, `Measuring the - effectiveness of a simple strictness - analyser `__, - but the current one is quite a bit different. + Switch on the strictness analyser. The + implementation is described in the paper `Theory and Practice of Demand Analysis in Haskell``__. The strictness analyser figures out when arguments and variables in a function can be treated 'strictly' (that is they are always From git at git.haskell.org Sun Mar 19 18:48:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 19 Mar 2017 18:48:43 +0000 (UTC) Subject: [commit: ghc] master: users-guide: Document TemplateHaskell availability (9c04129) Message-ID: <20170319184843.E478D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9c041294e5ac7e61e5d7f4858f22bd661dad25ae/ghc >--------------------------------------------------------------- commit 9c041294e5ac7e61e5d7f4858f22bd661dad25ae Author: Ben Gamari Date: Sun Mar 19 11:26:08 2017 -0400 users-guide: Document TemplateHaskell availability >--------------------------------------------------------------- 9c041294e5ac7e61e5d7f4858f22bd661dad25ae docs/users_guide/glasgow_exts.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 8893a23..96fe958 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -10564,6 +10564,7 @@ Syntax .. ghc-flag:: -XTemplateHaskell + :since: 6.0. Typed splices introduced in GHC 7.8.1. :implies: :ghc-flag:`-XTemplateHaskellQuotes` Enable Template Haskell's splice and quotation syntax. From git at git.haskell.org Sun Mar 19 18:48:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 19 Mar 2017 18:48:46 +0000 (UTC) Subject: [commit: ghc] master: genSym: Fix DEBUG build (d744c86) Message-ID: <20170319184846.9BDA23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d744c8645e77b97122339b35c4d6c757e606c196/ghc >--------------------------------------------------------------- commit d744c8645e77b97122339b35c4d6c757e606c196 Author: Ben Gamari Date: Sat Mar 18 14:45:35 2017 -0400 genSym: Fix DEBUG build It looks like this was likely a cut-and-paste error. >--------------------------------------------------------------- d744c8645e77b97122339b35c4d6c757e606c196 compiler/cbits/genSym.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/cbits/genSym.c b/compiler/cbits/genSym.c index 725a310..4af3940 100644 --- a/compiler/cbits/genSym.c +++ b/compiler/cbits/genSym.c @@ -10,7 +10,7 @@ static HsInt GenSymInc = 1; STATIC_INLINE void checkUniqueRange(HsInt u STG_UNUSED) { #if DEBUG // Uh oh! We will overflow next time a unique is requested. - assert(h != UNIQUE_MASK); + assert(u != UNIQUE_MASK); #endif } From git at git.haskell.org Mon Mar 20 06:41:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Mar 2017 06:41:57 +0000 (UTC) Subject: [commit: ghc] master: mkUserGuidePart: Remove duplicate -XDeriveGeneric entry (bf3952e) Message-ID: <20170320064157.B38F33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bf3952ed0f3d4c3ed2ddeb4a0de1b4c16df4a250/ghc >--------------------------------------------------------------- commit bf3952ed0f3d4c3ed2ddeb4a0de1b4c16df4a250 Author: Ömer Sinan Ağacan Date: Mon Mar 20 08:49:36 2017 +0300 mkUserGuidePart: Remove duplicate -XDeriveGeneric entry >--------------------------------------------------------------- bf3952ed0f3d4c3ed2ddeb4a0de1b4c16df4a250 utils/mkUserGuidePart/Options/Language.hs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/utils/mkUserGuidePart/Options/Language.hs b/utils/mkUserGuidePart/Options/Language.hs index 11adca1..f0aeb49 100644 --- a/utils/mkUserGuidePart/Options/Language.hs +++ b/utils/mkUserGuidePart/Options/Language.hs @@ -169,13 +169,6 @@ languageOptions = , flagReverse = "-XNoDeriveGeneric" , flagSince = "7.2.1" } - , flag { flagName = "-XDeriveGeneric" - , flagDescription = - "Enable :ref:`deriving for the Generic class `." - , flagType = DynamicFlag - , flagReverse = "-XNoDeriveGeneric" - , flagSince = "7.2.1" - } , flag { flagName = "-XDeriveLift" , flagDescription = "Enable :ref:`deriving for the Lift class `" From git at git.haskell.org Mon Mar 20 09:17:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Mar 2017 09:17:23 +0000 (UTC) Subject: [commit: ghc] tag 'ghc-8.3-start' created Message-ID: <20170320091723.5CD0F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New tag : ghc-8.3-start Referencing: 87bf44c63a75f55d964ce7b9faa1a413afb711d4 From git at git.haskell.org Mon Mar 20 18:19:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Mar 2017 18:19:38 +0000 (UTC) Subject: [commit: ghc] master: Fix Windows x86 build (713ff92) Message-ID: <20170320181938.4D7673A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/713ff9207e0f2493bd498ff725012c9895f728c8/ghc >--------------------------------------------------------------- commit 713ff9207e0f2493bd498ff725012c9895f728c8 Author: Tamar Christina Date: Sat Mar 18 15:19:01 2017 +0000 Fix Windows x86 build Summary: Fix some `-Werror` failures and work around a bug in the `x86` version of `mingw-w64-crt`'s libraries. The bump in the `win32` submodule is required for this. Test Plan: ./validate Reviewers: austin, bgamari, erikd, simonmar Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3362 >--------------------------------------------------------------- 713ff9207e0f2493bd498ff725012c9895f728c8 libraries/Win32 | 2 +- rts/linker/PEi386.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/Win32 b/libraries/Win32 index 06d5849..67c5cc5 160000 --- a/libraries/Win32 +++ b/libraries/Win32 @@ -1 +1 @@ -Subproject commit 06d584916a4c32e6d31b60499afd52e32e4281ef +Subproject commit 67c5cc56f0faeacc553471c8a7d9b9b95e011731 diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c index 9c7f4db..c27dd31 100644 --- a/rts/linker/PEi386.c +++ b/rts/linker/PEi386.c @@ -1357,9 +1357,11 @@ ocResolve_PEi386 ( ObjectCode* oc ) sym = (COFF_symbol*) myindex ( sizeof_COFF_symbol, symtab, reltab_j->SymbolTableIndex ); +#if defined(x86_64_HOST_ARCH) uint64_t symIndex = ((uint64_t)myindex(sizeof_COFF_symbol, symtab, reltab_j->SymbolTableIndex) - (uint64_t)symtab) / sizeof_COFF_symbol; +#endif IF_DEBUG(linker, debugBelch( From git at git.haskell.org Tue Mar 21 01:18:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Mar 2017 01:18:25 +0000 (UTC) Subject: [commit: ghc] master: Correctly account for -package-db ordering when picking packages. (e0eaea9) Message-ID: <20170321011825.722363A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e0eaea918c32b3aa445708656876d1e2aef94a13/ghc >--------------------------------------------------------------- commit e0eaea918c32b3aa445708656876d1e2aef94a13 Author: Edward Z. Yang Date: Sun Mar 19 16:07:49 2017 -0700 Correctly account for -package-db ordering when picking packages. Summary: When I originally implemented ABI-based shadowing as per ee4e1654c31b9c6f6ad9b19ece25f040bbbcbd72, I switched our strategy from pasting together lists to creating a map of all units first, and then selecting packages from this. However, what I did not realize when doing this was that we actually depended on the *ordering* of these lists later, when we selected a preferred package to use. The crux is if I have -package-db db1 -package-db db2 -package p-0.1, and p-0.1 is provided by both db1 and db2, which one does the -package flag select? Previously, this was undetermined; now we always select the instance from the LATEST package database. (If p-0.1 shows up multiple times in the same database, once again the chosen package is undefined.) The reason why cabal08 intermittently failed was that, in practice, we were sorting on the UnitId, so when we bumped version numbers, that often wibbled the UnitIds so that they compared oppositely. I've extended the test so that we check that the relation is antisymmetric. Fixes #13313 Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: bgamari, austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3369 >--------------------------------------------------------------- e0eaea918c32b3aa445708656876d1e2aef94a13 compiler/main/Packages.hs | 111 +++++++++++++++++++-------- testsuite/tests/cabal/cabal08/Makefile | 8 +- testsuite/tests/cabal/cabal08/all.T | 3 +- testsuite/tests/cabal/cabal08/cabal08.stdout | 6 ++ 4 files changed, 93 insertions(+), 35 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 e0eaea918c32b3aa445708656876d1e2aef94a13 From git at git.haskell.org Tue Mar 21 01:18:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Mar 2017 01:18:19 +0000 (UTC) Subject: [commit: ghc] master: UniqMap implementation. (09485bb) Message-ID: <20170321011819.D78FF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/09485bba2b9a4a78dc7c628187d5fd9b8bab3ecd/ghc >--------------------------------------------------------------- commit 09485bba2b9a4a78dc7c628187d5fd9b8bab3ecd Author: Edward Z. Yang Date: Sun Mar 19 15:24:01 2017 -0700 UniqMap implementation. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 09485bba2b9a4a78dc7c628187d5fd9b8bab3ecd compiler/ghc.cabal.in | 1 + compiler/utils/UniqMap.hs | 210 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 211 insertions(+) diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 8c9bc3b..fc8dcd9 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -508,6 +508,7 @@ Library UniqDFM UniqDSet UniqFM + UniqMap UniqSet Util Vectorise.Builtins.Base diff --git a/compiler/utils/UniqMap.hs b/compiler/utils/UniqMap.hs new file mode 100644 index 0000000..012409b --- /dev/null +++ b/compiler/utils/UniqMap.hs @@ -0,0 +1,210 @@ +{-# LANGUAGE RoleAnnotations #-} +{-# LANGUAGE TupleSections #-} +{-# LANGUAGE CPP #-} +{-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE DeriveFunctor #-} +{-# OPTIONS_GHC -Wall #-} + +-- Like 'UniqFM', these are maps for keys which are Uniquable. +-- Unlike 'UniqFM', these maps also remember their keys, which +-- makes them a much better drop in replacement for 'Data.Map.Map'. +-- +-- Key preservation is right-biased. +module UniqMap ( + UniqMap, + emptyUniqMap, + isNullUniqMap, + unitUniqMap, + listToUniqMap, + listToUniqMap_C, + addToUniqMap, + addListToUniqMap, + addToUniqMap_C, + addToUniqMap_Acc, + alterUniqMap, + addListToUniqMap_C, + adjustUniqMap, + delFromUniqMap, + delListFromUniqMap, + plusUniqMap, + plusUniqMap_C, + plusMaybeUniqMap_C, + plusUniqMapList, + minusUniqMap, + intersectUniqMap, + disjointUniqMap, + mapUniqMap, + filterUniqMap, + partitionUniqMap, + sizeUniqMap, + elemUniqMap, + lookupUniqMap, + lookupWithDefaultUniqMap, + anyUniqMap, + allUniqMap, + -- Non-deterministic functions omitted +) where + +import UniqFM + +import Unique +import Outputable + +#if __GLASGOW_HASKELL__ > 710 +import Data.Semigroup ( Semigroup(..) ) +#endif +import Data.Coerce +import Data.Maybe +import Data.Typeable +import Data.Data + +-- | Maps indexed by 'Uniquable' keys +newtype UniqMap k a = UniqMap (UniqFM (k, a)) + deriving (Data, Eq, Functor, Typeable) +type role UniqMap nominal representational + +#if __GLASGOW_HASKELL__ > 710 +instance Semigroup (UniqMap k a) where + (<>) = plusUniqMap +#endif + +instance Monoid (UniqMap k a) where + mempty = emptyUniqMap + mappend = plusUniqMap + +instance (Outputable k, Outputable a) => Outputable (UniqMap k a) where + ppr (UniqMap m) = + brackets $ fsep $ punctuate comma $ + [ ppr k <+> text "->" <+> ppr v + | (k, v) <- eltsUFM m ] + +liftC :: (a -> a -> a) -> (k, a) -> (k, a) -> (k, a) +liftC f (_, v) (k', v') = (k', f v v') + +emptyUniqMap :: UniqMap k a +emptyUniqMap = UniqMap emptyUFM + +isNullUniqMap :: UniqMap k a -> Bool +isNullUniqMap (UniqMap m) = isNullUFM m + +unitUniqMap :: Uniquable k => k -> a -> UniqMap k a +unitUniqMap k v = UniqMap (unitUFM k (k, v)) + +listToUniqMap :: Uniquable k => [(k,a)] -> UniqMap k a +listToUniqMap kvs = UniqMap (listToUFM [ (k,(k,v)) | (k,v) <- kvs]) + +listToUniqMap_C :: Uniquable k => (a -> a -> a) -> [(k,a)] -> UniqMap k a +listToUniqMap_C f kvs = UniqMap $ + listToUFM_C (liftC f) [ (k,(k,v)) | (k,v) <- kvs] + +addToUniqMap :: Uniquable k => UniqMap k a -> k -> a -> UniqMap k a +addToUniqMap (UniqMap m) k v = UniqMap $ addToUFM m k (k, v) + +addListToUniqMap :: Uniquable k => UniqMap k a -> [(k,a)] -> UniqMap k a +addListToUniqMap (UniqMap m) kvs = UniqMap $ + addListToUFM m [(k,(k,v)) | (k,v) <- kvs] + +addToUniqMap_C :: Uniquable k + => (a -> a -> a) + -> UniqMap k a + -> k + -> a + -> UniqMap k a +addToUniqMap_C f (UniqMap m) k v = UniqMap $ + addToUFM_C (liftC f) m k (k, v) + +addToUniqMap_Acc :: Uniquable k + => (b -> a -> a) + -> (b -> a) + -> UniqMap k a + -> k + -> b + -> UniqMap k a +addToUniqMap_Acc exi new (UniqMap m) k0 v0 = UniqMap $ + addToUFM_Acc (\b (k, v) -> (k, exi b v)) + (\b -> (k0, new b)) + m k0 v0 + +alterUniqMap :: Uniquable k + => (Maybe a -> Maybe a) + -> UniqMap k a + -> k + -> UniqMap k a +alterUniqMap f (UniqMap m) k = UniqMap $ + alterUFM (fmap (k,) . f . fmap snd) m k + +addListToUniqMap_C + :: Uniquable k + => (a -> a -> a) + -> UniqMap k a + -> [(k, a)] + -> UniqMap k a +addListToUniqMap_C f (UniqMap m) kvs = UniqMap $ + addListToUFM_C (liftC f) m + [(k,(k,v)) | (k,v) <- kvs] + +adjustUniqMap + :: Uniquable k + => (a -> a) + -> UniqMap k a + -> k + -> UniqMap k a +adjustUniqMap f (UniqMap m) k = UniqMap $ + adjustUFM (\(_,v) -> (k,f v)) m k + +delFromUniqMap :: Uniquable k => UniqMap k a -> k -> UniqMap k a +delFromUniqMap (UniqMap m) k = UniqMap $ delFromUFM m k + +delListFromUniqMap :: Uniquable k => UniqMap k a -> [k] -> UniqMap k a +delListFromUniqMap (UniqMap m) ks = UniqMap $ delListFromUFM m ks + +plusUniqMap :: UniqMap k a -> UniqMap k a -> UniqMap k a +plusUniqMap (UniqMap m1) (UniqMap m2) = UniqMap $ plusUFM m1 m2 + +plusUniqMap_C :: (a -> a -> a) -> UniqMap k a -> UniqMap k a -> UniqMap k a +plusUniqMap_C f (UniqMap m1) (UniqMap m2) = UniqMap $ + plusUFM_C (liftC f) m1 m2 + +plusMaybeUniqMap_C :: (a -> a -> Maybe a) -> UniqMap k a -> UniqMap k a -> UniqMap k a +plusMaybeUniqMap_C f (UniqMap m1) (UniqMap m2) = UniqMap $ + plusMaybeUFM_C (\(_, v) (k', v') -> fmap (k',) (f v v')) m1 m2 + +plusUniqMapList :: [UniqMap k a] -> UniqMap k a +plusUniqMapList xs = UniqMap $ plusUFMList (coerce xs) + +minusUniqMap :: UniqMap k a -> UniqMap k b -> UniqMap k a +minusUniqMap (UniqMap m1) (UniqMap m2) = UniqMap $ minusUFM m1 m2 + +intersectUniqMap :: UniqMap k a -> UniqMap k b -> UniqMap k a +intersectUniqMap (UniqMap m1) (UniqMap m2) = UniqMap $ intersectUFM m1 m2 + +disjointUniqMap :: UniqMap k a -> UniqMap k b -> Bool +disjointUniqMap (UniqMap m1) (UniqMap m2) = disjointUFM m1 m2 + +mapUniqMap :: (a -> b) -> UniqMap k a -> UniqMap k b +mapUniqMap f (UniqMap m) = UniqMap $ mapUFM (fmap f) m -- (,) k instance + +filterUniqMap :: (a -> Bool) -> UniqMap k a -> UniqMap k a +filterUniqMap f (UniqMap m) = UniqMap $ filterUFM (f . snd) m + +partitionUniqMap :: (a -> Bool) -> UniqMap k a -> (UniqMap k a, UniqMap k a) +partitionUniqMap f (UniqMap m) = + coerce $ partitionUFM (f . snd) m + +sizeUniqMap :: UniqMap k a -> Int +sizeUniqMap (UniqMap m) = sizeUFM m + +elemUniqMap :: Uniquable k => k -> UniqMap k a -> Bool +elemUniqMap k (UniqMap m) = elemUFM k m + +lookupUniqMap :: Uniquable k => UniqMap k a -> k -> Maybe a +lookupUniqMap (UniqMap m) k = fmap snd (lookupUFM m k) + +lookupWithDefaultUniqMap :: Uniquable k => UniqMap k a -> a -> k -> a +lookupWithDefaultUniqMap (UniqMap m) a k = fromMaybe a (fmap snd (lookupUFM m k)) + +anyUniqMap :: (a -> Bool) -> UniqMap k a -> Bool +anyUniqMap f (UniqMap m) = anyUFM (f . snd) m + +allUniqMap :: (a -> Bool) -> UniqMap k a -> Bool +allUniqMap f (UniqMap m) = allUFM (f . snd) m From git at git.haskell.org Tue Mar 21 01:18:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Mar 2017 01:18:22 +0000 (UTC) Subject: [commit: ghc] master: Document the perplexing reversed nature of extraPkgConfs and friends. (40b65db) Message-ID: <20170321011822.9D36B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/40b65db4cd34c3566b9f6c53c086d53e97574217/ghc >--------------------------------------------------------------- commit 40b65db4cd34c3566b9f6c53c086d53e97574217 Author: Edward Z. Yang Date: Sun Mar 19 16:06:55 2017 -0700 Document the perplexing reversed nature of extraPkgConfs and friends. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 40b65db4cd34c3566b9f6c53c086d53e97574217 compiler/main/DynFlags.hs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index f80f9a7..057c2c0 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -805,16 +805,26 @@ data DynFlags = DynFlags { -- Package flags extraPkgConfs :: [PkgConfRef] -> [PkgConfRef], -- ^ The @-package-db@ flags given on the command line, in the order - -- they appeared. + -- they appeared. In *reverse* order that they're specified + -- on the command line. This is intended to be applied with the + -- list of "initial" package databases derived from @GHC_PACKAGE_PATH@; + -- see 'getPackageConfRefs'; this is a function because 'extraPkgConfs' + -- maybe configured to filter out certain flags from *either* the + -- user command line, or the base command; see for example + -- 'removeUserPkgConf'. ignorePackageFlags :: [IgnorePackageFlag], - -- ^ The @-ignore-package@ flags from the command line + -- ^ The @-ignore-package@ flags from the command line. + -- In *reverse* order that they're specified on the command line. packageFlags :: [PackageFlag], - -- ^ The @-package@ and @-hide-package@ flags from the command-line + -- ^ The @-package@ and @-hide-package@ flags from the command-line. + -- In *reverse* order that they're specified on the command line. pluginPackageFlags :: [PackageFlag], - -- ^ The @-plugin-package-id@ flags from command line + -- ^ The @-plugin-package-id@ flags from command line. + -- In *reverse* order that they're specified on the command line. trustFlags :: [TrustFlag], - -- ^ The @-trust@ and @-distrust@ flags + -- ^ The @-trust@ and @-distrust@ flags. + -- In *reverse* order that they're specified on the command line. packageEnv :: Maybe FilePath, -- ^ Filepath to the package environment file (if overriding default) From git at git.haskell.org Tue Mar 21 04:22:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Mar 2017 04:22:47 +0000 (UTC) Subject: [commit: ghc] master: Let GHC know MutVar# ops can't fail (2ac13c1) Message-ID: <20170321042247.DDFBB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2ac13c132d039438382baef6ce52c79b29725145/ghc >--------------------------------------------------------------- commit 2ac13c132d039438382baef6ce52c79b29725145 Author: David Feuer Date: Tue Mar 21 00:12:07 2017 -0400 Let GHC know MutVar# ops can't fail The only way `readMutVar#` or `writeMutVar#` can fail is if its argument is not a valid pointer. I believe we ensure this by construction, and never test for pointer validity. So I think it should be safe to say that it can't fail. Fixes #13424 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3340 >--------------------------------------------------------------- 2ac13c132d039438382baef6ce52c79b29725145 compiler/prelude/primops.txt.pp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 64971a3..b81fd12 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -1910,20 +1910,34 @@ primop NewMutVarOp "newMutVar#" GenPrimOp out_of_line = True has_side_effects = True +-- Note [Why MutVar# ops can't fail] +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- +-- We don't label readMutVar# or writeMutVar# as can_fail. +-- This may seem a bit peculiar, because they surely *could* +-- fail spectacularly if passed a pointer to unallocated memory. +-- But MutVar#s are always correct by construction; we never +-- test if a pointer is valid before using it with these operations. +-- So we never have to worry about floating the pointer reference +-- outside a validity test. At the moment, has_side_effects blocks +-- up the relevant optimizations anyway, but we hope to draw finer +-- distinctions soon, which should improve matters for readMutVar# +-- at least. + primop ReadMutVarOp "readMutVar#" GenPrimOp MutVar# s a -> State# s -> (# State# s, a #) {Read contents of {\tt MutVar\#}. Result is not yet evaluated.} with + -- See Note [Why MutVar# ops can't fail] has_side_effects = True - can_fail = True primop WriteMutVarOp "writeMutVar#" GenPrimOp MutVar# s a -> a -> State# s -> State# s {Write contents of {\tt MutVar\#}.} with + -- See Note [Why MutVar# ops can't fail] has_side_effects = True code_size = { primOpCodeSizeForeignCall } -- for the write barrier - can_fail = True primop SameMutVarOp "sameMutVar#" GenPrimOp MutVar# s a -> MutVar# s a -> Int# From git at git.haskell.org Tue Mar 21 14:52:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Mar 2017 14:52:01 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Revert "More fixes for #5654" (b0cac39) Message-ID: <20170321145201.251A83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/b0cac39046244ec685d5ea2dfbeb4b340c789898/ghc >--------------------------------------------------------------- commit b0cac39046244ec685d5ea2dfbeb4b340c789898 Author: Ben Gamari Date: Sat Mar 18 12:08:53 2017 -0400 Revert "More fixes for #5654" This reverts commit 3a18baff06abc193569b1b76358da26375b3c8d6. >--------------------------------------------------------------- b0cac39046244ec685d5ea2dfbeb4b340c789898 includes/stg/MiscClosures.h | 1 - rts/Apply.cmm | 27 -------- rts/Interpreter.c | 72 ++-------------------- rts/Printer.c | 5 -- rts/Profiling.c | 6 +- rts/StgMiscClosures.cmm | 10 --- testsuite/tests/codeGen/should_run/cgrun057.stderr | 2 +- .../tests/profiling/should_run/T680.prof.sample | 65 +++++++++---------- testsuite/tests/profiling/should_run/all.T | 3 +- .../should_run/toplevel_scc_1.prof.sample | 41 ++++++------ 10 files changed, 62 insertions(+), 170 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 b0cac39046244ec685d5ea2dfbeb4b340c789898 From git at git.haskell.org Tue Mar 21 14:52:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Mar 2017 14:52:09 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: genSym: Fix DEBUG build (e4620dc) Message-ID: <20170321145209.D621C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/e4620dc7d2b54c4fd98139c25cff150b7e4b9640/ghc >--------------------------------------------------------------- commit e4620dc7d2b54c4fd98139c25cff150b7e4b9640 Author: Ben Gamari Date: Sat Mar 18 14:45:35 2017 -0400 genSym: Fix DEBUG build It looks like this was likely a cut-and-paste error. >--------------------------------------------------------------- e4620dc7d2b54c4fd98139c25cff150b7e4b9640 compiler/cbits/genSym.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/cbits/genSym.c b/compiler/cbits/genSym.c index 725a310..4af3940 100644 --- a/compiler/cbits/genSym.c +++ b/compiler/cbits/genSym.c @@ -10,7 +10,7 @@ static HsInt GenSymInc = 1; STATIC_INLINE void checkUniqueRange(HsInt u STG_UNUSED) { #if DEBUG // Uh oh! We will overflow next time a unique is requested. - assert(h != UNIQUE_MASK); + assert(u != UNIQUE_MASK); #endif } From git at git.haskell.org Tue Mar 21 14:52:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Mar 2017 14:52:03 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Revert "Fix bug in previous fix for #5654" (58f055d) Message-ID: <20170321145203.DF24D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/58f055dae77ab57247ffa96c70d62d8ddd3193e4/ghc >--------------------------------------------------------------- commit 58f055dae77ab57247ffa96c70d62d8ddd3193e4 Author: Ben Gamari Date: Sat Mar 18 12:09:06 2017 -0400 Revert "Fix bug in previous fix for #5654" This reverts commit 2a02040b2e23daa4f791afc290c33c9bbe3c620c. >--------------------------------------------------------------- 58f055dae77ab57247ffa96c70d62d8ddd3193e4 rts/Apply.cmm | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/rts/Apply.cmm b/rts/Apply.cmm index b18c347..3a73ce0 100644 --- a/rts/Apply.cmm +++ b/rts/Apply.cmm @@ -57,7 +57,6 @@ stg_ap_0_fast ( P_ fun ) again: W_ info; W_ untaggedfun; - W_ arity; untaggedfun = UNTAG(fun); info = %INFO_PTR(untaggedfun); switch [INVALID_OBJECT .. N_CLOSURE_TYPES] @@ -69,11 +68,6 @@ again: fun = StgInd_indirectee(fun); goto again; } - case BCO: - { - arity = TO_W_(StgBCO_arity(untaggedfun)); - goto dofun; - } case FUN, FUN_1_0, @@ -81,10 +75,9 @@ again: FUN_2_0, FUN_1_1, FUN_0_2, - FUN_STATIC: + FUN_STATIC, + BCO: { - arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); - dofun: if (CCCS == StgHeader_ccs(untaggedfun)) { return (fun); } else { @@ -99,8 +92,10 @@ again: // attribute this allocation to the "overhead of profiling" CCS_ALLOC(BYTES_TO_WDS(SIZEOF_StgPAP), CCS_OVERHEAD); P_ pap; + W_ arity; pap = Hp - SIZEOF_StgPAP + WDS(1); SET_HDR(pap, stg_PAP_info, CCCS); + arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); StgPAP_arity(pap) = arity; StgPAP_fun(pap) = fun; StgPAP_n_args(pap) = 0; From git at git.haskell.org Tue Mar 21 14:52:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Mar 2017 14:52:07 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Revert "Fix cost-centre-stacks bug (#5654)" (46c3689) Message-ID: <20170321145207.27D0A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/46c368964cb15d4b5e2e61760c239d9d3cc939b7/ghc >--------------------------------------------------------------- commit 46c368964cb15d4b5e2e61760c239d9d3cc939b7 Author: Ben Gamari Date: Sat Mar 18 12:09:17 2017 -0400 Revert "Fix cost-centre-stacks bug (#5654)" This reverts commit 394231b301efb6b56654b0a480ab794fe3b7e4db. >--------------------------------------------------------------- 46c368964cb15d4b5e2e61760c239d9d3cc939b7 compiler/codeGen/StgCmmClosure.hs | 6 +- includes/Cmm.h | 6 -- rts/Apply.cmm | 107 --------------------- .../profiling/should_run/T5654-O0.prof.sample | 28 ------ testsuite/tests/profiling/should_run/T5654-O1.hs | 14 --- .../profiling/should_run/T5654-O1.prof.sample | 27 ------ .../profiling/should_run/{T5654-O0.hs => T5654.hs} | 0 .../tests/profiling/should_run/T5654.prof.sample | 28 ++++++ .../tests/profiling/should_run/T680.prof.sample | 50 +++++----- testsuite/tests/profiling/should_run/all.T | 4 +- 10 files changed, 56 insertions(+), 214 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 46c368964cb15d4b5e2e61760c239d9d3cc939b7 From git at git.haskell.org Tue Mar 21 14:52:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Mar 2017 14:52:12 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Never tick primitive string literals (2251905) Message-ID: <20170321145212.9A6FD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/2251905024f963d84d66559202d2377853fdff25/ghc >--------------------------------------------------------------- commit 2251905024f963d84d66559202d2377853fdff25 Author: Ben Gamari Date: Sun Mar 19 11:53:01 2017 -0400 Never tick primitive string literals This is a more aggressive approach to the problem initially solved in f5b275a239d2554c4da0b7621211642bf3b10650, where top-level primitive string literals were being wrapped by ticks. This breaks the Core invariant descirbed in Note [CoreSyn top-level string literals]. However, the previous approach was incomplete and left several places where inappropriate ticks could sneak in. This commit kills the problem at the source: we simply never tick any primitive string literal expression. The assumption here is that these expressions are destined for the top-level, where they cannot be ticked, anyways. So even if they haven't been floated out yet there is no reason to tick them. This partially reverts commit f5b275a239d2554c4da0b7621211642bf3b10650. Test Plan: Validate with `-g` Reviewers: austin, scpmw, simonpj, simonmar, dfeuer Subscribers: dfeuer, simonmar, thomie Differential Revision: https://phabricator.haskell.org/D3063 >--------------------------------------------------------------- 2251905024f963d84d66559202d2377853fdff25 compiler/coreSyn/CoreSyn.hs | 2 ++ compiler/coreSyn/CoreUtils.hs | 5 +++++ compiler/simplCore/FloatOut.hs | 33 +++++++++++++-------------------- compiler/simplCore/Simplify.hs | 10 ++-------- 4 files changed, 22 insertions(+), 28 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 385ea4e..a99e473 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -387,6 +387,8 @@ It is important to note that top-level primitive string literals cannot be wrapped in Ticks, as is otherwise done with lifted bindings. CoreToStg expects to see just a plain (Lit (MachStr ...)) expression on the RHS of primitive string bindings; anything else and things break. CoreLint checks this invariant. +To ensure that ticks don't sneak in CoreUtils.mkTick refuses to wrap any +primitve string expression with a tick. Also see Note [Compilation plan for top-level string literals]. diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs index dce7ef9..e20fb87 100644 --- a/compiler/coreSyn/CoreUtils.hs +++ b/compiler/coreSyn/CoreUtils.hs @@ -299,6 +299,11 @@ mkTick t orig_expr = mkTick' id id orig_expr -> CoreExpr mkTick' top rest expr = case expr of + -- Never tick primitive string literals. These should ultimately float up to + -- the top-level where they must be unadorned. See Note + -- [CoreSyn top-level string literals] for details. + _ | exprIsLiteralString expr -> expr + -- Cost centre ticks should never be reordered relative to each -- other. Therefore we can stop whenever two collide. Tick t2 e diff --git a/compiler/simplCore/FloatOut.hs b/compiler/simplCore/FloatOut.hs index 72fc0d1..17ffba4 100644 --- a/compiler/simplCore/FloatOut.hs +++ b/compiler/simplCore/FloatOut.hs @@ -21,7 +21,7 @@ import DynFlags import ErrUtils ( dumpIfSet_dyn ) import Id ( Id, idArity, idType, isBottomingId, isJoinId, isJoinId_maybe ) -import BasicTypes ( TopLevelFlag(..), isTopLevel ) +import Var ( Var ) import SetLevels import UniqSupply ( UniqSupply ) import Bag @@ -735,26 +735,19 @@ atJoinCeiling (fs, floats, expr') wrapTick :: Tickish Id -> FloatBinds -> FloatBinds wrapTick t (FB tops ceils defns) - = FB (mapBag (wrap_bind TopLevel) tops) - (wrap_defns NotTopLevel ceils) - (M.map (M.map (wrap_defns NotTopLevel)) defns) + = FB (mapBag wrap_bind tops) (wrap_defns ceils) + (M.map (M.map wrap_defns) defns) where - wrap_defns toplvl = mapBag (wrap_one toplvl) - - wrap_bind toplvl (NonRec binder rhs) = NonRec binder (maybe_tick toplvl rhs) - wrap_bind toplvl (Rec pairs) = Rec (mapSnd (maybe_tick toplvl) pairs) - - wrap_one toplvl (FloatLet bind) = FloatLet (wrap_bind toplvl bind) - wrap_one toplvl (FloatCase e b c bs) = FloatCase (maybe_tick toplvl e) b c bs - - maybe_tick :: TopLevelFlag -> CoreExpr -> CoreExpr - maybe_tick toplvl e - -- We must take care not to tick top-level literal - -- strings as this violated the Core invariants. See Note [CoreSyn - -- top-level string literals]. - | isTopLevel toplvl && exprIsLiteralString e = e - | exprIsHNF e = tickHNFArgs t e - | otherwise = mkTick t e + wrap_defns = mapBag wrap_one + + wrap_bind (NonRec binder rhs) = NonRec binder (maybe_tick rhs) + wrap_bind (Rec pairs) = Rec (mapSnd maybe_tick pairs) + + wrap_one (FloatLet bind) = FloatLet (wrap_bind bind) + wrap_one (FloatCase e b c bs) = FloatCase (maybe_tick e) b c bs + + maybe_tick e | exprIsHNF e = tickHNFArgs t e + | otherwise = mkTick t e -- we don't need to wrap a tick around an HNF when we float it -- outside a tick: that is an invariant of the tick semantics -- Conversely, inlining of HNFs inside an SCC is allowed, and diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index b63e745..d7ad51b 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -569,15 +569,9 @@ prepareRhs top_lvl env0 id rhs0 -- On the other hand, for scoping ticks we need to be able to -- copy them on the floats, which in turn is only allowed if -- we can obtain non-counting ticks. - | (not (tickishCounts t) || tickishCanSplit t) + | not (tickishCounts t) || tickishCanSplit t = do { (is_exp, env', rhs') <- go n_val_args (zapFloats env) rhs - ; let tickIt (id, expr) - -- we have to take care not to tick top-level literal - -- strings. See Note [CoreSyn top-level string literals]. - | isTopLevel top_lvl && exprIsLiteralString expr - = (id, expr) - | otherwise - = (id, mkTick (mkNoCount t) expr) + ; let tickIt (id, expr) = (id, mkTick (mkNoCount t) expr) floats' = seFloats $ env `addFloats` mapFloats env' tickIt ; return (is_exp, env' { seFloats = floats' }, Tick t rhs') } From git at git.haskell.org Tue Mar 21 14:52:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Mar 2017 14:52:15 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Comment coercion flattening [skip ci] (db0111c) Message-ID: <20170321145215.546CE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/db0111cd458ed59c439456a6ce1e7c5f8d52fe33/ghc >--------------------------------------------------------------- commit db0111cd458ed59c439456a6ce1e7c5f8d52fe33 Author: Richard Eisenberg Date: Fri Mar 3 14:23:24 2017 -0500 Comment coercion flattening [skip ci] (cherry picked from commit 4dc993008a66d6a54909da462363a25e8449f000) >--------------------------------------------------------------- db0111cd458ed59c439456a6ce1e7c5f8d52fe33 compiler/typecheck/TcFlatten.hs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcFlatten.hs b/compiler/typecheck/TcFlatten.hs index 700412b..933bacc 100644 --- a/compiler/typecheck/TcFlatten.hs +++ b/compiler/typecheck/TcFlatten.hs @@ -951,7 +951,7 @@ flatten_one (CastTy ty g) flatten_one (CoercionTy co) = first mkCoercionTy <$> flatten_co co -- | "Flatten" a coercion. Really, just flatten the types that it coerces --- between and then use transitivity. +-- between and then use transitivity. See Note [Flattening coercions] flatten_co :: Coercion -> FlatM (Coercion, Coercion) flatten_co co = do { let (Pair ty1 ty2, role) = coercionKindRole co @@ -980,6 +980,31 @@ flatten_ty_con_app tc tys ; return (mkTyConApp tc xis, mkTyConAppCo role tc cos) } {- +Note [Flattening coercions] +~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Because a flattened type has a flattened kind, we also must "flatten" +coercions as we walk through a type. Otherwise, the "from" type of +the coercion might not match the (now flattened) kind of the type +that it's casting. flatten_co does the work, taking a coercion of +type (ty1 ~ ty2) and flattening it to have type (fty1 ~ fty2), +where flatten(ty1) = fty1 and flatten(ty2) = fty2. + +In other words: + + If r1 is a role + co :: s ~r1 t + flatten_co co = (fco, kco) + r2 is the role in the FlatM + + then + fco :: fs ~r1 ft + fs, ft are flattened types + kco :: (fs ~r1 ft) ~r2 (s ~r1 t) + +The second return value of flatten_co is always a ProofIrrelCo. As +such, it doesn't contain any information the caller doesn't have and +might not be necessary in whatever comes next. + Note [Flattening synonyms] ~~~~~~~~~~~~~~~~~~~~~~~~~~ Not expanding synonyms aggressively improves error messages, and From git at git.haskell.org Tue Mar 21 14:52:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Mar 2017 14:52:18 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix #12709 by not building bad applications (ae6e63a) Message-ID: <20170321145218.B13133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/ae6e63aa858d663952b67cc9969fd14782d307bb/ghc >--------------------------------------------------------------- commit ae6e63aa858d663952b67cc9969fd14782d307bb Author: Richard Eisenberg Date: Thu Mar 16 10:34:29 2017 -0400 Fix #12709 by not building bad applications In an effort to report multiple levity polymorphism errors all at once, the desugarer does not fail when encountering bad levity polymorphism. But we must be careful not to build the bad applications, lest they try to satisfy the let/app invariant and call isUnliftedType on a levity polymorphic type. This protects calls to mkCoreAppDs appropriately. test case: typecheck/should_fail/T12709 (cherry picked from commit dca44adb9e14992e0aed49cdfd4b2baa2182073b) >--------------------------------------------------------------- ae6e63aa858d663952b67cc9969fd14782d307bb compiler/coreSyn/MkCore.hs | 5 +++- compiler/deSugar/DsBinds.hs | 6 +++-- compiler/deSugar/DsExpr.hs | 24 +++++++++++------- compiler/deSugar/DsMonad.hs | 20 ++++++++++++--- compiler/deSugar/DsUtils.hs | 2 ++ testsuite/tests/typecheck/should_fail/T12709.hs | 29 ++++++++++++++++++++++ .../tests/typecheck/should_fail/T12709.stderr | 24 ++++++++++++++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 8 files changed, 96 insertions(+), 15 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 ae6e63aa858d663952b67cc9969fd14782d307bb From git at git.haskell.org Tue Mar 21 14:52:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Mar 2017 14:52:22 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix #13202 by failing more eagerly in tcRnStmt (4c6a016) Message-ID: <20170321145222.4AE073A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/4c6a016900b0e9af382661efc4bb737e47d90d93/ghc >--------------------------------------------------------------- commit 4c6a016900b0e9af382661efc4bb737e47d90d93 Author: Richard Eisenberg Date: Thu Mar 16 11:38:05 2017 -0400 Fix #13202 by failing more eagerly in tcRnStmt test cases: ghci/scripts/T13202{,a} (cherry picked from commit fa13c136e6e666b9a1393c1c0041020ad842c069) >--------------------------------------------------------------- 4c6a016900b0e9af382661efc4bb737e47d90d93 compiler/typecheck/TcRnDriver.hs | 3 +++ testsuite/tests/ghci/scripts/T13202.script | 6 ++++++ testsuite/tests/ghci/scripts/T13202.stderr | 8 ++++++++ testsuite/tests/ghci/scripts/T13202a.script | 3 +++ testsuite/tests/ghci/scripts/T13202a.stderr | 6 ++++++ testsuite/tests/ghci/scripts/all.T | 2 ++ 6 files changed, 28 insertions(+) diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index cdf3278..b02fdf5 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -1877,6 +1877,9 @@ tcRnStmt hsc_env rdr_stmt zonked_expr <- zonkTopLExpr tc_expr ; zonked_ids <- zonkTopBndrs bound_ids ; + failIfErrsM ; -- we can't do the next step if there are levity polymorphism errors + -- test case: ghci/scripts/T13202{,a} + -- None of the Ids should be of unboxed type, because we -- cast them all to HValues in the end! mapM_ bad_unboxed (filter (isUnliftedType . idType) zonked_ids) ; diff --git a/testsuite/tests/ghci/scripts/T13202.script b/testsuite/tests/ghci/scripts/T13202.script new file mode 100644 index 0000000..5da0a32 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13202.script @@ -0,0 +1,6 @@ +import GHC.Exts +:set -XTypeApplications -XMagicHash -XTypeInType +data TypeRep (a :: k) = TypeRep +let typeRepKind = undefined :: TypeRep (a :: k) -> TypeRep k +let typeRep = undefined :: TypeRep (a :: k) +let x = typeRepKind (typeRep @(Maybe Int#)) diff --git a/testsuite/tests/ghci/scripts/T13202.stderr b/testsuite/tests/ghci/scripts/T13202.stderr new file mode 100644 index 0000000..33c1945 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13202.stderr @@ -0,0 +1,8 @@ + +:6:22: error: + • Cannot apply expression of type ‘TypeRep a0’ + to a visible type argument ‘(Maybe Int#)’ + • In the first argument of ‘typeRepKind’, namely + ‘(typeRep @(Maybe Int#))’ + In the expression: typeRepKind (typeRep @(Maybe Int#)) + In an equation for ‘x’: x = typeRepKind (typeRep @(Maybe Int#)) diff --git a/testsuite/tests/ghci/scripts/T13202a.script b/testsuite/tests/ghci/scripts/T13202a.script new file mode 100644 index 0000000..107d332 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13202a.script @@ -0,0 +1,3 @@ +import GHC.Records +:set -XTypeApplications -XDataKinds +let foo = getField @"name" diff --git a/testsuite/tests/ghci/scripts/T13202a.stderr b/testsuite/tests/ghci/scripts/T13202a.stderr new file mode 100644 index 0000000..8d1d2dd --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13202a.stderr @@ -0,0 +1,6 @@ + +:3:5: error: + • Non type-variable argument in the constraint: HasField "name" r a + (Use FlexibleContexts to permit this) + • When checking the inferred type + foo :: forall a r. HasField "name" r a => r -> a diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 7f03cf8..20bc5ae 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -248,3 +248,5 @@ test('T12447', expect_broken(12447), ghci_script, ['T12447.script']) test('T10249', normal, ghci_script, ['T10249.script']) test('T12550', normal, ghci_script, ['T12550.script']) test('StaticPtr', normal, ghci_script, ['StaticPtr.script']) +test('T13202', normal, ghci_script, ['T13202.script']) +test('T13202a', normal, ghci_script, ['T13202a.script']) From git at git.haskell.org Tue Mar 21 14:52:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Mar 2017 14:52:25 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Test #13435 in typecheck/should_run/T13435 (d40d5e8) Message-ID: <20170321145225.9469F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/d40d5e8b40a1a795fef43f0abdf7aaf143fca911/ghc >--------------------------------------------------------------- commit d40d5e8b40a1a795fef43f0abdf7aaf143fca911 Author: Richard Eisenberg Date: Fri Mar 17 11:22:19 2017 -0400 Test #13435 in typecheck/should_run/T13435 (cherry picked from commit 66d174a9650c3099e2e694f71b43c2dac89b21b1) >--------------------------------------------------------------- d40d5e8b40a1a795fef43f0abdf7aaf143fca911 testsuite/tests/typecheck/should_run/T13435.hs | 14 ++++++++++++++ testsuite/tests/typecheck/should_run/T13435.stdout | 1 + testsuite/tests/typecheck/should_run/all.T | 1 + 3 files changed, 16 insertions(+) diff --git a/testsuite/tests/typecheck/should_run/T13435.hs b/testsuite/tests/typecheck/should_run/T13435.hs new file mode 100644 index 0000000..95ee946 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T13435.hs @@ -0,0 +1,14 @@ +{-# Language FlexibleInstances, TypeFamilies, TypeInType, MagicHash #-} + +module Main where + +import Data.Kind +import GHC.Exts + +class Shw (a :: TYPE rep) where + shw :: a -> String + +instance Int# ~ a => Shw (a :: TYPE IntRep) where + shw a = "I#" ++ show (I# a) + +main = putStrLn (shw 3#) diff --git a/testsuite/tests/typecheck/should_run/T13435.stdout b/testsuite/tests/typecheck/should_run/T13435.stdout new file mode 100644 index 0000000..ae451c2 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T13435.stdout @@ -0,0 +1 @@ +I#3 diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index 61db61e..60b5fae 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -120,3 +120,4 @@ test('EtaExpandLevPoly', normal, compile_and_run, ['']) test('TestTypeableBinary', normal, compile_and_run, ['']) test('Typeable1', normal, compile_fail, ['']) test('TypeableEq', normal, compile_and_run, ['']) +test('T13435', normal, compile_and_run, ['']) From git at git.haskell.org Tue Mar 21 14:52:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Mar 2017 14:52:28 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Improve Lint a little (81abf7b) Message-ID: <20170321145228.4D18F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/81abf7b4da850b1003af0740c3ca9aab893d654b/ghc >--------------------------------------------------------------- commit 81abf7b4da850b1003af0740c3ca9aab893d654b Author: Simon Peyton Jones Date: Fri Mar 17 08:54:39 2017 +0000 Improve Lint a little Better location info if the error is in an unfolding (cherry picked from commit 567bc6bd194836233ce1576acd7a62b1867f6607) >--------------------------------------------------------------- 81abf7b4da850b1003af0740c3ca9aab893d654b compiler/coreSyn/CoreLint.hs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index 93fcbe4..714006c 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -580,7 +580,9 @@ lintSingleBinding top_lvl_flag rec_flag (binder,rhs) _ -> return () ; mapM_ (lintCoreRule binder binder_ty) (idCoreRules binder) - ; lintIdUnfolding binder binder_ty (idUnfolding binder) } + + ; addLoc (UnfoldingOf binder) $ + lintIdUnfolding binder binder_ty (idUnfolding binder) } -- We should check the unfolding, if any, but this is tricky because -- the unfolding is a SimplifiableCoreExpr. Give up for now. @@ -609,7 +611,7 @@ lintRhs bndr rhs ; return $ mkLamType var' body_ty } lint_join_lams n tot True _other - = failWithL $ mkBadJoinArityMsg bndr tot (tot-n) + = failWithL $ mkBadJoinArityMsg bndr tot (tot-n) rhs lint_join_lams _ _ False rhs = markAllJoinsBad $ lintCoreExpr rhs -- Future join point, not yet eta-expanded @@ -1938,6 +1940,7 @@ instance HasDynFlags LintM where data LintLocInfo = RhsOf Id -- The variable bound | LambdaBodyOf Id -- The lambda-binder + | UnfoldingOf Id -- Unfolding of a binder | BodyOfLetRec [Id] -- One of the binders | CaseAlt CoreAlt -- Case alternative | CasePat CoreAlt -- The *pattern* of the case alternative @@ -2125,6 +2128,9 @@ dumpLoc (RhsOf v) dumpLoc (LambdaBodyOf b) = (getSrcLoc b, brackets (text "in body of lambda with binder" <+> pp_binder b)) +dumpLoc (UnfoldingOf b) + = (getSrcLoc b, brackets (text "in the unfolding of" <+> pp_binder b)) + dumpLoc (BodyOfLetRec []) = (noSrcLoc, brackets (text "In body of a letrec with no binders")) @@ -2351,12 +2357,14 @@ mkInvalidJoinPointMsg var ty = hang (text "Join point has invalid type:") 2 (ppr var <+> dcolon <+> ppr ty) -mkBadJoinArityMsg :: Var -> Int -> Int -> SDoc -mkBadJoinArityMsg var ar nlams +mkBadJoinArityMsg :: Var -> Int -> Int -> CoreExpr -> SDoc +mkBadJoinArityMsg var ar nlams rhs = vcat [ text "Join point has too few lambdas", text "Join var:" <+> ppr var, text "Join arity:" <+> ppr ar, - text "Number of lambdas:" <+> ppr nlams ] + text "Number of lambdas:" <+> ppr nlams, + text "Rhs = " <+> ppr rhs + ] invalidJoinOcc :: Var -> SDoc invalidJoinOcc var From git at git.haskell.org Tue Mar 21 14:52:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Mar 2017 14:52:34 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Remove solveSomeEqualities (6c41ed6) Message-ID: <20170321145234.49CA33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/6c41ed6e7994451f78af87bff43d6baef19b8f0f/ghc >--------------------------------------------------------------- commit 6c41ed6e7994451f78af87bff43d6baef19b8f0f Author: Richard Eisenberg Date: Thu Mar 16 15:56:37 2017 -0400 Remove solveSomeEqualities I had thought that it was necessary to solve kind-level equalities before validity-checking a type, but I was wrong. This patch simply deletes code. Hooray! (cherry picked from commit 3cfee57abf00f794e7962e2a60efd9d7d8baf06f) >--------------------------------------------------------------- 6c41ed6e7994451f78af87bff43d6baef19b8f0f compiler/typecheck/TcHsType.hs | 41 +++----------- compiler/typecheck/TcSimplify.hs | 62 +--------------------- .../tests/partial-sigs/should_fail/T11976.stderr | 7 --- 3 files changed, 8 insertions(+), 102 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 6c41ed6e7994451f78af87bff43d6baef19b8f0f From git at git.haskell.org Tue Mar 21 14:52:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Mar 2017 14:52:38 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: No join-point from an INLINE function with wrong arity (ba29313) Message-ID: <20170321145238.867E03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/ba293130a71662ded2f36ec902bc275b0adaa391/ghc >--------------------------------------------------------------- commit ba293130a71662ded2f36ec902bc275b0adaa391 Author: Simon Peyton Jones Date: Fri Mar 17 16:25:41 2017 +0000 No join-point from an INLINE function with wrong arity The main payload of this patch is NOT to make a join-point from a function with an INLINE pragma and the wrong arity; see Note [Join points and INLINE pragmas] in CoreOpt. This is what caused Trac #13413. But we must do the exact same thing in simpleOptExpr, which drove me to the following refactoring: * Move simpleOptExpr and simpleOptPgm from CoreSubst to a new module CoreOpt along with a few others (exprIsConApp_maybe, pushCoArg, etc) This eliminates a module loop altogether (delete CoreArity.hs-boot), and stops CoreSubst getting too huge. * Rename Simplify.matchOrConvertToJoinPoint to joinPointBinding_maybe Move it to the new CoreOpt Use it in simpleOptExpr as well as in Simplify * Define CoreArity.joinRhsArity and use it (cherry picked from commit a7dbafe9292212f3cbc21be42eb326ab0701db7e) >--------------------------------------------------------------- ba293130a71662ded2f36ec902bc275b0adaa391 compiler/coreSyn/CoreArity.hs | 13 +- compiler/coreSyn/CoreArity.hs-boot | 6 - compiler/coreSyn/{CoreSubst.hs => CoreOpt.hs} | 904 +++------------- compiler/coreSyn/CoreSubst.hs | 1084 +------------------- compiler/coreSyn/CoreSyn.hs | 5 + compiler/coreSyn/CoreUnfold.hs | 2 +- compiler/deSugar/Desugar.hs | 4 +- compiler/deSugar/DsBinds.hs | 2 +- compiler/ghc.cabal.in | 1 + compiler/ghc.mk | 1 + compiler/main/GhcPlugins.hs | 3 +- compiler/prelude/PrelRules.hs | 2 +- compiler/simplCore/Simplify.hs | 30 +- compiler/specialise/Rules.hs | 1 + compiler/specialise/Specialise.hs | 3 +- testsuite/tests/simplCore/should_compile/T13413.hs | 19 + testsuite/tests/simplCore/should_compile/all.T | 1 + 17 files changed, 175 insertions(+), 1906 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 ba293130a71662ded2f36ec902bc275b0adaa391 From git at git.haskell.org Tue Mar 21 14:52:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Mar 2017 14:52:31 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix #13343 by not defaulting SigTvs (32c9abe) Message-ID: <20170321145231.83CC73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/32c9abee8304d1ab86329bb24652b7232669def2/ghc >--------------------------------------------------------------- commit 32c9abee8304d1ab86329bb24652b7232669def2 Author: Richard Eisenberg Date: Thu Mar 16 11:59:45 2017 -0400 Fix #13343 by not defaulting SigTvs test case: typecheck/should_compile/T13343 (cherry picked from commit 02cc8f0c423e85033bdfd26f1492301b724930d8) >--------------------------------------------------------------- 32c9abee8304d1ab86329bb24652b7232669def2 compiler/typecheck/TcMType.hs | 23 ++++++++++++++-------- testsuite/tests/typecheck/should_compile/T13343.hs | 7 +++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index 5ea6aa5..f8c4f3b 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -998,31 +998,38 @@ zonkQuantifiedTyVar :: Bool -- True <=> this is a kind var and -XNoPolyKind zonkQuantifiedTyVar default_kind tv = case tcTyVarDetails tv of - SkolemTv {} -> do { kind <- zonkTcType (tyVarKind tv) - ; return $ Just (setTyVarKind tv kind) } + SkolemTv {} -> zonk_kind_and_return -- It might be a skolem type variable, -- for example from a user type signature - MetaTv { mtv_ref = ref } + MetaTv { mtv_ref = ref, mtv_info = info } -> do { when debugIsOn (check_empty ref) - ; zonk_meta_tv tv } + ; zonk_meta_tv info tv } _other -> pprPanic "zonkQuantifiedTyVar" (ppr tv) -- FlatSkol, RuntimeUnk where - zonk_meta_tv :: TcTyVar -> TcM (Maybe TcTyVar) - zonk_meta_tv tv - | isRuntimeRepVar tv -- Never quantify over a RuntimeRep var + zonk_kind_and_return = do { kind <- zonkTcType (tyVarKind tv) + ; return $ Just (setTyVarKind tv kind) } + + zonk_meta_tv :: MetaInfo -> TcTyVar -> TcM (Maybe TcTyVar) + zonk_meta_tv info tv + | isRuntimeRepVar tv && not_sig_tv -- Never quantify over a RuntimeRep var = do { writeMetaTyVar tv liftedRepTy ; return Nothing } - | default_kind -- -XNoPolyKinds and this is a kind var + | default_kind && not_sig_tv -- -XNoPolyKinds and this is a kind var = do { _ <- default_kind_var tv ; return Nothing } | otherwise = do { tv' <- skolemiseUnboundMetaTyVar tv ; return (Just tv') } + where + -- do not default SigTvs. This would violate the invariants on SigTvs + not_sig_tv = case info of SigTv -> False + _ -> True + default_kind_var :: TyVar -> TcM Type -- defaultKindVar is used exclusively with -XNoPolyKinds diff --git a/testsuite/tests/typecheck/should_compile/T13343.hs b/testsuite/tests/typecheck/should_compile/T13343.hs new file mode 100644 index 0000000..ab259e3 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T13343.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE TypeInType #-} +module Bug where + +import GHC.Exts + +type Bad = forall (v1 :: RuntimeRep) (a1 :: TYPE v). a1 diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index d2dd684..9caaf25 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -545,3 +545,4 @@ test('T12924', normal, compile, ['']) test('T12926', normal, compile, ['']) test('T13381', normal, compile_fail, ['']) test('T13337', normal, compile, ['']) +test('T13343', normal, compile, ['']) From git at git.haskell.org Tue Mar 21 14:52:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Mar 2017 14:52:41 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: users-guide: Document TemplateHaskell availability (b3f7e9b) Message-ID: <20170321145241.503353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/b3f7e9b54d9f36938effd265c84d5567b34c905b/ghc >--------------------------------------------------------------- commit b3f7e9b54d9f36938effd265c84d5567b34c905b Author: Ben Gamari Date: Sun Mar 19 11:26:08 2017 -0400 users-guide: Document TemplateHaskell availability (cherry picked from commit 9c041294e5ac7e61e5d7f4858f22bd661dad25ae) >--------------------------------------------------------------- b3f7e9b54d9f36938effd265c84d5567b34c905b docs/users_guide/glasgow_exts.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 0e8e956..17e096f 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -10564,6 +10564,7 @@ Syntax .. ghc-flag:: -XTemplateHaskell + :since: 6.0. Typed splices introduced in GHC 7.8.1. :implies: :ghc-flag:`-XTemplateHaskellQuotes` Enable Template Haskell's splice and quotation syntax. From git at git.haskell.org Wed Mar 22 00:24:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Mar 2017 00:24:27 +0000 (UTC) Subject: [commit: ghc] master: Bump unix submodule (25b2c1b) Message-ID: <20170322002427.372733A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/25b2c1b22d1b7c7dcb89e5f039755e2e45927a0d/ghc >--------------------------------------------------------------- commit 25b2c1b22d1b7c7dcb89e5f039755e2e45927a0d Author: Ben Gamari Date: Tue Mar 21 10:07:44 2017 -0400 Bump unix submodule >--------------------------------------------------------------- 25b2c1b22d1b7c7dcb89e5f039755e2e45927a0d libraries/unix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/unix b/libraries/unix index 47bcb47..19aaa0f 160000 --- a/libraries/unix +++ b/libraries/unix @@ -1 +1 @@ -Subproject commit 47bcb4751c47e4026a7458f94e542d2c7dbbf92d +Subproject commit 19aaa0fcca3427e4006a967972eb16a570ca43b1 From git at git.haskell.org Wed Mar 22 00:24:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Mar 2017 00:24:29 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump performance test allocations (8ef3a3c) Message-ID: <20170322002429.EC2863A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8ef3a3cabfa878293a46d1163a134de238b3fb63/ghc >--------------------------------------------------------------- commit 8ef3a3cabfa878293a46d1163a134de238b3fb63 Author: Ben Gamari Date: Tue Mar 21 20:21:13 2017 -0400 testsuite: Bump performance test allocations It's unclear what bumped these, but Simon had noticed that they are marginal. Happily, all are improvements. >--------------------------------------------------------------- 8ef3a3cabfa878293a46d1163a134de238b3fb63 testsuite/tests/perf/compiler/all.T | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 8b4ac08..fb7eca2 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -875,7 +875,7 @@ test('T9961', test('T9233', [ only_ways(['normal']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 974530192, 5), + [(wordsize(64), 924299320, 5), # 2015-08-04 999826288 initial value # 2016-04-14 1066246248 Final demand analyzer run # 2016-06-18 984268712 shuffling around of Data.Functor.Identity @@ -886,6 +886,7 @@ test('T9233', # 2017-02-01 894486272 Join points # 2017-02-07 884436192 Another improvement to SetLevels # 2017-02-17 974530192 Type-indexed Typeable + # 2017-03-21 924299320 It's unclear (wordsize(32), 515672240, 5) # Put in your value here if you hit this # 2016-04-06 515672240 (x86/Linux) initial value @@ -968,11 +969,12 @@ test('T12227', test('T12425', [ only_ways(['optasm']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 142256192, 5), - # initial: 125831400 - # 2017-01-18: 133380960 Allow top-level string literals in Core - # 2017-02-17: 153611448 Type-indexed Typeable - # 2017-03-03: 142256192 Share Typeable KindReps + [(wordsize(64), 134334800, 5), + # initial: 125831400 + # 2017-01-18: 133380960 Allow top-level string literals in Core + # 2017-02-17: 153611448 Type-indexed Typeable + # 2017-03-03: 142256192 Share Typeable KindReps + # 2017-03-21: 134334800 Unclear ]), ], compile, @@ -999,12 +1001,13 @@ test('T12234', test('T13035', [ only_ways(['normal']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 98390488, 5), + [(wordsize(64), 93249744, 5), # 2017-01-05 90595208 initial # 2017-01-19 95269000 Allow top-level string literals in Core # 2017-02-05 88806416 Probably OccAnal fixes # 2017-02-17 103890200 Type-indexed Typeable # 2017-02-25 98390488 Early inline patch + # 2017-03-21 93249744 It's unclear ]), ], compile, From git at git.haskell.org Wed Mar 22 21:15:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Mar 2017 21:15:13 +0000 (UTC) Subject: [commit: ghc] master: Haddock submodule update. (acd85ce) Message-ID: <20170322211513.CA30F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/acd85ce97accb8fac10b1191c30da9bfd507c857/ghc >--------------------------------------------------------------- commit acd85ce97accb8fac10b1191c30da9bfd507c857 Author: Edward Z. Yang Date: Wed Mar 22 14:14:45 2017 -0700 Haddock submodule update. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- acd85ce97accb8fac10b1191c30da9bfd507c857 utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index bf3c4d7..4eb765c 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit bf3c4d72a0fda38561376eac7eda216158783267 +Subproject commit 4eb765ca4205c79539d60b7afa9b7e261a4a49fe From git at git.haskell.org Wed Mar 22 21:29:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Mar 2017 21:29:32 +0000 (UTC) Subject: [commit: ghc] master: Make unsafeInterleaveST less unsafe (30d68d6) Message-ID: <20170322212932.0EAC13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/30d68d630c1685bb81ec4afdaf6d483ba8aafd38/ghc >--------------------------------------------------------------- commit 30d68d630c1685bb81ec4afdaf6d483ba8aafd38 Author: David Feuer Date: Wed Mar 22 17:25:03 2017 -0400 Make unsafeInterleaveST less unsafe * Make `unsafeInterleaveST` use `noDuplicate#` like `unsafeInterleaveIO` does to prevent the suspended action from being run in two threads. * In order to accomplish this without `unsafeCoerce#`, generalize the type of `noDuplicate#`. * Add `unsafeDupableInterleaveST` to get the old behavior. * Document unsafe `ST` functions and clean up some related documentation. Fixes #13457 Reviewers: austin, hvr, bgamari, ekmett Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3370 >--------------------------------------------------------------- 30d68d630c1685bb81ec4afdaf6d483ba8aafd38 compiler/prelude/primops.txt.pp | 2 +- libraries/base/Control/Monad/ST/Imp.hs | 4 +++- libraries/base/Control/Monad/ST/Unsafe.hs | 1 + libraries/base/GHC/IO.hs | 19 ++++++++++++++----- libraries/base/GHC/IO/Unsafe.hs | 16 +++++++++++++++- libraries/base/GHC/ST.hs | 26 +++++++++++++++++++++++--- 6 files changed, 57 insertions(+), 11 deletions(-) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index b81fd12..a313920 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -2358,7 +2358,7 @@ primop IsCurrentThreadBoundOp "isCurrentThreadBound#" GenPrimOp has_side_effects = True primop NoDuplicateOp "noDuplicate#" GenPrimOp - State# RealWorld -> State# RealWorld + State# s -> State# s with out_of_line = True has_side_effects = True diff --git a/libraries/base/Control/Monad/ST/Imp.hs b/libraries/base/Control/Monad/ST/Imp.hs index 984970f..c053dcc 100644 --- a/libraries/base/Control/Monad/ST/Imp.hs +++ b/libraries/base/Control/Monad/ST/Imp.hs @@ -29,10 +29,12 @@ module Control.Monad.ST.Imp ( -- * Unsafe operations unsafeInterleaveST, + unsafeDupableInterleaveST, unsafeIOToST, unsafeSTToIO ) where -import GHC.ST ( ST, runST, fixST, unsafeInterleaveST ) +import GHC.ST ( ST, runST, fixST, unsafeInterleaveST + , unsafeDupableInterleaveST ) import GHC.Base ( RealWorld ) import GHC.IO ( stToIO, unsafeIOToST, unsafeSTToIO ) diff --git a/libraries/base/Control/Monad/ST/Unsafe.hs b/libraries/base/Control/Monad/ST/Unsafe.hs index 9fa4b73..b8560b1 100644 --- a/libraries/base/Control/Monad/ST/Unsafe.hs +++ b/libraries/base/Control/Monad/ST/Unsafe.hs @@ -21,6 +21,7 @@ module Control.Monad.ST.Unsafe ( -- * Unsafe operations unsafeInterleaveST, + unsafeDupableInterleaveST, unsafeIOToST, unsafeSTToIO ) where diff --git a/libraries/base/GHC/IO.hs b/libraries/base/GHC/IO.hs index 8459db6..63b47ff 100644 --- a/libraries/base/GHC/IO.hs +++ b/libraries/base/GHC/IO.hs @@ -84,22 +84,31 @@ failIO s = IO (raiseIO# (toException (userError s))) -- --------------------------------------------------------------------------- -- Coercions between IO and ST --- | A monad transformer embedding strict state transformers in the 'IO' --- monad. The 'RealWorld' parameter indicates that the internal state +-- | Embed a strict state transformer in an 'IO' +-- action. The 'RealWorld' parameter indicates that the internal state -- used by the 'ST' computation is a special one supplied by the 'IO' -- monad, and thus distinct from those used by invocations of 'runST'. stToIO :: ST RealWorld a -> IO a stToIO (ST m) = IO m +-- | Convert an 'IO' action into an 'ST' action. The type of the result +-- is constrained to use a 'RealWorld' state, and therefore the result cannot +-- be passed to 'runST'. ioToST :: IO a -> ST RealWorld a ioToST (IO m) = (ST m) --- This relies on IO and ST having the same representation modulo the --- constraint on the type of the state --- +-- | Convert an 'IO' action to an 'ST' action. +-- This relies on 'IO' and 'ST' having the same representation modulo the +-- constraint on the type of the state. unsafeIOToST :: IO a -> ST s a unsafeIOToST (IO io) = ST $ \ s -> (unsafeCoerce# io) s +-- | Convert an 'ST' action to an 'IO' action. +-- This relies on 'IO' and 'ST' having the same representation modulo the +-- constraint on the type of the state. +-- +-- For an example demonstrating why this is unsafe, see +-- https://mail.haskell.org/pipermail/haskell-cafe/2009-April/060719.html unsafeSTToIO :: ST s a -> IO a unsafeSTToIO (ST m) = IO (unsafeCoerce# m) diff --git a/libraries/base/GHC/IO/Unsafe.hs b/libraries/base/GHC/IO/Unsafe.hs index 7523535..c1c07ae 100644 --- a/libraries/base/GHC/IO/Unsafe.hs +++ b/libraries/base/GHC/IO/Unsafe.hs @@ -104,7 +104,7 @@ unsafeDupablePerformIO :: IO a -> a unsafeDupablePerformIO (IO m) = case runRW# m of (# _, a #) -> a {-| -'unsafeInterleaveIO' allows 'IO' computation to be deferred lazily. +'unsafeInterleaveIO' allows an 'IO' computation to be deferred lazily. When passed a value of type @IO a@, the 'IO' will only be performed when the value of the @a@ is demanded. This is used to implement lazy file reading, see 'System.IO.hGetContents'. @@ -113,6 +113,9 @@ file reading, see 'System.IO.hGetContents'. unsafeInterleaveIO :: IO a -> IO a unsafeInterleaveIO m = unsafeDupableInterleaveIO (noDuplicate >> m) +-- Note [unsafeDupableInterleaveIO should not be inlined] +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- -- We used to believe that INLINE on unsafeInterleaveIO was safe, -- because the state from this IO thread is passed explicitly to the -- interleaved IO, so it cannot be floated out and shared. @@ -131,7 +134,18 @@ unsafeInterleaveIO m = unsafeDupableInterleaveIO (noDuplicate >> m) -- share and sometimes not (plus it probably breaks the noDuplicate). -- So now, we do not inline unsafeDupableInterleaveIO. +{-| +'unsafeDupableInterleaveIO' allows an 'IO' computation to be deferred lazily. +When passed a value of type @IO a@, the 'IO' will only be performed +when the value of the @a@ is demanded. + +The computation may be performed multiple times by different threads, +possibly at the same time. To ensure that the computation is performed +only once, use 'unsafeInterleaveIO' instead. +-} + {-# NOINLINE unsafeDupableInterleaveIO #-} +-- See Note [unsafeDupableInterleaveIO should not be inlined] unsafeDupableInterleaveIO :: IO a -> IO a unsafeDupableInterleaveIO (IO m) = IO ( \ s -> let diff --git a/libraries/base/GHC/ST.hs b/libraries/base/GHC/ST.hs index 7982d59..4e00c0e 100644 --- a/libraries/base/GHC/ST.hs +++ b/libraries/base/GHC/ST.hs @@ -21,7 +21,7 @@ module GHC.ST ( fixST, runST, -- * Unsafe functions - liftST, unsafeInterleaveST + liftST, unsafeInterleaveST, unsafeDupableInterleaveST ) where import GHC.Base @@ -84,9 +84,29 @@ data STret s a = STret (State# s) a liftST :: ST s a -> State# s -> STret s a liftST (ST m) = \s -> case m s of (# s', r #) -> STret s' r -{-# NOINLINE unsafeInterleaveST #-} +noDuplicateST :: ST s () +noDuplicateST = ST $ \s -> (# noDuplicate# s, () #) + +-- | 'unsafeInterleaveST' allows an 'ST' computation to be deferred +-- lazily. When passed a value of type @ST a@, the 'ST' computation will +-- only be performed when the value of the @a@ is demanded. +{-# INLINE unsafeInterleaveST #-} unsafeInterleaveST :: ST s a -> ST s a -unsafeInterleaveST (ST m) = ST ( \ s -> +unsafeInterleaveST m = unsafeDupableInterleaveST (noDuplicateST >> m) + +-- | 'unsafeDupableInterleaveST' allows an 'ST' computation to be deferred +-- lazily. When passed a value of type @ST a@, the 'ST' computation will +-- only be performed when the value of the @a@ is demanded. +-- +-- The computation may be performed multiple times by different threads, +-- possibly at the same time. To prevent this, use 'unsafeInterleaveST' instead. +-- +-- @since 4.11 +{-# NOINLINE unsafeDupableInterleaveST #-} +-- See Note [unsafeDupableInterleaveIO should not be inlined] +-- in GHC.IO.Unsafe +unsafeDupableInterleaveST :: ST s a -> ST s a +unsafeDupableInterleaveST (ST m) = ST ( \ s -> let r = case m s of (# _, res #) -> res in From git at git.haskell.org Thu Mar 23 19:45:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Mar 2017 19:45:36 +0000 (UTC) Subject: [commit: ghc] branch 'wip/alexbiehl' created Message-ID: <20170323194536.84F433A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/alexbiehl Referencing: 5748f7642e406ddf232fd49edf6366a3e4de8bf0 From git at git.haskell.org Thu Mar 23 19:45:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Mar 2017 19:45:39 +0000 (UTC) Subject: [commit: ghc] wip/alexbiehl: Try out another hash for FastStrings as discussed in IRC (5748f76) Message-ID: <20170323194539.425613A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/alexbiehl Link : http://ghc.haskell.org/trac/ghc/changeset/5748f7642e406ddf232fd49edf6366a3e4de8bf0/ghc >--------------------------------------------------------------- commit 5748f7642e406ddf232fd49edf6366a3e4de8bf0 Author: alexbiehl Date: Thu Mar 23 20:33:20 2017 +0100 Try out another hash for FastStrings as discussed in IRC >--------------------------------------------------------------- 5748f7642e406ddf232fd49edf6366a3e4de8bf0 compiler/utils/FastString.hs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/compiler/utils/FastString.hs b/compiler/utils/FastString.hs index 8d1bbb5..b094670 100644 --- a/compiler/utils/FastString.hs +++ b/compiler/utils/FastString.hs @@ -102,6 +102,7 @@ import FastFunctions import Panic import Util +import Data.Bits ((.&.)) import Control.DeepSeq import Control.Monad import Data.ByteString (ByteString) @@ -129,8 +130,8 @@ import GHC.Conc.Sync (sharedCAF) import GHC.Base ( unpackCString# ) -#define hASH_TBL_SIZE 4091 -#define hASH_TBL_SIZE_UNBOXED 4091# +#define hASH_TBL_SIZE 4096 +#define hASH_TBL_SIZE_UNBOXED 4096# fastStringToByteString :: FastString -> ByteString @@ -453,16 +454,16 @@ cmpStringPrefix ptr1 ptr2 len = do r <- memcmp ptr1 ptr2 len return (r == 0) +hashStr :: Ptr Word8 -> Int -> Int +hashStr (Ptr a#) (I# len#) = loop 0# a# .&. (hASH_TBL_SIZE - 1) + where + !end = plusAddr# a# len# -hashStr :: Ptr Word8 -> Int -> Int - -- use the Addr to produce a hash value between 0 & m (inclusive) -hashStr (Ptr a#) (I# len#) = loop 0# 0# - where - loop h n | isTrue# (n ==# len#) = I# h - | otherwise = loop h2 (n +# 1#) - where !c = ord# (indexCharOffAddr# a# n) - !h2 = (c +# (h *# 128#)) `remInt#` - hASH_TBL_SIZE# + loop h op | isTrue# (eqAddr# op end) = I# h + | otherwise = loop h' (plusAddr# op 1#) + where + !c = ord# (indexCharOffAddr# op 0#) + !h' = h *# 31# +# c -- ----------------------------------------------------------------------------- -- Operations From git at git.haskell.org Thu Mar 23 19:52:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Mar 2017 19:52:15 +0000 (UTC) Subject: [commit: ghc] wip/alexbiehl: Rewrite modulo hASH_TBL_SIZE (killed some transformation) (73656e6) Message-ID: <20170323195215.660DB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/alexbiehl Link : http://ghc.haskell.org/trac/ghc/changeset/73656e67d777e942b4e977f25cf803959ae4433f/ghc >--------------------------------------------------------------- commit 73656e67d777e942b4e977f25cf803959ae4433f Author: alexbiehl Date: Thu Mar 23 20:52:01 2017 +0100 Rewrite modulo hASH_TBL_SIZE (killed some transformation) >--------------------------------------------------------------- 73656e67d777e942b4e977f25cf803959ae4433f compiler/utils/FastString.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/utils/FastString.hs b/compiler/utils/FastString.hs index b094670..545bfd1 100644 --- a/compiler/utils/FastString.hs +++ b/compiler/utils/FastString.hs @@ -455,11 +455,11 @@ cmpStringPrefix ptr1 ptr2 len = return (r == 0) hashStr :: Ptr Word8 -> Int -> Int -hashStr (Ptr a#) (I# len#) = loop 0# a# .&. (hASH_TBL_SIZE - 1) +hashStr (Ptr a#) (I# len#) = loop 0# a# where !end = plusAddr# a# len# - loop h op | isTrue# (eqAddr# op end) = I# h + loop h op | isTrue# (eqAddr# op end) = I# h .&. (hASH_TBL_SIZE - 1) | otherwise = loop h' (plusAddr# op 1#) where !c = ord# (indexCharOffAddr# op 0#) From git at git.haskell.org Thu Mar 23 20:02:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Mar 2017 20:02:00 +0000 (UTC) Subject: [commit: ghc] wip/alexbiehl: Use primops only (a8b3fe1) Message-ID: <20170323200200.220EB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/alexbiehl Link : http://ghc.haskell.org/trac/ghc/changeset/a8b3fe11ae98a3b292eaadc38c92405f9128e3eb/ghc >--------------------------------------------------------------- commit a8b3fe11ae98a3b292eaadc38c92405f9128e3eb Author: alexbiehl Date: Thu Mar 23 21:01:47 2017 +0100 Use primops only >--------------------------------------------------------------- a8b3fe11ae98a3b292eaadc38c92405f9128e3eb compiler/utils/FastString.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/utils/FastString.hs b/compiler/utils/FastString.hs index 545bfd1..d55dee8 100644 --- a/compiler/utils/FastString.hs +++ b/compiler/utils/FastString.hs @@ -459,7 +459,11 @@ hashStr (Ptr a#) (I# len#) = loop 0# a# where !end = plusAddr# a# len# - loop h op | isTrue# (eqAddr# op end) = I# h .&. (hASH_TBL_SIZE - 1) + loop h op | isTrue# (eqAddr# op end) = I# (word2Int# + (and# + (int2Word# h) + (minusWord# + hASH_TBL_SIZE## 1##))) | otherwise = loop h' (plusAddr# op 1#) where !c = ord# (indexCharOffAddr# op 0#) From git at git.haskell.org Fri Mar 24 05:32:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Mar 2017 05:32:50 +0000 (UTC) Subject: [commit: ghc] master: Bump haddock submodule (90d9e97) Message-ID: <20170324053250.1B19A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/90d9e977224f3bd71bd5d2cc70e16851541346d2/ghc >--------------------------------------------------------------- commit 90d9e977224f3bd71bd5d2cc70e16851541346d2 Author: Ben Gamari Date: Thu Mar 23 20:41:34 2017 -0400 Bump haddock submodule >--------------------------------------------------------------- 90d9e977224f3bd71bd5d2cc70e16851541346d2 utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 4eb765c..07272c7 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 4eb765ca4205c79539d60b7afa9b7e261a4a49fe +Subproject commit 07272c70c1cc72cd631177796a1b5b332bcc579b From git at git.haskell.org Fri Mar 24 05:32:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Mar 2017 05:32:53 +0000 (UTC) Subject: [commit: ghc] master: Allow colors to be customized (adf27d6) Message-ID: <20170324053253.5086B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/adf27d614f8a48d8dcf2d4e2e7872f7b3f818364/ghc >--------------------------------------------------------------- commit adf27d614f8a48d8dcf2d4e2e7872f7b3f818364 Author: Phil Ruffwind Date: Thu Mar 23 20:59:01 2017 -0400 Allow colors to be customized Allow customization of diagnostic colors through the GHC_COLORS environment variable. Some color-related code have been refactored to PprColour to reduce the circular dependence between DynFlags, Outputable, ErrUtils. Some color functions that were part of Outputable but were never used have been deleted. Test Plan: validate Reviewers: austin, hvr, bgamari, dfeuer Reviewed By: bgamari, dfeuer Subscribers: dfeuer, rwbarton, thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3364 >--------------------------------------------------------------- adf27d614f8a48d8dcf2d4e2e7872f7b3f818364 compiler/ghc.cabal.in | 1 + compiler/ghc.mk | 1 + compiler/main/DynFlags.hs | 28 ++++++++------ compiler/main/DynFlags.hs-boot | 5 +-- compiler/main/ErrUtils.hs | 39 ++++++++++--------- compiler/utils/Outputable.hs | 87 +++++++---------------------------------- compiler/utils/PprColour.hs | 88 ++++++++++++++++++++++++++++++++++++++++++ compiler/utils/Util.hs | 15 +++++++ docs/users_guide/using.rst | 21 ++++++++-- ghc/GHCi/UI.hs | 2 +- 10 files changed, 176 insertions(+), 111 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 adf27d614f8a48d8dcf2d4e2e7872f7b3f818364 From git at git.haskell.org Fri Mar 24 05:32:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Mar 2017 05:32:56 +0000 (UTC) Subject: [commit: ghc] master: config.mk.in: Add bzip, gzip, and xz executable names to be overridden (1b37440) Message-ID: <20170324053256.077353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1b374402a7a078e53c3e00eb0460e8b22930c453/ghc >--------------------------------------------------------------- commit 1b374402a7a078e53c3e00eb0460e8b22930c453 Author: Ben Gamari Date: Thu Mar 23 20:59:21 2017 -0400 config.mk.in: Add bzip, gzip, and xz executable names to be overridden Reviewers: austin, hvr, erikd Reviewed By: erikd Subscribers: rwbarton, thomie, erikd, snowleopard Differential Revision: https://phabricator.haskell.org/D3367 >--------------------------------------------------------------- 1b374402a7a078e53c3e00eb0460e8b22930c453 configure.ac | 5 +++++ mk/config.mk.in | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 736c124..dd338a8 100644 --- a/configure.ac +++ b/configure.ac @@ -702,6 +702,11 @@ dnl ** check for tar dnl if GNU tar is named gtar, look for it first. AC_PATH_PROGS(TarCmd,gnutar gtar tar,tar) +dnl ** check for compressors +AC_PATH_PROGS(Bzip2Cmd,bzip2, bzip2) +AC_PATH_PROGS(GzipCmd,gzip, gzip) +AC_PATH_PROGS(XzCmd,pxz xz, xz) + dnl ** check for patch dnl if GNU patch is named gpatch, look for it first AC_PATH_PROGS(PatchCmd,gpatch patch, patch) diff --git a/mk/config.mk.in b/mk/config.mk.in index 729abfa..4e61eea 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -789,9 +789,9 @@ STRIP_CMD = strip endif PATCH_CMD = @PatchCmd@ TAR_CMD = @TarCmd@ -BZIP2_CMD = bzip2 -GZIP_CMD = gzip -XZ_CMD = xz +BZIP2_CMD = @Bzip2Cmd@ +GZIP_CMD = @GzipCmd@ +XZ_CMD = @XzCmd@ # xz is default compression TAR_COMP ?= xz From git at git.haskell.org Fri Mar 24 06:10:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Mar 2017 06:10:43 +0000 (UTC) Subject: [commit: ghc] master: ghci/Linker.hs: Fix a typo in error message (fc41fdc) Message-ID: <20170324061043.1831D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fc41fdc6423b91eef52c1f4c73a9be5e9dea17b9/ghc >--------------------------------------------------------------- commit fc41fdc6423b91eef52c1f4c73a9be5e9dea17b9 Author: Ömer Sinan Ağacan Date: Fri Mar 24 09:10:00 2017 +0300 ghci/Linker.hs: Fix a typo in error message >--------------------------------------------------------------- fc41fdc6423b91eef52c1f4c73a9be5e9dea17b9 compiler/ghci/Linker.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs index c9b0eff..edd947d 100644 --- a/compiler/ghci/Linker.hs +++ b/compiler/ghci/Linker.hs @@ -573,7 +573,7 @@ failNonStd dflags srcspan = dieWith dflags srcspan $ text "Cannot load" <+> compWay <+> text "objects when GHC is built" <+> ghciWay $$ text "To fix this, either:" $$ - text " (1) Use -fexternal-interprter, or" $$ + text " (1) Use -fexternal-interpreter, or" $$ text " (2) Build the program twice: once" <+> ghciWay <> text ", and then" $$ text " with" <+> compWay <+> From git at git.haskell.org Fri Mar 24 13:24:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Mar 2017 13:24:20 +0000 (UTC) Subject: [commit: ghc] master: Typos in comments (notes too) [ci skip] (1dd60ac) Message-ID: <20170324132420.9C2F13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1dd60ac9a949157da89d4e6e1f8203e746be58f3/ghc >--------------------------------------------------------------- commit 1dd60ac9a949157da89d4e6e1f8203e746be58f3 Author: Gabor Greif Date: Fri Mar 24 11:21:52 2017 +0100 Typos in comments (notes too) [ci skip] >--------------------------------------------------------------- 1dd60ac9a949157da89d4e6e1f8203e746be58f3 compiler/basicTypes/NameEnv.hs | 2 +- compiler/coreSyn/CoreOpt.hs | 12 ++++++------ compiler/nativeGen/RegAlloc/Graph/ArchBase.hs | 2 +- compiler/simplCore/CallArity.hs | 11 +++++------ compiler/simplCore/Simplify.hs | 2 +- compiler/specialise/Specialise.hs | 2 +- compiler/typecheck/TcHsType.hs | 2 +- libraries/base/Data/Bifoldable.hs | 2 +- testsuite/tests/programs/joao-circular/Visfun_Lazy.hs | 6 +++--- 9 files changed, 20 insertions(+), 21 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 1dd60ac9a949157da89d4e6e1f8203e746be58f3 From git at git.haskell.org Fri Mar 24 14:14:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Mar 2017 14:14:54 +0000 (UTC) Subject: [commit: ghc] master: Cmm: remove a few unused type aliases (8429a20) Message-ID: <20170324141454.95CAE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8429a202ec8aef0af226d3fb5907b47dc9cba155/ghc >--------------------------------------------------------------- commit 8429a202ec8aef0af226d3fb5907b47dc9cba155 Author: Michal Terepeta Date: Thu Mar 23 21:00:24 2017 -0400 Cmm: remove a few unused type aliases Test Plan: ./validate Reviewers: austin, bgamari, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3372 >--------------------------------------------------------------- 8429a202ec8aef0af226d3fb5907b47dc9cba155 compiler/cmm/Cmm.hs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/compiler/cmm/Cmm.hs b/compiler/cmm/Cmm.hs index 39c2d39..d2ee531 100644 --- a/compiler/cmm/Cmm.hs +++ b/compiler/cmm/Cmm.hs @@ -14,9 +14,6 @@ module Cmm ( GenBasicBlock(..), blockId, ListGraph(..), pprBBlock, - -- * Cmm graphs - CmmReplGraph, GenCmmReplGraph, CmmFwdRewrite, CmmBwdRewrite, - -- * Info Tables CmmTopInfo(..), CmmStackInfo(..), CmmInfoTable(..), topInfoTable, ClosureTypeInfo(..), @@ -33,7 +30,6 @@ import BlockId import CmmNode import SMRep import CmmExpr -import UniqSupply import Compiler.Hoopl import Outputable @@ -105,11 +101,6 @@ type CmmGraph = GenCmmGraph CmmNode data GenCmmGraph n = CmmGraph { g_entry :: BlockId, g_graph :: Graph n C C } type CmmBlock = Block CmmNode C C -type CmmReplGraph e x = GenCmmReplGraph CmmNode e x -type GenCmmReplGraph n e x = UniqSM (Maybe (Graph n e x)) -type CmmFwdRewrite f = FwdRewrite UniqSM CmmNode f -type CmmBwdRewrite f = BwdRewrite UniqSM CmmNode f - ----------------------------------------------------------------------------- -- Info Tables ----------------------------------------------------------------------------- From git at git.haskell.org Fri Mar 24 14:14:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Mar 2017 14:14:57 +0000 (UTC) Subject: [commit: ghc] master: Improve tracing in OccurAnal (5671e22) Message-ID: <20170324141457.500EE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5671e22e913c60a0b5be4ddb3caa55fe8398b14f/ghc >--------------------------------------------------------------- commit 5671e22e913c60a0b5be4ddb3caa55fe8398b14f Author: Matthew Pickering Date: Thu Mar 23 21:00:08 2017 -0400 Improve tracing in OccurAnal One commented out tracing function didn't type check and also show the scores of loop breaker nodes. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3371 >--------------------------------------------------------------- 5671e22e913c60a0b5be4ddb3caa55fe8398b14f compiler/simplCore/OccurAnal.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index 6093f42..b14dbd9 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -892,7 +892,6 @@ occAnalRec lvl (CyclicSCC details_s) (body_uds, binds) | otherwise -- At this point we always build a single Rec = -- pprTrace "occAnalRec" (vcat -- [ text "weak_fvs" <+> ppr weak_fvs - -- , text "tagged details" <+> ppr tagged_details_s -- , text "lb nodes" <+> ppr loop_breaker_nodes]) (final_uds, Rec pairs : binds) @@ -1204,6 +1203,7 @@ instance Outputable Details where , text "inl =" <+> ppr (nd_inl nd) , text "weak =" <+> ppr (nd_weak nd) , text "rule =" <+> ppr (nd_active_rule_fvs nd) + , text "score =" <+> ppr (nd_score nd) ]) -- The NodeScore is compared lexicographically; From git at git.haskell.org Fri Mar 24 14:54:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Mar 2017 14:54:37 +0000 (UTC) Subject: [commit: ghc] master: Document hithertoo undocumented HPCTIXFILE option. (ee7241c) Message-ID: <20170324145437.BBFD43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ee7241cfde455ab6731b9ce81b36247f082a1342/ghc >--------------------------------------------------------------- commit ee7241cfde455ab6731b9ce81b36247f082a1342 Author: Edward Z. Yang Date: Thu Mar 23 21:03:40 2017 -0400 Document hithertoo undocumented HPCTIXFILE option. Test Plan: none Reviewers: bgamari, austin, dfeuer Reviewed By: bgamari, dfeuer Subscribers: dfeuer, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3357 >--------------------------------------------------------------- ee7241cfde455ab6731b9ce81b36247f082a1342 docs/users_guide/profiling.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/users_guide/profiling.rst b/docs/users_guide/profiling.rst index 832464e..d035cc5 100644 --- a/docs/users_guide/profiling.rst +++ b/docs/users_guide/profiling.rst @@ -1292,7 +1292,8 @@ case :file:`Recip.tix`, which contains the coverage data for this run of the program. The program may be run multiple times (e.g. with different test data), and the coverage data from the separate runs is accumulated in the ``.tix`` file. To reset the coverage data and start again, just -remove the ``.tix`` file. +remove the ``.tix`` file. You can control where the ``.tix`` file +is generated using the environment variable :envvar:`HPCTIXFILE`. Having run the program, we can generate a textual summary of coverage: @@ -1532,8 +1533,10 @@ Caveats and Shortcomings of Haskell Program Coverage HPC does not attempt to lock the ``.tix`` file, so multiple concurrently running binaries in the same directory will exhibit a race condition. -There is no way to change the name of the ``.tix`` file generated, apart -from renaming the binary. HPC does not work with GHCi. +At compile time, there is no way to change the name of the ``.tix`` file generated; +at runtime, the name of the generated ``.tix`` file can be changed +using :envvar:`HPCTIXFILE`; the name of the ``.tix`` file +will also change if you rename the binary. HPC does not work with GHCi. .. _ticky-ticky: From git at git.haskell.org Fri Mar 24 14:54:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Mar 2017 14:54:35 +0000 (UTC) Subject: [commit: ghc] master: x86 nativeGen: Fix test with mask in range [128, 255] (#13425) (caf94b0) Message-ID: <20170324145435.04C033A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/caf94b062a0e37ffa7048e51447fc9486b658917/ghc >--------------------------------------------------------------- commit caf94b062a0e37ffa7048e51447fc9486b658917 Author: Reid Barton Date: Thu Mar 23 21:02:29 2017 -0400 x86 nativeGen: Fix test with mask in range [128,255] (#13425) My commit bdb0c43c7 optimized the encoding of instructions to test tag bits, but it did not always set exactly the same condition codes since the testb instruction does a single-byte comparison, rather than a full-word comparison. It would be correct to optimize the expression `x .&. 128 > 0` to the sequence testb $128, %al seta %al ; note: 'a' for unsigned comparison, ; not 'g' for signed comparison but the pretty-printer is not the right place to make this kind of context-sensitive optimization. Test Plan: harbormaster Reviewers: trofi, austin, bgamari, dfeuer Reviewed By: trofi, dfeuer Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3359 >--------------------------------------------------------------- caf94b062a0e37ffa7048e51447fc9486b658917 compiler/nativeGen/X86/Ppr.hs | 6 +++++- testsuite/tests/codeGen/should_run/T13425.hs | 10 ++++++++++ .../tests/codeGen/should_run/T13425.stdout | 0 testsuite/tests/codeGen/should_run/all.T | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs index 7d19e99..5044c83 100644 --- a/compiler/nativeGen/X86/Ppr.hs +++ b/compiler/nativeGen/X86/Ppr.hs @@ -671,8 +671,12 @@ pprInstr (TEST format src dst) = sdocWithPlatform $ \platform -> -- (We could handle masks larger than a single byte too, -- but it would complicate the code considerably -- and tag checks are by far the most common case.) + -- The mask must have the high bit clear for this smaller encoding + -- to be completely equivalent to the original; in particular so + -- that the signed comparison condition bits are the same as they + -- would be if doing a full word comparison. See Trac #13425. (OpImm (ImmInteger mask), OpReg dstReg) - | 0 <= mask && mask < 256 -> minSizeOfReg platform dstReg + | 0 <= mask && mask < 128 -> minSizeOfReg platform dstReg _ -> format in pprFormatOpOp (sLit "test") format' src dst where diff --git a/testsuite/tests/codeGen/should_run/T13425.hs b/testsuite/tests/codeGen/should_run/T13425.hs new file mode 100644 index 0000000..49d0721 --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T13425.hs @@ -0,0 +1,10 @@ +import Data.Bits ((.&.)) + +flags :: Int -> Int +flags x + | x .&. 128 > 0 = 12 + | otherwise = 13 +{-# NOINLINE flags #-} + +main :: IO () +main = print (flags 255) diff --git a/libraries/base/tests/hPutBuf002.stdout b/testsuite/tests/codeGen/should_run/T13425.stdout similarity index 100% copy from libraries/base/tests/hPutBuf002.stdout copy to testsuite/tests/codeGen/should_run/T13425.stdout diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index b952c10..ffe4b64 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -155,3 +155,4 @@ test('T9577', [ unless(arch('x86_64') or arch('i386'),skip), when(opsys('darwin'), expect_broken(12937)), when(opsys('mingw32'), expect_broken(12965)), only_ways(['normal']) ], compile_and_run, ['']) +test('T13425', normal, compile_and_run, ['-O']) From git at git.haskell.org Fri Mar 24 14:54:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Mar 2017 14:54:41 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add failing testcase for #13233 (27c9a7d) Message-ID: <20170324145441.087F13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/27c9a7d095d2383a7822d317dc7acfe579a4815b/ghc >--------------------------------------------------------------- commit 27c9a7d095d2383a7822d317dc7acfe579a4815b Author: Ben Gamari Date: Thu Mar 23 22:53:29 2017 -0400 testsuite: Add failing testcase for #13233 Thanks to Ryan Scott for the example. >--------------------------------------------------------------- 27c9a7d095d2383a7822d317dc7acfe579a4815b testsuite/tests/codeGen/should_compile/T13233.hs | 12 ++++++++++++ testsuite/tests/codeGen/should_compile/all.T | 1 + 2 files changed, 13 insertions(+) diff --git a/testsuite/tests/codeGen/should_compile/T13233.hs b/testsuite/tests/codeGen/should_compile/T13233.hs new file mode 100644 index 0000000..bb79856 --- /dev/null +++ b/testsuite/tests/codeGen/should_compile/T13233.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeInType #-} +{-# LANGUAGE UnboxedTuples #-} +module Bug where + +import GHC.Exts (TYPE) + +class Foo (a :: TYPE rep) where + bar :: forall (b :: TYPE rep2). (a -> a -> b) -> a -> a -> b + +baz :: forall (a :: TYPE rep). Foo a => a -> a -> (# a, a #) +baz = bar (#,#) diff --git a/testsuite/tests/codeGen/should_compile/all.T b/testsuite/tests/codeGen/should_compile/all.T index 6ae4e1c..a73a9d6 100644 --- a/testsuite/tests/codeGen/should_compile/all.T +++ b/testsuite/tests/codeGen/should_compile/all.T @@ -35,3 +35,4 @@ test('T10667', [ when((arch('powerpc64') or arch('powerpc64le')), compile, ['-g']) test('T12115', normal, compile, ['']) test('T12355', normal, compile, ['']) +test('T13233', expect_broken(13233), compile, ['']) From git at git.haskell.org Fri Mar 24 14:54:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Mar 2017 14:54:44 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add testcase for #13429 (be8122a) Message-ID: <20170324145444.1162B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/be8122ab72aeec509b5ce4b4f05fbc5cdb77bf5a/ghc >--------------------------------------------------------------- commit be8122ab72aeec509b5ce4b4f05fbc5cdb77bf5a Author: Ben Gamari Date: Thu Mar 23 23:03:54 2017 -0400 testsuite: Add testcase for #13429 >--------------------------------------------------------------- be8122ab72aeec509b5ce4b4f05fbc5cdb77bf5a testsuite/tests/simplCore/should_compile/T13429.hs | 114 +++++++++++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 2 files changed, 115 insertions(+) diff --git a/testsuite/tests/simplCore/should_compile/T13429.hs b/testsuite/tests/simplCore/should_compile/T13429.hs new file mode 100644 index 0000000..cc9b4d2 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T13429.hs @@ -0,0 +1,114 @@ +{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} +module Loop (Array(..), Image(..), X, promote, correlate) where +import Data.Maybe (fromMaybe) + +data Kernel e = Kernel Int Int !(Vector (Int, Int, e)) deriving (Show) + + +toKernel :: Array X e => Image X e -> Kernel e +toKernel img = + Kernel m2 n2 $ filter (\(_, _, x) -> x /= 0) $ imap addIx $ toVector img + where + (m, n) = dims img + (m2, n2) = (m `div` 2, n `div` 2) + addIx k (PixelX x) = + let (i, j) = toIx n k + in (i - m2, j - n2, x) + +correlate :: Array cs e => Image X e -> Image cs e -> Image cs e +correlate kernelImg imgM = makeImage (dims imgM) stencil + where + !(Kernel kM2 kN2 kernelV) = toKernel kernelImg + kLen = length kernelV + stencil (i, j) = + loop 0 (promote 0) $ \ k acc -> + let (iDelta, jDelta, x) = kernelV !! k + imgPx = index imgM (i + iDelta, j + jDelta) + in liftPx2 (+) acc (liftPx (x *) imgPx) + loop init' initAcc f = go init' initAcc + where + go step acc = + if step < kLen + then go (step + 1) (f step acc) + else acc +{-# INLINE correlate #-} + + + +-- | A Pixel family with a color space and a precision of elements. +data family Pixel cs e :: * + + +class (Eq e, Num e) => ColorSpace cs e where + promote :: e -> Pixel cs e + liftPx :: (e -> e) -> Pixel cs e -> Pixel cs e + liftPx2 :: (e -> e -> e) -> Pixel cs e -> Pixel cs e -> Pixel cs e + + + +data family Image cs e :: * + +class ColorSpace cs e => Array cs e where + dims :: Image cs e -> (Int, Int) + makeImage :: (Int, Int) -> ((Int, Int) -> Pixel cs e) -> Image cs e + toVector :: Image cs e -> Vector (Pixel cs e) + index :: Image cs e -> (Int, Int) -> Pixel cs e + +fromIx :: Int -> (Int, Int) -> Int +fromIx n (i, j) = n * i + j + +toIx :: Int -> Int -> (Int, Int) +toIx n k = divMod k n + +instance (Show (Pixel cs e), ColorSpace cs e, Array cs e) => + Show (Image cs e) where + show img = + let (m, n) = dims img + in ": " ++ show (toVector img) + + +data X = X + +newtype instance Pixel X e = PixelX e + +instance Show e => Show (Pixel X e) where + show (PixelX e) = "Pixel: " ++ show e + + +instance (Eq e, Num e) => ColorSpace X e where + promote = PixelX + liftPx f (PixelX g) = PixelX (f g) + liftPx2 f (PixelX g1) (PixelX g2) = PixelX (f g1 g2) + + +data instance Image X e = VImage Int Int (Vector (Pixel X e)) + +instance ColorSpace X e => Array X e where + dims (VImage m n _) = (m, n) + makeImage (m, n) f = VImage m n $ generate (m * n) (f . toIx n) + toVector (VImage _ _ v) = v + index (VImage _ n v) ix = fromMaybe (promote 0) (v !? (fromIx n ix)) + + +-- Vector emulation + +type Vector a = [a] + +imap :: (Num a, Enum a) => (a -> b -> c) -> [b] -> [c] +imap f = zipWith f [0..] + +(!?) :: [a] -> Int -> Maybe a +(!?) ls i + | i < 0 || i >= length ls = Nothing + | otherwise = Just (ls !! i) + +generate :: (Ord t, Num t) => t -> (t -> a) -> [a] +generate n f = go (n-1) [] where + go i acc | i < 0 = acc + | otherwise = go (i-1) (f i : acc) + diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 98d7d79..d6a539e 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -252,3 +252,4 @@ test('T13338', only_ways(['optasm']), compile, ['-dcore-lint']) test('T13367', normal, run_command, ['$MAKE -s --no-print-directory T13367']) test('T13417', normal, compile, ['-O']) test('T13413', normal, compile, ['']) +test('T13429', normal, compile, ['']) From git at git.haskell.org Sat Mar 25 14:50:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 25 Mar 2017 14:50:44 +0000 (UTC) Subject: [commit: packages/array] master: T229: Rework to pass on 32-bit machines (e96a8bf) Message-ID: <20170325145044.EBD0E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array On branch : master Link : http://git.haskell.org/packages/array.git/commitdiff/e96a8bf8ae101a91cfebf7be1cf956376b951b43 >--------------------------------------------------------------- commit e96a8bf8ae101a91cfebf7be1cf956376b951b43 Author: Ben Gamari Date: Fri Mar 24 12:51:59 2017 -0400 T229: Rework to pass on 32-bit machines Previously it failed with, -T229: Data.Array.Base.safe_scale: Overflow; scale: 4, n: 4611686018427387904 -CallStack (from HasCallStack): - error, called at libraries/array/Data/Array/Base.hs ... +T229: Ix{Int}.index: Index (17) out of range ((0,-1)) >--------------------------------------------------------------- e96a8bf8ae101a91cfebf7be1cf956376b951b43 tests/T229.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/T229.hs b/tests/T229.hs index 2265852..1d8c157 100644 --- a/tests/T229.hs +++ b/tests/T229.hs @@ -5,5 +5,11 @@ import Data.Word main :: IO () main = do -- This should fail due to integer overflow +#if WORD_SIZE == 8 m <- newArray_ (0,2^62-1) :: IO (IOUArray Int Word32) -- allocates 0 bytes readArray m 17 >>= print -- Read some random location in address space +#else + m <- newArray_ (0,2^30-1) :: IO (IOUArray Int Word32) -- allocates 0 bytes + readArray m 17 >>= print -- Read some random location in address space +#endif + From git at git.haskell.org Sun Mar 26 14:49:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Mar 2017 14:49:09 +0000 (UTC) Subject: [commit: ghc] master: linker: fix OpenBSD build failure, EM_PPC64 is not defined there (6c73504) Message-ID: <20170326144909.ACC033A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6c73504ac5f4e951062d5e868fa2b69b028b6e79/ghc >--------------------------------------------------------------- commit 6c73504ac5f4e951062d5e868fa2b69b028b6e79 Author: Sergei Trofimovich Date: Sun Mar 26 15:40:40 2017 +0100 linker: fix OpenBSD build failure, EM_PPC64 is not defined there Adam Steen reported build failure on OpenBSD: rts/linker/Elf.c:402:0: error: error: 'EM_PPC64' undeclared (first use in this function) case EM_PPC64: IF_DEBUG(linker,debugBelch( "powerpc64" )); OpenBSD-6.0 does not define EM_PPC64: /usr/include/sys/exec_elf.h:#define EM_PPC 20 /* PowerPC */ Reported-by: Adam Steen Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 6c73504ac5f4e951062d5e868fa2b69b028b6e79 rts/linker/Elf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c index 604c3dc..e8f6aab 100644 --- a/rts/linker/Elf.c +++ b/rts/linker/Elf.c @@ -399,10 +399,12 @@ ocVerifyImage_ELF ( ObjectCode* oc ) case EM_IA_64: IF_DEBUG(linker,debugBelch( "ia64" )); break; #endif case EM_PPC: IF_DEBUG(linker,debugBelch( "powerpc32" )); break; +#ifdef EM_PPC64 case EM_PPC64: IF_DEBUG(linker,debugBelch( "powerpc64" )); errorBelch("%s: RTS linker not implemented on PowerPC 64-bit", oc->fileName); return 0; +#endif #ifdef EM_X86_64 case EM_X86_64: IF_DEBUG(linker,debugBelch( "x86_64" )); break; #elif defined(EM_AMD64) From git at git.haskell.org Sun Mar 26 22:07:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Mar 2017 22:07:52 +0000 (UTC) Subject: [commit: packages/array] master: T229: Enable -XCPP (82a50c4) Message-ID: <20170326220752.1ACAB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array On branch : master Link : http://git.haskell.org/packages/array.git/commitdiff/82a50c4044bf176b713be1fa9cc1a004df203658 >--------------------------------------------------------------- commit 82a50c4044bf176b713be1fa9cc1a004df203658 Author: Ben Gamari Date: Sun Mar 26 13:02:10 2017 -0400 T229: Enable -XCPP >--------------------------------------------------------------- 82a50c4044bf176b713be1fa9cc1a004df203658 tests/T229.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/T229.hs b/tests/T229.hs index 1d8c157..9f4fd88 100644 --- a/tests/T229.hs +++ b/tests/T229.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE CPP #-} + import Data.Array.MArray import Data.Array.IO import Data.Word From git at git.haskell.org Sun Mar 26 22:10:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Mar 2017 22:10:30 +0000 (UTC) Subject: [commit: ghc] master: rts: Fix stat output on 32-bit platforms (94ec48f) Message-ID: <20170326221030.F0D183A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/94ec48f8a25d5a381a5d42016baa0333c186a442/ghc >--------------------------------------------------------------- commit 94ec48f8a25d5a381a5d42016baa0333c186a442 Author: Ben Gamari Date: Fri Mar 24 14:59:14 2017 -0400 rts: Fix stat output on 32-bit platforms The formatting strings fell out of sync with the arguments. >--------------------------------------------------------------- 94ec48f8a25d5a381a5d42016baa0333c186a442 rts/Stats.c | 58 +++++++++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/rts/Stats.c b/rts/Stats.c index 217bace..5f5fa58 100644 --- a/rts/Stats.c +++ b/rts/Stats.c @@ -757,35 +757,43 @@ stat_exit (void) } if (RtsFlags.GcFlags.giveStats == ONELINE_GC_STATS) { - char *fmt1, *fmt2; - if (RtsFlags.MiscFlags.machineReadable) { - fmt1 = " [(\"bytes allocated\", \"%llu\")\n"; - fmt2 = " ,(\"num_GCs\", \"%d\")\n" - " ,(\"average_bytes_used\", \"%ld\")\n" - " ,(\"max_bytes_used\", \"%ld\")\n" - " ,(\"num_byte_usage_samples\", \"%ld\")\n" - " ,(\"peak_megabytes_allocated\", \"%lu\")\n" - " ,(\"init_cpu_seconds\", \"%.3f\")\n" - " ,(\"init_wall_seconds\", \"%.3f\")\n" - " ,(\"mutator_cpu_seconds\", \"%.3f\")\n" - " ,(\"mutator_wall_seconds\", \"%.3f\")\n" - " ,(\"GC_cpu_seconds\", \"%.3f\")\n" - " ,(\"GC_wall_seconds\", \"%.3f\")\n" - " ]\n"; - } - else { - fmt1 = "<>\n"; + } /* print the long long separately to avoid bugginess on mingwin (2001-07-02, mingw-0.5) */ - statsPrintf(fmt1, stats.allocated_bytes); - statsPrintf(fmt2, + statsPrintf(fmt, + stats.allocated_bytes, stats.gcs, - stats.major_gcs == 0 ? 0 : - stats.cumulative_live_bytes/stats.major_gcs, + (uint64_t) + (stats.major_gcs == 0 ? 0 : + stats.cumulative_live_bytes/stats.major_gcs), stats.max_live_bytes, stats.major_gcs, - (unsigned long)(peak_mblocks_allocated * MBLOCK_SIZE / (1024L * 1024L)), + (uint64_t) (peak_mblocks_allocated * MBLOCK_SIZE / (1024L * 1024L)), TimeToSecondsDbl(init_cpu), TimeToSecondsDbl(init_elapsed), TimeToSecondsDbl(mut_cpu), TimeToSecondsDbl(mut_elapsed), TimeToSecondsDbl(gc_cpu), TimeToSecondsDbl(gc_elapsed)); From git at git.haskell.org Sun Mar 26 22:10:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Mar 2017 22:10:33 +0000 (UTC) Subject: [commit: ghc] master: Eliminate word-size dependence in HsDumpAst output (bc9f280) Message-ID: <20170326221033.BB8CA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bc9f280acf82d34fea72199a34b00c414c3ef59e/ghc >--------------------------------------------------------------- commit bc9f280acf82d34fea72199a34b00c414c3ef59e Author: Ben Gamari Date: Fri Mar 24 12:05:23 2017 -0400 Eliminate word-size dependence in HsDumpAst output Fixes DumpTypecheckedAst output on 32-bit platforms. >--------------------------------------------------------------- bc9f280acf82d34fea72199a34b00c414c3ef59e compiler/hsSyn/HsDumpAst.hs | 16 ++++++- .../should_compile/DumpTypecheckedAst.stderr | 54 +++++++++++----------- 2 files changed, 42 insertions(+), 28 deletions(-) diff --git a/compiler/hsSyn/HsDumpAst.hs b/compiler/hsSyn/HsDumpAst.hs index f735488..b76b3fb 100644 --- a/compiler/hsSyn/HsDumpAst.hs +++ b/compiler/hsSyn/HsDumpAst.hs @@ -18,6 +18,7 @@ module HsDumpAst ( import Data.Data hiding (Fixity) import Data.List import Bag +import BasicTypes import FastString import NameSet import Name @@ -46,7 +47,7 @@ showAstData b = showAstData' 0 showAstData' n = generic `ext1Q` list - `extQ` string `extQ` fastString `extQ` srcSpan + `extQ` string `extQ` fastString `extQ` srcSpan `extQ` lit `extQ` bytestring `extQ` name `extQ` occName `extQ` moduleName `extQ` var `extQ` dataCon @@ -76,6 +77,19 @@ showAstData b = showAstData' 0 ++ intercalate "," (map (showAstData' (n+1)) l) ++ "]" + -- Eliminate word-size dependence + lit :: HsLit -> String + lit (HsWordPrim s x) = numericLit "HsWord{64}Prim" x s + lit (HsWord64Prim s x) = numericLit "HsWord{64}Prim" x s + lit (HsIntPrim s x) = numericLit "HsInt{64}Prim" x s + lit (HsInt64Prim s x) = numericLit "HsInt{64}Prim" x s + lit l = generic l + + numericLit :: String -> Integer -> SourceText -> String + numericLit tag x s = indent n ++ unwords [ "{" ++ tag + , generic x + , generic s ++ "}" ] + name :: Name -> String name = ("{Name: "++) . (++"}") . showSDocDebug_ . ppr diff --git a/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr b/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr index 3725b6f..4b10222 100644 --- a/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr +++ b/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr @@ -21,14 +21,14 @@ ({abstract:ConLike}))) ({ } (HsLit - (HsWordPrim - (NoSourceText) - (14073232900889011755)))))) + {HsWord{64}Prim + (14073232900889011755) + (NoSourceText)})))) ({ } (HsLit - (HsWordPrim - (NoSourceText) - (2739668351064589274)))))) + {HsWord{64}Prim + (2739668351064589274) + (NoSourceText)})))) ({ } (HsVar ({ }{Var: (main:DumpTypecheckedAst.$trModule{v} [lidx] :: ghc-prim:GHC.Types.Module{tc})}))))) @@ -45,9 +45,9 @@ (NoSourceText) "Peano"))))))))) ({ } (HsLit - (HsIntPrim - (SourceText "0") - (0)))))) + {HsInt{64}Prim + (0) + (SourceText "0")})))) ({ } (HsVar ({ }{Var: (ghc-prim:GHC.Types.krep$*{v} [gid] :: ghc-prim:GHC.Types.KindRep{tc})}))))) @@ -71,14 +71,14 @@ ({abstract:ConLike}))) ({ } (HsLit - (HsWordPrim - (NoSourceText) - (13760111476013868540)))))) + {HsWord{64}Prim + (13760111476013868540) + (NoSourceText)})))) ({ } (HsLit - (HsWordPrim - (NoSourceText) - (12314848029315386153)))))) + {HsWord{64}Prim + (12314848029315386153) + (NoSourceText)})))) ({ } (HsVar ({ }{Var: (main:DumpTypecheckedAst.$trModule{v} [lidx] :: ghc-prim:GHC.Types.Module{tc})}))))) @@ -95,9 +95,9 @@ (NoSourceText) "'Zero"))))))))) ({ } (HsLit - (HsIntPrim - (SourceText "0") - (0)))))) + {HsInt{64}Prim + (0) + (SourceText "0")})))) ({ } (HsVar ({ }{Var: ($krep{v} [lid] :: ghc-prim:GHC.Types.KindRep{tc})}))))) @@ -121,14 +121,14 @@ ({abstract:ConLike}))) ({ } (HsLit - (HsWordPrim - (NoSourceText) - (1143980031331647856)))))) + {HsWord{64}Prim + (1143980031331647856) + (NoSourceText)})))) ({ } (HsLit - (HsWordPrim - (NoSourceText) - (14802086722010293686)))))) + {HsWord{64}Prim + (14802086722010293686) + (NoSourceText)})))) ({ } (HsVar ({ }{Var: (main:DumpTypecheckedAst.$trModule{v} [lidx] :: ghc-prim:GHC.Types.Module{tc})}))))) @@ -145,9 +145,9 @@ (NoSourceText) "'Succ"))))))))) ({ } (HsLit - (HsIntPrim - (SourceText "0") - (0)))))) + {HsInt{64}Prim + (0) + (SourceText "0")})))) ({ } (HsVar ({ }{Var: ($krep{v} [lid] :: ghc-prim:GHC.Types.KindRep{tc})}))))) From git at git.haskell.org Sun Mar 26 22:10:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Mar 2017 22:10:39 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add 32-bit output for compact_share test (d5847cf) Message-ID: <20170326221039.802EF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d5847cfeee824867af1259cccab048f331a9a204/ghc >--------------------------------------------------------------- commit d5847cfeee824867af1259cccab048f331a9a204 Author: Ben Gamari Date: Fri Mar 24 14:27:23 2017 -0400 testsuite: Add 32-bit output for compact_share test >--------------------------------------------------------------- d5847cfeee824867af1259cccab048f331a9a204 libraries/ghc-compact/tests/compact_share.stdout-ws-32 | 4 ++++ .../tests/{compact_share.stdout => compact_share.stdout-ws-64} | 0 2 files changed, 4 insertions(+) diff --git a/libraries/ghc-compact/tests/compact_share.stdout-ws-32 b/libraries/ghc-compact/tests/compact_share.stdout-ws-32 new file mode 100644 index 0000000..a6ac978 --- /dev/null +++ b/libraries/ghc-compact/tests/compact_share.stdout-ws-32 @@ -0,0 +1,4 @@ +275599 +1900544 +275599 +1114112 diff --git a/libraries/ghc-compact/tests/compact_share.stdout b/libraries/ghc-compact/tests/compact_share.stdout-ws-64 similarity index 100% rename from libraries/ghc-compact/tests/compact_share.stdout rename to libraries/ghc-compact/tests/compact_share.stdout-ws-64 From git at git.haskell.org Sun Mar 26 22:10:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Mar 2017 22:10:36 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Allow join007 to pass on 32-bit machines (aecbfb9) Message-ID: <20170326221036.952633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/aecbfb908a11991eb23b790a440efe4697ffb86a/ghc >--------------------------------------------------------------- commit aecbfb908a11991eb23b790a440efe4697ffb86a Author: Ben Gamari Date: Fri Mar 24 12:27:35 2017 -0400 testsuite: Allow join007 to pass on 32-bit machines The output of the test overflows. Given that the result is stable regardless of whether it overflows, I just made the expected output word-size dependent. >--------------------------------------------------------------- aecbfb908a11991eb23b790a440efe4697ffb86a testsuite/tests/perf/join_points/join007.hs | 2 ++ testsuite/tests/perf/join_points/join007.stdout-ws-32 | 1 + .../tests/perf/join_points/{join007.stdout => join007.stdout-ws-64} | 0 3 files changed, 3 insertions(+) diff --git a/testsuite/tests/perf/join_points/join007.hs b/testsuite/tests/perf/join_points/join007.hs index aa2f68c..59cc99b 100644 --- a/testsuite/tests/perf/join_points/join007.hs +++ b/testsuite/tests/perf/join_points/join007.hs @@ -39,4 +39,6 @@ enumFromToS lo hi = Stream next lo test :: Int -> Int -> Int test lo hi = sumS (filterS even (enumFromToS lo hi)) +-- Note that this overflows on 32-bit machines and therefore we have two stdout +-- files main = print $ test 1 10000000 diff --git a/testsuite/tests/perf/join_points/join007.stdout-ws-32 b/testsuite/tests/perf/join_points/join007.stdout-ws-32 new file mode 100644 index 0000000..d4692e3 --- /dev/null +++ b/testsuite/tests/perf/join_points/join007.stdout-ws-32 @@ -0,0 +1 @@ +-999630016 diff --git a/testsuite/tests/perf/join_points/join007.stdout b/testsuite/tests/perf/join_points/join007.stdout-ws-64 similarity index 100% rename from testsuite/tests/perf/join_points/join007.stdout rename to testsuite/tests/perf/join_points/join007.stdout-ws-64 From git at git.haskell.org Sun Mar 26 22:10:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Mar 2017 22:10:45 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Update performance numbers for 32-bit platforms (6d774ff) Message-ID: <20170326221045.BDAF13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6d774ff2fde787d2032bbcefcb3afd2262b3916e/ghc >--------------------------------------------------------------- commit 6d774ff2fde787d2032bbcefcb3afd2262b3916e Author: Ben Gamari Date: Fri Mar 24 12:26:03 2017 -0400 testsuite: Update performance numbers for 32-bit platforms >--------------------------------------------------------------- 6d774ff2fde787d2032bbcefcb3afd2262b3916e .../{T13257.stderr => T13257.stderr-ws-32} | 2 +- .../{T13257.stderr => T13257.stderr-ws-64} | 0 testsuite/tests/perf/compiler/all.T | 66 +++++++++++++++------- testsuite/tests/perf/haddock/all.T | 9 ++- testsuite/tests/perf/should_run/all.T | 34 +++++++---- testsuite/tests/perf/space_leaks/all.T | 8 ++- 6 files changed, 79 insertions(+), 40 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 6d774ff2fde787d2032bbcefcb3afd2262b3916e From git at git.haskell.org Sun Mar 26 22:10:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Mar 2017 22:10:42 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Make T10245 pass on 32-bit platforms (ff6ee99) Message-ID: <20170326221042.6313F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ff6ee998e06c74bf41841a9ccf2e55a722268e91/ghc >--------------------------------------------------------------- commit ff6ee998e06c74bf41841a9ccf2e55a722268e91 Author: Ben Gamari Date: Fri Mar 24 11:36:31 2017 -0400 testsuite: Make T10245 pass on 32-bit platforms >--------------------------------------------------------------- ff6ee998e06c74bf41841a9ccf2e55a722268e91 testsuite/tests/codeGen/should_run/T10245.hs | 12 ++++++++++++ testsuite/tests/codeGen/should_run/T10245.stdout-ws-32 | 3 +++ .../should_run/{T10245.stdout => T10245.stdout-ws-64} | 0 3 files changed, 15 insertions(+) diff --git a/testsuite/tests/codeGen/should_run/T10245.hs b/testsuite/tests/codeGen/should_run/T10245.hs index 7094a1d..43383a3 100644 --- a/testsuite/tests/codeGen/should_run/T10245.hs +++ b/testsuite/tests/codeGen/should_run/T10245.hs @@ -1,11 +1,23 @@ +{-# LANGUAGE CPP #-} + +#include "MachDeps.h" + f :: Int -> String f n = case n of +#if WORD_SIZE_IN_BITS == 64 0x8000000000000000 -> "yes" +#else + 0x80000000 -> "yes" +#endif _ -> "no" {-# NOINLINE f #-} main = do +#if WORD_SIZE_IN_BITS == 64 let string = "0x8000000000000000" +#else + let string = "0x80000000" +#endif let i = read string :: Integer let i' = fromIntegral i :: Int print i diff --git a/testsuite/tests/codeGen/should_run/T10245.stdout-ws-32 b/testsuite/tests/codeGen/should_run/T10245.stdout-ws-32 new file mode 100644 index 0000000..a6c8f1f --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T10245.stdout-ws-32 @@ -0,0 +1,3 @@ +2147483648 +-2147483648 +"yes" diff --git a/testsuite/tests/codeGen/should_run/T10245.stdout b/testsuite/tests/codeGen/should_run/T10245.stdout-ws-64 similarity index 100% rename from testsuite/tests/codeGen/should_run/T10245.stdout rename to testsuite/tests/codeGen/should_run/T10245.stdout-ws-64 From git at git.haskell.org Sun Mar 26 22:10:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Mar 2017 22:10:48 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Note x87 terribleness in num009 (a1b7e86) Message-ID: <20170326221048.820EB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a1b7e866378e848d50b940595aa43fa63672cf37/ghc >--------------------------------------------------------------- commit a1b7e866378e848d50b940595aa43fa63672cf37 Author: Ben Gamari Date: Fri Mar 24 13:22:08 2017 -0400 testsuite: Note x87 terribleness in num009 >--------------------------------------------------------------- a1b7e866378e848d50b940595aa43fa63672cf37 libraries/base/tests/Numeric/num009.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/base/tests/Numeric/num009.hs b/libraries/base/tests/Numeric/num009.hs index 429f0bf..c0dec43 100644 --- a/libraries/base/tests/Numeric/num009.hs +++ b/libraries/base/tests/Numeric/num009.hs @@ -1,4 +1,8 @@ -- trac #2059 +-- +-- Note that this test fails miserably when compiled to use X87 floating point. +-- For instance, in the case of (sin 1e20) the X86 FSIN instruction doesn't even +-- get the sign right on my machine. module Main(main) where @@ -20,7 +24,7 @@ test :: (RealFloat a, Floating a, RealFloat b, Floating b, Show b) test s f g x = do let y = realToFrac (f (realToFrac x)) z = g x unless (y == z) $ do - putStrLn (s ++ ' ':show x) + putStrLn ("uh oh! " ++ s ++ ' ':show x) print y print z print $ decodeFloat y From git at git.haskell.org Sun Mar 26 22:10:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Mar 2017 22:10:51 +0000 (UTC) Subject: [commit: ghc] master: Bump array submodule (86a0c8f) Message-ID: <20170326221051.3DC7E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/86a0c8f203d4cc997bacfb8f6455353547fafab1/ghc >--------------------------------------------------------------- commit 86a0c8f203d4cc997bacfb8f6455353547fafab1 Author: Ben Gamari Date: Fri Mar 24 23:15:09 2017 -0400 Bump array submodule >--------------------------------------------------------------- 86a0c8f203d4cc997bacfb8f6455353547fafab1 libraries/array | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/array b/libraries/array index 1b9a443..82a50c4 160000 --- a/libraries/array +++ b/libraries/array @@ -1 +1 @@ -Subproject commit 1b9a4430bbd6799f341a829f2d24ffc20e77ba2f +Subproject commit 82a50c4044bf176b713be1fa9cc1a004df203658 From git at git.haskell.org Sun Mar 26 23:29:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Mar 2017 23:29:08 +0000 (UTC) Subject: [commit: packages/array] master: T229: Fix name of WORD_SIZE macro (fc82074) Message-ID: <20170326232908.BD2CB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array On branch : master Link : http://git.haskell.org/packages/array.git/commitdiff/fc82074a9076d650610d71a966d8714f5217257f >--------------------------------------------------------------- commit fc82074a9076d650610d71a966d8714f5217257f Author: Ben Gamari Date: Sun Mar 26 19:06:04 2017 -0400 T229: Fix name of WORD_SIZE macro >--------------------------------------------------------------- fc82074a9076d650610d71a966d8714f5217257f tests/T229.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/T229.hs b/tests/T229.hs index 9f4fd88..1714849 100644 --- a/tests/T229.hs +++ b/tests/T229.hs @@ -1,5 +1,7 @@ {-# LANGUAGE CPP #-} +#include "MachDeps.h" + import Data.Array.MArray import Data.Array.IO import Data.Word @@ -7,7 +9,7 @@ import Data.Word main :: IO () main = do -- This should fail due to integer overflow -#if WORD_SIZE == 8 +#if WORD_SIZE_IN_BITS == 64 m <- newArray_ (0,2^62-1) :: IO (IOUArray Int Word32) -- allocates 0 bytes readArray m 17 >>= print -- Read some random location in address space #else From git at git.haskell.org Mon Mar 27 02:59:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:05 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix Windows x86 build (4a0b1dd) Message-ID: <20170327025905.0D1443A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/4a0b1dd8fe165a3f869824ad3e63fb0a5a1eb99f/ghc >--------------------------------------------------------------- commit 4a0b1dd8fe165a3f869824ad3e63fb0a5a1eb99f Author: Tamar Christina Date: Sat Mar 18 15:19:01 2017 +0000 Fix Windows x86 build Summary: Fix some `-Werror` failures and work around a bug in the `x86` version of `mingw-w64-crt`'s libraries. The bump in the `win32` submodule is required for this. Test Plan: ./validate Reviewers: austin, bgamari, erikd, simonmar Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3362 (cherry picked from commit 713ff9207e0f2493bd498ff725012c9895f728c8) >--------------------------------------------------------------- 4a0b1dd8fe165a3f869824ad3e63fb0a5a1eb99f libraries/Win32 | 2 +- rts/linker/PEi386.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/Win32 b/libraries/Win32 index 06d5849..67c5cc5 160000 --- a/libraries/Win32 +++ b/libraries/Win32 @@ -1 +1 @@ -Subproject commit 06d584916a4c32e6d31b60499afd52e32e4281ef +Subproject commit 67c5cc56f0faeacc553471c8a7d9b9b95e011731 diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c index 9c7f4db..c27dd31 100644 --- a/rts/linker/PEi386.c +++ b/rts/linker/PEi386.c @@ -1357,9 +1357,11 @@ ocResolve_PEi386 ( ObjectCode* oc ) sym = (COFF_symbol*) myindex ( sizeof_COFF_symbol, symtab, reltab_j->SymbolTableIndex ); +#if defined(x86_64_HOST_ARCH) uint64_t symIndex = ((uint64_t)myindex(sizeof_COFF_symbol, symtab, reltab_j->SymbolTableIndex) - (uint64_t)symtab) / sizeof_COFF_symbol; +#endif IF_DEBUG(linker, debugBelch( From git at git.haskell.org Mon Mar 27 02:59:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:13 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump haddock submodule (13ad99d) Message-ID: <20170327025913.325D13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/13ad99d51e1f8e07120c708866ece881bbca5665/ghc >--------------------------------------------------------------- commit 13ad99d51e1f8e07120c708866ece881bbca5665 Author: Ben Gamari Date: Thu Mar 23 15:31:37 2017 -0400 Bump haddock submodule >--------------------------------------------------------------- 13ad99d51e1f8e07120c708866ece881bbca5665 utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 4f249c9..0567d93 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 4f249c9b64d50d79e7ba703289cd67293a76821a +Subproject commit 0567d936e02dcbc41c62b4dd63c7aaafc3383844 From git at git.haskell.org Mon Mar 27 02:59:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:10 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Correctly account for -package-db ordering when picking packages. (1682980) Message-ID: <20170327025910.7883A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/1682980d7f5262fb42c0d11e8366bde6bc98c792/ghc >--------------------------------------------------------------- commit 1682980d7f5262fb42c0d11e8366bde6bc98c792 Author: Edward Z. Yang Date: Sun Mar 19 16:07:49 2017 -0700 Correctly account for -package-db ordering when picking packages. Summary: When I originally implemented ABI-based shadowing as per ee4e1654c31b9c6f6ad9b19ece25f040bbbcbd72, I switched our strategy from pasting together lists to creating a map of all units first, and then selecting packages from this. However, what I did not realize when doing this was that we actually depended on the *ordering* of these lists later, when we selected a preferred package to use. The crux is if I have -package-db db1 -package-db db2 -package p-0.1, and p-0.1 is provided by both db1 and db2, which one does the -package flag select? Previously, this was undetermined; now we always select the instance from the LATEST package database. (If p-0.1 shows up multiple times in the same database, once again the chosen package is undefined.) The reason why cabal08 intermittently failed was that, in practice, we were sorting on the UnitId, so when we bumped version numbers, that often wibbled the UnitIds so that they compared oppositely. I've extended the test so that we check that the relation is antisymmetric. Fixes #13313 Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: bgamari, austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3369 (cherry picked from commit e0eaea918c32b3aa445708656876d1e2aef94a13) >--------------------------------------------------------------- 1682980d7f5262fb42c0d11e8366bde6bc98c792 compiler/main/Packages.hs | 111 +++++++++++++++++++-------- testsuite/tests/cabal/cabal08/Makefile | 8 +- testsuite/tests/cabal/cabal08/all.T | 3 +- testsuite/tests/cabal/cabal08/cabal08.stdout | 6 ++ 4 files changed, 93 insertions(+), 35 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 1682980d7f5262fb42c0d11e8366bde6bc98c792 From git at git.haskell.org Mon Mar 27 02:59:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:07 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Make unsafeInterleaveST less unsafe (167548f) Message-ID: <20170327025907.B5BA13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/167548f4cd087535a6c4c9fc642b60669b4dc019/ghc >--------------------------------------------------------------- commit 167548f4cd087535a6c4c9fc642b60669b4dc019 Author: David Feuer Date: Wed Mar 22 17:25:03 2017 -0400 Make unsafeInterleaveST less unsafe * Make `unsafeInterleaveST` use `noDuplicate#` like `unsafeInterleaveIO` does to prevent the suspended action from being run in two threads. * In order to accomplish this without `unsafeCoerce#`, generalize the type of `noDuplicate#`. * Add `unsafeDupableInterleaveST` to get the old behavior. * Document unsafe `ST` functions and clean up some related documentation. Fixes #13457 Reviewers: austin, hvr, bgamari, ekmett Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3370 (cherry picked from commit 30d68d630c1685bb81ec4afdaf6d483ba8aafd38) >--------------------------------------------------------------- 167548f4cd087535a6c4c9fc642b60669b4dc019 compiler/prelude/primops.txt.pp | 2 +- libraries/base/Control/Monad/ST/Imp.hs | 4 +++- libraries/base/Control/Monad/ST/Unsafe.hs | 1 + libraries/base/GHC/IO.hs | 19 ++++++++++++++----- libraries/base/GHC/IO/Unsafe.hs | 16 +++++++++++++++- libraries/base/GHC/ST.hs | 26 +++++++++++++++++++++++--- 6 files changed, 57 insertions(+), 11 deletions(-) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 64971a3..5d0a2a4 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -2344,7 +2344,7 @@ primop IsCurrentThreadBoundOp "isCurrentThreadBound#" GenPrimOp has_side_effects = True primop NoDuplicateOp "noDuplicate#" GenPrimOp - State# RealWorld -> State# RealWorld + State# s -> State# s with out_of_line = True has_side_effects = True diff --git a/libraries/base/Control/Monad/ST/Imp.hs b/libraries/base/Control/Monad/ST/Imp.hs index 984970f..c053dcc 100644 --- a/libraries/base/Control/Monad/ST/Imp.hs +++ b/libraries/base/Control/Monad/ST/Imp.hs @@ -29,10 +29,12 @@ module Control.Monad.ST.Imp ( -- * Unsafe operations unsafeInterleaveST, + unsafeDupableInterleaveST, unsafeIOToST, unsafeSTToIO ) where -import GHC.ST ( ST, runST, fixST, unsafeInterleaveST ) +import GHC.ST ( ST, runST, fixST, unsafeInterleaveST + , unsafeDupableInterleaveST ) import GHC.Base ( RealWorld ) import GHC.IO ( stToIO, unsafeIOToST, unsafeSTToIO ) diff --git a/libraries/base/Control/Monad/ST/Unsafe.hs b/libraries/base/Control/Monad/ST/Unsafe.hs index 9fa4b73..b8560b1 100644 --- a/libraries/base/Control/Monad/ST/Unsafe.hs +++ b/libraries/base/Control/Monad/ST/Unsafe.hs @@ -21,6 +21,7 @@ module Control.Monad.ST.Unsafe ( -- * Unsafe operations unsafeInterleaveST, + unsafeDupableInterleaveST, unsafeIOToST, unsafeSTToIO ) where diff --git a/libraries/base/GHC/IO.hs b/libraries/base/GHC/IO.hs index 8459db6..63b47ff 100644 --- a/libraries/base/GHC/IO.hs +++ b/libraries/base/GHC/IO.hs @@ -84,22 +84,31 @@ failIO s = IO (raiseIO# (toException (userError s))) -- --------------------------------------------------------------------------- -- Coercions between IO and ST --- | A monad transformer embedding strict state transformers in the 'IO' --- monad. The 'RealWorld' parameter indicates that the internal state +-- | Embed a strict state transformer in an 'IO' +-- action. The 'RealWorld' parameter indicates that the internal state -- used by the 'ST' computation is a special one supplied by the 'IO' -- monad, and thus distinct from those used by invocations of 'runST'. stToIO :: ST RealWorld a -> IO a stToIO (ST m) = IO m +-- | Convert an 'IO' action into an 'ST' action. The type of the result +-- is constrained to use a 'RealWorld' state, and therefore the result cannot +-- be passed to 'runST'. ioToST :: IO a -> ST RealWorld a ioToST (IO m) = (ST m) --- This relies on IO and ST having the same representation modulo the --- constraint on the type of the state --- +-- | Convert an 'IO' action to an 'ST' action. +-- This relies on 'IO' and 'ST' having the same representation modulo the +-- constraint on the type of the state. unsafeIOToST :: IO a -> ST s a unsafeIOToST (IO io) = ST $ \ s -> (unsafeCoerce# io) s +-- | Convert an 'ST' action to an 'IO' action. +-- This relies on 'IO' and 'ST' having the same representation modulo the +-- constraint on the type of the state. +-- +-- For an example demonstrating why this is unsafe, see +-- https://mail.haskell.org/pipermail/haskell-cafe/2009-April/060719.html unsafeSTToIO :: ST s a -> IO a unsafeSTToIO (ST m) = IO (unsafeCoerce# m) diff --git a/libraries/base/GHC/IO/Unsafe.hs b/libraries/base/GHC/IO/Unsafe.hs index 7523535..c1c07ae 100644 --- a/libraries/base/GHC/IO/Unsafe.hs +++ b/libraries/base/GHC/IO/Unsafe.hs @@ -104,7 +104,7 @@ unsafeDupablePerformIO :: IO a -> a unsafeDupablePerformIO (IO m) = case runRW# m of (# _, a #) -> a {-| -'unsafeInterleaveIO' allows 'IO' computation to be deferred lazily. +'unsafeInterleaveIO' allows an 'IO' computation to be deferred lazily. When passed a value of type @IO a@, the 'IO' will only be performed when the value of the @a@ is demanded. This is used to implement lazy file reading, see 'System.IO.hGetContents'. @@ -113,6 +113,9 @@ file reading, see 'System.IO.hGetContents'. unsafeInterleaveIO :: IO a -> IO a unsafeInterleaveIO m = unsafeDupableInterleaveIO (noDuplicate >> m) +-- Note [unsafeDupableInterleaveIO should not be inlined] +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- -- We used to believe that INLINE on unsafeInterleaveIO was safe, -- because the state from this IO thread is passed explicitly to the -- interleaved IO, so it cannot be floated out and shared. @@ -131,7 +134,18 @@ unsafeInterleaveIO m = unsafeDupableInterleaveIO (noDuplicate >> m) -- share and sometimes not (plus it probably breaks the noDuplicate). -- So now, we do not inline unsafeDupableInterleaveIO. +{-| +'unsafeDupableInterleaveIO' allows an 'IO' computation to be deferred lazily. +When passed a value of type @IO a@, the 'IO' will only be performed +when the value of the @a@ is demanded. + +The computation may be performed multiple times by different threads, +possibly at the same time. To ensure that the computation is performed +only once, use 'unsafeInterleaveIO' instead. +-} + {-# NOINLINE unsafeDupableInterleaveIO #-} +-- See Note [unsafeDupableInterleaveIO should not be inlined] unsafeDupableInterleaveIO :: IO a -> IO a unsafeDupableInterleaveIO (IO m) = IO ( \ s -> let diff --git a/libraries/base/GHC/ST.hs b/libraries/base/GHC/ST.hs index 7982d59..4e00c0e 100644 --- a/libraries/base/GHC/ST.hs +++ b/libraries/base/GHC/ST.hs @@ -21,7 +21,7 @@ module GHC.ST ( fixST, runST, -- * Unsafe functions - liftST, unsafeInterleaveST + liftST, unsafeInterleaveST, unsafeDupableInterleaveST ) where import GHC.Base @@ -84,9 +84,29 @@ data STret s a = STret (State# s) a liftST :: ST s a -> State# s -> STret s a liftST (ST m) = \s -> case m s of (# s', r #) -> STret s' r -{-# NOINLINE unsafeInterleaveST #-} +noDuplicateST :: ST s () +noDuplicateST = ST $ \s -> (# noDuplicate# s, () #) + +-- | 'unsafeInterleaveST' allows an 'ST' computation to be deferred +-- lazily. When passed a value of type @ST a@, the 'ST' computation will +-- only be performed when the value of the @a@ is demanded. +{-# INLINE unsafeInterleaveST #-} unsafeInterleaveST :: ST s a -> ST s a -unsafeInterleaveST (ST m) = ST ( \ s -> +unsafeInterleaveST m = unsafeDupableInterleaveST (noDuplicateST >> m) + +-- | 'unsafeDupableInterleaveST' allows an 'ST' computation to be deferred +-- lazily. When passed a value of type @ST a@, the 'ST' computation will +-- only be performed when the value of the @a@ is demanded. +-- +-- The computation may be performed multiple times by different threads, +-- possibly at the same time. To prevent this, use 'unsafeInterleaveST' instead. +-- +-- @since 4.11 +{-# NOINLINE unsafeDupableInterleaveST #-} +-- See Note [unsafeDupableInterleaveIO should not be inlined] +-- in GHC.IO.Unsafe +unsafeDupableInterleaveST :: ST s a -> ST s a +unsafeDupableInterleaveST (ST m) = ST ( \ s -> let r = case m s of (# _, res #) -> res in From git at git.haskell.org Mon Mar 27 02:59:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:16 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Allow colors to be customized (7141a18) Message-ID: <20170327025916.850523A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/7141a183a968b3418c113b234de9f75a0a735766/ghc >--------------------------------------------------------------- commit 7141a183a968b3418c113b234de9f75a0a735766 Author: Phil Ruffwind Date: Thu Mar 23 20:59:01 2017 -0400 Allow colors to be customized Allow customization of diagnostic colors through the GHC_COLORS environment variable. Some color-related code have been refactored to PprColour to reduce the circular dependence between DynFlags, Outputable, ErrUtils. Some color functions that were part of Outputable but were never used have been deleted. Test Plan: validate Reviewers: austin, hvr, bgamari, dfeuer Reviewed By: bgamari, dfeuer Subscribers: dfeuer, rwbarton, thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3364 (cherry picked from commit adf27d614f8a48d8dcf2d4e2e7872f7b3f818364) >--------------------------------------------------------------- 7141a183a968b3418c113b234de9f75a0a735766 compiler/ghc.cabal.in | 1 + compiler/ghc.mk | 1 + compiler/main/DynFlags.hs | 28 ++++++++------ compiler/main/DynFlags.hs-boot | 5 +-- compiler/main/ErrUtils.hs | 39 ++++++++++--------- compiler/utils/Outputable.hs | 87 +++++++---------------------------------- compiler/utils/PprColour.hs | 88 ++++++++++++++++++++++++++++++++++++++++++ compiler/utils/Util.hs | 15 +++++++ docs/users_guide/using.rst | 21 ++++++++-- ghc/GHCi/UI.hs | 2 +- 10 files changed, 176 insertions(+), 111 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 7141a183a968b3418c113b234de9f75a0a735766 From git at git.haskell.org Mon Mar 27 02:59:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:19 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: config.mk.in: Add bzip, gzip, and xz executable names to be overridden (efa9f0f) Message-ID: <20170327025919.3BC383A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/efa9f0fe55f6f9349a20b80b643b6ecdc50bc12a/ghc >--------------------------------------------------------------- commit efa9f0fe55f6f9349a20b80b643b6ecdc50bc12a Author: Ben Gamari Date: Thu Mar 23 20:59:21 2017 -0400 config.mk.in: Add bzip, gzip, and xz executable names to be overridden Reviewers: austin, hvr, erikd Reviewed By: erikd Subscribers: rwbarton, thomie, erikd, snowleopard Differential Revision: https://phabricator.haskell.org/D3367 (cherry picked from commit 1b374402a7a078e53c3e00eb0460e8b22930c453) >--------------------------------------------------------------- efa9f0fe55f6f9349a20b80b643b6ecdc50bc12a configure.ac | 5 +++++ mk/config.mk.in | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 496cd05..af62bd9 100644 --- a/configure.ac +++ b/configure.ac @@ -702,6 +702,11 @@ dnl ** check for tar dnl if GNU tar is named gtar, look for it first. AC_PATH_PROGS(TarCmd,gnutar gtar tar,tar) +dnl ** check for compressors +AC_PATH_PROGS(Bzip2Cmd,bzip2, bzip2) +AC_PATH_PROGS(GzipCmd,gzip, gzip) +AC_PATH_PROGS(XzCmd,pxz xz, xz) + dnl ** check for patch dnl if GNU patch is named gpatch, look for it first AC_PATH_PROGS(PatchCmd,gpatch patch, patch) diff --git a/mk/config.mk.in b/mk/config.mk.in index 729abfa..4e61eea 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -789,9 +789,9 @@ STRIP_CMD = strip endif PATCH_CMD = @PatchCmd@ TAR_CMD = @TarCmd@ -BZIP2_CMD = bzip2 -GZIP_CMD = gzip -XZ_CMD = xz +BZIP2_CMD = @Bzip2Cmd@ +GZIP_CMD = @GzipCmd@ +XZ_CMD = @XzCmd@ # xz is default compression TAR_COMP ?= xz From git at git.haskell.org Mon Mar 27 02:59:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:22 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: x86 nativeGen: Fix test with mask in range [128, 255] (#13425) (85dc062) Message-ID: <20170327025922.71AA83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/85dc0627beeed6e67329c0f8b60fb049f433585a/ghc >--------------------------------------------------------------- commit 85dc0627beeed6e67329c0f8b60fb049f433585a Author: Reid Barton Date: Thu Mar 23 21:02:29 2017 -0400 x86 nativeGen: Fix test with mask in range [128,255] (#13425) My commit bdb0c43c7 optimized the encoding of instructions to test tag bits, but it did not always set exactly the same condition codes since the testb instruction does a single-byte comparison, rather than a full-word comparison. It would be correct to optimize the expression `x .&. 128 > 0` to the sequence testb $128, %al seta %al ; note: 'a' for unsigned comparison, ; not 'g' for signed comparison but the pretty-printer is not the right place to make this kind of context-sensitive optimization. Test Plan: harbormaster Reviewers: trofi, austin, bgamari, dfeuer Reviewed By: trofi, dfeuer Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3359 (cherry picked from commit caf94b062a0e37ffa7048e51447fc9486b658917) >--------------------------------------------------------------- 85dc0627beeed6e67329c0f8b60fb049f433585a compiler/nativeGen/X86/Ppr.hs | 6 +++++- testsuite/tests/codeGen/should_run/T13425.hs | 10 ++++++++++ .../tests/codeGen/should_run/T13425.stdout | 0 testsuite/tests/codeGen/should_run/all.T | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs index 7d19e99..5044c83 100644 --- a/compiler/nativeGen/X86/Ppr.hs +++ b/compiler/nativeGen/X86/Ppr.hs @@ -671,8 +671,12 @@ pprInstr (TEST format src dst) = sdocWithPlatform $ \platform -> -- (We could handle masks larger than a single byte too, -- but it would complicate the code considerably -- and tag checks are by far the most common case.) + -- The mask must have the high bit clear for this smaller encoding + -- to be completely equivalent to the original; in particular so + -- that the signed comparison condition bits are the same as they + -- would be if doing a full word comparison. See Trac #13425. (OpImm (ImmInteger mask), OpReg dstReg) - | 0 <= mask && mask < 256 -> minSizeOfReg platform dstReg + | 0 <= mask && mask < 128 -> minSizeOfReg platform dstReg _ -> format in pprFormatOpOp (sLit "test") format' src dst where diff --git a/testsuite/tests/codeGen/should_run/T13425.hs b/testsuite/tests/codeGen/should_run/T13425.hs new file mode 100644 index 0000000..49d0721 --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T13425.hs @@ -0,0 +1,10 @@ +import Data.Bits ((.&.)) + +flags :: Int -> Int +flags x + | x .&. 128 > 0 = 12 + | otherwise = 13 +{-# NOINLINE flags #-} + +main :: IO () +main = print (flags 255) diff --git a/libraries/base/tests/hPutBuf002.stdout b/testsuite/tests/codeGen/should_run/T13425.stdout similarity index 100% copy from libraries/base/tests/hPutBuf002.stdout copy to testsuite/tests/codeGen/should_run/T13425.stdout diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index b952c10..ffe4b64 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -155,3 +155,4 @@ test('T9577', [ unless(arch('x86_64') or arch('i386'),skip), when(opsys('darwin'), expect_broken(12937)), when(opsys('mingw32'), expect_broken(12965)), only_ways(['normal']) ], compile_and_run, ['']) +test('T13425', normal, compile_and_run, ['-O']) From git at git.haskell.org Mon Mar 27 02:59:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:25 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: linker: fix OpenBSD build failure, EM_PPC64 is not defined there (d4694b8) Message-ID: <20170327025925.304C73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/d4694b85be23c8a014225271060765c062502ed2/ghc >--------------------------------------------------------------- commit d4694b85be23c8a014225271060765c062502ed2 Author: Sergei Trofimovich Date: Sun Mar 26 15:40:40 2017 +0100 linker: fix OpenBSD build failure, EM_PPC64 is not defined there Adam Steen reported build failure on OpenBSD: rts/linker/Elf.c:402:0: error: error: 'EM_PPC64' undeclared (first use in this function) case EM_PPC64: IF_DEBUG(linker,debugBelch( "powerpc64" )); OpenBSD-6.0 does not define EM_PPC64: /usr/include/sys/exec_elf.h:#define EM_PPC 20 /* PowerPC */ Reported-by: Adam Steen Signed-off-by: Sergei Trofimovich (cherry picked from commit 6c73504ac5f4e951062d5e868fa2b69b028b6e79) >--------------------------------------------------------------- d4694b85be23c8a014225271060765c062502ed2 rts/linker/Elf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c index 604c3dc..e8f6aab 100644 --- a/rts/linker/Elf.c +++ b/rts/linker/Elf.c @@ -399,10 +399,12 @@ ocVerifyImage_ELF ( ObjectCode* oc ) case EM_IA_64: IF_DEBUG(linker,debugBelch( "ia64" )); break; #endif case EM_PPC: IF_DEBUG(linker,debugBelch( "powerpc32" )); break; +#ifdef EM_PPC64 case EM_PPC64: IF_DEBUG(linker,debugBelch( "powerpc64" )); errorBelch("%s: RTS linker not implemented on PowerPC 64-bit", oc->fileName); return 0; +#endif #ifdef EM_X86_64 case EM_X86_64: IF_DEBUG(linker,debugBelch( "x86_64" )); break; #elif defined(EM_AMD64) From git at git.haskell.org Mon Mar 27 02:59:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:28 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Add failing testcase for #13233 (c810c3c) Message-ID: <20170327025928.6968F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/c810c3c5e9c91ecf1a73d9013abf8e1c95f21ea1/ghc >--------------------------------------------------------------- commit c810c3c5e9c91ecf1a73d9013abf8e1c95f21ea1 Author: Ben Gamari Date: Thu Mar 23 22:53:29 2017 -0400 testsuite: Add failing testcase for #13233 Thanks to Ryan Scott for the example. (cherry picked from commit 27c9a7d095d2383a7822d317dc7acfe579a4815b) >--------------------------------------------------------------- c810c3c5e9c91ecf1a73d9013abf8e1c95f21ea1 testsuite/tests/codeGen/should_compile/T13233.hs | 12 ++++++++++++ testsuite/tests/codeGen/should_compile/all.T | 1 + 2 files changed, 13 insertions(+) diff --git a/testsuite/tests/codeGen/should_compile/T13233.hs b/testsuite/tests/codeGen/should_compile/T13233.hs new file mode 100644 index 0000000..bb79856 --- /dev/null +++ b/testsuite/tests/codeGen/should_compile/T13233.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeInType #-} +{-# LANGUAGE UnboxedTuples #-} +module Bug where + +import GHC.Exts (TYPE) + +class Foo (a :: TYPE rep) where + bar :: forall (b :: TYPE rep2). (a -> a -> b) -> a -> a -> b + +baz :: forall (a :: TYPE rep). Foo a => a -> a -> (# a, a #) +baz = bar (#,#) diff --git a/testsuite/tests/codeGen/should_compile/all.T b/testsuite/tests/codeGen/should_compile/all.T index 6ae4e1c..a73a9d6 100644 --- a/testsuite/tests/codeGen/should_compile/all.T +++ b/testsuite/tests/codeGen/should_compile/all.T @@ -35,3 +35,4 @@ test('T10667', [ when((arch('powerpc64') or arch('powerpc64le')), compile, ['-g']) test('T12115', normal, compile, ['']) test('T12355', normal, compile, ['']) +test('T13233', expect_broken(13233), compile, ['']) From git at git.haskell.org Mon Mar 27 02:59:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:31 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Document hithertoo undocumented HPCTIXFILE option. (309d863) Message-ID: <20170327025931.2B8FC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/309d86329dd425157b4dd8351ec2003ce77fc20d/ghc >--------------------------------------------------------------- commit 309d86329dd425157b4dd8351ec2003ce77fc20d Author: Edward Z. Yang Date: Thu Mar 23 21:03:40 2017 -0400 Document hithertoo undocumented HPCTIXFILE option. Test Plan: none Reviewers: bgamari, austin, dfeuer Reviewed By: bgamari, dfeuer Subscribers: dfeuer, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3357 (cherry picked from commit ee7241cfde455ab6731b9ce81b36247f082a1342) >--------------------------------------------------------------- 309d86329dd425157b4dd8351ec2003ce77fc20d docs/users_guide/profiling.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/users_guide/profiling.rst b/docs/users_guide/profiling.rst index 832464e..d035cc5 100644 --- a/docs/users_guide/profiling.rst +++ b/docs/users_guide/profiling.rst @@ -1292,7 +1292,8 @@ case :file:`Recip.tix`, which contains the coverage data for this run of the program. The program may be run multiple times (e.g. with different test data), and the coverage data from the separate runs is accumulated in the ``.tix`` file. To reset the coverage data and start again, just -remove the ``.tix`` file. +remove the ``.tix`` file. You can control where the ``.tix`` file +is generated using the environment variable :envvar:`HPCTIXFILE`. Having run the program, we can generate a textual summary of coverage: @@ -1532,8 +1533,10 @@ Caveats and Shortcomings of Haskell Program Coverage HPC does not attempt to lock the ``.tix`` file, so multiple concurrently running binaries in the same directory will exhibit a race condition. -There is no way to change the name of the ``.tix`` file generated, apart -from renaming the binary. HPC does not work with GHCi. +At compile time, there is no way to change the name of the ``.tix`` file generated; +at runtime, the name of the generated ``.tix`` file can be changed +using :envvar:`HPCTIXFILE`; the name of the ``.tix`` file +will also change if you rename the binary. HPC does not work with GHCi. .. _ticky-ticky: From git at git.haskell.org Mon Mar 27 02:59:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:34 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Add testcase for #13429 (366a5b7) Message-ID: <20170327025934.2D1283A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/366a5b7d5226517fa3d499f393d52e59c5b8c29e/ghc >--------------------------------------------------------------- commit 366a5b7d5226517fa3d499f393d52e59c5b8c29e Author: Ben Gamari Date: Thu Mar 23 23:03:54 2017 -0400 testsuite: Add testcase for #13429 (cherry picked from commit be8122ab72aeec509b5ce4b4f05fbc5cdb77bf5a) >--------------------------------------------------------------- 366a5b7d5226517fa3d499f393d52e59c5b8c29e testsuite/tests/simplCore/should_compile/T13429.hs | 114 +++++++++++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 2 files changed, 115 insertions(+) diff --git a/testsuite/tests/simplCore/should_compile/T13429.hs b/testsuite/tests/simplCore/should_compile/T13429.hs new file mode 100644 index 0000000..cc9b4d2 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T13429.hs @@ -0,0 +1,114 @@ +{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} +module Loop (Array(..), Image(..), X, promote, correlate) where +import Data.Maybe (fromMaybe) + +data Kernel e = Kernel Int Int !(Vector (Int, Int, e)) deriving (Show) + + +toKernel :: Array X e => Image X e -> Kernel e +toKernel img = + Kernel m2 n2 $ filter (\(_, _, x) -> x /= 0) $ imap addIx $ toVector img + where + (m, n) = dims img + (m2, n2) = (m `div` 2, n `div` 2) + addIx k (PixelX x) = + let (i, j) = toIx n k + in (i - m2, j - n2, x) + +correlate :: Array cs e => Image X e -> Image cs e -> Image cs e +correlate kernelImg imgM = makeImage (dims imgM) stencil + where + !(Kernel kM2 kN2 kernelV) = toKernel kernelImg + kLen = length kernelV + stencil (i, j) = + loop 0 (promote 0) $ \ k acc -> + let (iDelta, jDelta, x) = kernelV !! k + imgPx = index imgM (i + iDelta, j + jDelta) + in liftPx2 (+) acc (liftPx (x *) imgPx) + loop init' initAcc f = go init' initAcc + where + go step acc = + if step < kLen + then go (step + 1) (f step acc) + else acc +{-# INLINE correlate #-} + + + +-- | A Pixel family with a color space and a precision of elements. +data family Pixel cs e :: * + + +class (Eq e, Num e) => ColorSpace cs e where + promote :: e -> Pixel cs e + liftPx :: (e -> e) -> Pixel cs e -> Pixel cs e + liftPx2 :: (e -> e -> e) -> Pixel cs e -> Pixel cs e -> Pixel cs e + + + +data family Image cs e :: * + +class ColorSpace cs e => Array cs e where + dims :: Image cs e -> (Int, Int) + makeImage :: (Int, Int) -> ((Int, Int) -> Pixel cs e) -> Image cs e + toVector :: Image cs e -> Vector (Pixel cs e) + index :: Image cs e -> (Int, Int) -> Pixel cs e + +fromIx :: Int -> (Int, Int) -> Int +fromIx n (i, j) = n * i + j + +toIx :: Int -> Int -> (Int, Int) +toIx n k = divMod k n + +instance (Show (Pixel cs e), ColorSpace cs e, Array cs e) => + Show (Image cs e) where + show img = + let (m, n) = dims img + in ": " ++ show (toVector img) + + +data X = X + +newtype instance Pixel X e = PixelX e + +instance Show e => Show (Pixel X e) where + show (PixelX e) = "Pixel: " ++ show e + + +instance (Eq e, Num e) => ColorSpace X e where + promote = PixelX + liftPx f (PixelX g) = PixelX (f g) + liftPx2 f (PixelX g1) (PixelX g2) = PixelX (f g1 g2) + + +data instance Image X e = VImage Int Int (Vector (Pixel X e)) + +instance ColorSpace X e => Array X e where + dims (VImage m n _) = (m, n) + makeImage (m, n) f = VImage m n $ generate (m * n) (f . toIx n) + toVector (VImage _ _ v) = v + index (VImage _ n v) ix = fromMaybe (promote 0) (v !? (fromIx n ix)) + + +-- Vector emulation + +type Vector a = [a] + +imap :: (Num a, Enum a) => (a -> b -> c) -> [b] -> [c] +imap f = zipWith f [0..] + +(!?) :: [a] -> Int -> Maybe a +(!?) ls i + | i < 0 || i >= length ls = Nothing + | otherwise = Just (ls !! i) + +generate :: (Ord t, Num t) => t -> (t -> a) -> [a] +generate n f = go (n-1) [] where + go i acc | i < 0 = acc + | otherwise = go (i-1) (f i : acc) + diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 98d7d79..d6a539e 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -252,3 +252,4 @@ test('T13338', only_ways(['optasm']), compile, ['-dcore-lint']) test('T13367', normal, run_command, ['$MAKE -s --no-print-directory T13367']) test('T13417', normal, compile, ['-O']) test('T13413', normal, compile, ['']) +test('T13429', normal, compile, ['']) From git at git.haskell.org Mon Mar 27 02:59:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:37 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Make T10245 pass on 32-bit platforms (0b8263e) Message-ID: <20170327025937.171B63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/0b8263e80b6e31044f6963b0c970f481a622cc65/ghc >--------------------------------------------------------------- commit 0b8263e80b6e31044f6963b0c970f481a622cc65 Author: Ben Gamari Date: Fri Mar 24 11:36:31 2017 -0400 testsuite: Make T10245 pass on 32-bit platforms (cherry picked from commit ff6ee998e06c74bf41841a9ccf2e55a722268e91) >--------------------------------------------------------------- 0b8263e80b6e31044f6963b0c970f481a622cc65 testsuite/tests/codeGen/should_run/T10245.hs | 12 ++++++++++++ testsuite/tests/codeGen/should_run/T10245.stdout-ws-32 | 3 +++ .../should_run/{T10245.stdout => T10245.stdout-ws-64} | 0 3 files changed, 15 insertions(+) diff --git a/testsuite/tests/codeGen/should_run/T10245.hs b/testsuite/tests/codeGen/should_run/T10245.hs index 7094a1d..43383a3 100644 --- a/testsuite/tests/codeGen/should_run/T10245.hs +++ b/testsuite/tests/codeGen/should_run/T10245.hs @@ -1,11 +1,23 @@ +{-# LANGUAGE CPP #-} + +#include "MachDeps.h" + f :: Int -> String f n = case n of +#if WORD_SIZE_IN_BITS == 64 0x8000000000000000 -> "yes" +#else + 0x80000000 -> "yes" +#endif _ -> "no" {-# NOINLINE f #-} main = do +#if WORD_SIZE_IN_BITS == 64 let string = "0x8000000000000000" +#else + let string = "0x80000000" +#endif let i = read string :: Integer let i' = fromIntegral i :: Int print i diff --git a/testsuite/tests/codeGen/should_run/T10245.stdout-ws-32 b/testsuite/tests/codeGen/should_run/T10245.stdout-ws-32 new file mode 100644 index 0000000..a6c8f1f --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T10245.stdout-ws-32 @@ -0,0 +1,3 @@ +2147483648 +-2147483648 +"yes" diff --git a/testsuite/tests/codeGen/should_run/T10245.stdout b/testsuite/tests/codeGen/should_run/T10245.stdout-ws-64 similarity index 100% rename from testsuite/tests/codeGen/should_run/T10245.stdout rename to testsuite/tests/codeGen/should_run/T10245.stdout-ws-64 From git at git.haskell.org Mon Mar 27 02:59:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:39 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: rts: Fix stat output on 32-bit platforms (e4b4ba5) Message-ID: <20170327025939.C861D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/e4b4ba5158707e98916610f1c4226fada1b782b6/ghc >--------------------------------------------------------------- commit e4b4ba5158707e98916610f1c4226fada1b782b6 Author: Ben Gamari Date: Fri Mar 24 14:59:14 2017 -0400 rts: Fix stat output on 32-bit platforms The formatting strings fell out of sync with the arguments. (cherry picked from commit 94ec48f8a25d5a381a5d42016baa0333c186a442) >--------------------------------------------------------------- e4b4ba5158707e98916610f1c4226fada1b782b6 rts/Stats.c | 58 +++++++++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/rts/Stats.c b/rts/Stats.c index 217bace..5f5fa58 100644 --- a/rts/Stats.c +++ b/rts/Stats.c @@ -757,35 +757,43 @@ stat_exit (void) } if (RtsFlags.GcFlags.giveStats == ONELINE_GC_STATS) { - char *fmt1, *fmt2; - if (RtsFlags.MiscFlags.machineReadable) { - fmt1 = " [(\"bytes allocated\", \"%llu\")\n"; - fmt2 = " ,(\"num_GCs\", \"%d\")\n" - " ,(\"average_bytes_used\", \"%ld\")\n" - " ,(\"max_bytes_used\", \"%ld\")\n" - " ,(\"num_byte_usage_samples\", \"%ld\")\n" - " ,(\"peak_megabytes_allocated\", \"%lu\")\n" - " ,(\"init_cpu_seconds\", \"%.3f\")\n" - " ,(\"init_wall_seconds\", \"%.3f\")\n" - " ,(\"mutator_cpu_seconds\", \"%.3f\")\n" - " ,(\"mutator_wall_seconds\", \"%.3f\")\n" - " ,(\"GC_cpu_seconds\", \"%.3f\")\n" - " ,(\"GC_wall_seconds\", \"%.3f\")\n" - " ]\n"; - } - else { - fmt1 = "<>\n"; + } /* print the long long separately to avoid bugginess on mingwin (2001-07-02, mingw-0.5) */ - statsPrintf(fmt1, stats.allocated_bytes); - statsPrintf(fmt2, + statsPrintf(fmt, + stats.allocated_bytes, stats.gcs, - stats.major_gcs == 0 ? 0 : - stats.cumulative_live_bytes/stats.major_gcs, + (uint64_t) + (stats.major_gcs == 0 ? 0 : + stats.cumulative_live_bytes/stats.major_gcs), stats.max_live_bytes, stats.major_gcs, - (unsigned long)(peak_mblocks_allocated * MBLOCK_SIZE / (1024L * 1024L)), + (uint64_t) (peak_mblocks_allocated * MBLOCK_SIZE / (1024L * 1024L)), TimeToSecondsDbl(init_cpu), TimeToSecondsDbl(init_elapsed), TimeToSecondsDbl(mut_cpu), TimeToSecondsDbl(mut_elapsed), TimeToSecondsDbl(gc_cpu), TimeToSecondsDbl(gc_elapsed)); From git at git.haskell.org Mon Mar 27 02:59:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:42 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Allow join007 to pass on 32-bit machines (df21c54) Message-ID: <20170327025942.A24E33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/df21c5448618b07e0fb130be967124ecd5306494/ghc >--------------------------------------------------------------- commit df21c5448618b07e0fb130be967124ecd5306494 Author: Ben Gamari Date: Fri Mar 24 12:27:35 2017 -0400 testsuite: Allow join007 to pass on 32-bit machines The output of the test overflows. Given that the result is stable regardless of whether it overflows, I just made the expected output word-size dependent. (cherry picked from commit aecbfb908a11991eb23b790a440efe4697ffb86a) >--------------------------------------------------------------- df21c5448618b07e0fb130be967124ecd5306494 testsuite/tests/perf/join_points/join007.hs | 2 ++ testsuite/tests/perf/join_points/join007.stdout-ws-32 | 1 + .../tests/perf/join_points/{join007.stdout => join007.stdout-ws-64} | 0 3 files changed, 3 insertions(+) diff --git a/testsuite/tests/perf/join_points/join007.hs b/testsuite/tests/perf/join_points/join007.hs index aa2f68c..59cc99b 100644 --- a/testsuite/tests/perf/join_points/join007.hs +++ b/testsuite/tests/perf/join_points/join007.hs @@ -39,4 +39,6 @@ enumFromToS lo hi = Stream next lo test :: Int -> Int -> Int test lo hi = sumS (filterS even (enumFromToS lo hi)) +-- Note that this overflows on 32-bit machines and therefore we have two stdout +-- files main = print $ test 1 10000000 diff --git a/testsuite/tests/perf/join_points/join007.stdout-ws-32 b/testsuite/tests/perf/join_points/join007.stdout-ws-32 new file mode 100644 index 0000000..d4692e3 --- /dev/null +++ b/testsuite/tests/perf/join_points/join007.stdout-ws-32 @@ -0,0 +1 @@ +-999630016 diff --git a/testsuite/tests/perf/join_points/join007.stdout b/testsuite/tests/perf/join_points/join007.stdout-ws-64 similarity index 100% rename from testsuite/tests/perf/join_points/join007.stdout rename to testsuite/tests/perf/join_points/join007.stdout-ws-64 From git at git.haskell.org Mon Mar 27 02:59:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:45 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Note x87 terribleness in num009 (6fe3f90) Message-ID: <20170327025945.5A8413A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/6fe3f90a29aebc59f2aa7e5c9111ed1a4afaa127/ghc >--------------------------------------------------------------- commit 6fe3f90a29aebc59f2aa7e5c9111ed1a4afaa127 Author: Ben Gamari Date: Fri Mar 24 13:22:08 2017 -0400 testsuite: Note x87 terribleness in num009 (cherry picked from commit a1b7e866378e848d50b940595aa43fa63672cf37) >--------------------------------------------------------------- 6fe3f90a29aebc59f2aa7e5c9111ed1a4afaa127 libraries/base/tests/Numeric/num009.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/base/tests/Numeric/num009.hs b/libraries/base/tests/Numeric/num009.hs index 429f0bf..c0dec43 100644 --- a/libraries/base/tests/Numeric/num009.hs +++ b/libraries/base/tests/Numeric/num009.hs @@ -1,4 +1,8 @@ -- trac #2059 +-- +-- Note that this test fails miserably when compiled to use X87 floating point. +-- For instance, in the case of (sin 1e20) the X86 FSIN instruction doesn't even +-- get the sign right on my machine. module Main(main) where @@ -20,7 +24,7 @@ test :: (RealFloat a, Floating a, RealFloat b, Floating b, Show b) test s f g x = do let y = realToFrac (f (realToFrac x)) z = g x unless (y == z) $ do - putStrLn (s ++ ' ':show x) + putStrLn ("uh oh! " ++ s ++ ' ':show x) print y print z print $ decodeFloat y From git at git.haskell.org Mon Mar 27 02:59:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:48 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Eliminate word-size dependence in HsDumpAst output (b8f16d8) Message-ID: <20170327025948.6F1663A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/b8f16d89d803913f124d26cfcaa02d2d6f0b26c8/ghc >--------------------------------------------------------------- commit b8f16d89d803913f124d26cfcaa02d2d6f0b26c8 Author: Ben Gamari Date: Fri Mar 24 12:05:23 2017 -0400 Eliminate word-size dependence in HsDumpAst output Fixes DumpTypecheckedAst output on 32-bit platforms. (cherry picked from commit bc9f280acf82d34fea72199a34b00c414c3ef59e) >--------------------------------------------------------------- b8f16d89d803913f124d26cfcaa02d2d6f0b26c8 compiler/hsSyn/HsDumpAst.hs | 16 ++++++- .../should_compile/DumpTypecheckedAst.stderr | 54 +++++++++++----------- 2 files changed, 42 insertions(+), 28 deletions(-) diff --git a/compiler/hsSyn/HsDumpAst.hs b/compiler/hsSyn/HsDumpAst.hs index f735488..b76b3fb 100644 --- a/compiler/hsSyn/HsDumpAst.hs +++ b/compiler/hsSyn/HsDumpAst.hs @@ -18,6 +18,7 @@ module HsDumpAst ( import Data.Data hiding (Fixity) import Data.List import Bag +import BasicTypes import FastString import NameSet import Name @@ -46,7 +47,7 @@ showAstData b = showAstData' 0 showAstData' n = generic `ext1Q` list - `extQ` string `extQ` fastString `extQ` srcSpan + `extQ` string `extQ` fastString `extQ` srcSpan `extQ` lit `extQ` bytestring `extQ` name `extQ` occName `extQ` moduleName `extQ` var `extQ` dataCon @@ -76,6 +77,19 @@ showAstData b = showAstData' 0 ++ intercalate "," (map (showAstData' (n+1)) l) ++ "]" + -- Eliminate word-size dependence + lit :: HsLit -> String + lit (HsWordPrim s x) = numericLit "HsWord{64}Prim" x s + lit (HsWord64Prim s x) = numericLit "HsWord{64}Prim" x s + lit (HsIntPrim s x) = numericLit "HsInt{64}Prim" x s + lit (HsInt64Prim s x) = numericLit "HsInt{64}Prim" x s + lit l = generic l + + numericLit :: String -> Integer -> SourceText -> String + numericLit tag x s = indent n ++ unwords [ "{" ++ tag + , generic x + , generic s ++ "}" ] + name :: Name -> String name = ("{Name: "++) . (++"}") . showSDocDebug_ . ppr diff --git a/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr b/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr index 3725b6f..4b10222 100644 --- a/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr +++ b/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr @@ -21,14 +21,14 @@ ({abstract:ConLike}))) ({ } (HsLit - (HsWordPrim - (NoSourceText) - (14073232900889011755)))))) + {HsWord{64}Prim + (14073232900889011755) + (NoSourceText)})))) ({ } (HsLit - (HsWordPrim - (NoSourceText) - (2739668351064589274)))))) + {HsWord{64}Prim + (2739668351064589274) + (NoSourceText)})))) ({ } (HsVar ({ }{Var: (main:DumpTypecheckedAst.$trModule{v} [lidx] :: ghc-prim:GHC.Types.Module{tc})}))))) @@ -45,9 +45,9 @@ (NoSourceText) "Peano"))))))))) ({ } (HsLit - (HsIntPrim - (SourceText "0") - (0)))))) + {HsInt{64}Prim + (0) + (SourceText "0")})))) ({ } (HsVar ({ }{Var: (ghc-prim:GHC.Types.krep$*{v} [gid] :: ghc-prim:GHC.Types.KindRep{tc})}))))) @@ -71,14 +71,14 @@ ({abstract:ConLike}))) ({ } (HsLit - (HsWordPrim - (NoSourceText) - (13760111476013868540)))))) + {HsWord{64}Prim + (13760111476013868540) + (NoSourceText)})))) ({ } (HsLit - (HsWordPrim - (NoSourceText) - (12314848029315386153)))))) + {HsWord{64}Prim + (12314848029315386153) + (NoSourceText)})))) ({ } (HsVar ({ }{Var: (main:DumpTypecheckedAst.$trModule{v} [lidx] :: ghc-prim:GHC.Types.Module{tc})}))))) @@ -95,9 +95,9 @@ (NoSourceText) "'Zero"))))))))) ({ } (HsLit - (HsIntPrim - (SourceText "0") - (0)))))) + {HsInt{64}Prim + (0) + (SourceText "0")})))) ({ } (HsVar ({ }{Var: ($krep{v} [lid] :: ghc-prim:GHC.Types.KindRep{tc})}))))) @@ -121,14 +121,14 @@ ({abstract:ConLike}))) ({ } (HsLit - (HsWordPrim - (NoSourceText) - (1143980031331647856)))))) + {HsWord{64}Prim + (1143980031331647856) + (NoSourceText)})))) ({ } (HsLit - (HsWordPrim - (NoSourceText) - (14802086722010293686)))))) + {HsWord{64}Prim + (14802086722010293686) + (NoSourceText)})))) ({ } (HsVar ({ }{Var: (main:DumpTypecheckedAst.$trModule{v} [lidx] :: ghc-prim:GHC.Types.Module{tc})}))))) @@ -145,9 +145,9 @@ (NoSourceText) "'Succ"))))))))) ({ } (HsLit - (HsIntPrim - (SourceText "0") - (0)))))) + {HsInt{64}Prim + (0) + (SourceText "0")})))) ({ } (HsVar ({ }{Var: ($krep{v} [lid] :: ghc-prim:GHC.Types.KindRep{tc})}))))) From git at git.haskell.org Mon Mar 27 02:59:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:51 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Update performance numbers for 32-bit platforms (b29004b) Message-ID: <20170327025951.C325B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/b29004ba2c2f73a8c0e37f92554bde3b9f1d54f8/ghc >--------------------------------------------------------------- commit b29004ba2c2f73a8c0e37f92554bde3b9f1d54f8 Author: Ben Gamari Date: Fri Mar 24 12:26:03 2017 -0400 testsuite: Update performance numbers for 32-bit platforms (cherry picked from commit 6d774ff2fde787d2032bbcefcb3afd2262b3916e) >--------------------------------------------------------------- b29004ba2c2f73a8c0e37f92554bde3b9f1d54f8 .../{T13257.stderr => T13257.stderr-ws-32} | 2 +- .../{T13257.stderr => T13257.stderr-ws-64} | 0 testsuite/tests/perf/compiler/all.T | 66 +++++++++++++++------- testsuite/tests/perf/haddock/all.T | 9 ++- testsuite/tests/perf/should_run/all.T | 34 +++++++---- testsuite/tests/perf/space_leaks/all.T | 8 ++- 6 files changed, 79 insertions(+), 40 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 b29004ba2c2f73a8c0e37f92554bde3b9f1d54f8 From git at git.haskell.org Mon Mar 27 02:59:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:54 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Mark T12622 as broken in ghci way (7829e40) Message-ID: <20170327025954.7F6693A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/7829e40f7dd8cd469593fcc6eb94691f1163a8b9/ghc >--------------------------------------------------------------- commit 7829e40f7dd8cd469593fcc6eb94691f1163a8b9 Author: Ben Gamari Date: Sat Mar 25 12:28:59 2017 -0400 testsuite: Mark T12622 as broken in ghci way See #13481. (cherry picked from commit 140a2d1c463bd314c9afbeb8d60e739163ce576a) >--------------------------------------------------------------- 7829e40f7dd8cd469593fcc6eb94691f1163a8b9 testsuite/tests/codeGen/should_run/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index ffe4b64..9f334cf 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -148,7 +148,7 @@ test('PopCnt', omit_ways(['ghci']), multi_compile_and_run, ['PopCnt', [('PopCnt_cmm.cmm', '')], '']) test('T12059', normal, compile_and_run, ['']) test('T12433', normal, compile_and_run, ['']) -test('T12622', normal, multimod_compile_and_run, ['T12622', '-O']) +test('T12622', expect_broken_for(13481, ['ghci']), multimod_compile_and_run, ['T12622', '-O']) test('T12757', normal, compile_and_run, ['']) test('T12855', normal, compile_and_run, ['']) test('T9577', [ unless(arch('x86_64') or arch('i386'),skip), From git at git.haskell.org Mon Mar 27 02:59:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:54 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix Windows x86 build (4a0b1dd) Message-ID: <20170327025954.552C43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/4a0b1dd8fe165a3f869824ad3e63fb0a5a1eb99f/ghc >--------------------------------------------------------------- commit 4a0b1dd8fe165a3f869824ad3e63fb0a5a1eb99f Author: Tamar Christina Date: Sat Mar 18 15:19:01 2017 +0000 Fix Windows x86 build Summary: Fix some `-Werror` failures and work around a bug in the `x86` version of `mingw-w64-crt`'s libraries. The bump in the `win32` submodule is required for this. Test Plan: ./validate Reviewers: austin, bgamari, erikd, simonmar Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3362 (cherry picked from commit 713ff9207e0f2493bd498ff725012c9895f728c8) >--------------------------------------------------------------- 4a0b1dd8fe165a3f869824ad3e63fb0a5a1eb99f libraries/Win32 | 2 +- rts/linker/PEi386.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/Win32 b/libraries/Win32 index 06d5849..67c5cc5 160000 --- a/libraries/Win32 +++ b/libraries/Win32 @@ -1 +1 @@ -Subproject commit 06d584916a4c32e6d31b60499afd52e32e4281ef +Subproject commit 67c5cc56f0faeacc553471c8a7d9b9b95e011731 diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c index 9c7f4db..c27dd31 100644 --- a/rts/linker/PEi386.c +++ b/rts/linker/PEi386.c @@ -1357,9 +1357,11 @@ ocResolve_PEi386 ( ObjectCode* oc ) sym = (COFF_symbol*) myindex ( sizeof_COFF_symbol, symtab, reltab_j->SymbolTableIndex ); +#if defined(x86_64_HOST_ARCH) uint64_t symIndex = ((uint64_t)myindex(sizeof_COFF_symbol, symtab, reltab_j->SymbolTableIndex) - (uint64_t)symtab) / sizeof_COFF_symbol; +#endif IF_DEBUG(linker, debugBelch( From git at git.haskell.org Mon Mar 27 02:59:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:57 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Only run T13143 in optasm way (f76fbfa) Message-ID: <20170327025957.4191D3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/f76fbfacdb06d1657797fbe2a2026d10e33b39ac/ghc >--------------------------------------------------------------- commit f76fbfacdb06d1657797fbe2a2026d10e33b39ac Author: Ben Gamari Date: Sat Mar 25 12:07:32 2017 -0400 testsuite: Only run T13143 in optasm way Otherwise we run it in the hpc way, which outputs different Core. (cherry picked from commit 23da02b1584a5f1b083185d479807ba0ec6eccfe) >--------------------------------------------------------------- f76fbfacdb06d1657797fbe2a2026d10e33b39ac testsuite/tests/simplCore/should_compile/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index d6a539e..365aa44 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -235,7 +235,7 @@ test('T13025', normal, run_command, ['$MAKE -s --no-print-directory T13025']) -test('T13143', normal, compile, ['-O -ddump-simpl -dsuppress-uniques']) +test('T13143', only_ways(['optasm']), compile, ['-O -ddump-simpl -dsuppress-uniques']) test('T13156', normal, run_command, ['$MAKE -s --no-print-directory T13156']) test('T11444', normal, compile, ['']) test('str-rules', From git at git.haskell.org Mon Mar 27 02:59:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:57 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Make unsafeInterleaveST less unsafe (167548f) Message-ID: <20170327025957.1355A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/167548f4cd087535a6c4c9fc642b60669b4dc019/ghc >--------------------------------------------------------------- commit 167548f4cd087535a6c4c9fc642b60669b4dc019 Author: David Feuer Date: Wed Mar 22 17:25:03 2017 -0400 Make unsafeInterleaveST less unsafe * Make `unsafeInterleaveST` use `noDuplicate#` like `unsafeInterleaveIO` does to prevent the suspended action from being run in two threads. * In order to accomplish this without `unsafeCoerce#`, generalize the type of `noDuplicate#`. * Add `unsafeDupableInterleaveST` to get the old behavior. * Document unsafe `ST` functions and clean up some related documentation. Fixes #13457 Reviewers: austin, hvr, bgamari, ekmett Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3370 (cherry picked from commit 30d68d630c1685bb81ec4afdaf6d483ba8aafd38) >--------------------------------------------------------------- 167548f4cd087535a6c4c9fc642b60669b4dc019 compiler/prelude/primops.txt.pp | 2 +- libraries/base/Control/Monad/ST/Imp.hs | 4 +++- libraries/base/Control/Monad/ST/Unsafe.hs | 1 + libraries/base/GHC/IO.hs | 19 ++++++++++++++----- libraries/base/GHC/IO/Unsafe.hs | 16 +++++++++++++++- libraries/base/GHC/ST.hs | 26 +++++++++++++++++++++++--- 6 files changed, 57 insertions(+), 11 deletions(-) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 64971a3..5d0a2a4 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -2344,7 +2344,7 @@ primop IsCurrentThreadBoundOp "isCurrentThreadBound#" GenPrimOp has_side_effects = True primop NoDuplicateOp "noDuplicate#" GenPrimOp - State# RealWorld -> State# RealWorld + State# s -> State# s with out_of_line = True has_side_effects = True diff --git a/libraries/base/Control/Monad/ST/Imp.hs b/libraries/base/Control/Monad/ST/Imp.hs index 984970f..c053dcc 100644 --- a/libraries/base/Control/Monad/ST/Imp.hs +++ b/libraries/base/Control/Monad/ST/Imp.hs @@ -29,10 +29,12 @@ module Control.Monad.ST.Imp ( -- * Unsafe operations unsafeInterleaveST, + unsafeDupableInterleaveST, unsafeIOToST, unsafeSTToIO ) where -import GHC.ST ( ST, runST, fixST, unsafeInterleaveST ) +import GHC.ST ( ST, runST, fixST, unsafeInterleaveST + , unsafeDupableInterleaveST ) import GHC.Base ( RealWorld ) import GHC.IO ( stToIO, unsafeIOToST, unsafeSTToIO ) diff --git a/libraries/base/Control/Monad/ST/Unsafe.hs b/libraries/base/Control/Monad/ST/Unsafe.hs index 9fa4b73..b8560b1 100644 --- a/libraries/base/Control/Monad/ST/Unsafe.hs +++ b/libraries/base/Control/Monad/ST/Unsafe.hs @@ -21,6 +21,7 @@ module Control.Monad.ST.Unsafe ( -- * Unsafe operations unsafeInterleaveST, + unsafeDupableInterleaveST, unsafeIOToST, unsafeSTToIO ) where diff --git a/libraries/base/GHC/IO.hs b/libraries/base/GHC/IO.hs index 8459db6..63b47ff 100644 --- a/libraries/base/GHC/IO.hs +++ b/libraries/base/GHC/IO.hs @@ -84,22 +84,31 @@ failIO s = IO (raiseIO# (toException (userError s))) -- --------------------------------------------------------------------------- -- Coercions between IO and ST --- | A monad transformer embedding strict state transformers in the 'IO' --- monad. The 'RealWorld' parameter indicates that the internal state +-- | Embed a strict state transformer in an 'IO' +-- action. The 'RealWorld' parameter indicates that the internal state -- used by the 'ST' computation is a special one supplied by the 'IO' -- monad, and thus distinct from those used by invocations of 'runST'. stToIO :: ST RealWorld a -> IO a stToIO (ST m) = IO m +-- | Convert an 'IO' action into an 'ST' action. The type of the result +-- is constrained to use a 'RealWorld' state, and therefore the result cannot +-- be passed to 'runST'. ioToST :: IO a -> ST RealWorld a ioToST (IO m) = (ST m) --- This relies on IO and ST having the same representation modulo the --- constraint on the type of the state --- +-- | Convert an 'IO' action to an 'ST' action. +-- This relies on 'IO' and 'ST' having the same representation modulo the +-- constraint on the type of the state. unsafeIOToST :: IO a -> ST s a unsafeIOToST (IO io) = ST $ \ s -> (unsafeCoerce# io) s +-- | Convert an 'ST' action to an 'IO' action. +-- This relies on 'IO' and 'ST' having the same representation modulo the +-- constraint on the type of the state. +-- +-- For an example demonstrating why this is unsafe, see +-- https://mail.haskell.org/pipermail/haskell-cafe/2009-April/060719.html unsafeSTToIO :: ST s a -> IO a unsafeSTToIO (ST m) = IO (unsafeCoerce# m) diff --git a/libraries/base/GHC/IO/Unsafe.hs b/libraries/base/GHC/IO/Unsafe.hs index 7523535..c1c07ae 100644 --- a/libraries/base/GHC/IO/Unsafe.hs +++ b/libraries/base/GHC/IO/Unsafe.hs @@ -104,7 +104,7 @@ unsafeDupablePerformIO :: IO a -> a unsafeDupablePerformIO (IO m) = case runRW# m of (# _, a #) -> a {-| -'unsafeInterleaveIO' allows 'IO' computation to be deferred lazily. +'unsafeInterleaveIO' allows an 'IO' computation to be deferred lazily. When passed a value of type @IO a@, the 'IO' will only be performed when the value of the @a@ is demanded. This is used to implement lazy file reading, see 'System.IO.hGetContents'. @@ -113,6 +113,9 @@ file reading, see 'System.IO.hGetContents'. unsafeInterleaveIO :: IO a -> IO a unsafeInterleaveIO m = unsafeDupableInterleaveIO (noDuplicate >> m) +-- Note [unsafeDupableInterleaveIO should not be inlined] +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- -- We used to believe that INLINE on unsafeInterleaveIO was safe, -- because the state from this IO thread is passed explicitly to the -- interleaved IO, so it cannot be floated out and shared. @@ -131,7 +134,18 @@ unsafeInterleaveIO m = unsafeDupableInterleaveIO (noDuplicate >> m) -- share and sometimes not (plus it probably breaks the noDuplicate). -- So now, we do not inline unsafeDupableInterleaveIO. +{-| +'unsafeDupableInterleaveIO' allows an 'IO' computation to be deferred lazily. +When passed a value of type @IO a@, the 'IO' will only be performed +when the value of the @a@ is demanded. + +The computation may be performed multiple times by different threads, +possibly at the same time. To ensure that the computation is performed +only once, use 'unsafeInterleaveIO' instead. +-} + {-# NOINLINE unsafeDupableInterleaveIO #-} +-- See Note [unsafeDupableInterleaveIO should not be inlined] unsafeDupableInterleaveIO :: IO a -> IO a unsafeDupableInterleaveIO (IO m) = IO ( \ s -> let diff --git a/libraries/base/GHC/ST.hs b/libraries/base/GHC/ST.hs index 7982d59..4e00c0e 100644 --- a/libraries/base/GHC/ST.hs +++ b/libraries/base/GHC/ST.hs @@ -21,7 +21,7 @@ module GHC.ST ( fixST, runST, -- * Unsafe functions - liftST, unsafeInterleaveST + liftST, unsafeInterleaveST, unsafeDupableInterleaveST ) where import GHC.Base @@ -84,9 +84,29 @@ data STret s a = STret (State# s) a liftST :: ST s a -> State# s -> STret s a liftST (ST m) = \s -> case m s of (# s', r #) -> STret s' r -{-# NOINLINE unsafeInterleaveST #-} +noDuplicateST :: ST s () +noDuplicateST = ST $ \s -> (# noDuplicate# s, () #) + +-- | 'unsafeInterleaveST' allows an 'ST' computation to be deferred +-- lazily. When passed a value of type @ST a@, the 'ST' computation will +-- only be performed when the value of the @a@ is demanded. +{-# INLINE unsafeInterleaveST #-} unsafeInterleaveST :: ST s a -> ST s a -unsafeInterleaveST (ST m) = ST ( \ s -> +unsafeInterleaveST m = unsafeDupableInterleaveST (noDuplicateST >> m) + +-- | 'unsafeDupableInterleaveST' allows an 'ST' computation to be deferred +-- lazily. When passed a value of type @ST a@, the 'ST' computation will +-- only be performed when the value of the @a@ is demanded. +-- +-- The computation may be performed multiple times by different threads, +-- possibly at the same time. To prevent this, use 'unsafeInterleaveST' instead. +-- +-- @since 4.11 +{-# NOINLINE unsafeDupableInterleaveST #-} +-- See Note [unsafeDupableInterleaveIO should not be inlined] +-- in GHC.IO.Unsafe +unsafeDupableInterleaveST :: ST s a -> ST s a +unsafeDupableInterleaveST (ST m) = ST ( \ s -> let r = case m s of (# _, res #) -> res in From git at git.haskell.org Mon Mar 27 02:59:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 02:59:59 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Correctly account for -package-db ordering when picking packages. (1682980) Message-ID: <20170327025959.C3BB73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/1682980d7f5262fb42c0d11e8366bde6bc98c792/ghc >--------------------------------------------------------------- commit 1682980d7f5262fb42c0d11e8366bde6bc98c792 Author: Edward Z. Yang Date: Sun Mar 19 16:07:49 2017 -0700 Correctly account for -package-db ordering when picking packages. Summary: When I originally implemented ABI-based shadowing as per ee4e1654c31b9c6f6ad9b19ece25f040bbbcbd72, I switched our strategy from pasting together lists to creating a map of all units first, and then selecting packages from this. However, what I did not realize when doing this was that we actually depended on the *ordering* of these lists later, when we selected a preferred package to use. The crux is if I have -package-db db1 -package-db db2 -package p-0.1, and p-0.1 is provided by both db1 and db2, which one does the -package flag select? Previously, this was undetermined; now we always select the instance from the LATEST package database. (If p-0.1 shows up multiple times in the same database, once again the chosen package is undefined.) The reason why cabal08 intermittently failed was that, in practice, we were sorting on the UnitId, so when we bumped version numbers, that often wibbled the UnitIds so that they compared oppositely. I've extended the test so that we check that the relation is antisymmetric. Fixes #13313 Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: bgamari, austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3369 (cherry picked from commit e0eaea918c32b3aa445708656876d1e2aef94a13) >--------------------------------------------------------------- 1682980d7f5262fb42c0d11e8366bde6bc98c792 compiler/main/Packages.hs | 111 +++++++++++++++++++-------- testsuite/tests/cabal/cabal08/Makefile | 8 +- testsuite/tests/cabal/cabal08/all.T | 3 +- testsuite/tests/cabal/cabal08/cabal08.stdout | 6 ++ 4 files changed, 93 insertions(+), 35 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 1682980d7f5262fb42c0d11e8366bde6bc98c792 From git at git.haskell.org Mon Mar 27 03:00:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:00 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Recompile if -fhpc is added or removed (#11798) (81fcfdf) Message-ID: <20170327030000.89A083A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/81fcfdf1d2534e352de0096545ebe414ad8d8077/ghc >--------------------------------------------------------------- commit 81fcfdf1d2534e352de0096545ebe414ad8d8077 Author: Reid Barton Date: Sat Mar 25 10:53:29 2017 -0400 Recompile if -fhpc is added or removed (#11798) Test Plan: validate Reviewers: austin, bgamari, dfeuer Reviewed By: dfeuer Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3368 (cherry picked from commit 14b46a556dde8a2795ff5ede46ba8ee63368ae93) >--------------------------------------------------------------- 81fcfdf1d2534e352de0096545ebe414ad8d8077 compiler/iface/FlagChecker.hs | 10 ++++++++-- testsuite/tests/hpc/Makefile | 6 ++++++ testsuite/tests/hpc/T11798.hs | 3 +++ testsuite/tests/hpc/T11798.stdout | 2 ++ testsuite/tests/hpc/all.T | 2 ++ 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/compiler/iface/FlagChecker.hs b/compiler/iface/FlagChecker.hs index a0654b0..305a21b 100644 --- a/compiler/iface/FlagChecker.hs +++ b/compiler/iface/FlagChecker.hs @@ -57,9 +57,15 @@ fingerprintDynFlags dflags at DynFlags{..} this_mod nameio = then 0 else optLevel - in -- pprTrace "flags" (ppr (mainis, safeHs, lang, cpp, paths, prof, opt)) $ - computeFingerprint nameio (mainis, safeHs, lang, cpp, paths, prof, opt) + -- -fhpc, see https://ghc.haskell.org/trac/ghc/ticket/11798 + -- hpcDir is output-only, so we should recompile if it changes + hpc = if gopt Opt_Hpc dflags then Just hpcDir else Nothing + -- Nesting just to avoid ever more Binary tuple instances + flags = (mainis, safeHs, lang, cpp, paths, (prof, opt, hpc)) + + in -- pprTrace "flags" (ppr flags) $ + computeFingerprint nameio flags {- Note [path flags and recompilation] diff --git a/testsuite/tests/hpc/Makefile b/testsuite/tests/hpc/Makefile index 9a36a1c..6de7cee 100644 --- a/testsuite/tests/hpc/Makefile +++ b/testsuite/tests/hpc/Makefile @@ -1,3 +1,9 @@ TOP=../.. include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk + +# Test that adding -fhpc triggers recompilation +T11798: + "$(TEST_HC)" $(TEST_HC_ARGS) T11798 + "$(TEST_HC)" $(TEST_HC_ARGS) T11798 -fhpc + test -e .hpc/T11798.mix diff --git a/testsuite/tests/hpc/T11798.hs b/testsuite/tests/hpc/T11798.hs new file mode 100644 index 0000000..2d42817 --- /dev/null +++ b/testsuite/tests/hpc/T11798.hs @@ -0,0 +1,3 @@ +module T11798 where + +f x = [x,x,x] diff --git a/testsuite/tests/hpc/T11798.stdout b/testsuite/tests/hpc/T11798.stdout new file mode 100644 index 0000000..024b0dc --- /dev/null +++ b/testsuite/tests/hpc/T11798.stdout @@ -0,0 +1,2 @@ +[1 of 1] Compiling T11798 ( T11798.hs, T11798.o ) +[1 of 1] Compiling T11798 ( T11798.hs, T11798.o ) [flags changed] diff --git a/testsuite/tests/hpc/all.T b/testsuite/tests/hpc/all.T index f1fc590..274674b 100644 --- a/testsuite/tests/hpc/all.T +++ b/testsuite/tests/hpc/all.T @@ -3,6 +3,8 @@ test('T10138', [extra_files(['.keepme.hpc.T10138/']), # Using --hpcdir with an absolute path should work (exit code 0). ['{hpc} report T10138.keepme.tix --hpcdir="`pwd`/.keepme.hpc.T10138"']) +test('T11798', normal, run_command, ['$MAKE -s --no-print-directory T11798']) + # Run tests below only for the hpc way. # # Do not explicitly specify '-fhpc' in extra_hc_opts, unless also setting From git at git.haskell.org Mon Mar 27 03:00:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:02 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump haddock submodule (13ad99d) Message-ID: <20170327030002.80B1A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/13ad99d51e1f8e07120c708866ece881bbca5665/ghc >--------------------------------------------------------------- commit 13ad99d51e1f8e07120c708866ece881bbca5665 Author: Ben Gamari Date: Thu Mar 23 15:31:37 2017 -0400 Bump haddock submodule >--------------------------------------------------------------- 13ad99d51e1f8e07120c708866ece881bbca5665 utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 4f249c9..0567d93 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 4f249c9b64d50d79e7ba703289cd67293a76821a +Subproject commit 0567d936e02dcbc41c62b4dd63c7aaafc3383844 From git at git.haskell.org Mon Mar 27 03:00:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:05 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: config.mk.in: Add bzip, gzip, and xz executable names to be overridden (efa9f0f) Message-ID: <20170327030005.3ADB53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/efa9f0fe55f6f9349a20b80b643b6ecdc50bc12a/ghc >--------------------------------------------------------------- commit efa9f0fe55f6f9349a20b80b643b6ecdc50bc12a Author: Ben Gamari Date: Thu Mar 23 20:59:21 2017 -0400 config.mk.in: Add bzip, gzip, and xz executable names to be overridden Reviewers: austin, hvr, erikd Reviewed By: erikd Subscribers: rwbarton, thomie, erikd, snowleopard Differential Revision: https://phabricator.haskell.org/D3367 (cherry picked from commit 1b374402a7a078e53c3e00eb0460e8b22930c453) >--------------------------------------------------------------- efa9f0fe55f6f9349a20b80b643b6ecdc50bc12a configure.ac | 5 +++++ mk/config.mk.in | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 496cd05..af62bd9 100644 --- a/configure.ac +++ b/configure.ac @@ -702,6 +702,11 @@ dnl ** check for tar dnl if GNU tar is named gtar, look for it first. AC_PATH_PROGS(TarCmd,gnutar gtar tar,tar) +dnl ** check for compressors +AC_PATH_PROGS(Bzip2Cmd,bzip2, bzip2) +AC_PATH_PROGS(GzipCmd,gzip, gzip) +AC_PATH_PROGS(XzCmd,pxz xz, xz) + dnl ** check for patch dnl if GNU patch is named gpatch, look for it first AC_PATH_PROGS(PatchCmd,gpatch patch, patch) diff --git a/mk/config.mk.in b/mk/config.mk.in index 729abfa..4e61eea 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -789,9 +789,9 @@ STRIP_CMD = strip endif PATCH_CMD = @PatchCmd@ TAR_CMD = @TarCmd@ -BZIP2_CMD = bzip2 -GZIP_CMD = gzip -XZ_CMD = xz +BZIP2_CMD = @Bzip2Cmd@ +GZIP_CMD = @GzipCmd@ +XZ_CMD = @XzCmd@ # xz is default compression TAR_COMP ?= xz From git at git.haskell.org Mon Mar 27 03:00:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:17 +0000 (UTC) Subject: [commit: ghc] master: Bump array submodule (2f8a3e3) Message-ID: <20170327030017.36A093A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2f8a3e37c5f76fd11034dd8f7d0381dd1c655cca/ghc >--------------------------------------------------------------- commit 2f8a3e37c5f76fd11034dd8f7d0381dd1c655cca Author: Ben Gamari Date: Sun Mar 26 19:06:36 2017 -0400 Bump array submodule Previous change fix 32-bit systems, but broke 64-bits >--------------------------------------------------------------- 2f8a3e37c5f76fd11034dd8f7d0381dd1c655cca libraries/array | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/array b/libraries/array index 82a50c4..fc82074 160000 --- a/libraries/array +++ b/libraries/array @@ -1 +1 @@ -Subproject commit 82a50c4044bf176b713be1fa9cc1a004df203658 +Subproject commit fc82074a9076d650610d71a966d8714f5217257f From git at git.haskell.org Mon Mar 27 03:00:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:08 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Allow colors to be customized (7141a18) Message-ID: <20170327030008.6E1613A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/7141a183a968b3418c113b234de9f75a0a735766/ghc >--------------------------------------------------------------- commit 7141a183a968b3418c113b234de9f75a0a735766 Author: Phil Ruffwind Date: Thu Mar 23 20:59:01 2017 -0400 Allow colors to be customized Allow customization of diagnostic colors through the GHC_COLORS environment variable. Some color-related code have been refactored to PprColour to reduce the circular dependence between DynFlags, Outputable, ErrUtils. Some color functions that were part of Outputable but were never used have been deleted. Test Plan: validate Reviewers: austin, hvr, bgamari, dfeuer Reviewed By: bgamari, dfeuer Subscribers: dfeuer, rwbarton, thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3364 (cherry picked from commit adf27d614f8a48d8dcf2d4e2e7872f7b3f818364) >--------------------------------------------------------------- 7141a183a968b3418c113b234de9f75a0a735766 compiler/ghc.cabal.in | 1 + compiler/ghc.mk | 1 + compiler/main/DynFlags.hs | 28 ++++++++------ compiler/main/DynFlags.hs-boot | 5 +-- compiler/main/ErrUtils.hs | 39 ++++++++++--------- compiler/utils/Outputable.hs | 87 +++++++---------------------------------- compiler/utils/PprColour.hs | 88 ++++++++++++++++++++++++++++++++++++++++++ compiler/utils/Util.hs | 15 +++++++ docs/users_guide/using.rst | 21 ++++++++-- ghc/GHCi/UI.hs | 2 +- 10 files changed, 176 insertions(+), 111 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 7141a183a968b3418c113b234de9f75a0a735766 From git at git.haskell.org Mon Mar 27 03:00:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:11 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: x86 nativeGen: Fix test with mask in range [128, 255] (#13425) (85dc062) Message-ID: <20170327030011.ABE263A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/85dc0627beeed6e67329c0f8b60fb049f433585a/ghc >--------------------------------------------------------------- commit 85dc0627beeed6e67329c0f8b60fb049f433585a Author: Reid Barton Date: Thu Mar 23 21:02:29 2017 -0400 x86 nativeGen: Fix test with mask in range [128,255] (#13425) My commit bdb0c43c7 optimized the encoding of instructions to test tag bits, but it did not always set exactly the same condition codes since the testb instruction does a single-byte comparison, rather than a full-word comparison. It would be correct to optimize the expression `x .&. 128 > 0` to the sequence testb $128, %al seta %al ; note: 'a' for unsigned comparison, ; not 'g' for signed comparison but the pretty-printer is not the right place to make this kind of context-sensitive optimization. Test Plan: harbormaster Reviewers: trofi, austin, bgamari, dfeuer Reviewed By: trofi, dfeuer Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3359 (cherry picked from commit caf94b062a0e37ffa7048e51447fc9486b658917) >--------------------------------------------------------------- 85dc0627beeed6e67329c0f8b60fb049f433585a compiler/nativeGen/X86/Ppr.hs | 6 +++++- testsuite/tests/codeGen/should_run/T13425.hs | 10 ++++++++++ .../tests/codeGen/should_run/T13425.stdout | 0 testsuite/tests/codeGen/should_run/all.T | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs index 7d19e99..5044c83 100644 --- a/compiler/nativeGen/X86/Ppr.hs +++ b/compiler/nativeGen/X86/Ppr.hs @@ -671,8 +671,12 @@ pprInstr (TEST format src dst) = sdocWithPlatform $ \platform -> -- (We could handle masks larger than a single byte too, -- but it would complicate the code considerably -- and tag checks are by far the most common case.) + -- The mask must have the high bit clear for this smaller encoding + -- to be completely equivalent to the original; in particular so + -- that the signed comparison condition bits are the same as they + -- would be if doing a full word comparison. See Trac #13425. (OpImm (ImmInteger mask), OpReg dstReg) - | 0 <= mask && mask < 256 -> minSizeOfReg platform dstReg + | 0 <= mask && mask < 128 -> minSizeOfReg platform dstReg _ -> format in pprFormatOpOp (sLit "test") format' src dst where diff --git a/testsuite/tests/codeGen/should_run/T13425.hs b/testsuite/tests/codeGen/should_run/T13425.hs new file mode 100644 index 0000000..49d0721 --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T13425.hs @@ -0,0 +1,10 @@ +import Data.Bits ((.&.)) + +flags :: Int -> Int +flags x + | x .&. 128 > 0 = 12 + | otherwise = 13 +{-# NOINLINE flags #-} + +main :: IO () +main = print (flags 255) diff --git a/libraries/base/tests/hPutBuf002.stdout b/testsuite/tests/codeGen/should_run/T13425.stdout similarity index 100% copy from libraries/base/tests/hPutBuf002.stdout copy to testsuite/tests/codeGen/should_run/T13425.stdout diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index b952c10..ffe4b64 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -155,3 +155,4 @@ test('T9577', [ unless(arch('x86_64') or arch('i386'),skip), when(opsys('darwin'), expect_broken(12937)), when(opsys('mingw32'), expect_broken(12965)), only_ways(['normal']) ], compile_and_run, ['']) +test('T13425', normal, compile_and_run, ['-O']) From git at git.haskell.org Mon Mar 27 03:00:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:14 +0000 (UTC) Subject: [commit: ghc] master: Drop dead code in rts/{Prelude.h, package.conf.in} (43e7b23) Message-ID: <20170327030014.6D8D13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/43e7b23a472e5decc3fde2fcaf924e0c893b8a64/ghc >--------------------------------------------------------------- commit 43e7b23a472e5decc3fde2fcaf924e0c893b8a64 Author: Moritz Angermann Date: Sat Mar 25 10:53:17 2017 -0400 Drop dead code in rts/{Prelude.h,package.conf.in} The endevor to drop the `-Wl,-u,` requirement for linking the rts, base, ,... turned out to be less fruitful than I had hoped. However it did turn up a few dead symbols, that are referenced but for which the definition seems to have diminished. Reviewers: austin, rwbarton, geekosaur, erikd, simonmar, bgamari Reviewed By: geekosaur, simonmar Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3350 >--------------------------------------------------------------- 43e7b23a472e5decc3fde2fcaf924e0c893b8a64 rts/Prelude.h | 6 +-- rts/package.conf.in | 105 +++++++++++++++++++++++++++------------------------- 2 files changed, 57 insertions(+), 54 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 43e7b23a472e5decc3fde2fcaf924e0c893b8a64 From git at git.haskell.org Mon Mar 27 03:00:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:23 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Only run T13143 in optasm way (23da02b) Message-ID: <20170327030023.4355F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/23da02b1584a5f1b083185d479807ba0ec6eccfe/ghc >--------------------------------------------------------------- commit 23da02b1584a5f1b083185d479807ba0ec6eccfe Author: Ben Gamari Date: Sat Mar 25 12:07:32 2017 -0400 testsuite: Only run T13143 in optasm way Otherwise we run it in the hpc way, which outputs different Core. >--------------------------------------------------------------- 23da02b1584a5f1b083185d479807ba0ec6eccfe testsuite/tests/simplCore/should_compile/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index d6a539e..365aa44 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -235,7 +235,7 @@ test('T13025', normal, run_command, ['$MAKE -s --no-print-directory T13025']) -test('T13143', normal, compile, ['-O -ddump-simpl -dsuppress-uniques']) +test('T13143', only_ways(['optasm']), compile, ['-O -ddump-simpl -dsuppress-uniques']) test('T13156', normal, run_command, ['$MAKE -s --no-print-directory T13156']) test('T11444', normal, compile, ['']) test('str-rules', From git at git.haskell.org Mon Mar 27 03:00:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:20 +0000 (UTC) Subject: [commit: ghc] master: Recompile if -fhpc is added or removed (#11798) (14b46a5) Message-ID: <20170327030020.8815D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/14b46a556dde8a2795ff5ede46ba8ee63368ae93/ghc >--------------------------------------------------------------- commit 14b46a556dde8a2795ff5ede46ba8ee63368ae93 Author: Reid Barton Date: Sat Mar 25 10:53:29 2017 -0400 Recompile if -fhpc is added or removed (#11798) Test Plan: validate Reviewers: austin, bgamari, dfeuer Reviewed By: dfeuer Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3368 >--------------------------------------------------------------- 14b46a556dde8a2795ff5ede46ba8ee63368ae93 compiler/iface/FlagChecker.hs | 10 ++++++++-- testsuite/tests/hpc/Makefile | 6 ++++++ testsuite/tests/hpc/T11798.hs | 3 +++ testsuite/tests/hpc/T11798.stdout | 2 ++ testsuite/tests/hpc/all.T | 2 ++ 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/compiler/iface/FlagChecker.hs b/compiler/iface/FlagChecker.hs index b21c2ce..2c0b6c4 100644 --- a/compiler/iface/FlagChecker.hs +++ b/compiler/iface/FlagChecker.hs @@ -57,9 +57,15 @@ fingerprintDynFlags dflags at DynFlags{..} this_mod nameio = then 0 else optLevel - in -- pprTrace "flags" (ppr (mainis, safeHs, lang, cpp, paths, prof, opt)) $ - computeFingerprint nameio (mainis, safeHs, lang, cpp, paths, prof, opt) + -- -fhpc, see https://ghc.haskell.org/trac/ghc/ticket/11798 + -- hpcDir is output-only, so we should recompile if it changes + hpc = if gopt Opt_Hpc dflags then Just hpcDir else Nothing + -- Nesting just to avoid ever more Binary tuple instances + flags = (mainis, safeHs, lang, cpp, paths, (prof, opt, hpc)) + + in -- pprTrace "flags" (ppr flags) $ + computeFingerprint nameio flags {- Note [path flags and recompilation] diff --git a/testsuite/tests/hpc/Makefile b/testsuite/tests/hpc/Makefile index 9a36a1c..6de7cee 100644 --- a/testsuite/tests/hpc/Makefile +++ b/testsuite/tests/hpc/Makefile @@ -1,3 +1,9 @@ TOP=../.. include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk + +# Test that adding -fhpc triggers recompilation +T11798: + "$(TEST_HC)" $(TEST_HC_ARGS) T11798 + "$(TEST_HC)" $(TEST_HC_ARGS) T11798 -fhpc + test -e .hpc/T11798.mix diff --git a/testsuite/tests/hpc/T11798.hs b/testsuite/tests/hpc/T11798.hs new file mode 100644 index 0000000..2d42817 --- /dev/null +++ b/testsuite/tests/hpc/T11798.hs @@ -0,0 +1,3 @@ +module T11798 where + +f x = [x,x,x] diff --git a/testsuite/tests/hpc/T11798.stdout b/testsuite/tests/hpc/T11798.stdout new file mode 100644 index 0000000..024b0dc --- /dev/null +++ b/testsuite/tests/hpc/T11798.stdout @@ -0,0 +1,2 @@ +[1 of 1] Compiling T11798 ( T11798.hs, T11798.o ) +[1 of 1] Compiling T11798 ( T11798.hs, T11798.o ) [flags changed] diff --git a/testsuite/tests/hpc/all.T b/testsuite/tests/hpc/all.T index f1fc590..274674b 100644 --- a/testsuite/tests/hpc/all.T +++ b/testsuite/tests/hpc/all.T @@ -3,6 +3,8 @@ test('T10138', [extra_files(['.keepme.hpc.T10138/']), # Using --hpcdir with an absolute path should work (exit code 0). ['{hpc} report T10138.keepme.tix --hpcdir="`pwd`/.keepme.hpc.T10138"']) +test('T11798', normal, run_command, ['$MAKE -s --no-print-directory T11798']) + # Run tests below only for the hpc way. # # Do not explicitly specify '-fhpc' in extra_hc_opts, unless also setting From git at git.haskell.org Mon Mar 27 03:00:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:26 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Mark T12622 as broken in ghci way (140a2d1) Message-ID: <20170327030026.025493A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/140a2d1c463bd314c9afbeb8d60e739163ce576a/ghc >--------------------------------------------------------------- commit 140a2d1c463bd314c9afbeb8d60e739163ce576a Author: Ben Gamari Date: Sat Mar 25 12:28:59 2017 -0400 testsuite: Mark T12622 as broken in ghci way See #13481. >--------------------------------------------------------------- 140a2d1c463bd314c9afbeb8d60e739163ce576a testsuite/tests/codeGen/should_run/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index ffe4b64..9f334cf 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -148,7 +148,7 @@ test('PopCnt', omit_ways(['ghci']), multi_compile_and_run, ['PopCnt', [('PopCnt_cmm.cmm', '')], '']) test('T12059', normal, compile_and_run, ['']) test('T12433', normal, compile_and_run, ['']) -test('T12622', normal, multimod_compile_and_run, ['T12622', '-O']) +test('T12622', expect_broken_for(13481, ['ghci']), multimod_compile_and_run, ['T12622', '-O']) test('T12757', normal, compile_and_run, ['']) test('T12855', normal, compile_and_run, ['']) test('T9577', [ unless(arch('x86_64') or arch('i386'),skip), From git at git.haskell.org Mon Mar 27 03:00:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:28 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: linker: fix OpenBSD build failure, EM_PPC64 is not defined there (d4694b8) Message-ID: <20170327030028.B99053A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/d4694b85be23c8a014225271060765c062502ed2/ghc >--------------------------------------------------------------- commit d4694b85be23c8a014225271060765c062502ed2 Author: Sergei Trofimovich Date: Sun Mar 26 15:40:40 2017 +0100 linker: fix OpenBSD build failure, EM_PPC64 is not defined there Adam Steen reported build failure on OpenBSD: rts/linker/Elf.c:402:0: error: error: 'EM_PPC64' undeclared (first use in this function) case EM_PPC64: IF_DEBUG(linker,debugBelch( "powerpc64" )); OpenBSD-6.0 does not define EM_PPC64: /usr/include/sys/exec_elf.h:#define EM_PPC 20 /* PowerPC */ Reported-by: Adam Steen Signed-off-by: Sergei Trofimovich (cherry picked from commit 6c73504ac5f4e951062d5e868fa2b69b028b6e79) >--------------------------------------------------------------- d4694b85be23c8a014225271060765c062502ed2 rts/linker/Elf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c index 604c3dc..e8f6aab 100644 --- a/rts/linker/Elf.c +++ b/rts/linker/Elf.c @@ -399,10 +399,12 @@ ocVerifyImage_ELF ( ObjectCode* oc ) case EM_IA_64: IF_DEBUG(linker,debugBelch( "ia64" )); break; #endif case EM_PPC: IF_DEBUG(linker,debugBelch( "powerpc32" )); break; +#ifdef EM_PPC64 case EM_PPC64: IF_DEBUG(linker,debugBelch( "powerpc64" )); errorBelch("%s: RTS linker not implemented on PowerPC 64-bit", oc->fileName); return 0; +#endif #ifdef EM_X86_64 case EM_X86_64: IF_DEBUG(linker,debugBelch( "x86_64" )); break; #elif defined(EM_AMD64) From git at git.haskell.org Mon Mar 27 03:00:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:31 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Document hithertoo undocumented HPCTIXFILE option. (309d863) Message-ID: <20170327030031.74B113A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/309d86329dd425157b4dd8351ec2003ce77fc20d/ghc >--------------------------------------------------------------- commit 309d86329dd425157b4dd8351ec2003ce77fc20d Author: Edward Z. Yang Date: Thu Mar 23 21:03:40 2017 -0400 Document hithertoo undocumented HPCTIXFILE option. Test Plan: none Reviewers: bgamari, austin, dfeuer Reviewed By: bgamari, dfeuer Subscribers: dfeuer, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3357 (cherry picked from commit ee7241cfde455ab6731b9ce81b36247f082a1342) >--------------------------------------------------------------- 309d86329dd425157b4dd8351ec2003ce77fc20d docs/users_guide/profiling.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/users_guide/profiling.rst b/docs/users_guide/profiling.rst index 832464e..d035cc5 100644 --- a/docs/users_guide/profiling.rst +++ b/docs/users_guide/profiling.rst @@ -1292,7 +1292,8 @@ case :file:`Recip.tix`, which contains the coverage data for this run of the program. The program may be run multiple times (e.g. with different test data), and the coverage data from the separate runs is accumulated in the ``.tix`` file. To reset the coverage data and start again, just -remove the ``.tix`` file. +remove the ``.tix`` file. You can control where the ``.tix`` file +is generated using the environment variable :envvar:`HPCTIXFILE`. Having run the program, we can generate a textual summary of coverage: @@ -1532,8 +1533,10 @@ Caveats and Shortcomings of Haskell Program Coverage HPC does not attempt to lock the ``.tix`` file, so multiple concurrently running binaries in the same directory will exhibit a race condition. -There is no way to change the name of the ``.tix`` file generated, apart -from renaming the binary. HPC does not work with GHCi. +At compile time, there is no way to change the name of the ``.tix`` file generated; +at runtime, the name of the generated ``.tix`` file can be changed +using :envvar:`HPCTIXFILE`; the name of the ``.tix`` file +will also change if you rename the binary. HPC does not work with GHCi. .. _ticky-ticky: From git at git.haskell.org Mon Mar 27 03:00:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:34 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Make T10245 pass on 32-bit platforms (0b8263e) Message-ID: <20170327030034.56DA73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/0b8263e80b6e31044f6963b0c970f481a622cc65/ghc >--------------------------------------------------------------- commit 0b8263e80b6e31044f6963b0c970f481a622cc65 Author: Ben Gamari Date: Fri Mar 24 11:36:31 2017 -0400 testsuite: Make T10245 pass on 32-bit platforms (cherry picked from commit ff6ee998e06c74bf41841a9ccf2e55a722268e91) >--------------------------------------------------------------- 0b8263e80b6e31044f6963b0c970f481a622cc65 testsuite/tests/codeGen/should_run/T10245.hs | 12 ++++++++++++ testsuite/tests/codeGen/should_run/T10245.stdout-ws-32 | 3 +++ .../should_run/{T10245.stdout => T10245.stdout-ws-64} | 0 3 files changed, 15 insertions(+) diff --git a/testsuite/tests/codeGen/should_run/T10245.hs b/testsuite/tests/codeGen/should_run/T10245.hs index 7094a1d..43383a3 100644 --- a/testsuite/tests/codeGen/should_run/T10245.hs +++ b/testsuite/tests/codeGen/should_run/T10245.hs @@ -1,11 +1,23 @@ +{-# LANGUAGE CPP #-} + +#include "MachDeps.h" + f :: Int -> String f n = case n of +#if WORD_SIZE_IN_BITS == 64 0x8000000000000000 -> "yes" +#else + 0x80000000 -> "yes" +#endif _ -> "no" {-# NOINLINE f #-} main = do +#if WORD_SIZE_IN_BITS == 64 let string = "0x8000000000000000" +#else + let string = "0x80000000" +#endif let i = read string :: Integer let i' = fromIntegral i :: Int print i diff --git a/testsuite/tests/codeGen/should_run/T10245.stdout-ws-32 b/testsuite/tests/codeGen/should_run/T10245.stdout-ws-32 new file mode 100644 index 0000000..a6c8f1f --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T10245.stdout-ws-32 @@ -0,0 +1,3 @@ +2147483648 +-2147483648 +"yes" diff --git a/testsuite/tests/codeGen/should_run/T10245.stdout b/testsuite/tests/codeGen/should_run/T10245.stdout-ws-64 similarity index 100% rename from testsuite/tests/codeGen/should_run/T10245.stdout rename to testsuite/tests/codeGen/should_run/T10245.stdout-ws-64 From git at git.haskell.org Mon Mar 27 03:00:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:37 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Add testcase for #13429 (366a5b7) Message-ID: <20170327030037.5528F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/366a5b7d5226517fa3d499f393d52e59c5b8c29e/ghc >--------------------------------------------------------------- commit 366a5b7d5226517fa3d499f393d52e59c5b8c29e Author: Ben Gamari Date: Thu Mar 23 23:03:54 2017 -0400 testsuite: Add testcase for #13429 (cherry picked from commit be8122ab72aeec509b5ce4b4f05fbc5cdb77bf5a) >--------------------------------------------------------------- 366a5b7d5226517fa3d499f393d52e59c5b8c29e testsuite/tests/simplCore/should_compile/T13429.hs | 114 +++++++++++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 2 files changed, 115 insertions(+) diff --git a/testsuite/tests/simplCore/should_compile/T13429.hs b/testsuite/tests/simplCore/should_compile/T13429.hs new file mode 100644 index 0000000..cc9b4d2 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T13429.hs @@ -0,0 +1,114 @@ +{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} +module Loop (Array(..), Image(..), X, promote, correlate) where +import Data.Maybe (fromMaybe) + +data Kernel e = Kernel Int Int !(Vector (Int, Int, e)) deriving (Show) + + +toKernel :: Array X e => Image X e -> Kernel e +toKernel img = + Kernel m2 n2 $ filter (\(_, _, x) -> x /= 0) $ imap addIx $ toVector img + where + (m, n) = dims img + (m2, n2) = (m `div` 2, n `div` 2) + addIx k (PixelX x) = + let (i, j) = toIx n k + in (i - m2, j - n2, x) + +correlate :: Array cs e => Image X e -> Image cs e -> Image cs e +correlate kernelImg imgM = makeImage (dims imgM) stencil + where + !(Kernel kM2 kN2 kernelV) = toKernel kernelImg + kLen = length kernelV + stencil (i, j) = + loop 0 (promote 0) $ \ k acc -> + let (iDelta, jDelta, x) = kernelV !! k + imgPx = index imgM (i + iDelta, j + jDelta) + in liftPx2 (+) acc (liftPx (x *) imgPx) + loop init' initAcc f = go init' initAcc + where + go step acc = + if step < kLen + then go (step + 1) (f step acc) + else acc +{-# INLINE correlate #-} + + + +-- | A Pixel family with a color space and a precision of elements. +data family Pixel cs e :: * + + +class (Eq e, Num e) => ColorSpace cs e where + promote :: e -> Pixel cs e + liftPx :: (e -> e) -> Pixel cs e -> Pixel cs e + liftPx2 :: (e -> e -> e) -> Pixel cs e -> Pixel cs e -> Pixel cs e + + + +data family Image cs e :: * + +class ColorSpace cs e => Array cs e where + dims :: Image cs e -> (Int, Int) + makeImage :: (Int, Int) -> ((Int, Int) -> Pixel cs e) -> Image cs e + toVector :: Image cs e -> Vector (Pixel cs e) + index :: Image cs e -> (Int, Int) -> Pixel cs e + +fromIx :: Int -> (Int, Int) -> Int +fromIx n (i, j) = n * i + j + +toIx :: Int -> Int -> (Int, Int) +toIx n k = divMod k n + +instance (Show (Pixel cs e), ColorSpace cs e, Array cs e) => + Show (Image cs e) where + show img = + let (m, n) = dims img + in ": " ++ show (toVector img) + + +data X = X + +newtype instance Pixel X e = PixelX e + +instance Show e => Show (Pixel X e) where + show (PixelX e) = "Pixel: " ++ show e + + +instance (Eq e, Num e) => ColorSpace X e where + promote = PixelX + liftPx f (PixelX g) = PixelX (f g) + liftPx2 f (PixelX g1) (PixelX g2) = PixelX (f g1 g2) + + +data instance Image X e = VImage Int Int (Vector (Pixel X e)) + +instance ColorSpace X e => Array X e where + dims (VImage m n _) = (m, n) + makeImage (m, n) f = VImage m n $ generate (m * n) (f . toIx n) + toVector (VImage _ _ v) = v + index (VImage _ n v) ix = fromMaybe (promote 0) (v !? (fromIx n ix)) + + +-- Vector emulation + +type Vector a = [a] + +imap :: (Num a, Enum a) => (a -> b -> c) -> [b] -> [c] +imap f = zipWith f [0..] + +(!?) :: [a] -> Int -> Maybe a +(!?) ls i + | i < 0 || i >= length ls = Nothing + | otherwise = Just (ls !! i) + +generate :: (Ord t, Num t) => t -> (t -> a) -> [a] +generate n f = go (n-1) [] where + go i acc | i < 0 = acc + | otherwise = go (i-1) (f i : acc) + diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 98d7d79..d6a539e 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -252,3 +252,4 @@ test('T13338', only_ways(['optasm']), compile, ['-dcore-lint']) test('T13367', normal, run_command, ['$MAKE -s --no-print-directory T13367']) test('T13417', normal, compile, ['-O']) test('T13413', normal, compile, ['']) +test('T13429', normal, compile, ['']) From git at git.haskell.org Mon Mar 27 03:00:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:40 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Add failing testcase for #13233 (c810c3c) Message-ID: <20170327030040.8FF5C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/c810c3c5e9c91ecf1a73d9013abf8e1c95f21ea1/ghc >--------------------------------------------------------------- commit c810c3c5e9c91ecf1a73d9013abf8e1c95f21ea1 Author: Ben Gamari Date: Thu Mar 23 22:53:29 2017 -0400 testsuite: Add failing testcase for #13233 Thanks to Ryan Scott for the example. (cherry picked from commit 27c9a7d095d2383a7822d317dc7acfe579a4815b) >--------------------------------------------------------------- c810c3c5e9c91ecf1a73d9013abf8e1c95f21ea1 testsuite/tests/codeGen/should_compile/T13233.hs | 12 ++++++++++++ testsuite/tests/codeGen/should_compile/all.T | 1 + 2 files changed, 13 insertions(+) diff --git a/testsuite/tests/codeGen/should_compile/T13233.hs b/testsuite/tests/codeGen/should_compile/T13233.hs new file mode 100644 index 0000000..bb79856 --- /dev/null +++ b/testsuite/tests/codeGen/should_compile/T13233.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeInType #-} +{-# LANGUAGE UnboxedTuples #-} +module Bug where + +import GHC.Exts (TYPE) + +class Foo (a :: TYPE rep) where + bar :: forall (b :: TYPE rep2). (a -> a -> b) -> a -> a -> b + +baz :: forall (a :: TYPE rep). Foo a => a -> a -> (# a, a #) +baz = bar (#,#) diff --git a/testsuite/tests/codeGen/should_compile/all.T b/testsuite/tests/codeGen/should_compile/all.T index 6ae4e1c..a73a9d6 100644 --- a/testsuite/tests/codeGen/should_compile/all.T +++ b/testsuite/tests/codeGen/should_compile/all.T @@ -35,3 +35,4 @@ test('T10667', [ when((arch('powerpc64') or arch('powerpc64le')), compile, ['-g']) test('T12115', normal, compile, ['']) test('T12355', normal, compile, ['']) +test('T13233', expect_broken(13233), compile, ['']) From git at git.haskell.org Mon Mar 27 03:00:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:43 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Update performance numbers for 32-bit platforms (b29004b) Message-ID: <20170327030043.E6A133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/b29004ba2c2f73a8c0e37f92554bde3b9f1d54f8/ghc >--------------------------------------------------------------- commit b29004ba2c2f73a8c0e37f92554bde3b9f1d54f8 Author: Ben Gamari Date: Fri Mar 24 12:26:03 2017 -0400 testsuite: Update performance numbers for 32-bit platforms (cherry picked from commit 6d774ff2fde787d2032bbcefcb3afd2262b3916e) >--------------------------------------------------------------- b29004ba2c2f73a8c0e37f92554bde3b9f1d54f8 .../{T13257.stderr => T13257.stderr-ws-32} | 2 +- .../{T13257.stderr => T13257.stderr-ws-64} | 0 testsuite/tests/perf/compiler/all.T | 66 +++++++++++++++------- testsuite/tests/perf/haddock/all.T | 9 ++- testsuite/tests/perf/should_run/all.T | 34 +++++++---- testsuite/tests/perf/space_leaks/all.T | 8 ++- 6 files changed, 79 insertions(+), 40 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 b29004ba2c2f73a8c0e37f92554bde3b9f1d54f8 From git at git.haskell.org Mon Mar 27 03:00:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:46 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Note x87 terribleness in num009 (6fe3f90) Message-ID: <20170327030046.9EC823A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/6fe3f90a29aebc59f2aa7e5c9111ed1a4afaa127/ghc >--------------------------------------------------------------- commit 6fe3f90a29aebc59f2aa7e5c9111ed1a4afaa127 Author: Ben Gamari Date: Fri Mar 24 13:22:08 2017 -0400 testsuite: Note x87 terribleness in num009 (cherry picked from commit a1b7e866378e848d50b940595aa43fa63672cf37) >--------------------------------------------------------------- 6fe3f90a29aebc59f2aa7e5c9111ed1a4afaa127 libraries/base/tests/Numeric/num009.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/base/tests/Numeric/num009.hs b/libraries/base/tests/Numeric/num009.hs index 429f0bf..c0dec43 100644 --- a/libraries/base/tests/Numeric/num009.hs +++ b/libraries/base/tests/Numeric/num009.hs @@ -1,4 +1,8 @@ -- trac #2059 +-- +-- Note that this test fails miserably when compiled to use X87 floating point. +-- For instance, in the case of (sin 1e20) the X86 FSIN instruction doesn't even +-- get the sign right on my machine. module Main(main) where @@ -20,7 +24,7 @@ test :: (RealFloat a, Floating a, RealFloat b, Floating b, Show b) test s f g x = do let y = realToFrac (f (realToFrac x)) z = g x unless (y == z) $ do - putStrLn (s ++ ' ':show x) + putStrLn ("uh oh! " ++ s ++ ' ':show x) print y print z print $ decodeFloat y From git at git.haskell.org Mon Mar 27 03:00:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:49 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Allow join007 to pass on 32-bit machines (df21c54) Message-ID: <20170327030049.73C423A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/df21c5448618b07e0fb130be967124ecd5306494/ghc >--------------------------------------------------------------- commit df21c5448618b07e0fb130be967124ecd5306494 Author: Ben Gamari Date: Fri Mar 24 12:27:35 2017 -0400 testsuite: Allow join007 to pass on 32-bit machines The output of the test overflows. Given that the result is stable regardless of whether it overflows, I just made the expected output word-size dependent. (cherry picked from commit aecbfb908a11991eb23b790a440efe4697ffb86a) >--------------------------------------------------------------- df21c5448618b07e0fb130be967124ecd5306494 testsuite/tests/perf/join_points/join007.hs | 2 ++ testsuite/tests/perf/join_points/join007.stdout-ws-32 | 1 + .../tests/perf/join_points/{join007.stdout => join007.stdout-ws-64} | 0 3 files changed, 3 insertions(+) diff --git a/testsuite/tests/perf/join_points/join007.hs b/testsuite/tests/perf/join_points/join007.hs index aa2f68c..59cc99b 100644 --- a/testsuite/tests/perf/join_points/join007.hs +++ b/testsuite/tests/perf/join_points/join007.hs @@ -39,4 +39,6 @@ enumFromToS lo hi = Stream next lo test :: Int -> Int -> Int test lo hi = sumS (filterS even (enumFromToS lo hi)) +-- Note that this overflows on 32-bit machines and therefore we have two stdout +-- files main = print $ test 1 10000000 diff --git a/testsuite/tests/perf/join_points/join007.stdout-ws-32 b/testsuite/tests/perf/join_points/join007.stdout-ws-32 new file mode 100644 index 0000000..d4692e3 --- /dev/null +++ b/testsuite/tests/perf/join_points/join007.stdout-ws-32 @@ -0,0 +1 @@ +-999630016 diff --git a/testsuite/tests/perf/join_points/join007.stdout b/testsuite/tests/perf/join_points/join007.stdout-ws-64 similarity index 100% rename from testsuite/tests/perf/join_points/join007.stdout rename to testsuite/tests/perf/join_points/join007.stdout-ws-64 From git at git.haskell.org Mon Mar 27 03:00:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:52 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: rts: Fix stat output on 32-bit platforms (e4b4ba5) Message-ID: <20170327030052.2E3733A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/e4b4ba5158707e98916610f1c4226fada1b782b6/ghc >--------------------------------------------------------------- commit e4b4ba5158707e98916610f1c4226fada1b782b6 Author: Ben Gamari Date: Fri Mar 24 14:59:14 2017 -0400 rts: Fix stat output on 32-bit platforms The formatting strings fell out of sync with the arguments. (cherry picked from commit 94ec48f8a25d5a381a5d42016baa0333c186a442) >--------------------------------------------------------------- e4b4ba5158707e98916610f1c4226fada1b782b6 rts/Stats.c | 58 +++++++++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/rts/Stats.c b/rts/Stats.c index 217bace..5f5fa58 100644 --- a/rts/Stats.c +++ b/rts/Stats.c @@ -757,35 +757,43 @@ stat_exit (void) } if (RtsFlags.GcFlags.giveStats == ONELINE_GC_STATS) { - char *fmt1, *fmt2; - if (RtsFlags.MiscFlags.machineReadable) { - fmt1 = " [(\"bytes allocated\", \"%llu\")\n"; - fmt2 = " ,(\"num_GCs\", \"%d\")\n" - " ,(\"average_bytes_used\", \"%ld\")\n" - " ,(\"max_bytes_used\", \"%ld\")\n" - " ,(\"num_byte_usage_samples\", \"%ld\")\n" - " ,(\"peak_megabytes_allocated\", \"%lu\")\n" - " ,(\"init_cpu_seconds\", \"%.3f\")\n" - " ,(\"init_wall_seconds\", \"%.3f\")\n" - " ,(\"mutator_cpu_seconds\", \"%.3f\")\n" - " ,(\"mutator_wall_seconds\", \"%.3f\")\n" - " ,(\"GC_cpu_seconds\", \"%.3f\")\n" - " ,(\"GC_wall_seconds\", \"%.3f\")\n" - " ]\n"; - } - else { - fmt1 = "<>\n"; + } /* print the long long separately to avoid bugginess on mingwin (2001-07-02, mingw-0.5) */ - statsPrintf(fmt1, stats.allocated_bytes); - statsPrintf(fmt2, + statsPrintf(fmt, + stats.allocated_bytes, stats.gcs, - stats.major_gcs == 0 ? 0 : - stats.cumulative_live_bytes/stats.major_gcs, + (uint64_t) + (stats.major_gcs == 0 ? 0 : + stats.cumulative_live_bytes/stats.major_gcs), stats.max_live_bytes, stats.major_gcs, - (unsigned long)(peak_mblocks_allocated * MBLOCK_SIZE / (1024L * 1024L)), + (uint64_t) (peak_mblocks_allocated * MBLOCK_SIZE / (1024L * 1024L)), TimeToSecondsDbl(init_cpu), TimeToSecondsDbl(init_elapsed), TimeToSecondsDbl(mut_cpu), TimeToSecondsDbl(mut_elapsed), TimeToSecondsDbl(gc_cpu), TimeToSecondsDbl(gc_elapsed)); From git at git.haskell.org Mon Mar 27 03:00:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:54 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Eliminate word-size dependence in HsDumpAst output (b8f16d8) Message-ID: <20170327030054.DD7653A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/b8f16d89d803913f124d26cfcaa02d2d6f0b26c8/ghc >--------------------------------------------------------------- commit b8f16d89d803913f124d26cfcaa02d2d6f0b26c8 Author: Ben Gamari Date: Fri Mar 24 12:05:23 2017 -0400 Eliminate word-size dependence in HsDumpAst output Fixes DumpTypecheckedAst output on 32-bit platforms. (cherry picked from commit bc9f280acf82d34fea72199a34b00c414c3ef59e) >--------------------------------------------------------------- b8f16d89d803913f124d26cfcaa02d2d6f0b26c8 compiler/hsSyn/HsDumpAst.hs | 16 ++++++- .../should_compile/DumpTypecheckedAst.stderr | 54 +++++++++++----------- 2 files changed, 42 insertions(+), 28 deletions(-) diff --git a/compiler/hsSyn/HsDumpAst.hs b/compiler/hsSyn/HsDumpAst.hs index f735488..b76b3fb 100644 --- a/compiler/hsSyn/HsDumpAst.hs +++ b/compiler/hsSyn/HsDumpAst.hs @@ -18,6 +18,7 @@ module HsDumpAst ( import Data.Data hiding (Fixity) import Data.List import Bag +import BasicTypes import FastString import NameSet import Name @@ -46,7 +47,7 @@ showAstData b = showAstData' 0 showAstData' n = generic `ext1Q` list - `extQ` string `extQ` fastString `extQ` srcSpan + `extQ` string `extQ` fastString `extQ` srcSpan `extQ` lit `extQ` bytestring `extQ` name `extQ` occName `extQ` moduleName `extQ` var `extQ` dataCon @@ -76,6 +77,19 @@ showAstData b = showAstData' 0 ++ intercalate "," (map (showAstData' (n+1)) l) ++ "]" + -- Eliminate word-size dependence + lit :: HsLit -> String + lit (HsWordPrim s x) = numericLit "HsWord{64}Prim" x s + lit (HsWord64Prim s x) = numericLit "HsWord{64}Prim" x s + lit (HsIntPrim s x) = numericLit "HsInt{64}Prim" x s + lit (HsInt64Prim s x) = numericLit "HsInt{64}Prim" x s + lit l = generic l + + numericLit :: String -> Integer -> SourceText -> String + numericLit tag x s = indent n ++ unwords [ "{" ++ tag + , generic x + , generic s ++ "}" ] + name :: Name -> String name = ("{Name: "++) . (++"}") . showSDocDebug_ . ppr diff --git a/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr b/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr index 3725b6f..4b10222 100644 --- a/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr +++ b/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr @@ -21,14 +21,14 @@ ({abstract:ConLike}))) ({ } (HsLit - (HsWordPrim - (NoSourceText) - (14073232900889011755)))))) + {HsWord{64}Prim + (14073232900889011755) + (NoSourceText)})))) ({ } (HsLit - (HsWordPrim - (NoSourceText) - (2739668351064589274)))))) + {HsWord{64}Prim + (2739668351064589274) + (NoSourceText)})))) ({ } (HsVar ({ }{Var: (main:DumpTypecheckedAst.$trModule{v} [lidx] :: ghc-prim:GHC.Types.Module{tc})}))))) @@ -45,9 +45,9 @@ (NoSourceText) "Peano"))))))))) ({ } (HsLit - (HsIntPrim - (SourceText "0") - (0)))))) + {HsInt{64}Prim + (0) + (SourceText "0")})))) ({ } (HsVar ({ }{Var: (ghc-prim:GHC.Types.krep$*{v} [gid] :: ghc-prim:GHC.Types.KindRep{tc})}))))) @@ -71,14 +71,14 @@ ({abstract:ConLike}))) ({ } (HsLit - (HsWordPrim - (NoSourceText) - (13760111476013868540)))))) + {HsWord{64}Prim + (13760111476013868540) + (NoSourceText)})))) ({ } (HsLit - (HsWordPrim - (NoSourceText) - (12314848029315386153)))))) + {HsWord{64}Prim + (12314848029315386153) + (NoSourceText)})))) ({ } (HsVar ({ }{Var: (main:DumpTypecheckedAst.$trModule{v} [lidx] :: ghc-prim:GHC.Types.Module{tc})}))))) @@ -95,9 +95,9 @@ (NoSourceText) "'Zero"))))))))) ({ } (HsLit - (HsIntPrim - (SourceText "0") - (0)))))) + {HsInt{64}Prim + (0) + (SourceText "0")})))) ({ } (HsVar ({ }{Var: ($krep{v} [lid] :: ghc-prim:GHC.Types.KindRep{tc})}))))) @@ -121,14 +121,14 @@ ({abstract:ConLike}))) ({ } (HsLit - (HsWordPrim - (NoSourceText) - (1143980031331647856)))))) + {HsWord{64}Prim + (1143980031331647856) + (NoSourceText)})))) ({ } (HsLit - (HsWordPrim - (NoSourceText) - (14802086722010293686)))))) + {HsWord{64}Prim + (14802086722010293686) + (NoSourceText)})))) ({ } (HsVar ({ }{Var: (main:DumpTypecheckedAst.$trModule{v} [lidx] :: ghc-prim:GHC.Types.Module{tc})}))))) @@ -145,9 +145,9 @@ (NoSourceText) "'Succ"))))))))) ({ } (HsLit - (HsIntPrim - (SourceText "0") - (0)))))) + {HsInt{64}Prim + (0) + (SourceText "0")})))) ({ } (HsVar ({ }{Var: ($krep{v} [lid] :: ghc-prim:GHC.Types.KindRep{tc})}))))) From git at git.haskell.org Mon Mar 27 03:00:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:00:57 +0000 (UTC) Subject: [commit: ghc] master: Refactor MachO.c (f1ce276) Message-ID: <20170327030057.9B37B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f1ce27669a43710a3dfcafd61d34601f395231bc/ghc >--------------------------------------------------------------- commit f1ce27669a43710a3dfcafd61d34601f395231bc Author: Moritz Angermann Date: Tue Mar 21 11:01:40 2017 -0400 Refactor MachO.c - Rename existing structs with typedefs from MachOTypes. - Update the following functions to make use of the extended ObjectCode structure: - ocAllocateSymbolExtras_MachO - resolveImports - ocGetNames_MachO - ocResolve_MachO - ocRunInit_MachO - repalce int with size_t for fread - Add aarch64 to the 64bit magic header check. Depends on D3239, D3251 This is just one of the pieces for the rts linker support for ios (aarch64-macho) --- The following diagram and legend tries to explain the dependencies a bit: ``` .- D3240 v D3255 <- This <- D3251 <- D3239 ^ '- D3238 ``` - In D3238 we started allowing preloading object code with mmap in iOS, where we can't have r+w+x. - In D3239 we introduced a richer extension of the object code data type to make working with mach-o files easier. - In D3240 we set the stage to allow loading archives (.a) on iOS - In D3251 we added init and deinit functions to populate and depopulate the enriched object code data structure for mach-o files. - In D3252 we refactored most of the MachO.c file to use the new types and data structure. - in D3255 we finally introduce the aarch64-mach-o linker. Reviewers: austin, rwbarton, erikd, simonmar, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3252 >--------------------------------------------------------------- f1ce27669a43710a3dfcafd61d34601f395231bc rts/linker/MachO.c | 434 ++++++++++++++++++++++------------------------------- 1 file changed, 183 insertions(+), 251 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 f1ce27669a43710a3dfcafd61d34601f395231bc From git at git.haskell.org Mon Mar 27 03:01:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:01:00 +0000 (UTC) Subject: [commit: ghc] master: rts linker: Introduce MachOTypes (8ed29b5) Message-ID: <20170327030100.C14813A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8ed29b50376856018dfbbcbd6d728c69af0c9f29/ghc >--------------------------------------------------------------- commit 8ed29b50376856018dfbbcbd6d728c69af0c9f29 Author: Moritz Angermann Date: Tue Mar 21 10:59:49 2017 -0400 rts linker: Introduce MachOTypes This diff introduces MachOTypes, to reduce the need to typing `struct` all the time. It also coaleces the 64 and non 64 structs. It also adds additional fiedls to the object code structure for macho, which makes working with macho object code much simpler and requires less passing around of variabls or address recomputation for the header, symbol table, etc... Furthermore this diff introduces a type for a linked list of stubs. I had to move the #ifdef from the bottom of the file up, to be able to extend the object code structure conditional on the use of the macho file format. This is just one of the pieces for the rts linker support for ios (aarch64-macho) --- The following diagram and legend tries to explain the dependencies a bit: ``` .- D3240 v D3255 <- D3252 <- D3251 <- This ^ '- D3238 ``` - In D3238 we started allowing preloading object code with mmap in iOS, where we can't have r+w+x. - In D3239 we introduced a richer extension of the object code data type to make working with mach-o files easier. - In D3240 we set the stage to allow loading archives (.a) on iOS - In D3251 we added init and deinit functions to populate and depopulate the enriched object code data structure for mach-o files. - In D3252 we refactored most of the MachO.c file to use the new types and data structure. - in D3255 we finally introduce the aarch64-mach-o linker. Reviewers: austin, erikd, simonmar, rwbarton, bgamari Subscribers: rwbarton, thomie, ryantrinkle Differential Revision: https://phabricator.haskell.org/D3239 >--------------------------------------------------------------- 8ed29b50376856018dfbbcbd6d728c69af0c9f29 rts/Linker.c | 6 +++ rts/LinkerInternals.h | 28 +++++++++- rts/linker/MachOTypes.h | 133 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 165 insertions(+), 2 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 8ed29b50376856018dfbbcbd6d728c69af0c9f29 From git at git.haskell.org Mon Mar 27 03:01:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:01:03 +0000 (UTC) Subject: [commit: ghc] master: Add ocInit_MachO (938392c) Message-ID: <20170327030103.7CF183A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/938392c8515ccbe894714f43852fe604a21ce30b/ghc >--------------------------------------------------------------- commit 938392c8515ccbe894714f43852fe604a21ce30b Author: Moritz Angermann Date: Tue Mar 21 11:01:11 2017 -0400 Add ocInit_MachO This adds ocInit_MachO function, used to populate the extended ObjectCode structure, and the corresponding stgFree. It also adds defines for iOS, such that MachO.o is also compiled for iOS targets. Depends on D3239 --- This is just one of the pieces for the rts linker support for ios (aarch64-macho) --- The following diagram and legend tries to explain the dependencies a bit: ``` .- D3240 v D3255 <- D3252 <- This <- D3239 ^ '- D3238 ``` - In D3238 we started allowing preloading object code with mmap in iOS, where we can't have r+w+x. - In D3239 we introduced a richer extension of the object code data type to make working with mach-o files easier. - In D3240 we set the stage to allow loading archives (.a) on iOS - In D3251 we added init and deinit functions to populate and depopulate the enriched object code data structure for mach-o files. - In D3252 we refactored most of the MachO.c file to use the new types and data structure. - in D3255 we finally introduce the aarch64-mach-o linker. Reviewers: rwbarton, bgamari, austin, erikd, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3251 >--------------------------------------------------------------- 938392c8515ccbe894714f43852fe604a21ce30b rts/Linker.c | 9 ++++++ rts/linker/LoadArchive.c | 3 ++ rts/linker/MachO.c | 81 +++++++++++++++++++++++++++++++++++++++++++++--- rts/linker/MachO.h | 4 +++ 4 files changed, 93 insertions(+), 4 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index 87f1eeb..529af9a 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -1186,6 +1186,10 @@ void freeObjectCode (ObjectCode *oc) } #endif +#if defined(OBJECTFORMAT_MACHO) + ocDeinit_MachO(oc); +#endif + stgFree(oc->fileName); stgFree(oc->archiveMemberName); @@ -1389,6 +1393,11 @@ preloadObjectFile (pathchar *path) oc = mkOc(path, image, fileSize, true, NULL, misalignment); +#ifdef OBJFORMAT_MACHO + if (ocVerifyImage_MachO( oc )) + ocInit_MachO( oc ); +#endif + return oc; } diff --git a/rts/linker/LoadArchive.c b/rts/linker/LoadArchive.c index f9997cf..a33c00d 100644 --- a/rts/linker/LoadArchive.c +++ b/rts/linker/LoadArchive.c @@ -538,6 +538,9 @@ static HsInt loadArchive_ (pathchar *path) oc = mkOc(path, image, memberSize, false, archiveMemberName , misalignment); +#ifdef OBJFORMAT_MACHO + ocInit_MachO( oc ); +#endif stgFree(archiveMemberName); diff --git a/rts/linker/MachO.c b/rts/linker/MachO.c index 55b2bf1..13508fa 100644 --- a/rts/linker/MachO.c +++ b/rts/linker/MachO.c @@ -1,6 +1,6 @@ #include "Rts.h" -#ifdef darwin_HOST_OS +#if defined(darwin_HOST_OS) || defined(ios_HOST_OS) #include "RtsUtils.h" #include "GetEnv.h" @@ -17,7 +17,7 @@ #include #include -#if defined(HAVE_SYS_MMAN_H) +#if defined(HAVE_SYS_MMAN_H) && RTS_LINKER_USE_MMAP # include #endif @@ -46,6 +46,77 @@ #define nlist nlist_64 #endif +/* + * Initialize some common data in the object code so we don't have to + * continuously look up the addresses. + */ +void +ocInit_MachO(ObjectCode * oc) +{ + oc->info = (ObjectCodeFormatInfo*)stgCallocBytes( + 1, sizeof(ObjectCodeFormatInfo), + "ocInit_MachO(ObjectCodeFormatInfo)"); + oc->info->header = (MachOHeader *) oc->image; + oc->info->symCmd = NULL; + oc->info->segCmd = NULL; + oc->info->dsymCmd = NULL; + + MachOLoadCommand *lc = (MachOLoadCommand*)(oc->image + sizeof(MachOHeader)); + for(size_t i = 0; i < oc->info->header->ncmds; i++) { + if (lc->cmd == LC_SEGMENT || lc->cmd == LC_SEGMENT_64) { + oc->info->segCmd = (MachOSegmentCommand*) lc; + } + else if (lc->cmd == LC_SYMTAB) { + oc->info->symCmd = (MachOSymtabCommand*) lc; + } + else if (lc->cmd == LC_DYSYMTAB) { + oc->info->dsymCmd = (MachODsymtabCommand*) lc; + } + lc = (MachOLoadCommand *) ( ((char*)lc) + lc->cmdsize ); + } + if (NULL == oc->info->segCmd) { + barf("ocGetNames_MachO: no segment load command"); + } + + oc->info->macho_sections = (MachOSection*) (oc->info->segCmd+1); + oc->n_sections = oc->info->segCmd->nsects; + + oc->info->nlist = oc->info->symCmd == NULL + ? NULL + : (MachONList *)(oc->image + oc->info->symCmd->symoff); + oc->info->names = oc->image + oc->info->symCmd->stroff; + + /* If we have symbols, allocate and fill the macho_symbols + * This will make relocation easier. + */ + oc->info->n_macho_symbols = 0; + oc->info->macho_symbols = NULL; + + if(NULL != oc->info->nlist) { + oc->info->n_macho_symbols = oc->info->symCmd->nsyms; + oc->info->macho_symbols = (MachOSymbol*)stgCallocBytes( + oc->info->symCmd->nsyms, + sizeof(MachOSymbol), + "ocInit_MachO(MachOSymbol)"); + for(uint32_t i = 0; i < oc->info->symCmd->nsyms; i++) { + oc->info->macho_symbols[i].name = oc->info->names + + oc->info->nlist[i].n_un.n_strx; + oc->info->macho_symbols[i].nlist = &oc->info->nlist[i]; + /* we don't have an address for this symbol yet; this will be + * populated during ocGetNames_MachO. hence addr = NULL + */ + oc->info->macho_symbols[i].addr = NULL; + } + } +} + +void +ocDeinit_MachO(ObjectCode * oc) { + if(oc->info->n_macho_symbols > 0) { + stgFree(oc->info->macho_symbols); + } + stgFree(oc->info); +} static int resolveImports( ObjectCode* oc, @@ -55,6 +126,7 @@ resolveImports( unsigned long *indirectSyms, struct nlist *nlist); +#if NEED_SYMBOL_EXTRAS #if defined(powerpc_HOST_ARCH) int ocAllocateSymbolExtras_MachO(ObjectCode* oc) @@ -144,6 +216,7 @@ ocAllocateSymbolExtras_MachO(ObjectCode* oc) #else #error Unknown MachO architecture #endif /* HOST_ARCH */ +#endif /* NEED_SYMBOL_EXTRAS */ int ocVerifyImage_MachO(ObjectCode * oc) @@ -153,7 +226,7 @@ ocVerifyImage_MachO(ObjectCode * oc) IF_DEBUG(linker, debugBelch("ocVerifyImage_MachO: start\n")); -#if x86_64_HOST_ARCH || powerpc64_HOST_ARCH +#if x86_64_HOST_ARCH || powerpc64_HOST_ARCH || aarch64_HOST_ARCH if(header->magic != MH_MAGIC_64) { errorBelch("Could not load image %s: bad magic!\n" " Expected %08x (64bit), got %08x%s\n", @@ -1241,4 +1314,4 @@ machoGetMisalignment( FILE * f ) return misalignment ? (16 - misalignment) : 0; } -#endif /* darwin_HOST_OS */ +#endif /* darwin_HOST_OS, ios_HOST_OS */ diff --git a/rts/linker/MachO.h b/rts/linker/MachO.h index 8c7fb1f..9362eb7 100644 --- a/rts/linker/MachO.h +++ b/rts/linker/MachO.h @@ -5,6 +5,10 @@ #include "BeginPrivate.h" +#include "MachOTypes.h" + +void ocInit_MachO ( ObjectCode* oc ); +void ocDeinit_MachO ( ObjectCode* oc ); int ocVerifyImage_MachO ( ObjectCode* oc ); int ocGetNames_MachO ( ObjectCode* oc ); int ocResolve_MachO ( ObjectCode* oc ); From git at git.haskell.org Mon Mar 27 03:01:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:01:06 +0000 (UTC) Subject: [commit: ghc] master: Make mmap r+w only during preload for iOS. (fdbbd63) Message-ID: <20170327030106.382ED3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fdbbd63db18cf3ba0cd8f0d61da904317ae5ae01/ghc >--------------------------------------------------------------- commit fdbbd63db18cf3ba0cd8f0d61da904317ae5ae01 Author: Moritz Angermann Date: Tue Mar 21 10:58:28 2017 -0400 Make mmap r+w only during preload for iOS. While we do not yet enable mmap for ios builds. If we later do, we must not try to mmap r+w+x, on iOS as that clearly fails. This diff also adds a check for the successful mmaping. I don't think we can blanket change this to r+w for every case, unless we are absolutely sure that we are going to remap this and set +x where needed. This is just one of the pieces for the rts linker support for ios (aarch64-macho) --- The following diagram and legend tries to explain the dependencies a bit: ``` .- D3240 v D3255 <- D3252 <- D3251 <- D3239 ^ '- This ``` - In D3238 we started allowing preloading object code with mmap in iOS, where we can't have r+w+x. - In D3239 we introduced a richer extension of the object code data type to make working with mach-o files easier. - In D3240 we set the stage to allow loading archives (.a) on iOS - In D3251 we added init and deinit functions to populate and depopulate the enriched object code data structure for mach-o files. - In D3252 we refactored most of the MachO.c file to use the new types and data structure. - in D3255 we finally introduce the aarch64-mach-o linker. Reviewers: ezyang, austin, erikd, simonmar, bgamari, rwbarton Reviewed By: bgamari Subscribers: rwbarton, ryantrinkle, thomie Differential Revision: https://phabricator.haskell.org/D3238 >--------------------------------------------------------------- fdbbd63db18cf3ba0cd8f0d61da904317ae5ae01 rts/Linker.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/rts/Linker.c b/rts/Linker.c index 247f246..7654f2b 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -1308,9 +1308,26 @@ preloadObjectFile (pathchar *path) return NULL; } + /* iOS does not permit to mmap with r+w+x, however while the comment for + * this function says this is not the final resting place, for some + * architectures / hosts (at least mach-o non-iOS -- see ocGetNames_MachO) + * the image mmaped here in fact ends up being the final resting place for + * the sections. And hence we need to leave r+w+x here for other hosts + * until all hosts have been made aware of the initial image being r+w only. + * + * See also the misalignment logic for darwin below. + */ +#if defined(ios_HOST_OS) + image = mmap(NULL, fileSize, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); +#else image = mmap(NULL, fileSize, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, fd, 0); - // not 32-bit yet, we'll remap later +#endif + + if (image == MAP_FAILED) { + errorBelch("mmap: failed. errno = %d", errno); + } + // not 32-bit yet, we'll remap later close(fd); #else /* !RTS_LINKER_USE_MMAP */ From git at git.haskell.org Mon Mar 27 03:01:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:01:08 +0000 (UTC) Subject: [commit: ghc] master: Adds aarch64 linker for mach-o files. (e8a2741) Message-ID: <20170327030108.EC8B83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e8a27410d0e51062422cb4782913bbbdf9deea74/ghc >--------------------------------------------------------------- commit e8a27410d0e51062422cb4782913bbbdf9deea74 Author: Moritz Angermann Date: Tue Mar 21 11:02:20 2017 -0400 Adds aarch64 linker for mach-o files. This is the final commit that ties them all together. Here we add the aarch64 linker for macho files. - In D3238 we started allowing preloading object code with mmap in iOS, where we can't have r+w+x. - In D3239 we introduced a richer extension of the object code data type to make working with mach-o files easier. - In D3240 we set the stage to allow loading archives (.a) on iOS - In D3251 we added init and deinit functions to populate and depopulate the enriched object code data structure for mach-o files. - In D3252 we refactored most of the MachO.c file to use the new types and datastructure. This commit will than finally add the aarch64 (arm64) linker for mach-o files to ghc, using the improved foundation we have constructed above. The dependency structure therefore is as follows ``` .- D3240 v This <- D3252 <- D3251 <- D3239 ^ '- D3238 ``` Depends: D3252, D3240, D3238 Test Plan: To test this with iOS, we also need the remote-iserv diff D3233. With all that in place, proceed as follows: - Build ghc for the host ``` ghc $ ./configure --prefix=/test/opt \ --disable-large-address-space \ --with-llc=/path/to/llvm-3.9/bin/llc \ --with-opt=/path/to/llvm-3.9/bin/opt # edit mk/build.mk to specify quick ghc $ make && make install ``` - Build ghc for ios ``` ghc $ ./configure --target=aarch64-apple-darwin14 \ --prefix=/test/opt \ --disable-large-address-space \ --with-llc=/path/to/llvm-3.9/bin/llc \ --with-opt=/path/to/llvm-3.9/bin/opt \ --with-ghc=/test/bin/ghc \ --enable-bootstrap-with-devel-snapshot # edit mk/build.mk to specify quick-cross ghc $ make && make install ``` - Obtain the iOS wrapper scripts from https://github.com/angerman/ghc-ios-scripts and place them in PATH. - Build iserv-proxy for the host ``` ghc/iserv $ cabal install -fproxy -flibrary ``` - Build iserv-library for the target ``` # build cryptonite without integer-gmp ghc/iserv $ aarch64-apple-darwin14-cabal install cryptonite -f-integer-gmp ghc/iserv $ aarch64-apple-darwin14-cabal install -flibrary ``` - Create an iOS application with the following `main.m`: ``` #import #include "HsFFI.h" extern void startSlave(bool, int, const char *); int main(int argc, char * argv[]) { const char * documents_path = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] firstObject].path.UTF8String; hs_init(NULL, NULL); startSlave(false, 5000, documents_path); @autoreleasepool { return UIApplicationMain(argc, argv, nil, nil); } } ``` and link it with: the iserv archive from `~/.cabal/lib/aarch64-ios-ghc` as well as all dependent archives. - Build, Install and Launch the iserv-slave application on your iphone - Compile some Template Haskell code with the `aarch64-apple-darwin14-ghc`, through the `iserv-proxy` ``` app $ aarch64-apple-darwin14-ghc Module.hs \ -threaded -staticlib \ -outputdir build/aarch64 -pgmlibtool libtool-quiet -stubdir . \ -fexternal-interpreter \ -pgmi=$HOME/.cabal/bin/iserv-proxy \ -opti10.0.0.1 \ -opti5000 ``` where 10.0.0.1 is the ip of your iserv-slave. magic. Reviewers: rwbarton, bgamari, austin, hvr, erikd, simonmar Subscribers: thomie, erikd, ryantrinkle Differential Revision: https://phabricator.haskell.org/D3255 >--------------------------------------------------------------- e8a27410d0e51062422cb4782913bbbdf9deea74 configure.ac | 2 +- rts/linker/MachO.c | 748 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 722 insertions(+), 28 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 e8a27410d0e51062422cb4782913bbbdf9deea74 From git at git.haskell.org Mon Mar 27 03:01:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:01:12 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Recompile if -fhpc is added or removed (#11798) (81fcfdf) Message-ID: <20170327030112.4631C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/81fcfdf1d2534e352de0096545ebe414ad8d8077/ghc >--------------------------------------------------------------- commit 81fcfdf1d2534e352de0096545ebe414ad8d8077 Author: Reid Barton Date: Sat Mar 25 10:53:29 2017 -0400 Recompile if -fhpc is added or removed (#11798) Test Plan: validate Reviewers: austin, bgamari, dfeuer Reviewed By: dfeuer Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3368 (cherry picked from commit 14b46a556dde8a2795ff5ede46ba8ee63368ae93) >--------------------------------------------------------------- 81fcfdf1d2534e352de0096545ebe414ad8d8077 compiler/iface/FlagChecker.hs | 10 ++++++++-- testsuite/tests/hpc/Makefile | 6 ++++++ testsuite/tests/hpc/T11798.hs | 3 +++ testsuite/tests/hpc/T11798.stdout | 2 ++ testsuite/tests/hpc/all.T | 2 ++ 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/compiler/iface/FlagChecker.hs b/compiler/iface/FlagChecker.hs index a0654b0..305a21b 100644 --- a/compiler/iface/FlagChecker.hs +++ b/compiler/iface/FlagChecker.hs @@ -57,9 +57,15 @@ fingerprintDynFlags dflags at DynFlags{..} this_mod nameio = then 0 else optLevel - in -- pprTrace "flags" (ppr (mainis, safeHs, lang, cpp, paths, prof, opt)) $ - computeFingerprint nameio (mainis, safeHs, lang, cpp, paths, prof, opt) + -- -fhpc, see https://ghc.haskell.org/trac/ghc/ticket/11798 + -- hpcDir is output-only, so we should recompile if it changes + hpc = if gopt Opt_Hpc dflags then Just hpcDir else Nothing + -- Nesting just to avoid ever more Binary tuple instances + flags = (mainis, safeHs, lang, cpp, paths, (prof, opt, hpc)) + + in -- pprTrace "flags" (ppr flags) $ + computeFingerprint nameio flags {- Note [path flags and recompilation] diff --git a/testsuite/tests/hpc/Makefile b/testsuite/tests/hpc/Makefile index 9a36a1c..6de7cee 100644 --- a/testsuite/tests/hpc/Makefile +++ b/testsuite/tests/hpc/Makefile @@ -1,3 +1,9 @@ TOP=../.. include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk + +# Test that adding -fhpc triggers recompilation +T11798: + "$(TEST_HC)" $(TEST_HC_ARGS) T11798 + "$(TEST_HC)" $(TEST_HC_ARGS) T11798 -fhpc + test -e .hpc/T11798.mix diff --git a/testsuite/tests/hpc/T11798.hs b/testsuite/tests/hpc/T11798.hs new file mode 100644 index 0000000..2d42817 --- /dev/null +++ b/testsuite/tests/hpc/T11798.hs @@ -0,0 +1,3 @@ +module T11798 where + +f x = [x,x,x] diff --git a/testsuite/tests/hpc/T11798.stdout b/testsuite/tests/hpc/T11798.stdout new file mode 100644 index 0000000..024b0dc --- /dev/null +++ b/testsuite/tests/hpc/T11798.stdout @@ -0,0 +1,2 @@ +[1 of 1] Compiling T11798 ( T11798.hs, T11798.o ) +[1 of 1] Compiling T11798 ( T11798.hs, T11798.o ) [flags changed] diff --git a/testsuite/tests/hpc/all.T b/testsuite/tests/hpc/all.T index f1fc590..274674b 100644 --- a/testsuite/tests/hpc/all.T +++ b/testsuite/tests/hpc/all.T @@ -3,6 +3,8 @@ test('T10138', [extra_files(['.keepme.hpc.T10138/']), # Using --hpcdir with an absolute path should work (exit code 0). ['{hpc} report T10138.keepme.tix --hpcdir="`pwd`/.keepme.hpc.T10138"']) +test('T11798', normal, run_command, ['$MAKE -s --no-print-directory T11798']) + # Run tests below only for the hpc way. # # Do not explicitly specify '-fhpc' in extra_hc_opts, unless also setting From git at git.haskell.org Mon Mar 27 03:01:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:01:15 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Mark T12622 as broken in ghci way (7829e40) Message-ID: <20170327030115.07A763A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/7829e40f7dd8cd469593fcc6eb94691f1163a8b9/ghc >--------------------------------------------------------------- commit 7829e40f7dd8cd469593fcc6eb94691f1163a8b9 Author: Ben Gamari Date: Sat Mar 25 12:28:59 2017 -0400 testsuite: Mark T12622 as broken in ghci way See #13481. (cherry picked from commit 140a2d1c463bd314c9afbeb8d60e739163ce576a) >--------------------------------------------------------------- 7829e40f7dd8cd469593fcc6eb94691f1163a8b9 testsuite/tests/codeGen/should_run/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index ffe4b64..9f334cf 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -148,7 +148,7 @@ test('PopCnt', omit_ways(['ghci']), multi_compile_and_run, ['PopCnt', [('PopCnt_cmm.cmm', '')], '']) test('T12059', normal, compile_and_run, ['']) test('T12433', normal, compile_and_run, ['']) -test('T12622', normal, multimod_compile_and_run, ['T12622', '-O']) +test('T12622', expect_broken_for(13481, ['ghci']), multimod_compile_and_run, ['T12622', '-O']) test('T12757', normal, compile_and_run, ['']) test('T12855', normal, compile_and_run, ['']) test('T9577', [ unless(arch('x86_64') or arch('i386'),skip), From git at git.haskell.org Mon Mar 27 03:01:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 03:01:17 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Only run T13143 in optasm way (f76fbfa) Message-ID: <20170327030117.B15E23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/f76fbfacdb06d1657797fbe2a2026d10e33b39ac/ghc >--------------------------------------------------------------- commit f76fbfacdb06d1657797fbe2a2026d10e33b39ac Author: Ben Gamari Date: Sat Mar 25 12:07:32 2017 -0400 testsuite: Only run T13143 in optasm way Otherwise we run it in the hpc way, which outputs different Core. (cherry picked from commit 23da02b1584a5f1b083185d479807ba0ec6eccfe) >--------------------------------------------------------------- f76fbfacdb06d1657797fbe2a2026d10e33b39ac testsuite/tests/simplCore/should_compile/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index d6a539e..365aa44 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -235,7 +235,7 @@ test('T13025', normal, run_command, ['$MAKE -s --no-print-directory T13025']) -test('T13143', normal, compile, ['-O -ddump-simpl -dsuppress-uniques']) +test('T13143', only_ways(['optasm']), compile, ['-O -ddump-simpl -dsuppress-uniques']) test('T13156', normal, run_command, ['$MAKE -s --no-print-directory T13156']) test('T11444', normal, compile, ['']) test('str-rules', From git at git.haskell.org Mon Mar 27 10:28:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 10:28:26 +0000 (UTC) Subject: [commit: ghc] master: Remove unused argument from importSuggestions (a6ce7f3) Message-ID: <20170327102826.1E6683A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a6ce7f338c88920f380a2ed3f3f82b0184aeb341/ghc >--------------------------------------------------------------- commit a6ce7f338c88920f380a2ed3f3f82b0184aeb341 Author: Matthew Pickering Date: Thu Mar 23 14:08:26 2017 +0000 Remove unused argument from importSuggestions Reviewers: austin, bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3376 >--------------------------------------------------------------- a6ce7f338c88920f380a2ed3f3f82b0184aeb341 compiler/rename/RnEnv.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs index 7c05994..ae647f1 100644 --- a/compiler/rename/RnEnv.hs +++ b/compiler/rename/RnEnv.hs @@ -1843,7 +1843,7 @@ unknownNameSuggestions_ :: WhereLooking -> DynFlags -> RdrName -> SDoc unknownNameSuggestions_ where_look dflags global_env local_env imports tried_rdr_name = similarNameSuggestions where_look dflags global_env local_env tried_rdr_name $$ - importSuggestions dflags imports tried_rdr_name + importSuggestions imports tried_rdr_name similarNameSuggestions :: WhereLooking -> DynFlags @@ -1964,8 +1964,8 @@ similarNameSuggestions where_look dflags global_env | i <- is, let ispec = is_decl i, is_qual ispec ] -- | Generate helpful suggestions if a qualified name Mod.foo is not in scope. -importSuggestions :: DynFlags -> ImportAvails -> RdrName -> SDoc -importSuggestions _dflags imports rdr_name +importSuggestions :: ImportAvails -> RdrName -> SDoc +importSuggestions imports rdr_name | not (isQual rdr_name || isUnqual rdr_name) = Outputable.empty | null interesting_imports , Just name <- mod_name From git at git.haskell.org Mon Mar 27 10:28:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 10:28:23 +0000 (UTC) Subject: [commit: ghc] master: Only use locally bound variables in pattern synonym declarations (d819e41) Message-ID: <20170327102823.60BC43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d819e416a2a537b78b2698dfe753aa68dfb8b837/ghc >--------------------------------------------------------------- commit d819e416a2a537b78b2698dfe753aa68dfb8b837 Author: Matthew Pickering Date: Mon Mar 27 11:24:25 2017 +0100 Only use locally bound variables in pattern synonym declarations Summary: We were using the unconstrainted `lookupOccRn` function which looked up any variable in scope. Instead we only want to consider variables brought into scope by renaming the pattern on the RHS. A few more changes to make reporting of unbound names suggest the correct things. Fixes #13470 Reviewers: simonpj, austin, bgamari Reviewed By: simonpj Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3377 >--------------------------------------------------------------- d819e416a2a537b78b2698dfe753aa68dfb8b837 compiler/rename/RnBinds.hs | 41 +++++++++++++++++++++--- compiler/rename/RnEnv.hs | 31 ++++++++++++++---- testsuite/tests/patsyn/should_fail/T13470.hs | 20 ++++++++++++ testsuite/tests/patsyn/should_fail/T13470.stderr | 8 +++++ testsuite/tests/patsyn/should_fail/all.T | 1 + 5 files changed, 89 insertions(+), 12 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 d819e416a2a537b78b2698dfe753aa68dfb8b837 From git at git.haskell.org Mon Mar 27 12:41:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 12:41:37 +0000 (UTC) Subject: [commit: ghc] master: Don't redefine typedef names (a6675a9) Message-ID: <20170327124137.63A353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a6675a93efe7cae2f206508047a39e73ce4e92a5/ghc >--------------------------------------------------------------- commit a6675a93efe7cae2f206508047a39e73ce4e92a5 Author: Gabor Greif Date: Mon Mar 27 13:33:49 2017 +0200 Don't redefine typedef names instead define the structs referred to by - SectionFormatInfo - ObjectCodeFormatInfo that were only forward-declared earlier. This fixes redefinition errors with gcc4.4 >--------------------------------------------------------------- a6675a93efe7cae2f206508047a39e73ce4e92a5 rts/LinkerInternals.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h index 2217c5e..16fbab2 100644 --- a/rts/LinkerInternals.h +++ b/rts/LinkerInternals.h @@ -318,12 +318,12 @@ char *cstring_from_section_name( || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) \ || defined(openbsd_HOST_OS) || defined(gnu_HOST_OS) # define OBJFORMAT_ELF -typedef struct _ObjectCodeFormatInfo { void* placeholder;} ObjectCodeFormatInfo; -typedef struct _SectionFormatInfo { void* placeholder; } SectionFormatInfo; +struct _SectionFormatInfo { void* placeholder; }; +struct _ObjectCodeFormatInfo { void* placeholder; }; #elif defined (mingw32_HOST_OS) # define OBJFORMAT_PEi386 -typedef struct _ObjectCodeFormatInfo { void* placeholder;} ObjectCodeFormatInfo; -typedef struct _SectionFormatInfo { void* placeholder; } SectionFormatInfo; +struct _SectionFormatInfo { void* placeholder; }; +struct _ObjectCodeFormatInfo { void* placeholder; }; #elif defined(darwin_HOST_OS) || defined(ios_HOST_OS) # define OBJFORMAT_MACHO # include "linker/MachOTypes.h" From git at git.haskell.org Mon Mar 27 15:31:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 15:31:44 +0000 (UTC) Subject: [commit: ghc] master: Eliminate a user manual warning (af33073) Message-ID: <20170327153144.249B33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/af33073c77e409d594e61609b3fba7070766cb75/ghc >--------------------------------------------------------------- commit af33073c77e409d594e61609b3fba7070766cb75 Author: Simon Peyton Jones Date: Mon Mar 27 10:09:37 2017 +0100 Eliminate a user manual warning I was getting docs/users_guide/glasgow_exts.rst:12783: WARNING: Title underline too short. ``COLUMN`` pragma --------------- So I lengthened the row of hyphens. >--------------------------------------------------------------- af33073c77e409d594e61609b3fba7070766cb75 docs/users_guide/glasgow_exts.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 96fe958..98fbea1 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -12780,7 +12780,7 @@ positions are not automatically advanced. .. _column-pragma: ``COLUMN`` pragma ---------------- +----------------- .. index:: single: COLUMN; pragma From git at git.haskell.org Mon Mar 27 15:31:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 15:31:46 +0000 (UTC) Subject: [commit: ghc] master: Simplify the logic for tc_hs_sig_type (1e06d8b) Message-ID: <20170327153146.D34553A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1e06d8b8f2aea0a06d40618c296a034f3e408ae2/ghc >--------------------------------------------------------------- commit 1e06d8b8f2aea0a06d40618c296a034f3e408ae2 Author: Simon Peyton Jones Date: Mon Mar 27 10:05:26 2017 +0100 Simplify the logic for tc_hs_sig_type In fixing Trac #13337, and introducing solveSomeEqualities, Richard introduce the higher-order function tc_hs_sig_type_x, with a solver as its argument. It turned out that there was a much simpler way to do the same thing, which this patch implements. Less code, easier to grok. No change in behaviour though. >--------------------------------------------------------------- 1e06d8b8f2aea0a06d40618c296a034f3e408ae2 compiler/typecheck/TcHsType.hs | 62 ++++++++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index 99fc6dd..c15ac4b 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -212,28 +212,28 @@ tcHsSigType ctxt sig_ty ; checkValidType ctxt ty ; return ty } --- kind-checks/desugars an 'LHsSigType' and then kind-generalizes. +tc_hs_sig_type_and_gen :: LHsSigType Name -> Kind -> TcM Type +-- Kind-checks/desugars an 'LHsSigType', +-- solve equalities, +-- and then kind-generalizes. -- This will never emit constraints, as it uses solveEqualities interally. -- No validity checking, but it does zonk en route to generalization -tc_hs_sig_type_and_gen :: LHsSigType Name -> Kind -> TcM Type -tc_hs_sig_type_and_gen sig_ty kind - = do { ty <- tc_hs_sig_type_x solveEqualities sig_ty kind +tc_hs_sig_type_and_gen hs_ty kind + = do { ty <- solveEqualities $ + tc_hs_sig_type hs_ty kind + -- NB the call to solveEqualities, which unifies all those + -- kind variables floating about, immediately prior to + -- kind generalisation ; kindGeneralizeType ty } tc_hs_sig_type :: LHsSigType Name -> Kind -> TcM Type --- May emit constraints +-- Kind-check/desugar a 'LHsSigType', but does not solve +-- the equalities that arise from doing so; instead it may +-- emit kind-equality constraints into the monad -- No zonking or validity checking -tc_hs_sig_type = tc_hs_sig_type_x id - --- Version of tc_hs_sig_type parameterized over how it should solve --- equalities -tc_hs_sig_type_x :: (forall a. TcM a -> TcM a) -- id or solveEqualities - -> LHsSigType Name -> Kind - -> TcM Type -tc_hs_sig_type_x solve (HsIB { hsib_body = hs_ty - , hsib_vars = sig_vars }) kind - = do { (tkvs, ty) <- solve $ - tcImplicitTKBndrsType sig_vars $ +tc_hs_sig_type (HsIB { hsib_vars = sig_vars + , hsib_body = hs_ty }) kind + = do { (tkvs, ty) <- tcImplicitTKBndrsType sig_vars $ tc_lhs_type typeLevelMode hs_ty kind ; return (mkSpecForAllTys tkvs ty) } @@ -332,6 +332,7 @@ tcLHsType ty = addTypeCtxt ty (tc_infer_lhs_type typeLevelMode ty) -- | Should we generalise the kind of this type signature? -- We *should* generalise if the type is closed -- or if NoMonoLocalBinds is set. Otherwise, nope. +-- See Note [Kind generalisation plan] decideKindGeneralisationPlan :: LHsSigType Name -> TcM Bool decideKindGeneralisationPlan sig_ty@(HsIB { hsib_closed = closed }) = do { mono_locals <- xoptM LangExt.MonoLocalBinds @@ -340,7 +341,34 @@ decideKindGeneralisationPlan sig_ty@(HsIB { hsib_closed = closed }) (ppr sig_ty $$ text "should gen?" <+> ppr should_gen) ; return should_gen } -{- +{- Note [Kind generalisation plan] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +When should we do kind-generalisation for user-written type signature? +Answer: we use the same rule as for value bindings: + + * We always kind-generalise if the type signature is closed + * Additionally, we attempt to generalise if we have NoMonoLocalBinds + +Trac #13337 shows the problem if we kind-generalise an open type (i.e. +one that mentions in-scope tpe variable + foo :: forall k (a :: k) proxy. (Typeable k, Typeable a) + => proxy a -> String + foo _ = case eqT :: Maybe (k :~: Type) of + Nothing -> ... + Just Refl -> case eqT :: Maybe (a :~: Int) of ... + +In the expression type sig on the last line, we have (a :: k) +but (Int :: Type). Since (:~:) is kind-homogeneous, this requires +k ~ *, which is true in the Refl branch of the outer case. + +That equality will be solved if we allow it to float out to the +implication constraint for the Refl match, bnot not if we aggressively +attempt to solve all equalities the moment they occur; that is, when +checking (Maybe (a :~: Int)). (NB: solveEqualities fails unless it +solves all the kind equalities, which is the right thing at top level.) + +So here the right thing is simply not to do kind generalisation! + ************************************************************************ * * Type-checking modes From git at git.haskell.org Mon Mar 27 15:31:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 15:31:49 +0000 (UTC) Subject: [commit: ghc] master: Typechecker comments and debug tracing only (7e1c492) Message-ID: <20170327153149.8D0353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7e1c492de158f8a8692526a44f6a9a1f203ddcf7/ghc >--------------------------------------------------------------- commit 7e1c492de158f8a8692526a44f6a9a1f203ddcf7 Author: Simon Peyton Jones Date: Mon Mar 27 10:12:53 2017 +0100 Typechecker comments and debug tracing only >--------------------------------------------------------------- 7e1c492de158f8a8692526a44f6a9a1f203ddcf7 compiler/typecheck/TcFlatten.hs | 2 +- compiler/typecheck/TcMType.hs | 4 +++- compiler/typecheck/TcType.hs | 21 ++++++++++++++------- compiler/typecheck/TcUnify.hs | 3 +-- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/compiler/typecheck/TcFlatten.hs b/compiler/typecheck/TcFlatten.hs index 933bacc..8b3aaa9 100644 --- a/compiler/typecheck/TcFlatten.hs +++ b/compiler/typecheck/TcFlatten.hs @@ -722,7 +722,7 @@ yields a better error message anyway.) flatten :: FlattenMode -> CtEvidence -> TcType -> TcS (Xi, TcCoercion) flatten mode ev ty - = do { traceTcS "flatten {" (ppr ty) + = do { traceTcS "flatten {" (ppr mode <+> ppr ty) ; (ty', co) <- runFlatten mode ev (flatten_one ty) ; traceTcS "flatten }" (ppr ty') ; return (ty', co) } diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index decb6cb..1f183ed 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -1026,7 +1026,9 @@ zonkQuantifiedTyVar default_kind tv = do { tv' <- skolemiseUnboundMetaTyVar tv ; return (Just tv') } where - -- do not default SigTvs. This would violate the invariants on SigTvs + -- Do not default SigTvs. Doing so would violate the invariants + -- on SigTvs; see Note [Signature skolems] in TcType. + -- Trac #13343 is an example not_sig_tv = case info of SigTv -> False _ -> True diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 6a4a989..e5708b6 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -439,15 +439,23 @@ why Var.hs shouldn't actually have the definition, but it "belongs" here. Note [Signature skolems] ~~~~~~~~~~~~~~~~~~~~~~~~ +A SigTv is a specialised variant of TauTv, with the following invarints: + + * A SigTv can be unified only with a TyVar, + not with any other type + + * Its MetaDetails, if filled in, will always be another SigTv + or a SkolemTv + +SigTvs are only distinguished to improve error messages. Consider this f :: forall a. [a] -> Int f (x::b : xs) = 3 Here 'b' is a lexically scoped type variable, but it turns out to be -the same as the skolem 'a'. So we have a special kind of skolem -constant, SigTv, which can unify with other SigTvs. They are used -*only* for pattern type signatures. +the same as the skolem 'a'. So we make them both SigTvs, which can unify +with each other. Similarly consider data T (a:k1) = MkT (S a) @@ -455,6 +463,8 @@ Similarly consider When doing kind inference on {S,T} we don't want *skolems* for k1,k2, because they end up unifying; we want those SigTvs again. +SigTvs are used *only* for pattern type signatures. + Note [TyVars and TcTyVars during type checking] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The Var type has constructors TyVar and TcTyVar. They are used @@ -514,10 +524,7 @@ data MetaInfo | SigTv -- A variant of TauTv, except that it should not be -- unified with a type, only with a type variable - -- SigTvs are only distinguished to improve error messages - -- see Note [Signature skolems] - -- The MetaDetails, if filled in, will - -- always be another SigTv or a SkolemTv + -- See Note [Signature skolems] | FlatMetaTv -- A flatten meta-tyvar -- It is a meta-tyvar, but it is always untouchable, with level 0 diff --git a/compiler/typecheck/TcUnify.hs b/compiler/typecheck/TcUnify.hs index acfb0b7..ef0c95a 100644 --- a/compiler/typecheck/TcUnify.hs +++ b/compiler/typecheck/TcUnify.hs @@ -1908,8 +1908,7 @@ metaTyVarUpdateOK :: DynFlags -> TcType -- ty :: k2 -> Maybe TcType -- possibly-expanded ty -- (metaTyFVarUpdateOK tv ty) --- We are about to update the meta-tyvar tv with ty, in --- our on-the-flyh unifier +-- We are about to update the meta-tyvar tv with ty -- Check (a) that tv doesn't occur in ty (occurs check) -- (b) that ty does not have any foralls -- (in the impredicative case), or type functions From git at git.haskell.org Mon Mar 27 15:31:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 15:31:52 +0000 (UTC) Subject: [commit: ghc] master: Fix explicitly-bidirectional pattern synonyms (7c7479d) Message-ID: <20170327153152.B66763A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7c7479d047113a0cbf237c864d403bb638ca0241/ghc >--------------------------------------------------------------- commit 7c7479d047113a0cbf237c864d403bb638ca0241 Author: Simon Peyton Jones Date: Mon Mar 27 10:22:22 2017 +0100 Fix explicitly-bidirectional pattern synonyms This partly fixes Trac #13441, at least for the explicitly bidirectional case. See Note [Checking against a pattern signature], the part about "Existential type variables". Alas, the implicitly-bidirectional case is still not quite right, but at least there is a workaround by making it explicitly bidirectional. >--------------------------------------------------------------- 7c7479d047113a0cbf237c864d403bb638ca0241 compiler/typecheck/TcPatSyn.hs | 32 ++++++++++++++++--------- testsuite/tests/patsyn/should_compile/T13441.hs | 29 ++++++++++++++++++++++ testsuite/tests/patsyn/should_compile/all.T | 1 + 3 files changed, 51 insertions(+), 11 deletions(-) diff --git a/compiler/typecheck/TcPatSyn.hs b/compiler/typecheck/TcPatSyn.hs index 15895b5..6f7764e 100644 --- a/compiler/typecheck/TcPatSyn.hs +++ b/compiler/typecheck/TcPatSyn.hs @@ -149,13 +149,14 @@ tcCheckPatSynDecl psb at PSB{ psb_id = lname@(L _ name), psb_args = details pushLevelAndCaptureConstraints $ tcExtendTyVarEnv univ_tvs $ tcPat PatSyn lpat (mkCheckExpType pat_ty) $ - do { let new_tv | isUnidirectional dir = newMetaTyVarX - | otherwise = newMetaSigTyVarX + do { let new_tv = case dir of + ImplicitBidirectional -> newMetaSigTyVarX + _ -> newMetaTyVarX + -- new_tv: see the "Existential type variables" + -- part of Note [Checking against a pattern signature] in_scope = mkInScopeSet (mkVarSet univ_tvs) empty_subst = mkEmptyTCvSubst in_scope ; (subst, ex_tvs') <- mapAccumLM new_tv empty_subst ex_tvs - -- See the "Existential type variables" part of - -- Note [Checking against a pattern signature] ; traceTc "tcpatsyn1" (vcat [ ppr v <+> dcolon <+> ppr (tyVarKind v) | v <- ex_tvs]) ; traceTc "tcpatsyn2" (vcat [ ppr v <+> dcolon <+> ppr (tyVarKind v) | v <- ex_tvs']) ; let prov_theta' = substTheta subst prov_theta @@ -240,12 +241,20 @@ unify x := [a] during type checking, and then use the instantiating type dl = $dfunEqList d in k [a] dl ys -This "concealing" story works for /uni-directional/ pattern synonyms, -but obviously not for bidirectional ones. So in the bidirectional case -we use SigTv, rather than a generic TauTv, meta-tyvar so that. And -we should really check that those SigTvs don't get unified with each -other. - +This "concealing" story works for /uni-directional/ pattern synonyms. +It also works for /explicitly-bidirectional/ pattern synonyms, where +the constructor direction is typecheked entirely separately. + +But for /implicitly-bidirecitonal/ ones like + pattern P x = MkS x +we are trying to typecheck both directions at once. So for this we +use SigTv, rather than a generic TauTv. But it's not quite done: + - We should really check that those SigTvs don't get unified + with each other. + - Trac #13441 is rejected if you use an implicitly-bidirectional + pattern. +Maybe it'd be better to treat it like an explicitly-bidirectional +pattern? -} collectPatSynArgInfo :: HsPatSynDetails (Located Name) -> ([Name], [Name], Bool) @@ -519,7 +528,6 @@ tcPatSynBuilderBind (PSB { psb_id = L loc name, psb_def = lpat | Right match_group <- mb_match_group -- Bidirectional = do { patsyn <- tcLookupPatSyn name - ; traceTc "tcPatSynBuilderBind {" $ ppr patsyn ; let Just (builder_id, need_dummy_arg) = patSynBuilder patsyn -- Bidirectional, so patSynBuilder returns Just @@ -534,6 +542,8 @@ tcPatSynBuilderBind (PSB { psb_id = L loc name, psb_def = lpat sig = completeSigFromId (PatSynCtxt name) builder_id + ; traceTc "tcPatSynBuilderBind {" $ + ppr patsyn $$ ppr builder_id <+> dcolon <+> ppr (idType builder_id) ; (builder_binds, _) <- tcPolyCheck emptyPragEnv sig (noLoc bind) ; traceTc "tcPatSynBuilderBind }" $ ppr builder_binds ; return builder_binds } diff --git a/testsuite/tests/patsyn/should_compile/T13441.hs b/testsuite/tests/patsyn/should_compile/T13441.hs new file mode 100644 index 0000000..d7a339f --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T13441.hs @@ -0,0 +1,29 @@ +{-# LANGUAGE ScopedTypeVariables, PatternSynonyms, DataKinds, PolyKinds, + GADTs, TypeOperators, TypeFamilies #-} + +module T13441 where + +import Data.Functor.Identity + +data FList f xs where + FNil :: FList f '[] + (:@) :: f x -> FList f xs -> FList f (x ': xs) + +data Nat = Zero | Succ Nat + +type family Length (xs :: [k]) :: Nat where + Length '[] = Zero + Length (_ ': xs) = Succ (Length xs) + +type family Replicate (n :: Nat) (x :: a) = (r :: [a]) where + Replicate Zero _ = '[] + Replicate (Succ n) x = x ': Replicate n x + +type Vec n a = FList Identity (Replicate n a) + +pattern (:>) :: forall n a. n ~ Length (Replicate n a) + => forall m. n ~ Succ m + => a -> Vec m a -> Vec n a +pattern x :> xs <- Identity x :@ xs + where + x :> xs = Identity x :@ xs diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T index 87de2f0..1f36424 100644 --- a/testsuite/tests/patsyn/should_compile/all.T +++ b/testsuite/tests/patsyn/should_compile/all.T @@ -64,3 +64,4 @@ test('T12698', normal, compile, ['']) test('T12746', normal, multi_compile, ['T12746', [('T12746A.hs', '-c')],'-v0']) test('T12968', normal, compile, ['']) test('T13349b', normal, compile, ['']) +test('T13441', normal, compile, ['']) From git at git.haskell.org Mon Mar 27 15:32:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 15:32:02 +0000 (UTC) Subject: [commit: ghc] master: Remove utterly bogus code (de4723f) Message-ID: <20170327153202.826563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/de4723fd6d97b285bb754d8b95531c86d34c4032/ghc >--------------------------------------------------------------- commit de4723fd6d97b285bb754d8b95531c86d34c4032 Author: Simon Peyton Jones Date: Mon Mar 27 14:33:55 2017 +0100 Remove utterly bogus code The commit 6746549772c5cc0ac66c0fce562f297f4d4b80a2 Author: Richard Eisenberg Date: Fri Dec 11 18:19:53 2015 -0500 Add kind equalities to GHC. added this entirely bogus code to Simplify.simplLam: env' | Coercion co <- arg = extendCvSubst env bndr co | otherwise = env It's bogus because 'co' is an 'InCoercion', but a CvSubst should have only OutCoercions in it. Moreover, completeBind does the job nicely. This led to an ASSERT failure in an experimental branch; but I have not got a repro case that works on HEAD. But still, the patch deletes code and fixes a bug, so it must be good. The only mystery is why Richard added it in the first place :-). I hope I'm not missing anything. But it validates fine. >--------------------------------------------------------------- de4723fd6d97b285bb754d8b95531c86d34c4032 compiler/simplCore/Simplify.hs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index fae040f..e78714d 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -1370,13 +1370,8 @@ simplLam env (bndr:bndrs) body (ApplyToTy { sc_arg_ty = arg_ty, sc_cont = cont } simplLam env (bndr:bndrs) body (ApplyToVal { sc_arg = arg, sc_env = arg_se , sc_cont = cont }) = do { tick (BetaReduction bndr) - ; simplNonRecE env' (zap_unfolding bndr) (arg, arg_se) (bndrs, body) cont } + ; simplNonRecE env (zap_unfolding bndr) (arg, arg_se) (bndrs, body) cont } where - env' | Coercion co <- arg - = extendCvSubst env bndr co - | otherwise - = env - zap_unfolding bndr -- See Note [Zap unfolding when beta-reducing] | isId bndr, isStableUnfolding (realIdUnfolding bndr) = setIdUnfolding bndr NoUnfolding From git at git.haskell.org Mon Mar 27 15:31:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 15:31:56 +0000 (UTC) Subject: [commit: ghc] master: Fix error-message suppress on given equalities (e0ad55f) Message-ID: <20170327153156.666F73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e0ad55f894a8d85dcc099c33c63cfe3d4515d464/ghc >--------------------------------------------------------------- commit e0ad55f894a8d85dcc099c33c63cfe3d4515d464 Author: Simon Peyton Jones Date: Mon Mar 27 10:32:08 2017 +0100 Fix error-message suppress on given equalities I'd got the logic slightly wrong when reporting type errors for insoluble 'given' equalities. We suppress insoluble givens under some circumstances (see Note [Given errors]), but we then suppressed subsequent 'wanted' errors because the (suppressed) 'given' error "won". Result: no errors at all :-(. This patch fixes it and - Renames TcType.isTyVarUnderDatatype to the more perspicuous TcType.isInsolubleOccursCheck In doing this I realise that I don't understand why we need to keep the insolubles partitioned out separately at all... but that is for another day. >--------------------------------------------------------------- e0ad55f894a8d85dcc099c33c63cfe3d4515d464 compiler/typecheck/TcCanonical.hs | 9 +-- compiler/typecheck/TcErrors.hs | 77 ++++++++++++++-------- compiler/typecheck/TcType.hs | 45 ++++++++----- testsuite/tests/ghci/scripts/Defer02.stderr | 5 ++ .../tests/indexed-types/should_fail/T2627b.stderr | 10 ++- .../tests/indexed-types/should_fail/T5934.stderr | 18 ++++- .../tests/indexed-types/should_fail/T6123.stderr | 3 +- .../tests/indexed-types/should_fail/T7354.stderr | 5 +- .../tests/typecheck/should_compile/T12427a.stderr | 21 +----- .../tests/typecheck/should_fail/T12589.stderr | 9 +++ testsuite/tests/typecheck/should_fail/T13446.hs | 46 +++++++++++++ .../tests/typecheck/should_fail/T13446.stderr | 10 +++ testsuite/tests/typecheck/should_fail/all.T | 1 + 13 files changed, 184 insertions(+), 75 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 e0ad55f894a8d85dcc099c33c63cfe3d4515d464 From git at git.haskell.org Mon Mar 27 15:31:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 15:31:59 +0000 (UTC) Subject: [commit: ghc] master: Fix 'unsolved constraints' in GHCi (feca929) Message-ID: <20170327153159.C6B683A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/feca929b8f7a7dfe96d06c27d405ce331cdcdb41/ghc >--------------------------------------------------------------- commit feca929b8f7a7dfe96d06c27d405ce331cdcdb41 Author: Simon Peyton Jones Date: Mon Mar 27 14:32:43 2017 +0100 Fix 'unsolved constraints' in GHCi In initTc, if the computation fails with an exception, we should not complain about unsolved constraints. Fixes Trac #13466. >--------------------------------------------------------------- feca929b8f7a7dfe96d06c27d405ce331cdcdb41 compiler/typecheck/TcRnMonad.hs | 11 +++++++---- testsuite/tests/ghci/scripts/T13466.script | 2 ++ testsuite/tests/ghci/scripts/T13466.stderr | 5 +++++ testsuite/tests/ghci/scripts/all.T | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/TcRnMonad.hs b/compiler/typecheck/TcRnMonad.hs index 3404ce7..2b73812 100644 --- a/compiler/typecheck/TcRnMonad.hs +++ b/compiler/typecheck/TcRnMonad.hs @@ -336,11 +336,14 @@ initTcWithGbl hsc_env gbl_env loc do_this Right res -> return (Just res) Left _ -> return Nothing } - -- Check for unsolved constraints + -- Check for unsolved constraints + -- If we succeed (maybe_res = Just r), there should be + -- no unsolved constraints. But if we exit via an + -- exception (maybe_res = Nothing), we may have skipped + -- solving, so don't panic then (Trac #13466) ; lie <- readIORef (tcl_lie lcl_env) - ; if isEmptyWC lie - then return () - else pprPanic "initTc: unsolved constraints" (ppr lie) + ; when (isJust maybe_res && not (isEmptyWC lie)) $ + pprPanic "initTc: unsolved constraints" (ppr lie) -- Collect any error messages ; msgs <- readIORef (tcl_errs lcl_env) diff --git a/testsuite/tests/ghci/scripts/T13466.script b/testsuite/tests/ghci/scripts/T13466.script new file mode 100644 index 0000000..0310fac --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13466.script @@ -0,0 +1,2 @@ +:set -XTypeApplications +:t out_of_scope @[] diff --git a/testsuite/tests/ghci/scripts/T13466.stderr b/testsuite/tests/ghci/scripts/T13466.stderr new file mode 100644 index 0000000..ba3d5fd --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13466.stderr @@ -0,0 +1,5 @@ + +:1:1: error: + • Cannot apply expression of type ‘t1’ + to a visible type argument ‘[]’ + • In the expression: out_of_scope @[] diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 20bc5ae..00d8d81 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -250,3 +250,4 @@ test('T12550', normal, ghci_script, ['T12550.script']) test('StaticPtr', normal, ghci_script, ['StaticPtr.script']) test('T13202', normal, ghci_script, ['T13202.script']) test('T13202a', normal, ghci_script, ['T13202a.script']) +test('T13466', normal, ghci_script, ['T13466.script']) From git at git.haskell.org Mon Mar 27 16:44:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 16:44:10 +0000 (UTC) Subject: [commit: ghc] master: -fspec-constr-keen docs typos [skip ci] (5025fe2) Message-ID: <20170327164410.51A0A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5025fe2435d030f0c5ecdc2a933c7bfcb3efcb7c/ghc >--------------------------------------------------------------- commit 5025fe2435d030f0c5ecdc2a933c7bfcb3efcb7c Author: Matthew Pickering Date: Mon Mar 27 17:41:41 2017 +0100 -fspec-constr-keen docs typos [skip ci] >--------------------------------------------------------------- 5025fe2435d030f0c5ecdc2a933c7bfcb3efcb7c docs/users_guide/using-optimisation.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/users_guide/using-optimisation.rst b/docs/users_guide/using-optimisation.rst index 8f7d6b8..fb2f284 100644 --- a/docs/users_guide/using-optimisation.rst +++ b/docs/users_guide/using-optimisation.rst @@ -584,8 +584,8 @@ list. :default: off - If this flag is on, call-patten specialision will specialise a call - ``(f (Just x))`` with an explicit constructor agument, even if the argument + If this flag is on, call-pattern specialisation will specialise a call + ``(f (Just x))`` with an explicit constructor argument, even if the argument is not scrutinised in the body of the function. This is sometimes beneficial; e.g. the argument might be given to some other function that can itself be specialised. From git at git.haskell.org Mon Mar 27 19:05:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Mar 2017 19:05:13 +0000 (UTC) Subject: [commit: ghc] master: Fix #13458 (cea7141) Message-ID: <20170327190513.D4F833A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cea7141851ce653cb20207da3591d09e73fa396d/ghc >--------------------------------------------------------------- commit cea7141851ce653cb20207da3591d09e73fa396d Author: Richard Eisenberg Date: Wed Mar 22 22:32:04 2017 -0400 Fix #13458 Core Lint shouldn't check representations of types that don't have representations. test case: typecheck/should_compile/T13458 >--------------------------------------------------------------- cea7141851ce653cb20207da3591d09e73fa396d compiler/coreSyn/CoreLint.hs | 26 +++++++++++++++------- compiler/simplStg/RepType.hs | 4 ---- testsuite/tests/typecheck/should_compile/T13458.hs | 11 +++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index 0363d6b..b97f97e 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -1630,7 +1630,7 @@ lintCoercion co@(UnivCo prov r ty1 ty2) (checkTypes ty1 ty2) ; return (k1, k2, ty1, ty2, r) } where - report s = hang (text $ "Unsafe coercion between " ++ s) + report s = hang (text $ "Unsafe coercion: " ++ s) 2 (vcat [ text "From:" <+> ppr ty1 , text " To:" <+> ppr ty2]) isUnBoxed :: PrimRep -> Bool @@ -1638,10 +1638,20 @@ lintCoercion co@(UnivCo prov r ty1 ty2) -- see #9122 for discussion of these checks checkTypes t1 t2 - = do { checkWarnL (reps1 `equalLength` reps2) - (report "values with different # of reps") - ; zipWithM_ validateCoercion reps1 reps2 } + = do { checkWarnL lev_poly1 + (report "left-hand type is levity-polymorphic") + ; checkWarnL lev_poly2 + (report "right-hand type is levity-polymorphic") + ; when (not (lev_poly1 || lev_poly2)) $ + do { checkWarnL (reps1 `equalLength` reps2) + (report "between values with different # of reps") + ; zipWithM_ validateCoercion reps1 reps2 }} where + lev_poly1 = isTypeLevPoly t1 + lev_poly2 = isTypeLevPoly t2 + + -- don't look at these unless lev_poly1/2 are False + -- Otherwise, we get #13458 reps1 = typePrimRep t1 reps2 = typePrimRep t2 @@ -1649,15 +1659,15 @@ lintCoercion co@(UnivCo prov r ty1 ty2) validateCoercion rep1 rep2 = do { dflags <- getDynFlags ; checkWarnL (isUnBoxed rep1 == isUnBoxed rep2) - (report "unboxed and boxed value") + (report "between unboxed and boxed value") ; checkWarnL (TyCon.primRepSizeW dflags rep1 == TyCon.primRepSizeW dflags rep2) - (report "unboxed values of different size") + (report "between unboxed values of different size") ; let fl = liftM2 (==) (TyCon.primRepIsFloat rep1) (TyCon.primRepIsFloat rep2) ; case fl of - Nothing -> addWarnL (report "vector types") - Just False -> addWarnL (report "float and integral values") + Nothing -> addWarnL (report "between vector types") + Just False -> addWarnL (report "between float and integral values") _ -> return () } diff --git a/compiler/simplStg/RepType.hs b/compiler/simplStg/RepType.hs index f59a854..be72574 100644 --- a/compiler/simplStg/RepType.hs +++ b/compiler/simplStg/RepType.hs @@ -343,10 +343,6 @@ kindPrimRep doc (TyConApp typ [runtime_rep]) kindPrimRep doc ki = pprPanic "kindPrimRep" (ppr ki $$ doc) - -- TODO (RAE): Remove: - -- WARN( True, text "kindPrimRep defaulting to LiftedRep on" <+> ppr ki $$ doc ) - -- [LiftedRep] -- this can happen legitimately for, e.g., Any - -- | Take a type of kind RuntimeRep and extract the list of 'PrimRep' that -- it encodes. runtimeRepPrimRep :: HasDebugCallStack => SDoc -> Type -> [PrimRep] diff --git a/testsuite/tests/typecheck/should_compile/T13458.hs b/testsuite/tests/typecheck/should_compile/T13458.hs new file mode 100644 index 0000000..9b51378 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T13458.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE MagicHash, TypeInType, ScopedTypeVariables #-} +{-# OPTIONS_GHC -O #-} +module T13458 where +import GHC.Exts +import Data.Kind +import Unsafe.Coerce + +unsafeCoerce' :: forall (r :: RuntimeRep) + (a :: TYPE r) (b :: TYPE r). + a -> b +unsafeCoerce' = unsafeCoerce id diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 9caaf25..97a5350 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -546,3 +546,4 @@ test('T12926', normal, compile, ['']) test('T13381', normal, compile_fail, ['']) test('T13337', normal, compile, ['']) test('T13343', normal, compile, ['']) +test('T13458', normal, compile, ['']) From git at git.haskell.org Tue Mar 28 02:16:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Mar 2017 02:16:11 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-simplify' created Message-ID: <20170328021611.DEFA03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rwbarton-simplify Referencing: 91a584e237379a5d8dbe4d7be0e08c6ccca3132a From git at git.haskell.org Tue Mar 28 02:16:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Mar 2017 02:16:14 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-simplify: Fix space leaks in simplifier (#13426) (91a584e) Message-ID: <20170328021614.A125A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-simplify Link : http://ghc.haskell.org/trac/ghc/changeset/91a584e237379a5d8dbe4d7be0e08c6ccca3132a/ghc >--------------------------------------------------------------- commit 91a584e237379a5d8dbe4d7be0e08c6ccca3132a Author: Reid Barton Date: Mon Mar 27 22:15:29 2017 -0400 Fix space leaks in simplifier (#13426) >--------------------------------------------------------------- 91a584e237379a5d8dbe4d7be0e08c6ccca3132a compiler/simplCore/Simplify.hs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index e78714d..065f524 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -1001,16 +1001,22 @@ simplExprF1 env (Lit lit) cont = rebuild env (Lit lit) cont simplExprF1 env (Tick t expr) cont = simplTick env t expr cont simplExprF1 env (Cast body co) cont = simplCast env body co cont simplExprF1 env (Coercion co) cont = simplCoercionF env co cont -simplExprF1 env (Type ty) cont = ASSERT( contIsRhsOrArg cont ) - rebuild env (Type (substTy env ty)) cont +simplExprF1 env (Type ty) cont = ASSERT( contIsRhsOrArg cont ) do { + ty' <- simplType env ty; + rebuild env (Type ty') cont } simplExprF1 env (App fun arg) cont - = simplExprF env fun $ - case arg of - Type ty -> ApplyToTy { sc_arg_ty = substTy env ty - , sc_hole_ty = substTy env (exprType fun) - , sc_cont = cont } - _ -> ApplyToVal { sc_arg = arg, sc_env = env + = case arg of + Type ty -> do { + ty' <- simplType env ty; + hole' <- simplType env (exprType fun); + simplExprF env fun (ApplyToTy { + sc_arg_ty = ty' + , sc_hole_ty = hole' + , sc_cont = cont }) + } + _ -> simplExprF env fun $ + ApplyToVal { sc_arg = arg, sc_env = env , sc_dup = NoDup, sc_cont = cont } simplExprF1 env expr@(Lam {}) cont @@ -2217,7 +2223,7 @@ reallyRebuildCase env scrut case_bndr alts cont ; dflags <- getDynFlags ; let alts_ty' = contResultType dup_cont - ; case_expr <- mkCase dflags scrut' case_bndr' alts_ty' alts' + ; case_expr <- seqType alts_ty' `seq` mkCase dflags scrut' case_bndr' alts_ty' alts' -- Notice that rebuild gets the in-scope set from env', not alt_env -- (which in any case is only build in simplAlts) From git at git.haskell.org Tue Mar 28 07:50:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Mar 2017 07:50:30 +0000 (UTC) Subject: [commit: ghc] master: Test Trac #13490 (eb6ccb7) Message-ID: <20170328075030.B9D9C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/eb6ccb7cd8751cd027ee9913e47f1371bfa62289/ghc >--------------------------------------------------------------- commit eb6ccb7cd8751cd027ee9913e47f1371bfa62289 Author: Simon Peyton Jones Date: Tue Mar 28 08:44:11 2017 +0100 Test Trac #13490 >--------------------------------------------------------------- eb6ccb7cd8751cd027ee9913e47f1371bfa62289 testsuite/tests/typecheck/should_compile/T13490.hs | 12 ++++++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 2 files changed, 13 insertions(+) diff --git a/testsuite/tests/typecheck/should_compile/T13490.hs b/testsuite/tests/typecheck/should_compile/T13490.hs new file mode 100644 index 0000000..72e0ede --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T13490.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE FlexibleContexts, TypeFamilies #-} + +module T13490 where + +import Data.Typeable + +type family Foo a + +data C a + +foo :: (Typeable (C z), z ~ Foo zp) => C zp +foo = undefined diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 97a5350..cfc4eff 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -547,3 +547,4 @@ test('T13381', normal, compile_fail, ['']) test('T13337', normal, compile, ['']) test('T13343', normal, compile, ['']) test('T13458', normal, compile, ['']) +test('T13490', normal, compile, ['']) From git at git.haskell.org Tue Mar 28 07:50:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Mar 2017 07:50:27 +0000 (UTC) Subject: [commit: ghc] master: Complete the fix for #13441 (pattern synonyms) (b5c8120) Message-ID: <20170328075027.3509C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b5c81203d047293f54c4e89ac70d505197968cb3/ghc >--------------------------------------------------------------- commit b5c81203d047293f54c4e89ac70d505197968cb3 Author: Simon Peyton Jones Date: Tue Mar 28 08:23:44 2017 +0100 Complete the fix for #13441 (pattern synonyms) Do not attempt to typecheck both directions of an implicitly-bidirectional pattern synonym simultanously, as we were before. Instead, the builder is typechecked when we typecheck the code for the builder, which was of course happening already, even in both bidirectional cases. See Note [Checking against a pattern signature], under "Existential type variables". >--------------------------------------------------------------- b5c81203d047293f54c4e89ac70d505197968cb3 compiler/typecheck/TcPatSyn.hs | 45 ++++++++++++---------- testsuite/tests/patsyn/should_compile/T13441.hs | 7 ++++ testsuite/tests/patsyn/should_compile/T13441a.hs | 11 ++++++ testsuite/tests/patsyn/should_compile/T13441b.hs | 12 ++++++ .../tests/patsyn/should_compile/T13441b.stderr | 11 ++++++ testsuite/tests/patsyn/should_compile/all.T | 2 + 6 files changed, 67 insertions(+), 21 deletions(-) diff --git a/compiler/typecheck/TcPatSyn.hs b/compiler/typecheck/TcPatSyn.hs index 6f7764e..01cb542 100644 --- a/compiler/typecheck/TcPatSyn.hs +++ b/compiler/typecheck/TcPatSyn.hs @@ -149,14 +149,11 @@ tcCheckPatSynDecl psb at PSB{ psb_id = lname@(L _ name), psb_args = details pushLevelAndCaptureConstraints $ tcExtendTyVarEnv univ_tvs $ tcPat PatSyn lpat (mkCheckExpType pat_ty) $ - do { let new_tv = case dir of - ImplicitBidirectional -> newMetaSigTyVarX - _ -> newMetaTyVarX - -- new_tv: see the "Existential type variables" - -- part of Note [Checking against a pattern signature] - in_scope = mkInScopeSet (mkVarSet univ_tvs) + do { let in_scope = mkInScopeSet (mkVarSet univ_tvs) empty_subst = mkEmptyTCvSubst in_scope - ; (subst, ex_tvs') <- mapAccumLM new_tv empty_subst ex_tvs + ; (subst, ex_tvs') <- mapAccumLM newMetaTyVarX empty_subst ex_tvs + -- newMetaTyVarX: see the "Existential type variables" + -- part of Note [Checking against a pattern signature] ; traceTc "tcpatsyn1" (vcat [ ppr v <+> dcolon <+> ppr (tyVarKind v) | v <- ex_tvs]) ; traceTc "tcpatsyn2" (vcat [ ppr v <+> dcolon <+> ppr (tyVarKind v) | v <- ex_tvs']) ; let prov_theta' = substTheta subst prov_theta @@ -241,20 +238,26 @@ unify x := [a] during type checking, and then use the instantiating type dl = $dfunEqList d in k [a] dl ys -This "concealing" story works for /uni-directional/ pattern synonyms. -It also works for /explicitly-bidirectional/ pattern synonyms, where -the constructor direction is typecheked entirely separately. - -But for /implicitly-bidirecitonal/ ones like - pattern P x = MkS x -we are trying to typecheck both directions at once. So for this we -use SigTv, rather than a generic TauTv. But it's not quite done: - - We should really check that those SigTvs don't get unified - with each other. - - Trac #13441 is rejected if you use an implicitly-bidirectional - pattern. -Maybe it'd be better to treat it like an explicitly-bidirectional -pattern? +All this applies when type-checking the /matching/ side of +a pattern synonym. What about the /building/ side? + +* For Unidirectional, there is no builder + +* For ExplicitBidirectional, the builder is completely separate + code, typechecked in tcPatSynBuilderBind + +* For ImplicitBidirectional, the builder is still typechecked in + tcPatSynBuilderBind, by converting the pattern to an expression and + typechecking it. + + At one point, for ImplicitBidirectional I used SigTvs (instead of + TauTvs) in tcCheckPatSynDecl. But (a) strengthening the check here + is redundant since tcPatSynBuilderBind does the job, (b) it was + still incomplete (SigTvs can unify with each other), and (c) it + didn't even work (Trac #13441 was accepted with + ExplicitBidirectional, but rejected if expressed in + ImplicitBidirectional form. Conclusion: trying to be too clever is + a bad idea. -} collectPatSynArgInfo :: HsPatSynDetails (Located Name) -> ([Name], [Name], Bool) diff --git a/testsuite/tests/patsyn/should_compile/T13441.hs b/testsuite/tests/patsyn/should_compile/T13441.hs index d7a339f..7380175 100644 --- a/testsuite/tests/patsyn/should_compile/T13441.hs +++ b/testsuite/tests/patsyn/should_compile/T13441.hs @@ -21,9 +21,16 @@ type family Replicate (n :: Nat) (x :: a) = (r :: [a]) where type Vec n a = FList Identity (Replicate n a) +-- Using explicitly-bidirectional pattern pattern (:>) :: forall n a. n ~ Length (Replicate n a) => forall m. n ~ Succ m => a -> Vec m a -> Vec n a pattern x :> xs <- Identity x :@ xs where x :> xs = Identity x :@ xs + +-- Using implicitly-bidirectional pattern +pattern (:>>) :: forall n a. n ~ Length (Replicate n a) + => forall m. n ~ Succ m + => a -> Vec m a -> Vec n a +pattern x :>> xs = Identity x :@ xs diff --git a/testsuite/tests/patsyn/should_compile/T13441a.hs b/testsuite/tests/patsyn/should_compile/T13441a.hs new file mode 100644 index 0000000..7736094 --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T13441a.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE PatternSynonyms, GADTs #-} +module T13441a where + +data S where + MkS :: Eq a => [a] -> S + +-- Unidirectional pattern binding; +-- the existential is more specific than needed +-- c.f. T13441b +pattern P :: () => Eq x => x -> S +pattern P x <- MkS x diff --git a/testsuite/tests/patsyn/should_compile/T13441b.hs b/testsuite/tests/patsyn/should_compile/T13441b.hs new file mode 100644 index 0000000..8f8d2ba --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T13441b.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE PatternSynonyms, GADTs #-} +module T13441a where + +data S where + MkS :: Eq a => [a] -> S + +-- Implicitly-bidirectional pattern binding; +-- the existential is more specific than needed, +-- and hence should be rejected +-- c.f. T13441a +pattern P :: () => Eq x => x -> S +pattern P x = MkS x diff --git a/testsuite/tests/patsyn/should_compile/T13441b.stderr b/testsuite/tests/patsyn/should_compile/T13441b.stderr new file mode 100644 index 0000000..4469086 --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T13441b.stderr @@ -0,0 +1,11 @@ + +T13441b.hs:12:19: error: + • Couldn't match expected type ‘[a0]’ with actual type ‘x’ + ‘x’ is a rigid type variable bound by + the signature for pattern synonym ‘P’ at T13441b.hs:12:1-19 + • In the first argument of ‘MkS’, namely ‘x’ + In the expression: MkS x + In an equation for ‘P’: P x = MkS x + • Relevant bindings include + x :: x (bound at T13441b.hs:12:19) + $bP :: x -> S (bound at T13441b.hs:12:9) diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T index 1f36424..8fce7e9 100644 --- a/testsuite/tests/patsyn/should_compile/all.T +++ b/testsuite/tests/patsyn/should_compile/all.T @@ -65,3 +65,5 @@ test('T12746', normal, multi_compile, ['T12746', [('T12746A.hs', '-c')],'-v0']) test('T12968', normal, compile, ['']) test('T13349b', normal, compile, ['']) test('T13441', normal, compile, ['']) +test('T13441a', normal, compile, ['']) +test('T13441b', normal, compile_fail, ['']) From git at git.haskell.org Tue Mar 28 10:26:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Mar 2017 10:26:19 +0000 (UTC) Subject: [commit: ghc] master: Spelling in comments only [ci skip] (08a6fc6) Message-ID: <20170328102619.C61343A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/08a6fc69ce1617bb997cb02584a961ac29a266eb/ghc >--------------------------------------------------------------- commit 08a6fc69ce1617bb997cb02584a961ac29a266eb Author: Gabor Greif Date: Tue Mar 28 11:59:48 2017 +0200 Spelling in comments only [ci skip] >--------------------------------------------------------------- 08a6fc69ce1617bb997cb02584a961ac29a266eb compiler/cmm/CmmImplementSwitchPlans.hs | 2 +- compiler/coreSyn/CoreLint.hs | 2 +- compiler/ghci/ByteCodeGen.hs | 2 +- compiler/prelude/TysPrim.hs | 2 +- compiler/prelude/primops.txt.pp | 2 +- compiler/simplCore/Simplify.hs | 2 +- ghc/GHCi/UI.hs | 2 +- rts/linker/Elf.c | 2 +- rts/linker/MachO.c | 8 ++++---- rts/linker/MachOTypes.h | 4 ++-- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/compiler/cmm/CmmImplementSwitchPlans.hs b/compiler/cmm/CmmImplementSwitchPlans.hs index 225c77e..d378c66 100644 --- a/compiler/cmm/CmmImplementSwitchPlans.hs +++ b/compiler/cmm/CmmImplementSwitchPlans.hs @@ -21,7 +21,7 @@ import DynFlags -- CmmSwitch and returned as a SwitchPlan; here is just the implementation in -- terms of Cmm code. See Note [Cmm Switches, the general plan] in CmmSwitch. -- --- This division into different modules is both to clearly separte concerns, +-- This division into different modules is both to clearly separate concerns, -- but also because createSwitchPlan needs access to the constructors of -- SwitchTargets, a data type exported abstractly by CmmSwitch. -- diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index b97f97e..089a225 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -2198,7 +2198,7 @@ mkScrutMsg var var_ty scrut_ty subst mkNonDefltMsg, mkNonIncreasingAltsMsg :: CoreExpr -> MsgDoc mkNonDefltMsg e - = hang (text "Case expression with DEFAULT not at the beginnning") 4 (ppr e) + = hang (text "Case expression with DEFAULT not at the beginning") 4 (ppr e) mkNonIncreasingAltsMsg e = hang (text "Case expression with badly-ordered alternatives") 4 (ppr e) diff --git a/compiler/ghci/ByteCodeGen.hs b/compiler/ghci/ByteCodeGen.hs index 5484288..0033df1 100644 --- a/compiler/ghci/ByteCodeGen.hs +++ b/compiler/ghci/ByteCodeGen.hs @@ -139,7 +139,7 @@ Note [generating code for top-level string literal bindings] Here is a summary on how the byte code generator deals with top-level string literals: -1. Top-level string literal bindings are spearted from the rest of the module. +1. Top-level string literal bindings are separated from the rest of the module. 2. The strings are allocated via iservCmd, in allocateTopStrings diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs index cdc25e0..0732b56 100644 --- a/compiler/prelude/TysPrim.hs +++ b/compiler/prelude/TysPrim.hs @@ -235,7 +235,7 @@ mkTemplateTyVarsFrom :: Int -> [Kind] -> [TyVar] -- b with unique (mkAlphaTyVarUnique n+1) -- ... etc -- Typically called as --- mkTemplateTyVarsFrom (legth kv_bndrs) kinds +-- mkTemplateTyVarsFrom (length kv_bndrs) kinds -- where kv_bndrs are the kind-level binders of a TyCon mkTemplateTyVarsFrom n kinds = [ mkTyVar name kind diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index a313920..41a725f 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -200,7 +200,7 @@ primop IntMulMayOfloOp "mulIntMayOflo#" {Return non-zero if there is any possibility that the upper word of a signed integer multiply might contain useful information. Return zero only if you are completely sure that no overflow can occur. - On a 32-bit platform, the recommmended implementation is to do a + On a 32-bit platform, the recommended implementation is to do a 32 x 32 -> 64 signed multiply, and subtract result[63:32] from (result[31] >>signed 31). If this is zero, meaning that the upper word is merely a sign extension of the lower one, no diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index e78714d..1b89f3e 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -485,7 +485,7 @@ completeNonRecX top_lvl env is_strict old_bndr new_bndr new_rhs {- {- No, no, no! Do not try preInlineUnconditionally in completeNonRecX Doing so risks exponential behaviour, because new_rhs has been simplified once already - In the cases described by the folowing commment, postInlineUnconditionally will + In the cases described by the following comment, postInlineUnconditionally will catch many of the relevant cases. -- This happens; for example, the case_bndr during case of -- known constructor: case (a,b) of x { (p,q) -> ... } diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index b2b54d3..f684bf7 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -920,7 +920,7 @@ runCommands' eh sourceErrorHandler gCmd = gmask $ \unmask -> do -- A result of Nothing means there was no more input to process. -- Otherwise the result is Just b where b is True if the command succeeded; -- this is relevant only to ghc -e, which will exit with status 1 --- if the commmand was unsuccessful. GHCi will continue in either case. +-- if the command was unsuccessful. GHCi will continue in either case. runOneCommand :: (SomeException -> GHCi Bool) -> InputT GHCi (Maybe String) -> InputT GHCi (Maybe Bool) runOneCommand eh gCmd = do diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c index e8f6aab..2ce4d3d 100644 --- a/rts/linker/Elf.c +++ b/rts/linker/Elf.c @@ -375,7 +375,7 @@ ocVerifyImage_ELF ( ObjectCode* oc ) if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) { IF_DEBUG(linker,debugBelch( "Is big-endian\n" )); } else { - errorBelch("%s: unknown endiannness", oc->fileName); + errorBelch("%s: unknown endianness", oc->fileName); return 0; } diff --git a/rts/linker/MachO.c b/rts/linker/MachO.c index 9fc3c5b..16b712a 100644 --- a/rts/linker/MachO.c +++ b/rts/linker/MachO.c @@ -618,7 +618,7 @@ relocateSection_aarch64(ObjectCode * oc, Section * section) return 1; /* at this point, we have: * - * - loaded the sections (potentially into non-continuous memory), + * - loaded the sections (potentially into non-contiguous memory), * (in ocGetNames_MachO) * - registered exported sybmols * (in ocGetNames_MachO) @@ -628,7 +628,7 @@ relocateSection_aarch64(ObjectCode * oc, Section * section) * - All oc->symbols however should now point at the right place. */ - /* we need to care about the explicity addend */ + /* we need to care about the explicit addend */ int64_t explicit_addend = 0; size_t nreloc = section->info->macho_section->nreloc; @@ -986,7 +986,7 @@ relocateSection( thing -= value; break; default: - barf("unkown relocation"); + barf("unknown relocation"); } switch(reloc->r_length) @@ -1687,7 +1687,7 @@ ocGetNames_MachO(ObjectCode* oc) * - EXT and UNDF * - EXT and not in the same section. * - * As sections are not necessarily continuous and can live + * As sections are not necessarily contiguous and can live * anywhere in the addressable space. This obviously makes * sense. However it took me a while to figure this out. */ diff --git a/rts/linker/MachOTypes.h b/rts/linker/MachOTypes.h index 31bfdb4..f78bfca 100644 --- a/rts/linker/MachOTypes.h +++ b/rts/linker/MachOTypes.h @@ -30,7 +30,7 @@ typedef struct scattered_relocation_info MachOScatteredRelocationInfo; /* Dealing with nlist symbol entries can become * painful. We'll have our own Symbol struct that * mirrors the symbol from the nlist and can carry - * some more infomration (like addr). + * some more information (like addr). */ typedef struct _MachOSymbol { SymbolName * name; /* the name of the symbol. */ @@ -101,7 +101,7 @@ typedef struct _ObjectCodeFormatInfo { * * These are very similar to the SymbolExtras * below. However the SymbolExtras are allocated - * per ObejctCode and not per Section. + * per ObjectCode and not per Section. * * TODO: Merge SymbolExtras and Stubs. */ From git at git.haskell.org Tue Mar 28 10:31:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Mar 2017 10:31:39 +0000 (UTC) Subject: [commit: ghc] master: Fix #13433 (074d13e) Message-ID: <20170328103139.36F513A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/074d13eb3b6489e8b2f555f61496761614a3e207/ghc >--------------------------------------------------------------- commit 074d13eb3b6489e8b2f555f61496761614a3e207 Author: Simon Marlow Date: Mon Mar 27 13:15:04 2017 +0100 Fix #13433 Summary: See comments for details. Test Plan: validate Reviewers: mpickering, bgamari, austin, erikd Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3386 >--------------------------------------------------------------- 074d13eb3b6489e8b2f555f61496761614a3e207 rts/Apply.cmm | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/rts/Apply.cmm b/rts/Apply.cmm index b3a04ca..4c34f0f 100644 --- a/rts/Apply.cmm +++ b/rts/Apply.cmm @@ -156,13 +156,26 @@ again: THUNK_STATIC, THUNK_SELECTOR: { - // The thunk might evaluate to a function, so we have to come - // back here again to adjust its CCS if necessary. The - // stg_restore_ccs_eval stack frame does that. + // We have a thunk of some kind, so evaluate it. + + // The thunk might evaluate to a function, so we have to + // come back here again to adjust its CCS if necessary. + // Therefore we need to push a stack frame to look at the + // function that gets returned (a stg_restore_ccs_eval + // frame), and therefore we need a stack check. STK_CHK_GEN(); + + // We can't use the value of 'info' any more, because if + // STK_CHK_GEN() did a GC then the closure we're looking + // at may have changed, e.g. a THUNK_SELECTOR may have + // been evaluated by the GC. So we reload the info + // pointer now. + untaggedfun = UNTAG(fun); + info = %INFO_PTR(untaggedfun); + jump %ENTRY_CODE(info) (stg_restore_cccs_eval_info, CCCS) - (UNTAG(fun)); + (untaggedfun); } default: { From git at git.haskell.org Tue Mar 28 10:32:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Mar 2017 10:32:50 +0000 (UTC) Subject: [commit: ghc] master: Make the test fail if compiled without -threaded (c77551a) Message-ID: <20170328103250.D3A8D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c77551abd42a346d03826d23df710ebf9eacb19f/ghc >--------------------------------------------------------------- commit c77551abd42a346d03826d23df710ebf9eacb19f Author: Simon Marlow Date: Mon Mar 27 16:09:23 2017 +0100 Make the test fail if compiled without -threaded Test Plan: validate Reviewers: bgamari, austin, erikd Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3387 >--------------------------------------------------------------- c77551abd42a346d03826d23df710ebf9eacb19f testsuite/tests/concurrent/should_run/hs_try_putmvar003.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/testsuite/tests/concurrent/should_run/hs_try_putmvar003.hs b/testsuite/tests/concurrent/should_run/hs_try_putmvar003.hs index d74a9cb..4442698 100644 --- a/testsuite/tests/concurrent/should_run/hs_try_putmvar003.hs +++ b/testsuite/tests/concurrent/should_run/hs_try_putmvar003.hs @@ -10,6 +10,7 @@ import GHC.Conc import GHC.MVar (MVar(..)) import GHC.Prim import System.Environment +import System.Exit -- Measure C to Haskell callback throughput under a workload with -- several dimensions: @@ -29,6 +30,8 @@ import System.Environment -- hs_try_putmvar() is 9x faster with these parameters. main = do + when (not rtsSupportsBoundThreads) $ + die "This test requires -threaded" args <- getArgs case args of ["1",x,y,z] -> experiment False (read x) (read y) (read z) From git at git.haskell.org Tue Mar 28 20:22:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Mar 2017 20:22:20 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T13479' created Message-ID: <20170328202220.46E4C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T13479 Referencing: 84716345c856667ac4aef455bc6f254289dafb39 From git at git.haskell.org Tue Mar 28 20:22:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Mar 2017 20:22:23 +0000 (UTC) Subject: [commit: ghc] wip/T13479: Zap Call Arity info in the simplifier (8471634) Message-ID: <20170328202223.162AC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13479 Link : http://ghc.haskell.org/trac/ghc/changeset/84716345c856667ac4aef455bc6f254289dafb39/ghc >--------------------------------------------------------------- commit 84716345c856667ac4aef455bc6f254289dafb39 Author: Joachim Breitner Date: Tue Mar 28 16:19:16 2017 -0400 Zap Call Arity info in the simplifier As #13479 shows, there are corner cases where the simplifier decides to not eta-expand a function as much as its call arity would suggest, but instead transforms the code that the call arity annotation becomes a lie. As the call arity information is only meant to be used by the immediatelly following simplifier run, it makes sense to simply zap the information there. Differential Revision: https://phabricator.haskell.org/D3390 >--------------------------------------------------------------- 84716345c856667ac4aef455bc6f254289dafb39 compiler/basicTypes/IdInfo.hs | 5 ++++- compiler/simplCore/Simplify.hs | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/compiler/basicTypes/IdInfo.hs b/compiler/basicTypes/IdInfo.hs index f29fba7..bd6ec8f 100644 --- a/compiler/basicTypes/IdInfo.hs +++ b/compiler/basicTypes/IdInfo.hs @@ -29,7 +29,7 @@ module IdInfo ( -- ** Zapping various forms of Info zapLamInfo, zapFragileInfo, zapDemandInfo, zapUsageInfo, zapUsageEnvInfo, zapUsedOnceInfo, - zapTailCallInfo, + zapTailCallInfo, zapCallArityInfo, -- ** The ArityInfo type ArityInfo, @@ -553,6 +553,9 @@ zapTailCallInfo info where safe_occ = occ { occ_tail = NoTailCallInfo } +zapCallArityInfo :: IdInfo -> IdInfo +zapCallArityInfo info = setCallArityInfo info 0 + {- ************************************************************************ * * diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index e78714d..dd9b01b 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -803,7 +803,12 @@ completeBind env top_lvl is_rec mb_cont old_bndr new_bndr new_rhs | otherwise = info2 - final_id = new_bndr `setIdInfo` info3 + -- Zap call arity info. We have used it by now (via + -- `tryEtaExpandRhs`), and the simplifier can invalidate this + -- information, leading to broken code later (e.g. #13479) + info4 = zapCallArityInfo info3 + + final_id = new_bndr `setIdInfo` info4 ; -- pprTrace "Binding" (ppr final_id <+> ppr new_unfolding) $ return (addNonRec env final_id final_rhs) } } From git at git.haskell.org Tue Mar 28 23:36:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Mar 2017 23:36:05 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T13479' deleted Message-ID: <20170328233605.1AF223A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/T13479 From git at git.haskell.org Tue Mar 28 23:36:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Mar 2017 23:36:07 +0000 (UTC) Subject: [commit: ghc] master: Zap Call Arity info in the simplifier (e07211f) Message-ID: <20170328233607.CFD313A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e07211f752b9b98e2bd6957f126bd537d178041a/ghc >--------------------------------------------------------------- commit e07211f752b9b98e2bd6957f126bd537d178041a Author: Joachim Breitner Date: Tue Mar 28 16:19:16 2017 -0400 Zap Call Arity info in the simplifier As #13479 shows, there are corner cases where the simplifier decides to not eta-expand a function as much as its call arity would suggest, but instead transforms the code that the call arity annotation becomes a lie. As the call arity information is only meant to be used by the immediatelly following simplifier run, it makes sense to simply zap the information there. Differential Revision: https://phabricator.haskell.org/D3390 >--------------------------------------------------------------- e07211f752b9b98e2bd6957f126bd537d178041a compiler/basicTypes/IdInfo.hs | 5 ++++- compiler/simplCore/Simplify.hs | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/compiler/basicTypes/IdInfo.hs b/compiler/basicTypes/IdInfo.hs index f29fba7..bd6ec8f 100644 --- a/compiler/basicTypes/IdInfo.hs +++ b/compiler/basicTypes/IdInfo.hs @@ -29,7 +29,7 @@ module IdInfo ( -- ** Zapping various forms of Info zapLamInfo, zapFragileInfo, zapDemandInfo, zapUsageInfo, zapUsageEnvInfo, zapUsedOnceInfo, - zapTailCallInfo, + zapTailCallInfo, zapCallArityInfo, -- ** The ArityInfo type ArityInfo, @@ -553,6 +553,9 @@ zapTailCallInfo info where safe_occ = occ { occ_tail = NoTailCallInfo } +zapCallArityInfo :: IdInfo -> IdInfo +zapCallArityInfo info = setCallArityInfo info 0 + {- ************************************************************************ * * diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 1b89f3e..43006f8 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -803,7 +803,12 @@ completeBind env top_lvl is_rec mb_cont old_bndr new_bndr new_rhs | otherwise = info2 - final_id = new_bndr `setIdInfo` info3 + -- Zap call arity info. We have used it by now (via + -- `tryEtaExpandRhs`), and the simplifier can invalidate this + -- information, leading to broken code later (e.g. #13479) + info4 = zapCallArityInfo info3 + + final_id = new_bndr `setIdInfo` info4 ; -- pprTrace "Binding" (ppr final_id <+> ppr new_unfolding) $ return (addNonRec env final_id final_rhs) } } From git at git.haskell.org Wed Mar 29 02:37:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 02:37:13 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Add 32-bit output for compact_share test (9f1f679) Message-ID: <20170329023713.260693A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/9f1f6797cd00be58b91c386fda77455598c8126a/ghc >--------------------------------------------------------------- commit 9f1f6797cd00be58b91c386fda77455598c8126a Author: Ben Gamari Date: Fri Mar 24 14:27:23 2017 -0400 testsuite: Add 32-bit output for compact_share test (cherry picked from commit d5847cfeee824867af1259cccab048f331a9a204) >--------------------------------------------------------------- 9f1f6797cd00be58b91c386fda77455598c8126a libraries/ghc-compact/tests/compact_share.stdout-ws-32 | 4 ++++ .../tests/{compact_share.stdout => compact_share.stdout-ws-64} | 0 2 files changed, 4 insertions(+) diff --git a/libraries/ghc-compact/tests/compact_share.stdout-ws-32 b/libraries/ghc-compact/tests/compact_share.stdout-ws-32 new file mode 100644 index 0000000..a6ac978 --- /dev/null +++ b/libraries/ghc-compact/tests/compact_share.stdout-ws-32 @@ -0,0 +1,4 @@ +275599 +1900544 +275599 +1114112 diff --git a/libraries/ghc-compact/tests/compact_share.stdout b/libraries/ghc-compact/tests/compact_share.stdout-ws-64 similarity index 100% rename from libraries/ghc-compact/tests/compact_share.stdout rename to libraries/ghc-compact/tests/compact_share.stdout-ws-64 From git at git.haskell.org Wed Mar 29 02:37:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 02:37:16 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix 'unsolved constraints' in GHCi (a260938) Message-ID: <20170329023716.7F6B23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/a260938a30192b6bf159fd1a646455d982184d84/ghc >--------------------------------------------------------------- commit a260938a30192b6bf159fd1a646455d982184d84 Author: Simon Peyton Jones Date: Mon Mar 27 14:32:43 2017 +0100 Fix 'unsolved constraints' in GHCi In initTc, if the computation fails with an exception, we should not complain about unsolved constraints. Fixes Trac #13466. (cherry picked from commit feca929b8f7a7dfe96d06c27d405ce331cdcdb41) >--------------------------------------------------------------- a260938a30192b6bf159fd1a646455d982184d84 compiler/typecheck/TcRnMonad.hs | 11 +++++++---- testsuite/tests/ghci/scripts/T13466.script | 2 ++ testsuite/tests/ghci/scripts/T13466.stderr | 5 +++++ testsuite/tests/ghci/scripts/all.T | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/TcRnMonad.hs b/compiler/typecheck/TcRnMonad.hs index 0e5e07d..ef72932 100644 --- a/compiler/typecheck/TcRnMonad.hs +++ b/compiler/typecheck/TcRnMonad.hs @@ -336,11 +336,14 @@ initTcWithGbl hsc_env gbl_env loc do_this Right res -> return (Just res) Left _ -> return Nothing } - -- Check for unsolved constraints + -- Check for unsolved constraints + -- If we succeed (maybe_res = Just r), there should be + -- no unsolved constraints. But if we exit via an + -- exception (maybe_res = Nothing), we may have skipped + -- solving, so don't panic then (Trac #13466) ; lie <- readIORef (tcl_lie lcl_env) - ; if isEmptyWC lie - then return () - else pprPanic "initTc: unsolved constraints" (ppr lie) + ; when (isJust maybe_res && not (isEmptyWC lie)) $ + pprPanic "initTc: unsolved constraints" (ppr lie) -- Collect any error messages ; msgs <- readIORef (tcl_errs lcl_env) diff --git a/testsuite/tests/ghci/scripts/T13466.script b/testsuite/tests/ghci/scripts/T13466.script new file mode 100644 index 0000000..0310fac --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13466.script @@ -0,0 +1,2 @@ +:set -XTypeApplications +:t out_of_scope @[] diff --git a/testsuite/tests/ghci/scripts/T13466.stderr b/testsuite/tests/ghci/scripts/T13466.stderr new file mode 100644 index 0000000..ba3d5fd --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13466.stderr @@ -0,0 +1,5 @@ + +:1:1: error: + • Cannot apply expression of type ‘t1’ + to a visible type argument ‘[]’ + • In the expression: out_of_scope @[] diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 20bc5ae..00d8d81 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -250,3 +250,4 @@ test('T12550', normal, ghci_script, ['T12550.script']) test('StaticPtr', normal, ghci_script, ['StaticPtr.script']) test('T13202', normal, ghci_script, ['T13202.script']) test('T13202a', normal, ghci_script, ['T13202a.script']) +test('T13466', normal, ghci_script, ['T13466.script']) From git at git.haskell.org Wed Mar 29 02:37:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 02:37:19 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Zap Call Arity info in the simplifier (d88d025) Message-ID: <20170329023719.40D603A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/d88d0258204bf8d4aadd57280b8322890e5b98b3/ghc >--------------------------------------------------------------- commit d88d0258204bf8d4aadd57280b8322890e5b98b3 Author: Joachim Breitner Date: Tue Mar 28 16:19:16 2017 -0400 Zap Call Arity info in the simplifier As #13479 shows, there are corner cases where the simplifier decides to not eta-expand a function as much as its call arity would suggest, but instead transforms the code that the call arity annotation becomes a lie. As the call arity information is only meant to be used by the immediatelly following simplifier run, it makes sense to simply zap the information there. Differential Revision: https://phabricator.haskell.org/D3390 (cherry picked from commit e07211f752b9b98e2bd6957f126bd537d178041a) >--------------------------------------------------------------- d88d0258204bf8d4aadd57280b8322890e5b98b3 compiler/basicTypes/IdInfo.hs | 5 ++++- compiler/simplCore/Simplify.hs | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/compiler/basicTypes/IdInfo.hs b/compiler/basicTypes/IdInfo.hs index f29fba7..bd6ec8f 100644 --- a/compiler/basicTypes/IdInfo.hs +++ b/compiler/basicTypes/IdInfo.hs @@ -29,7 +29,7 @@ module IdInfo ( -- ** Zapping various forms of Info zapLamInfo, zapFragileInfo, zapDemandInfo, zapUsageInfo, zapUsageEnvInfo, zapUsedOnceInfo, - zapTailCallInfo, + zapTailCallInfo, zapCallArityInfo, -- ** The ArityInfo type ArityInfo, @@ -553,6 +553,9 @@ zapTailCallInfo info where safe_occ = occ { occ_tail = NoTailCallInfo } +zapCallArityInfo :: IdInfo -> IdInfo +zapCallArityInfo info = setCallArityInfo info 0 + {- ************************************************************************ * * diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 3a52fbe..977fa25 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -797,7 +797,12 @@ completeBind env top_lvl is_rec mb_cont old_bndr new_bndr new_rhs | otherwise = info2 - final_id = new_bndr `setIdInfo` info3 + -- Zap call arity info. We have used it by now (via + -- `tryEtaExpandRhs`), and the simplifier can invalidate this + -- information, leading to broken code later (e.g. #13479) + info4 = zapCallArityInfo info3 + + final_id = new_bndr `setIdInfo` info4 ; -- pprTrace "Binding" (ppr final_id <+> ppr new_unfolding) $ return (addNonRec env final_id final_rhs) } } From git at git.haskell.org Wed Mar 29 10:21:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 10:21:55 +0000 (UTC) Subject: [commit: ghc] branch 'wip/mpickering-unfolding-discounts' created Message-ID: <20170329102155.C69D43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/mpickering-unfolding-discounts Referencing: 41739f3228ff5017862de4bb9857bc7422272133 From git at git.haskell.org Wed Mar 29 10:21:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 10:21:58 +0000 (UTC) Subject: [commit: ghc] wip/mpickering-unfolding-discounts: Tweak unfolding defaults (41739f3) Message-ID: <20170329102158.8605D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/mpickering-unfolding-discounts Link : http://ghc.haskell.org/trac/ghc/changeset/41739f3228ff5017862de4bb9857bc7422272133/ghc >--------------------------------------------------------------- commit 41739f3228ff5017862de4bb9857bc7422272133 Author: Matthew Pickering Date: Wed Mar 29 11:20:36 2017 +0100 Tweak unfolding defaults >--------------------------------------------------------------- 41739f3228ff5017862de4bb9857bc7422272133 compiler/main/DynFlags.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 927d3c4..f2f6604 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -1655,8 +1655,8 @@ defaultDynFlags mySettings = -- E.g. 450 is not enough in 'fulsom' for Interval.sqr to inline -- into Csg.calc (The unfolding for sqr never makes it into the -- interface file.) - ufCreationThreshold = 750, - ufUseThreshold = 60, + ufCreationThreshold = 2000, + ufUseThreshold = 400, ufFunAppDiscount = 60, -- Be fairly keen to inline a function if that means -- we'll be able to pick the right method from a dictionary From git at git.haskell.org Wed Mar 29 13:59:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 13:59:33 +0000 (UTC) Subject: [commit: ghc] master: Add a couple of HasDebugCallStack contexts (60d338f) Message-ID: <20170329135933.190FA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/60d338f50992ddd932cbdd47587ef495a1ab8d21/ghc >--------------------------------------------------------------- commit 60d338f50992ddd932cbdd47587ef495a1ab8d21 Author: Simon Peyton Jones Date: Wed Mar 29 09:01:58 2017 +0100 Add a couple of HasDebugCallStack contexts Just for future (and past) debugging... >--------------------------------------------------------------- 60d338f50992ddd932cbdd47587ef495a1ab8d21 compiler/types/Coercion.hs | 4 ++-- compiler/types/Coercion.hs-boot | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index 86f9d76..e1dcfde 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -426,7 +426,7 @@ mkHeteroCoercionType Phantom = panic "mkHeteroCoercionType" -- | Given a coercion @co1 :: (a :: TYPE r1) ~ (b :: TYPE r2)@, -- produce a coercion @rep_co :: r1 ~ r2 at . -mkRuntimeRepCo :: Coercion -> Coercion +mkRuntimeRepCo :: HasDebugCallStack => Coercion -> Coercion mkRuntimeRepCo co = mkNthCo 0 kind_co where @@ -1530,7 +1530,7 @@ liftCoSubstWith r tvs cos ty -- that coerces between @lc_left(ty)@ and @lc_right(ty)@, where -- @lc_left@ is a substitution mapping type variables to the left-hand -- types of the mapped coercions in @lc@, and similar for @lc_right at . -liftCoSubst :: Role -> LiftingContext -> Type -> Coercion +liftCoSubst :: HasDebugCallStack => Role -> LiftingContext -> Type -> Coercion liftCoSubst r lc@(LC subst env) ty | isEmptyVarEnv env = Refl r (substTy subst ty) | otherwise = ty_co_subst lc r ty diff --git a/compiler/types/Coercion.hs-boot b/compiler/types/Coercion.hs-boot index eefefd0..dd10d6e 100644 --- a/compiler/types/Coercion.hs-boot +++ b/compiler/types/Coercion.hs-boot @@ -42,7 +42,7 @@ coVarRole :: CoVar -> Role mkCoercionType :: Role -> Type -> Type -> Type data LiftingContext -liftCoSubst :: Role -> LiftingContext -> Type -> Coercion +liftCoSubst :: HasDebugCallStack => Role -> LiftingContext -> Type -> Coercion seqCo :: Coercion -> () coercionKind :: Coercion -> Pair Type From git at git.haskell.org Wed Mar 29 13:59:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 13:59:36 +0000 (UTC) Subject: [commit: ghc] master: Allow unbound Refl binders in a RULE (8674883) Message-ID: <20170329135936.53FDD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8674883c137401873fd53a6963acd33af651c2af/ghc >--------------------------------------------------------------- commit 8674883c137401873fd53a6963acd33af651c2af Author: Simon Peyton Jones Date: Wed Mar 29 09:00:02 2017 +0100 Allow unbound Refl binders in a RULE Trac #13410 was failing because we had a RULE with a binder (c :: t~t) and the /occurrences/ of c on the LHS were being optimised to Refl, leaving a binder that would not be filled in by matching the LHS of the rule. I flirted with trying to ensure that occurrences (c :: t~t) are not optimised to Relf, but that turned out to be fragile; it was being done, for good reasons, in multiple places, including - TyCoRep.substCoVarBndr - Simplify.simplCast - Corecion.mkCoVarCo So I fixed it in one place by making Rules.matchN deal happily with an unbound binder (c :: t~t). Quite easy. See "Coercion variables" in Note [Unbound RULE binders] in Rules. In addition, I needed to make CoreLint be happy with an bound RULE binder that is a Relf coercion variable In debugging this, I was perplexed that occurrences of a variable (c :: t~t) mysteriously turned into Refl. I found out how it was happening, and decided to move it: * In TyCoRep.substCoVarBndr, do not substitute Refl for a binder (c :: t~t). * In mkCoVarCo do not optimise (c :: t~t) to Refl. Instead, we do this optimisation in optCoercion (specifically opt_co4) where, surprisingly, the optimisation was /not/ being done. This has no effect on what programs compile; it just moves a relatively-expensive optimisation to optCoercion, where it seems more properly to belong. It's actually not clear to me which is really "better", but this way round is less surprising. One small simplifying refactoring * Eliminate TyCoRep.substCoVarBndrCallback, which was only called locally. >--------------------------------------------------------------- 8674883c137401873fd53a6963acd33af651c2af compiler/coreSyn/CoreLint.hs | 18 ++- compiler/specialise/Rules.hs | 47 +++++-- compiler/types/Coercion.hs | 33 +++-- compiler/types/OptCoercion.hs | 32 ++++- compiler/types/TyCoRep.hs | 22 +-- testsuite/tests/simplCore/should_compile/T13410.hs | 152 +++++++++++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 7 files changed, 260 insertions(+), 45 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 8674883c137401873fd53a6963acd33af651c2af From git at git.haskell.org Wed Mar 29 13:59:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 13:59:39 +0000 (UTC) Subject: [commit: ghc] master: Fix ASSERT failure in TcErrors (f88ac37) Message-ID: <20170329135939.0C9063A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f88ac374c5cb150d4f172fb40be338d2112a0600/ghc >--------------------------------------------------------------- commit f88ac374c5cb150d4f172fb40be338d2112a0600 Author: Simon Peyton Jones Date: Wed Mar 29 14:57:21 2017 +0100 Fix ASSERT failure in TcErrors This fixes Trac #13494, by improving commit e0ad55f894a8d85dcc099c33c63cfe3d4515d464 Author: Simon Peyton Jones Date: Mon Mar 27 10:32:08 2017 +0100 Fix error-message suppress on given equalities which in turn was a fix to #13446 >--------------------------------------------------------------- f88ac374c5cb150d4f172fb40be338d2112a0600 compiler/typecheck/TcErrors.hs | 29 ++++++++++++---------- .../tests/indexed-types/should_fail/T2627b.stderr | 10 +++----- .../tests/indexed-types/should_fail/T6123.stderr | 3 ++- .../tests/indexed-types/should_fail/T7354.stderr | 5 ++-- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 84a28a7..9701637 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -1474,22 +1474,21 @@ mkTyVarEqErr dflags ctxt report ct oriented tv1 ty2 , report ] - -- So tv is a meta tyvar (or started that way before we - -- generalised it). So presumably it is an *untouchable* - -- meta tyvar or a SigTv, else it'd have been unified | OC_Occurs <- occ_check_expand - , insoluble_occurs_check - -- See Note [Occurs check error] in TcCanonical - = do { let occCheckMsg = important $ addArising (ctOrigin ct) $ - hang (text "Occurs check: cannot construct the infinite" <+> what <> colon) + -- We report an "occurs check" even for a ~ F t a, where F is a type + -- function; it's not insouble (because in principle F could reduce) + -- but we have certainly been unable to solve it + -- See Note [Occurs check error] in TcCanonical + = do { let main_msg = addArising (ctOrigin ct) $ + hang (text "Occurs check: cannot construct the infinite" <+> what <> colon) 2 (sep [ppr ty1, char '~', ppr ty2]) + extra2 = important $ mkEqInfoMsg ct ty1 ty2 - interesting_tyvars - = filter (not . noFreeVarsOfType . tyVarKind) $ - filter isTyVar $ - fvVarList $ - tyCoFVsOfType ty1 `unionFV` tyCoFVsOfType ty2 + interesting_tyvars = filter (not . noFreeVarsOfType . tyVarKind) $ + filter isTyVar $ + fvVarList $ + tyCoFVsOfType ty1 `unionFV` tyCoFVsOfType ty2 extra3 = relevant_bindings $ ppWhen (not (null interesting_tyvars)) $ hang (text "Type variable kinds:") 2 $ @@ -1497,7 +1496,8 @@ mkTyVarEqErr dflags ctxt report ct oriented tv1 ty2 interesting_tyvars) tyvar_binding tv = ppr tv <+> dcolon <+> ppr (tyVarKind tv) - ; mkErrorMsgFromCt ctxt ct $ mconcat [occCheckMsg, extra2, extra3, report] } + ; mkErrorMsgFromCt ctxt ct $ + mconcat [important main_msg, extra2, extra3, report] } | OC_Bad <- occ_check_expand = do { let msg = vcat [ text "Cannot instantiate unification variable" @@ -1546,6 +1546,9 @@ mkTyVarEqErr dflags ctxt report ct oriented tv1 ty2 ; mkErrorMsgFromCt ctxt ct (mconcat [msg, tv_extra, report]) } -- Nastiest case: attempt to unify an untouchable variable + -- So tv is a meta tyvar (or started that way before we + -- generalised it). So presumably it is an *untouchable* + -- meta tyvar or a SigTv, else it'd have been unified -- See Note [Error messages for untouchables] | (implic:_) <- cec_encl ctxt -- Get the innermost context , Implic { ic_env = env, ic_given = given diff --git a/testsuite/tests/indexed-types/should_fail/T2627b.stderr b/testsuite/tests/indexed-types/should_fail/T2627b.stderr index 1a09bd8..63f11b9 100644 --- a/testsuite/tests/indexed-types/should_fail/T2627b.stderr +++ b/testsuite/tests/indexed-types/should_fail/T2627b.stderr @@ -1,13 +1,9 @@ T2627b.hs:20:24: error: - • Couldn't match type ‘b0’ with ‘Dual (Dual b0)’ + • Occurs check: cannot construct the infinite type: + b0 ~ Dual (Dual b0) arising from a use of ‘conn’ - ‘b0’ is untouchable - inside the constraints: b ~ W e f - bound by a pattern with constructor: - Wr :: forall e f. e -> Comm f -> Comm (W e f), - in an equation for ‘conn’ - at T2627b.hs:20:14-19 + The type variable ‘b0’ is ambiguous • In the expression: conn undefined undefined In an equation for ‘conn’: conn (Rd k) (Wr a r) = conn undefined undefined diff --git a/testsuite/tests/indexed-types/should_fail/T6123.stderr b/testsuite/tests/indexed-types/should_fail/T6123.stderr index eafd27c..0ae1a5e 100644 --- a/testsuite/tests/indexed-types/should_fail/T6123.stderr +++ b/testsuite/tests/indexed-types/should_fail/T6123.stderr @@ -1,6 +1,7 @@ T6123.hs:10:14: error: - • Couldn't match type ‘a0’ with ‘Id a0’ arising from a use of ‘cid’ + • Occurs check: cannot construct the infinite type: a0 ~ Id a0 + arising from a use of ‘cid’ The type variable ‘a0’ is ambiguous • In the expression: cid undefined In an equation for ‘cundefined’: cundefined = cid undefined diff --git a/testsuite/tests/indexed-types/should_fail/T7354.stderr b/testsuite/tests/indexed-types/should_fail/T7354.stderr index f4c3c0d..b7b70b8 100644 --- a/testsuite/tests/indexed-types/should_fail/T7354.stderr +++ b/testsuite/tests/indexed-types/should_fail/T7354.stderr @@ -1,8 +1,7 @@ T7354.hs:28:11: error: - • Couldn't match type ‘p’ with ‘Base t (Prim [p] p)’ - ‘p’ is a rigid type variable bound by - the inferred type of foo :: Prim [p] p -> t at T7354.hs:28:1-13 + • Occurs check: cannot construct the infinite type: + p ~ Base t (Prim [p] p) Expected type: Prim [p] p -> Base t (Prim [p] p) Actual type: Prim [p] p -> p • In the first argument of ‘ana’, namely ‘alg’ From git at git.haskell.org Wed Mar 29 14:37:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 14:37:20 +0000 (UTC) Subject: [commit: ghc] master: cg057: accept output (01e1298) Message-ID: <20170329143720.C33CE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/01e12987189a205aa1a829a52af2d2ad77c48bea/ghc >--------------------------------------------------------------- commit 01e12987189a205aa1a829a52af2d2ad77c48bea Author: Simon Marlow Date: Wed Mar 29 06:25:05 2017 -0700 cg057: accept output >--------------------------------------------------------------- 01e12987189a205aa1a829a52af2d2ad77c48bea testsuite/tests/codeGen/should_run/cgrun057.stderr | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/codeGen/should_run/cgrun057.stderr b/testsuite/tests/codeGen/should_run/cgrun057.stderr index 5d1656d..ae2defb 100644 --- a/testsuite/tests/codeGen/should_run/cgrun057.stderr +++ b/testsuite/tests/codeGen/should_run/cgrun057.stderr @@ -1,6 +1,7 @@ -*** Exception (reporting due to +RTS -xc): (THUNK_STATIC), stack trace: +*** Exception (reporting due to +RTS -xc): (THUNK_2_0), stack trace: Main.g, called from Main.f, called from Main.main, called from Main.CAF - --> evaluated by: Main.main + --> evaluated by: Main.f, + called from Main.main From git at git.haskell.org Wed Mar 29 14:37:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 14:37:23 +0000 (UTC) Subject: [commit: ghc] master: Fix scc001 (5ebf83e) Message-ID: <20170329143723.910183A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5ebf83e0bdde02ccf289eb7bdaf1d360f20eebd2/ghc >--------------------------------------------------------------- commit 5ebf83e0bdde02ccf289eb7bdaf1d360f20eebd2 Author: Simon Marlow Date: Wed Mar 29 06:17:38 2017 -0700 Fix scc001 >--------------------------------------------------------------- 5ebf83e0bdde02ccf289eb7bdaf1d360f20eebd2 testsuite/tests/profiling/should_run/all.T | 2 +- .../tests/profiling/should_run/scc001.prof.sample | 42 +++++++++++----------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/testsuite/tests/profiling/should_run/all.T b/testsuite/tests/profiling/should_run/all.T index 96041ff..ec5f154 100644 --- a/testsuite/tests/profiling/should_run/all.T +++ b/testsuite/tests/profiling/should_run/all.T @@ -38,7 +38,7 @@ test('T3001-2', [only_ways(['prof_hb']), extra_ways(['prof_hb'])], # As with ioprof001, the unoptimised profile is different but # not badly wrong (CAF attribution is different). -test('scc001', [], compile_and_run, +test('scc001', expect_broken_for_10037, compile_and_run, ['-fno-state-hack -fno-full-laziness']) # Note [consistent stacks] test('scc002', [], compile_and_run, ['']) diff --git a/testsuite/tests/profiling/should_run/scc001.prof.sample b/testsuite/tests/profiling/should_run/scc001.prof.sample index 1144774..f2e55d5 100644 --- a/testsuite/tests/profiling/should_run/scc001.prof.sample +++ b/testsuite/tests/profiling/should_run/scc001.prof.sample @@ -1,33 +1,33 @@ - Sat Jun 4 11:59 2016 Time and Allocation Profiling Report (Final) + Wed Mar 29 06:17 2017 Time and Allocation Profiling Report (Final) scc001 +RTS -hc -p -RTS total time = 0.00 secs (0 ticks @ 1000 us, 1 processor) - total alloc = 50,888 bytes (excludes profiling overheads) + total alloc = 50,856 bytes (excludes profiling overheads) COST CENTRE MODULE SRC %time %alloc -MAIN MAIN 0.0 1.7 +MAIN MAIN 0.0 1.6 +CAF GHC.IO.Handle.FD 0.0 68.3 CAF GHC.IO.Encoding 0.0 5.4 CAF GHC.Conc.Signal 0.0 1.3 -CAF GHC.IO.Handle.FD 0.0 67.8 -main Main scc001.hs:(5,1)-(7,23) 0.0 22.5 +main Main scc001.hs:(5,1)-(7,23) 0.0 22.2 - individual inherited -COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc + individual inherited +COST CENTRE MODULE SRC no. entries %time %alloc %time %alloc -MAIN MAIN 46 0 0.0 1.7 0.0 100.0 - CAF Main 91 0 0.0 0.1 0.0 0.1 - (...) Main scc001.hs:16:1-16 97 1 0.0 0.0 0.0 0.0 - h Main scc001.hs:16:1-16 96 1 0.0 0.0 0.0 0.0 - main Main scc001.hs:(5,1)-(7,23) 92 1 0.0 0.0 0.0 0.0 - CAF GHC.Show 88 0 0.0 0.6 0.0 0.6 - CAF GHC.IO.Handle.FD 85 0 0.0 67.8 0.0 67.8 - CAF GHC.IO.Handle.Text 84 0 0.0 0.2 0.0 0.2 - CAF GHC.Conc.Signal 82 0 0.0 1.3 0.0 1.3 - CAF GHC.IO.Encoding 79 0 0.0 5.4 0.0 5.4 - CAF GHC.IO.Encoding.Iconv 65 0 0.0 0.5 0.0 0.5 - main Main scc001.hs:(5,1)-(7,23) 93 0 0.0 22.5 0.0 22.5 - f Main scc001.hs:10:1-7 94 1 0.0 0.0 0.0 0.0 - g Main scc001.hs:13:1-7 95 1 0.0 0.0 0.0 0.0 +MAIN MAIN 111 0 0.0 1.6 0.0 100.0 + CAF Main 221 0 0.0 0.0 0.0 0.6 + (...) Main scc001.hs:16:1-16 227 1 0.0 0.0 0.0 0.0 + main Main scc001.hs:(5,1)-(7,23) 222 1 0.0 0.5 0.0 0.5 + f Main scc001.hs:10:1-7 224 1 0.0 0.0 0.0 0.0 + g Main scc001.hs:13:1-7 225 1 0.0 0.0 0.0 0.0 + h Main scc001.hs:16:1-16 226 1 0.0 0.0 0.0 0.0 + CAF GHC.Conc.Signal 216 0 0.0 1.3 0.0 1.3 + CAF GHC.IO.Encoding 206 0 0.0 5.4 0.0 5.4 + CAF GHC.IO.Encoding.Iconv 204 0 0.0 0.4 0.0 0.4 + CAF GHC.IO.Handle.FD 196 0 0.0 68.3 0.0 68.3 + CAF GHC.IO.Handle.Text 194 0 0.0 0.2 0.0 0.2 + CAF GHC.Show 179 0 0.0 0.6 0.0 0.6 + main Main scc001.hs:(5,1)-(7,23) 223 0 0.0 21.7 0.0 21.7 From git at git.haskell.org Wed Mar 29 20:53:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 20:53:31 +0000 (UTC) Subject: [commit: ghc] master: testsuite: More 32-bit performance changes (fb7e5bd) Message-ID: <20170329205331.E38043A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fb7e5bd350407888d6638e15d16aad311d7d9006/ghc >--------------------------------------------------------------- commit fb7e5bd350407888d6638e15d16aad311d7d9006 Author: Ben Gamari Date: Mon Mar 27 08:16:18 2017 -0400 testsuite: More 32-bit performance changes >--------------------------------------------------------------- fb7e5bd350407888d6638e15d16aad311d7d9006 testsuite/tests/perf/compiler/all.T | 4 ++-- testsuite/tests/perf/haddock/all.T | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 178de3d..a390830 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -813,10 +813,10 @@ test('T9872b', # 2016-09-15: 4069522928 Fix #12422 # 2017-02-14 3730686224 Early inlining: 5% improvement - (wordsize(32), 1740903516, 5) + (wordsize(32), 1894037608, 5) # was 1700000000 # 2016-04-06 2422750696 x86/Linux - # 2017-03-24 1740903516 x86/Linux, 64-bit machine + # 2017-03-24 1894037608 x86/Linux, 64-bit machine ]), ], compile_fail, diff --git a/testsuite/tests/perf/haddock/all.T b/testsuite/tests/perf/haddock/all.T index 461a3a5..65e1644 100644 --- a/testsuite/tests/perf/haddock/all.T +++ b/testsuite/tests/perf/haddock/all.T @@ -47,14 +47,14 @@ test('haddock.base', # 2014-12-01: 4202377432 (x86/Windows, 64bit machine) # 2015-01-20: 4434804940 (x86/Windows, 64bit machine) - ,(wordsize(32), 3623926468, 5)]) + ,(wordsize(32), 3819657568, 5)]) # 2012-08-14: 3046487920 (x86/OSX) # 2012-10-30: 2955470952 (x86/Windows) # 2013-02-10: 3146596848 (x86/OSX) # 2014-02-22: 3554624600 (x86/Linux - new haddock) # 2014-06-29: 3799130400 (x86/Linux) # 2016-04-06: 5509757068 (x86/Linux) - # 2017-03-24: 3623926468 (x86/Linux) + # 2017-03-24: 3819657568 (x86/Linux) ], stats, ['haddock.t']) @@ -157,12 +157,12 @@ test('haddock.compiler', # 2014-12-01: 104140852 (x86/Windows, sudden shrinkage!) # 2014-12-10: 217933548 increased again - ,(wordsize(32), 3872262112, 5)]) + ,(wordsize(32), 118738876, 5)]) # 2012-08-14: 13471797488 (x86/OSX) # 2014-01-22: 14581475024 (x86/Linux - new haddock) # 2014-06-29: 15110426000 (x86/Linux) # 2016-04-06: 16222702892 (x86/Linux) - # 2017-03-24: 3872262112 (x86/Linux) + # 2017-03-24: 118738876 (x86/Linux) ], stats, ['haddock.t']) From git at git.haskell.org Wed Mar 29 20:53:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 20:53:34 +0000 (UTC) Subject: [commit: ghc] master: base: Check for path separators chars in openTempFile' template string (b04ded8) Message-ID: <20170329205334.99B923A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b04ded8fca8ee8b0cd9c7c055bc5dc61ef2be1fe/ghc >--------------------------------------------------------------- commit b04ded8fca8ee8b0cd9c7c055bc5dc61ef2be1fe Author: Ben Gamari Date: Mon Mar 27 12:40:42 2017 -0400 base: Check for path separators chars in openTempFile' template string This fixes #13489. >--------------------------------------------------------------- b04ded8fca8ee8b0cd9c7c055bc5dc61ef2be1fe libraries/base/System/IO.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/base/System/IO.hs b/libraries/base/System/IO.hs index d1ed9e3..1796200 100644 --- a/libraries/base/System/IO.hs +++ b/libraries/base/System/IO.hs @@ -441,7 +441,8 @@ fixIO k = do openTempFile :: FilePath -- ^ Directory in which to create the file -> String -- ^ File name template. If the template is \"foo.ext\" then -- the created file will be \"fooXXX.ext\" where XXX is some - -- random number. + -- random number. Note that this should not contain any path + -- separator characters. -> IO (FilePath, Handle) openTempFile tmp_dir template = openTempFile' "openTempFile" tmp_dir template False 0o600 @@ -465,7 +466,10 @@ openBinaryTempFileWithDefaultPermissions tmp_dir template openTempFile' :: String -> FilePath -> String -> Bool -> CMode -> IO (FilePath, Handle) -openTempFile' loc tmp_dir template binary mode = findTempName +openTempFile' loc tmp_dir template binary mode + | pathSeparator `elem` template + = fail $ "openTempFile': Template string must not contain path separator characters: "++template + | otherwise = findTempName where -- We split off the last extension, so we can use .foo.ext files -- for temporary files (hidden on Unix OSes). Unfortunately we're From git at git.haskell.org Wed Mar 29 20:53:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 20:53:38 +0000 (UTC) Subject: [commit: ghc] master: Fixed error messages for RecursiveDo (#8501) (5856c56) Message-ID: <20170329205338.924FB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5856c564dff79a5c2b6a92b1c6c350798b538da3/ghc >--------------------------------------------------------------- commit 5856c564dff79a5c2b6a92b1c6c350798b538da3 Author: Rupert Horlick Date: Wed Mar 29 15:26:11 2017 -0400 Fixed error messages for RecursiveDo (#8501) Changes in a few different places to catch several different types of error related to RecursiveDo Signed-off-by: Rupert Horlick Test Plan: Three test cases, with further tests in comments Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3271 >--------------------------------------------------------------- 5856c564dff79a5c2b6a92b1c6c350798b538da3 compiler/parser/Lexer.x | 10 +- compiler/parser/RdrHsSyn.hs | 7 +- compiler/rename/RnEnv.hs | 10 +- compiler/utils/StringBuffer.hs | 15 + testsuite/tests/ghci/prog011/prog011.stderr | 2 +- testsuite/tests/ghci/scripts/ghci014.stdout | 982 --------------------- testsuite/tests/mdo/should_fail/mdofail005.stderr | 4 +- testsuite/tests/parser/should_fail/T8501a.hs | 27 + testsuite/tests/parser/should_fail/T8501a.stderr | 4 + testsuite/tests/parser/should_fail/T8501b.hs | 10 + testsuite/tests/parser/should_fail/T8501b.stderr | 4 + testsuite/tests/parser/should_fail/T8501c.hs | 15 + testsuite/tests/parser/should_fail/T8501c.stderr | 6 + testsuite/tests/parser/should_fail/all.T | 3 + .../tests/parser/should_fail/readFail040.stderr | 4 +- 15 files changed, 111 insertions(+), 992 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 5856c564dff79a5c2b6a92b1c6c350798b538da3 From git at git.haskell.org Wed Mar 29 20:53:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 20:53:41 +0000 (UTC) Subject: [commit: ghc] master: Print module when dumping rules (04ea4c3) Message-ID: <20170329205341.53BC23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/04ea4c3f86db4e2cc7b2683f58f2076233039ebf/ghc >--------------------------------------------------------------- commit 04ea4c3f86db4e2cc7b2683f58f2076233039ebf Author: Matthew Pickering Date: Wed Mar 29 16:08:40 2017 -0400 Print module when dumping rules It is sometimes hard to find where a rule is defined. Printing the module where it comes from will make it much easier to find. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3378 >--------------------------------------------------------------- 04ea4c3f86db4e2cc7b2683f58f2076233039ebf compiler/coreSyn/CoreSyn.hs | 7 ++++++- compiler/simplCore/Simplify.hs | 13 ++++++++++--- compiler/specialise/Rules.hs | 4 ++-- .../tests/indexed-types/should_compile/T7837.stderr | 10 +++++----- testsuite/tests/perf/compiler/T4007.stdout | 16 ++++++++-------- testsuite/tests/simplCore/should_compile/T6056.stderr | 10 +++++----- testsuite/tests/simplCore/should_compile/T8848.stdout | 4 ++-- 7 files changed, 38 insertions(+), 26 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 6762ed6..bee6289 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -4,6 +4,7 @@ -} {-# LANGUAGE CPP, DeriveDataTypeable, FlexibleContexts #-} +{-# LANGUAGE NamedFieldPuns #-} -- | CoreSyn holds all the main data types for use by for the Glasgow Haskell Compiler midsection module CoreSyn ( @@ -89,7 +90,7 @@ module CoreSyn ( -- ** Operations on 'CoreRule's ruleArity, ruleName, ruleIdName, ruleActivation, - setRuleIdName, + setRuleIdName, ruleModule, isBuiltinRule, isLocalRule, isAutoRule, -- * Core vectorisation declarations data type @@ -1246,6 +1247,10 @@ ruleArity (Rule {ru_args = args}) = length args ruleName :: CoreRule -> RuleName ruleName = ru_name +ruleModule :: CoreRule -> Maybe Module +ruleModule Rule { ru_origin } = Just ru_origin +ruleModule BuiltinRule {} = Nothing + ruleActivation :: CoreRule -> Activation ruleActivation (BuiltinRule { }) = AlwaysActive ruleActivation (Rule { ru_act = act }) = act diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 43006f8..2e814b6 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -51,6 +51,7 @@ import FastString import Pair import Util import ErrUtils +import Module ( moduleName, pprModuleName ) {- The guts of the simplifier is in this module, but the driver loop for @@ -1784,7 +1785,7 @@ tryRules env rules fn args call_cont do { nodump dflags -- This ensures that an empty file is written ; return Nothing } ; -- No rule matches Just (rule, rule_rhs) -> - do { checkedTick (RuleFired (ru_name rule)) + do { checkedTick (RuleFired (ruleName rule)) ; let cont' = pushSimplifiedArgs env (drop (ruleArity rule) args) call_cont @@ -1796,17 +1797,23 @@ tryRules env rules fn args call_cont ; dump dflags rule rule_rhs ; return (Just (occ_anald_rhs, cont')) }}} where + printRuleModule rule = + parens + (maybe (text "BUILTIN") (pprModuleName . moduleName) (ruleModule rule)) + dump dflags rule rule_rhs | dopt Opt_D_dump_rule_rewrites dflags = log_rule dflags Opt_D_dump_rule_rewrites "Rule fired" $ vcat - [ text "Rule:" <+> ftext (ru_name rule) + [ text "Rule:" <+> ftext (ruleName rule) + , text "Module:" <+> printRuleModule rule , text "Before:" <+> hang (ppr fn) 2 (sep (map ppr args)) , text "After: " <+> pprCoreExpr rule_rhs , text "Cont: " <+> ppr call_cont ] | dopt Opt_D_dump_rule_firings dflags = log_rule dflags Opt_D_dump_rule_firings "Rule fired:" $ - ftext (ru_name rule) + ftext (ruleName rule) + <+> printRuleModule rule | otherwise = return () diff --git a/compiler/specialise/Rules.hs b/compiler/specialise/Rules.hs index 1dcff82..83b4e8d 100644 --- a/compiler/specialise/Rules.hs +++ b/compiler/specialise/Rules.hs @@ -263,7 +263,7 @@ pprRulesForUser :: DynFlags -> [CoreRule] -> SDoc pprRulesForUser dflags rules = withPprStyle (defaultUserStyle dflags) $ pprRules $ - sortBy (comparing ru_name) $ + sortBy (comparing ruleName) $ tidyRules emptyTidyEnv rules {- @@ -420,7 +420,7 @@ findBest target (rule1,ans1) ((rule2,ans2):prs) | rule2 `isMoreSpecific` rule1 = findBest target (rule2,ans2) prs | debugIsOn = let pp_rule rule = sdocWithPprDebug $ \dbg -> if dbg then ppr rule - else doubleQuotes (ftext (ru_name rule)) + else doubleQuotes (ftext (ruleName rule)) in pprTrace "Rules.findBest: rule overlap (Rule 1 wins)" (vcat [ sdocWithPprDebug $ \dbg -> if dbg then text "Expression to match:" <+> ppr fn diff --git a/testsuite/tests/indexed-types/should_compile/T7837.stderr b/testsuite/tests/indexed-types/should_compile/T7837.stderr index 7fd0a48..eb68261 100644 --- a/testsuite/tests/indexed-types/should_compile/T7837.stderr +++ b/testsuite/tests/indexed-types/should_compile/T7837.stderr @@ -1,5 +1,5 @@ -Rule fired: Class op signum -Rule fired: Class op abs -Rule fired: Class op HEq_sc -Rule fired: normalize/Double -Rule fired: Class op HEq_sc +Rule fired: Class op signum (BUILTIN) +Rule fired: Class op abs (BUILTIN) +Rule fired: Class op HEq_sc (BUILTIN) +Rule fired: normalize/Double (T7837) +Rule fired: Class op HEq_sc (BUILTIN) diff --git a/testsuite/tests/perf/compiler/T4007.stdout b/testsuite/tests/perf/compiler/T4007.stdout index 59c81d9..7cbc345 100644 --- a/testsuite/tests/perf/compiler/T4007.stdout +++ b/testsuite/tests/perf/compiler/T4007.stdout @@ -1,8 +1,8 @@ -Rule fired: Class op >> -Rule fired: Class op return -Rule fired: unpack -Rule fired: Class op foldr -Rule fired: fold/build -Rule fired: <# -Rule fired: tagToEnum# -Rule fired: unpack-list +Rule fired: Class op >> (BUILTIN) +Rule fired: Class op return (BUILTIN) +Rule fired: unpack (GHC.Base) +Rule fired: Class op foldr (BUILTIN) +Rule fired: fold/build (GHC.Base) +Rule fired: <# (BUILTIN) +Rule fired: tagToEnum# (BUILTIN) +Rule fired: unpack-list (GHC.Base) diff --git a/testsuite/tests/simplCore/should_compile/T6056.stderr b/testsuite/tests/simplCore/should_compile/T6056.stderr index 5ef76c0..a1f022e 100644 --- a/testsuite/tests/simplCore/should_compile/T6056.stderr +++ b/testsuite/tests/simplCore/should_compile/T6056.stderr @@ -1,5 +1,5 @@ -Rule fired: SPEC/T6056 $wsmallerAndRest @ Int -Rule fired: Class op < -Rule fired: SPEC/T6056 $wsmallerAndRest @ Int -Rule fired: SPEC/T6056 $wsmallerAndRest @ Int -Rule fired: SPEC/T6056 $wsmallerAndRest @ Int +Rule fired: SPEC/T6056 $wsmallerAndRest @ Int (T6056) +Rule fired: Class op < (BUILTIN) +Rule fired: SPEC/T6056 $wsmallerAndRest @ Int (T6056) +Rule fired: SPEC/T6056 $wsmallerAndRest @ Int (T6056) +Rule fired: SPEC/T6056 $wsmallerAndRest @ Int (T6056) diff --git a/testsuite/tests/simplCore/should_compile/T8848.stdout b/testsuite/tests/simplCore/should_compile/T8848.stdout index de0d424..c4a33ad 100644 --- a/testsuite/tests/simplCore/should_compile/T8848.stdout +++ b/testsuite/tests/simplCore/should_compile/T8848.stdout @@ -1,2 +1,2 @@ -Rule fired: SPEC map2 -Rule fired: SPEC map2 +Rule fired: SPEC map2 (T8848) +Rule fired: SPEC map2 (T8848) From git at git.haskell.org Wed Mar 29 20:53:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 20:53:44 +0000 (UTC) Subject: [commit: ghc] master: Allow operators as record pattern synonym fields (154d224) Message-ID: <20170329205344.944973A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/154d224ade3d9f22b0e22fc8be8f3907f1ad51d2/ghc >--------------------------------------------------------------- commit 154d224ade3d9f22b0e22fc8be8f3907f1ad51d2 Author: Matthew Pickering Date: Wed Mar 29 16:09:08 2017 -0400 Allow operators as record pattern synonym fields Fixes #13454 Reviewers: austin, bgamari, dfeuer Reviewed By: dfeuer Subscribers: RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3379 >--------------------------------------------------------------- 154d224ade3d9f22b0e22fc8be8f3907f1ad51d2 compiler/parser/Parser.y | 4 ++-- testsuite/tests/patsyn/should_compile/T13454.hs | 15 +++++++++++++++ testsuite/tests/patsyn/should_compile/all.T | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index caa22dc..21f564e 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -1362,8 +1362,8 @@ vars0 :: { [Located RdrName] } | varid vars0 { $1 : $2 } cvars1 :: { [RecordPatSynField (Located RdrName)] } - : varid { [RecordPatSynField $1 $1] } - | varid ',' cvars1 {% addAnnotation (getLoc $1) AnnComma (getLoc $2) >> + : var { [RecordPatSynField $1 $1] } + | var ',' cvars1 {% addAnnotation (getLoc $1) AnnComma (getLoc $2) >> return ((RecordPatSynField $1 $1) : $3 )} where_decls :: { Located ([AddAnn] diff --git a/testsuite/tests/patsyn/should_compile/T13454.hs b/testsuite/tests/patsyn/should_compile/T13454.hs new file mode 100644 index 0000000..88a5441 --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T13454.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE PatternSynonyms, ViewPatterns #-} +module T13454 where + +pattern MkOp :: Op -> Exp -> Exp -> Exp +pattern MkOp {(·), a, b} <- (splitOp -> Just ((·), a, b)) + where MkOp (·) a b = a · b + +data Exp = Val Int | Add Exp Exp | Mul Exp Exp deriving Show + +type Op = Exp -> Exp -> Exp + +splitOp :: Exp -> Maybe (Op, Exp, Exp) +splitOp (Add a b) = Just (Add, a, b) +splitOp (Mul a b) = Just (Mul, a, b) +splitOp _ = Nothing diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T index 8fce7e9..fa8a3d8 100644 --- a/testsuite/tests/patsyn/should_compile/all.T +++ b/testsuite/tests/patsyn/should_compile/all.T @@ -67,3 +67,4 @@ test('T13349b', normal, compile, ['']) test('T13441', normal, compile, ['']) test('T13441a', normal, compile, ['']) test('T13441b', normal, compile_fail, ['']) +test('T13454', normal, compile, ['']) From git at git.haskell.org Wed Mar 29 23:03:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:03:36 +0000 (UTC) Subject: [commit: ghc] master: Various patches to support android cross compilation (924a65f) Message-ID: <20170329230336.356A23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/924a65fc27bb2a3e24489f7baea7ad5fb8a556ac/ghc >--------------------------------------------------------------- commit 924a65fc27bb2a3e24489f7baea7ad5fb8a556ac Author: Moritz Angermann Date: Wed Mar 29 17:29:58 2017 -0400 Various patches to support android cross compilation - Better test for SHT_INIT_ARRAY than openbsd_HOST_OS This is actually bens patch: https://gist.github.com/bgamari/c846e6a5f2cd988716cd5e36c68d5bef - linux-android defines. - No need for -lpthread on OSAndroid However, I’m confused why we do not use the AC NEED_PTHREAD_LIB value here? - Use mmap on android - Support `none` vendor. Reviewers: austin, hvr, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D3356 >--------------------------------------------------------------- 924a65fc27bb2a3e24489f7baea7ad5fb8a556ac aclocal.m4 | 2 +- compiler/main/DriverPipeline.hs | 2 +- configure.ac | 2 +- rts/linker/Elf.c | 10 +++++++--- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 6341bc9..2062b0d 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -227,7 +227,7 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS], checkVendor() { case [$]1 in - dec|unknown|hp|apple|next|sun|sgi|ibm|montavista|portbld) + dec|none|unknown|hp|apple|next|sun|sgi|ibm|montavista|portbld) ;; *) echo "Unknown vendor [$]1" diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index c4918cc..0979f92 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1895,7 +1895,7 @@ linkBinary' staticLink dflags o_files dep_packages = do let thread_opts | WayThreaded `elem` ways dflags = let os = platformOS (targetPlatform dflags) - in if os `elem` [OSMinGW32, OSFreeBSD, OSOpenBSD, + in if os `elem` [OSMinGW32, OSFreeBSD, OSOpenBSD, OSAndroid, OSNetBSD, OSHaiku, OSQNXNTO, OSiOS, OSDarwin] then [] else ["-lpthread"] diff --git a/configure.ac b/configure.ac index 547e9b1..c7eac4a 100644 --- a/configure.ac +++ b/configure.ac @@ -1081,7 +1081,7 @@ dnl ** Use MMAP in the runtime linker? dnl -------------------------------------------------------------- case ${TargetOS} in - linux|freebsd|dragonfly|netbsd|openbsd|kfreebsdgnu|gnu|solaris2) + linux|linux-android|freebsd|dragonfly|netbsd|openbsd|kfreebsdgnu|gnu|solaris2) RtsLinkerUseMmap=1 ;; darwin|ios) diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c index 2ce4d3d..73e34d3 100644 --- a/rts/linker/Elf.c +++ b/rts/linker/Elf.c @@ -1,6 +1,10 @@ #include "Rts.h" -#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) || defined(gnu_HOST_OS) +#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) \ +|| defined(linux_android_HOST_OS) \ +|| defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) \ +|| defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) \ +|| defined(openbsd_HOST_OS) || defined(gnu_HOST_OS) #include "RtsUtils.h" #include "RtsSymbolInfo.h" @@ -613,13 +617,13 @@ static int getSectionKind_ELF( Elf_Shdr *hdr, int *is_bss ) /* .rodata-style section */ return SECTIONKIND_CODE_OR_RODATA; } -#ifndef openbsd_HOST_OS +#ifdef SHT_INIT_ARRAY if (hdr->sh_type == SHT_INIT_ARRAY && (hdr->sh_flags & SHF_ALLOC) && (hdr->sh_flags & SHF_WRITE)) { /* .init_array section */ return SECTIONKIND_INIT_ARRAY; } -#endif /* not OpenBSD */ +#endif /* not SHT_INIT_ARRAY */ if (hdr->sh_type == SHT_NOBITS && (hdr->sh_flags & SHF_ALLOC) && (hdr->sh_flags & SHF_WRITE)) { /* .bss-style section */ From git at git.haskell.org Wed Mar 29 23:03:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:03:42 +0000 (UTC) Subject: [commit: ghc] master: Show valid substitutions for typed holes (26c95f4) Message-ID: <20170329230342.E2B6C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/26c95f46e679fb73e1ec2bec2be0801c72fd1449/ghc >--------------------------------------------------------------- commit 26c95f46e679fb73e1ec2bec2be0801c72fd1449 Author: Matthías Páll Gissurarson Date: Wed Mar 29 17:30:28 2017 -0400 Show valid substitutions for typed holes The idea is to implement a mechanism similar to PureScript, where they suggest which identifiers in scope would fit the given hole. In PureScript, they use subsumption (which is what we would like here as well). For subsumption, we would have to check each type in scope whether the hole is a subtype of the given type, but that would require `tcSubType` and constraint satisfiability checking. Currently, `TcSimplify` uses a lot of functions from `TcErrors`, so that would require more of a rewrite, I will hold on with that for now, and submit the more simpler type equality version. As an example, consider ``` ps :: String -> IO () ps = putStrLn ps2 :: a -> IO () ps2 _ = putStrLn "hello, world" main :: IO () main = _ "hello, world" ``` The results would be something like ``` • Found hole: _ :: [Char] -> IO () • In the expression: _ In a stmt of a 'do' block: _ "hello, world" In the expression: do _ "hello, world" • Relevant bindings include main :: IO () (bound at test.hs:13:1) ps :: String -> IO () (bound at test.hs:7:1) ps2 :: forall a. a -> IO () (bound at test.hs:10:1) Valid substitutions include putStrLn :: String -> IO () (imported from ‘Prelude’ at test.hs:1:1-14 (and originally defined in ‘System.IO’)) putStr :: String -> IO () (imported from ‘Prelude’ at test.hs:1:1-14 (and originally defined in ‘System.IO’)) ``` We'd like here for ps2 to be suggested as well, but for that we require subsumption. Reviewers: austin, bgamari, dfeuer, mpickering Reviewed By: dfeuer, mpickering Subscribers: mpickering, Wizek, dfeuer, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3361 >--------------------------------------------------------------- 26c95f46e679fb73e1ec2bec2be0801c72fd1449 compiler/main/DynFlags.hs | 7 + compiler/typecheck/TcErrors.hs | 170 +++++++++++++++++++-- docs/users_guide/using-optimisation.rst | 10 ++ testsuite/tests/ghci/scripts/T8353.stderr | 5 + .../tests/typecheck/should_compile/T13050.stderr | 5 + .../tests/typecheck/should_compile/ValidSubs.hs | 4 + testsuite/tests/typecheck/should_compile/all.T | 2 + .../should_compile/valid_substitutions.hs | 19 +++ .../should_compile/valid_substitutions.stderr | 37 +++++ utils/mkUserGuidePart/Options/Optimizations.hs | 7 + 10 files changed, 256 insertions(+), 10 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 26c95f46e679fb73e1ec2bec2be0801c72fd1449 From git at git.haskell.org Wed Mar 29 23:03:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:03:33 +0000 (UTC) Subject: [commit: ghc] master: Check TargetPlatform instead of HostPlatform for leading underscore (81f5b6e) Message-ID: <20170329230333.6E1353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/81f5b6ecbadec49af53189756dda5e0b199f9703/ghc >--------------------------------------------------------------- commit 81f5b6ecbadec49af53189756dda5e0b199f9703 Author: Moritz Angermann Date: Wed Mar 29 17:28:16 2017 -0400 Check TargetPlatform instead of HostPlatform for leading underscore Reviewers: austin, hvr, rwbarton, bgamari Reviewed By: rwbarton, bgamari Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D3348 >--------------------------------------------------------------- 81f5b6ecbadec49af53189756dda5e0b199f9703 aclocal.m4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aclocal.m4 b/aclocal.m4 index 3337215..6341bc9 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -874,12 +874,14 @@ FP_CHECK_ALIGNMENT([$1]) # checking for *no* leading underscore first. Sigh. --SDM # # Similarly on OpenBSD, but this test doesn't help. -- dons +# AC_DEFUN([FP_LEADING_UNDERSCORE], [AC_CHECK_LIB([elf], [nlist], [LIBS="-lelf $LIBS"]) AC_CACHE_CHECK([leading underscore in symbol names], [fptools_cv_leading_underscore], [ # Hack!: nlist() under Digital UNIX insist on there being an _, # but symbol table listings shows none. What is going on here?!? -case $HostPlatform in +case $TargetPlatform in +*linux-android*) fptools_cv_leading_underscore=no;; *openbsd*) # x86 openbsd is ELF from 3.4 >, meaning no leading uscore case $build in i386-*2\.@<:@0-9@:>@ | i386-*3\.@<:@0-3@:>@ ) fptools_cv_leading_underscore=yes ;; From git at git.haskell.org Wed Mar 29 23:03:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:03:38 +0000 (UTC) Subject: [commit: ghc] master: unique: fix UNIQUE_BITS crosscompilation (Trac #13491) (01b062e) Message-ID: <20170329230338.E14FF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/01b062ec3fa138b92124ce7ca4deca0ddcb474ea/ghc >--------------------------------------------------------------- commit 01b062ec3fa138b92124ce7ca4deca0ddcb474ea Author: Sergei Trofimovich Date: Wed Mar 29 17:30:50 2017 -0400 unique: fix UNIQUE_BITS crosscompilation (Trac #13491) The #13491 manifests best when we try to crosscompile from 32-bit (i386-linux) to 64-bit (powerpc64-linux) system: ./configure --target=powerpc64-unknown-linux-gnu The build fails at assembly time: "inplace/bin/ghc-stage1" ... -c rts/StgStartup.cmm /tmp/ghc19687_0/ghc_4.s: Assembler messages: /tmp/ghc19687_0/ghc_4.s:11:0: error: Error: unknown pseudo-op: `.l' | 11 | .L<\x00>4: | ^ That happens because UNIQUE_BITS is defined in terms of WORD_SIZE_IN_BITS macro: #define UNIQUE_BITS (WORD_SIZE_IN_BITS - 8) WORD_SIZE_IN_BITS is 64 bits (equals to target value) while ghc-stage1 is still running on i386-linux The fix is to stop relying on target macros and use host's 'sizeof (HsInt)' and 'finiteBitSize' way to determine unique layout. Signed-off-by: Sergei Trofimovich Test Plan: build i386-to-powerpc64 crosscompiler Reviewers: rwbarton, austin, bgamari Reviewed By: bgamari Subscribers: RyanGlScott, thomie Differential Revision: https://phabricator.haskell.org/D3397 >--------------------------------------------------------------- 01b062ec3fa138b92124ce7ca4deca0ddcb474ea compiler/Unique.h | 8 +++++--- compiler/basicTypes/UniqSupply.hs | 2 +- compiler/basicTypes/Unique.hs | 11 ++++++++--- compiler/cbits/genSym.c | 1 + 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/compiler/Unique.h b/compiler/Unique.h index a786d8f..e4cd267 100644 --- a/compiler/Unique.h +++ b/compiler/Unique.h @@ -1,3 +1,5 @@ -#include "../includes/MachDeps.h" - -#define UNIQUE_BITS (WORD_SIZE_IN_BITS - 8) +/* unique has the following structure: + * HsInt unique = + * (unique_tag << (sizeof (HsInt) - UNIQUE_TAG_BITS)) | unique_number + */ +#define UNIQUE_TAG_BITS 8 diff --git a/compiler/basicTypes/UniqSupply.hs b/compiler/basicTypes/UniqSupply.hs index 431c96c..da1a924 100644 --- a/compiler/basicTypes/UniqSupply.hs +++ b/compiler/basicTypes/UniqSupply.hs @@ -77,7 +77,7 @@ takeUniqFromSupply :: UniqSupply -> (Unique, UniqSupply) -- ^ Obtain the 'Unique' from this particular 'UniqSupply', and a new supply mkSplitUniqSupply c - = case ord c `shiftL` UNIQUE_BITS of + = case ord c `shiftL` uNIQUE_BITS of mask -> let -- here comes THE MAGIC: diff --git a/compiler/basicTypes/Unique.hs b/compiler/basicTypes/Unique.hs index 8e0f5e6..a49fa80 100644 --- a/compiler/basicTypes/Unique.hs +++ b/compiler/basicTypes/Unique.hs @@ -22,6 +22,7 @@ Haskell). module Unique ( -- * Main data types Unique, Uniquable(..), + uNIQUE_BITS, -- ** Constructors, destructors and operations on 'Unique's hasKey, @@ -98,6 +99,10 @@ Fast comparison is everything on @Uniques@: -- These are sometimes also referred to as \"keys\" in comments in GHC. newtype Unique = MkUnique Int +{-# INLINE uNIQUE_BITS #-} +uNIQUE_BITS :: Int +uNIQUE_BITS = finiteBitSize (0 :: Int) - UNIQUE_TAG_BITS + {- Now come the functions which construct uniques from their pieces, and vice versa. The stuff about unique *supplies* is handled further down this module. @@ -132,7 +137,7 @@ newTagUnique u c = mkUnique c i where (_,i) = unpkUnique u -- | How many bits are devoted to the unique index (as opposed to the class -- character). uniqueMask :: Int -uniqueMask = (1 `shiftL` UNIQUE_BITS) - 1 +uniqueMask = (1 `shiftL` uNIQUE_BITS) - 1 -- pop the Char in the top 8 bits of the Unique(Supply) @@ -146,14 +151,14 @@ mkUnique :: Char -> Int -> Unique -- Builds a unique from pieces mkUnique c i = MkUnique (tag .|. bits) where - tag = ord c `shiftL` UNIQUE_BITS + tag = ord c `shiftL` uNIQUE_BITS bits = i .&. uniqueMask unpkUnique (MkUnique u) = let -- as long as the Char may have its eighth bit set, we -- really do need the logical right-shift here! - tag = chr (u `shiftR` UNIQUE_BITS) + tag = chr (u `shiftR` uNIQUE_BITS) i = u .&. uniqueMask in (tag, i) diff --git a/compiler/cbits/genSym.c b/compiler/cbits/genSym.c index 4af3940..6943ab1 100644 --- a/compiler/cbits/genSym.c +++ b/compiler/cbits/genSym.c @@ -5,6 +5,7 @@ static HsInt GenSymCounter = 0; static HsInt GenSymInc = 1; +#define UNIQUE_BITS (sizeof (HsInt) * 8 - UNIQUE_TAG_BITS) #define UNIQUE_MASK ((1ULL << UNIQUE_BITS) - 1) STATIC_INLINE void checkUniqueRange(HsInt u STG_UNUSED) { From git at git.haskell.org Wed Mar 29 23:41:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:41:23 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: More fixes for #5654 (8a1f4e5) Message-ID: <20170329234123.0B2D43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/8a1f4e592cd1acb5f6b386ce913afe1065c26177/ghc >--------------------------------------------------------------- commit 8a1f4e592cd1acb5f6b386ce913afe1065c26177 Author: Simon Marlow Date: Tue Dec 20 14:32:11 2016 +0000 More fixes for #5654 * In stg_ap_0_fast, if we're evaluating a thunk, the thunk might evaluate to a function in which case we may have to adjust its CCS. * The interpreter has its own implementation of stg_ap_0_fast, so we have to do the same shenanigans with creating empty PAPs and copying PAPs there. * GHCi creates Cost Centres as children of CCS_MAIN, which enterFunCCS() wrongly assumed to imply that they were CAFs. Now we use the is_caf flag for this, which we have to correctly initialise when we create a Cost Centre in GHCi. (cherry picked from commit 3a18baff06abc193569b1b76358da26375b3c8d6) >--------------------------------------------------------------- 8a1f4e592cd1acb5f6b386ce913afe1065c26177 includes/stg/MiscClosures.h | 1 + rts/Apply.cmm | 27 ++++++++ rts/Interpreter.c | 72 ++++++++++++++++++++-- rts/Printer.c | 5 ++ rts/Profiling.c | 6 +- rts/StgMiscClosures.cmm | 10 +++ testsuite/tests/codeGen/should_run/cgrun057.stderr | 2 +- .../tests/profiling/should_run/T680.prof.sample | 65 ++++++++++--------- testsuite/tests/profiling/should_run/all.T | 3 +- .../should_run/toplevel_scc_1.prof.sample | 41 ++++++------ 10 files changed, 170 insertions(+), 62 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 8a1f4e592cd1acb5f6b386ce913afe1065c26177 From git at git.haskell.org Wed Mar 29 23:41:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:41:25 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix bug in previous fix for #5654 (fd26938) Message-ID: <20170329234125.B99CF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/fd269386b096d59a849853952cef213f805d24b3/ghc >--------------------------------------------------------------- commit fd269386b096d59a849853952cef213f805d24b3 Author: Simon Marlow Date: Sat Dec 17 18:08:48 2016 -0500 Fix bug in previous fix for #5654 I forgot to account for BCOs, which have a different layout from functions. This caused crashes when using profiling with GHCi (via -fexternal-interpreter -prof), which unfortunately is not tested at all by validate, even when profiling is enabled. I'm going to add some testing that would have caught this in a separate patch. Test Plan: ``` cd nofib/spectral/puzzle && make NoFibWithGHCi=YES EXTRA_RUNTEST_OPTS='-fexternal-interpreter -prof' ``` New testsuite tests coming in a separate diff. Reviewers: niteria, austin, erikd, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2868 GHC Trac Issues: #5654 (cherry picked from commit 2a02040b2e23daa4f791afc290c33c9bbe3c620c) >--------------------------------------------------------------- fd269386b096d59a849853952cef213f805d24b3 rts/Apply.cmm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/rts/Apply.cmm b/rts/Apply.cmm index 3a73ce0..b18c347 100644 --- a/rts/Apply.cmm +++ b/rts/Apply.cmm @@ -57,6 +57,7 @@ stg_ap_0_fast ( P_ fun ) again: W_ info; W_ untaggedfun; + W_ arity; untaggedfun = UNTAG(fun); info = %INFO_PTR(untaggedfun); switch [INVALID_OBJECT .. N_CLOSURE_TYPES] @@ -68,6 +69,11 @@ again: fun = StgInd_indirectee(fun); goto again; } + case BCO: + { + arity = TO_W_(StgBCO_arity(untaggedfun)); + goto dofun; + } case FUN, FUN_1_0, @@ -75,9 +81,10 @@ again: FUN_2_0, FUN_1_1, FUN_0_2, - FUN_STATIC, - BCO: + FUN_STATIC: { + arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); + dofun: if (CCCS == StgHeader_ccs(untaggedfun)) { return (fun); } else { @@ -92,10 +99,8 @@ again: // attribute this allocation to the "overhead of profiling" CCS_ALLOC(BYTES_TO_WDS(SIZEOF_StgPAP), CCS_OVERHEAD); P_ pap; - W_ arity; pap = Hp - SIZEOF_StgPAP + WDS(1); SET_HDR(pap, stg_PAP_info, CCCS); - arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); StgPAP_arity(pap) = arity; StgPAP_fun(pap) = fun; StgPAP_n_args(pap) = 0; From git at git.haskell.org Wed Mar 29 23:41:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:41:34 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix #13433 (bdcb0c8) Message-ID: <20170329234134.5FBED3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/bdcb0c8572044f2a93981910bb4ed6e9d65160c0/ghc >--------------------------------------------------------------- commit bdcb0c8572044f2a93981910bb4ed6e9d65160c0 Author: Simon Marlow Date: Mon Mar 27 13:15:04 2017 +0100 Fix #13433 Summary: See comments for details. Test Plan: validate Reviewers: mpickering, bgamari, austin, erikd Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3386 (cherry picked from commit 074d13eb3b6489e8b2f555f61496761614a3e207) >--------------------------------------------------------------- bdcb0c8572044f2a93981910bb4ed6e9d65160c0 rts/Apply.cmm | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/rts/Apply.cmm b/rts/Apply.cmm index b3a04ca..4c34f0f 100644 --- a/rts/Apply.cmm +++ b/rts/Apply.cmm @@ -156,13 +156,26 @@ again: THUNK_STATIC, THUNK_SELECTOR: { - // The thunk might evaluate to a function, so we have to come - // back here again to adjust its CCS if necessary. The - // stg_restore_ccs_eval stack frame does that. + // We have a thunk of some kind, so evaluate it. + + // The thunk might evaluate to a function, so we have to + // come back here again to adjust its CCS if necessary. + // Therefore we need to push a stack frame to look at the + // function that gets returned (a stg_restore_ccs_eval + // frame), and therefore we need a stack check. STK_CHK_GEN(); + + // We can't use the value of 'info' any more, because if + // STK_CHK_GEN() did a GC then the closure we're looking + // at may have changed, e.g. a THUNK_SELECTOR may have + // been evaluated by the GC. So we reload the info + // pointer now. + untaggedfun = UNTAG(fun); + info = %INFO_PTR(untaggedfun); + jump %ENTRY_CODE(info) (stg_restore_cccs_eval_info, CCCS) - (UNTAG(fun)); + (untaggedfun); } default: { From git at git.haskell.org Wed Mar 29 23:41:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:41:31 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: base: Check for path separators chars in openTempFile' template string (02a9c6a) Message-ID: <20170329234131.A83633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/02a9c6a3442c1b560176ec01789c0042c655c0eb/ghc >--------------------------------------------------------------- commit 02a9c6a3442c1b560176ec01789c0042c655c0eb Author: Ben Gamari Date: Mon Mar 27 12:40:42 2017 -0400 base: Check for path separators chars in openTempFile' template string This fixes #13489. (cherry picked from commit b04ded8fca8ee8b0cd9c7c055bc5dc61ef2be1fe) >--------------------------------------------------------------- 02a9c6a3442c1b560176ec01789c0042c655c0eb libraries/base/System/IO.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/base/System/IO.hs b/libraries/base/System/IO.hs index d1ed9e3..1796200 100644 --- a/libraries/base/System/IO.hs +++ b/libraries/base/System/IO.hs @@ -441,7 +441,8 @@ fixIO k = do openTempFile :: FilePath -- ^ Directory in which to create the file -> String -- ^ File name template. If the template is \"foo.ext\" then -- the created file will be \"fooXXX.ext\" where XXX is some - -- random number. + -- random number. Note that this should not contain any path + -- separator characters. -> IO (FilePath, Handle) openTempFile tmp_dir template = openTempFile' "openTempFile" tmp_dir template False 0o600 @@ -465,7 +466,10 @@ openBinaryTempFileWithDefaultPermissions tmp_dir template openTempFile' :: String -> FilePath -> String -> Bool -> CMode -> IO (FilePath, Handle) -openTempFile' loc tmp_dir template binary mode = findTempName +openTempFile' loc tmp_dir template binary mode + | pathSeparator `elem` template + = fail $ "openTempFile': Template string must not contain path separator characters: "++template + | otherwise = findTempName where -- We split off the last extension, so we can use .foo.ext files -- for temporary files (hidden on Unix OSes). Unfortunately we're From git at git.haskell.org Wed Mar 29 23:41:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:41:28 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix cost-centre-stacks bug (#5654) (9a1ac01) Message-ID: <20170329234128.EEC483A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/9a1ac01fbc806e5a267b8a943d8f5269fef0e61f/ghc >--------------------------------------------------------------- commit 9a1ac01fbc806e5a267b8a943d8f5269fef0e61f Author: Simon Marlow Date: Thu Dec 15 11:17:19 2016 -0500 Fix cost-centre-stacks bug (#5654) This fixes some cases of wrong stacks being generated by the profiler. For background and details on the fix see `Note [Evaluating functions with profiling]` in `rts/Apply.cmm`. This does have an impact on allocations for some programs when profiling. nofib results: ``` k-nucleotide +0.0% +8.8% +11.0% +11.0% 0.0% puzzle +0.0% +12.5% 0.244 0.246 0.0% typecheck 0.0% +8.7% +16.1% +16.2% 0.0% ------------------------------------------------------------------------ -------- Min -0.0% -0.0% -34.4% -35.5% -25.0% Max +0.0% +12.5% +48.9% +49.4% +10.6% Geometric Mean +0.0% +0.6% +2.0% +1.8% -0.3% ``` But runtimes don't seem to be affected much, and the examples I looked at were completely legitimate. For example, in puzzle we have this: ``` position :: ItemType -> StateType -> BankType position Bono = bonoPos position Edge = edgePos position Larry = larryPos position Adam = adamPos ``` where the identifiers on the rhs are all record selectors. Previously the profiler gave a stack that looked like ``` position bonoPos ... ``` i.e. `bonoPos` was at the same level of the call stack as `position`, but now it looks like ``` position bonoPos ... ``` I used the normaliser from the testsuite to diff the profiling output from other nofib programs and they all looked better. Test Plan: * the broken test passes * validate * compiled and ran all of nofib, measured perf, diff'd several .prof files Reviewers: niteria, erikd, austin, scpmw, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2804 GHC Trac Issues: #5654, #10007 (cherry picked from commit 394231b301efb6b56654b0a480ab794fe3b7e4db) >--------------------------------------------------------------- 9a1ac01fbc806e5a267b8a943d8f5269fef0e61f compiler/codeGen/StgCmmClosure.hs | 6 +- includes/Cmm.h | 6 ++ rts/Apply.cmm | 107 +++++++++++++++++++++ .../profiling/should_run/{T5654.hs => T5654-O0.hs} | 0 .../profiling/should_run/T5654-O0.prof.sample | 28 ++++++ .../profiling/should_run/{T5654.hs => T5654-O1.hs} | 0 .../profiling/should_run/T5654-O1.prof.sample | 27 ++++++ .../tests/profiling/should_run/T5654.prof.sample | 28 ------ .../tests/profiling/should_run/T680.prof.sample | 50 +++++----- testsuite/tests/profiling/should_run/all.T | 4 +- 10 files changed, 200 insertions(+), 56 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 9a1ac01fbc806e5a267b8a943d8f5269fef0e61f From git at git.haskell.org Wed Mar 29 23:41:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:41:37 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Make the test fail if compiled without -threaded (67f00af) Message-ID: <20170329234137.1DC763A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/67f00af62b4103a1bbabac0f463aa93bea059714/ghc >--------------------------------------------------------------- commit 67f00af62b4103a1bbabac0f463aa93bea059714 Author: Simon Marlow Date: Mon Mar 27 16:09:23 2017 +0100 Make the test fail if compiled without -threaded Test Plan: validate Reviewers: bgamari, austin, erikd Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3387 (cherry picked from commit c77551abd42a346d03826d23df710ebf9eacb19f) >--------------------------------------------------------------- 67f00af62b4103a1bbabac0f463aa93bea059714 testsuite/tests/concurrent/should_run/hs_try_putmvar003.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/testsuite/tests/concurrent/should_run/hs_try_putmvar003.hs b/testsuite/tests/concurrent/should_run/hs_try_putmvar003.hs index d74a9cb..4442698 100644 --- a/testsuite/tests/concurrent/should_run/hs_try_putmvar003.hs +++ b/testsuite/tests/concurrent/should_run/hs_try_putmvar003.hs @@ -10,6 +10,7 @@ import GHC.Conc import GHC.MVar (MVar(..)) import GHC.Prim import System.Environment +import System.Exit -- Measure C to Haskell callback throughput under a workload with -- several dimensions: @@ -29,6 +30,8 @@ import System.Environment -- hs_try_putmvar() is 9x faster with these parameters. main = do + when (not rtsSupportsBoundThreads) $ + die "This test requires -threaded" args <- getArgs case args of ["1",x,y,z] -> experiment False (read x) (read y) (read z) From git at git.haskell.org Wed Mar 29 23:41:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:41:39 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Simplify the logic for tc_hs_sig_type (208c3ec) Message-ID: <20170329234139.CA89C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/208c3ec276f8cc0416f5279a8a3e8078a23488e2/ghc >--------------------------------------------------------------- commit 208c3ec276f8cc0416f5279a8a3e8078a23488e2 Author: Simon Peyton Jones Date: Mon Mar 27 10:05:26 2017 +0100 Simplify the logic for tc_hs_sig_type In fixing Trac #13337, and introducing solveSomeEqualities, Richard introduce the higher-order function tc_hs_sig_type_x, with a solver as its argument. It turned out that there was a much simpler way to do the same thing, which this patch implements. Less code, easier to grok. No change in behaviour though. (cherry picked from commit 1e06d8b8f2aea0a06d40618c296a034f3e408ae2) >--------------------------------------------------------------- 208c3ec276f8cc0416f5279a8a3e8078a23488e2 compiler/typecheck/TcHsType.hs | 62 ++++++++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index e5dcd7c..658a13b 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -212,28 +212,28 @@ tcHsSigType ctxt sig_ty ; checkValidType ctxt ty ; return ty } --- kind-checks/desugars an 'LHsSigType' and then kind-generalizes. +tc_hs_sig_type_and_gen :: LHsSigType Name -> Kind -> TcM Type +-- Kind-checks/desugars an 'LHsSigType', +-- solve equalities, +-- and then kind-generalizes. -- This will never emit constraints, as it uses solveEqualities interally. -- No validity checking, but it does zonk en route to generalization -tc_hs_sig_type_and_gen :: LHsSigType Name -> Kind -> TcM Type -tc_hs_sig_type_and_gen sig_ty kind - = do { ty <- tc_hs_sig_type_x solveEqualities sig_ty kind +tc_hs_sig_type_and_gen hs_ty kind + = do { ty <- solveEqualities $ + tc_hs_sig_type hs_ty kind + -- NB the call to solveEqualities, which unifies all those + -- kind variables floating about, immediately prior to + -- kind generalisation ; kindGeneralizeType ty } tc_hs_sig_type :: LHsSigType Name -> Kind -> TcM Type --- May emit constraints +-- Kind-check/desugar a 'LHsSigType', but does not solve +-- the equalities that arise from doing so; instead it may +-- emit kind-equality constraints into the monad -- No zonking or validity checking -tc_hs_sig_type = tc_hs_sig_type_x id - --- Version of tc_hs_sig_type parameterized over how it should solve --- equalities -tc_hs_sig_type_x :: (forall a. TcM a -> TcM a) -- id or solveEqualities - -> LHsSigType Name -> Kind - -> TcM Type -tc_hs_sig_type_x solve (HsIB { hsib_body = hs_ty - , hsib_vars = sig_vars }) kind - = do { (tkvs, ty) <- solve $ - tcImplicitTKBndrsType sig_vars $ +tc_hs_sig_type (HsIB { hsib_vars = sig_vars + , hsib_body = hs_ty }) kind + = do { (tkvs, ty) <- tcImplicitTKBndrsType sig_vars $ tc_lhs_type typeLevelMode hs_ty kind ; return (mkSpecForAllTys tkvs ty) } @@ -332,6 +332,7 @@ tcLHsType ty = addTypeCtxt ty (tc_infer_lhs_type typeLevelMode ty) -- | Should we generalise the kind of this type signature? -- We *should* generalise if the type is closed -- or if NoMonoLocalBinds is set. Otherwise, nope. +-- See Note [Kind generalisation plan] decideKindGeneralisationPlan :: LHsSigType Name -> TcM Bool decideKindGeneralisationPlan sig_ty@(HsIB { hsib_closed = closed }) = do { mono_locals <- xoptM LangExt.MonoLocalBinds @@ -340,7 +341,34 @@ decideKindGeneralisationPlan sig_ty@(HsIB { hsib_closed = closed }) (ppr sig_ty $$ text "should gen?" <+> ppr should_gen) ; return should_gen } -{- +{- Note [Kind generalisation plan] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +When should we do kind-generalisation for user-written type signature? +Answer: we use the same rule as for value bindings: + + * We always kind-generalise if the type signature is closed + * Additionally, we attempt to generalise if we have NoMonoLocalBinds + +Trac #13337 shows the problem if we kind-generalise an open type (i.e. +one that mentions in-scope tpe variable + foo :: forall k (a :: k) proxy. (Typeable k, Typeable a) + => proxy a -> String + foo _ = case eqT :: Maybe (k :~: Type) of + Nothing -> ... + Just Refl -> case eqT :: Maybe (a :~: Int) of ... + +In the expression type sig on the last line, we have (a :: k) +but (Int :: Type). Since (:~:) is kind-homogeneous, this requires +k ~ *, which is true in the Refl branch of the outer case. + +That equality will be solved if we allow it to float out to the +implication constraint for the Refl match, bnot not if we aggressively +attempt to solve all equalities the moment they occur; that is, when +checking (Maybe (a :~: Int)). (NB: solveEqualities fails unless it +solves all the kind equalities, which is the right thing at top level.) + +So here the right thing is simply not to do kind generalisation! + ************************************************************************ * * Type-checking modes From git at git.haskell.org Wed Mar 29 23:41:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:41:42 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Eliminate a user manual warning (20dc253) Message-ID: <20170329234142.885D03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/20dc25345db1d318fc02ceb1ef15754be0cc13be/ghc >--------------------------------------------------------------- commit 20dc25345db1d318fc02ceb1ef15754be0cc13be Author: Simon Peyton Jones Date: Mon Mar 27 10:09:37 2017 +0100 Eliminate a user manual warning I was getting docs/users_guide/glasgow_exts.rst:12783: WARNING: Title underline too short. ``COLUMN`` pragma --------------- So I lengthened the row of hyphens. (cherry picked from commit af33073c77e409d594e61609b3fba7070766cb75) >--------------------------------------------------------------- 20dc25345db1d318fc02ceb1ef15754be0cc13be docs/users_guide/glasgow_exts.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 17e096f..89b970c 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -12780,7 +12780,7 @@ positions are not automatically advanced. .. _column-pragma: ``COLUMN`` pragma ---------------- +----------------- .. index:: single: COLUMN; pragma From git at git.haskell.org Wed Mar 29 23:41:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:41:45 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Typechecker comments and debug tracing only (55adbbd) Message-ID: <20170329234145.406CA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/55adbbdeec92ccb368a1e72856ee62124bf55ec6/ghc >--------------------------------------------------------------- commit 55adbbdeec92ccb368a1e72856ee62124bf55ec6 Author: Simon Peyton Jones Date: Mon Mar 27 10:12:53 2017 +0100 Typechecker comments and debug tracing only (cherry picked from commit 7e1c492de158f8a8692526a44f6a9a1f203ddcf7) >--------------------------------------------------------------- 55adbbdeec92ccb368a1e72856ee62124bf55ec6 compiler/typecheck/TcFlatten.hs | 2 +- compiler/typecheck/TcMType.hs | 4 +++- compiler/typecheck/TcType.hs | 21 ++++++++++++++------- compiler/typecheck/TcUnify.hs | 3 +-- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/compiler/typecheck/TcFlatten.hs b/compiler/typecheck/TcFlatten.hs index 933bacc..8b3aaa9 100644 --- a/compiler/typecheck/TcFlatten.hs +++ b/compiler/typecheck/TcFlatten.hs @@ -722,7 +722,7 @@ yields a better error message anyway.) flatten :: FlattenMode -> CtEvidence -> TcType -> TcS (Xi, TcCoercion) flatten mode ev ty - = do { traceTcS "flatten {" (ppr ty) + = do { traceTcS "flatten {" (ppr mode <+> ppr ty) ; (ty', co) <- runFlatten mode ev (flatten_one ty) ; traceTcS "flatten }" (ppr ty') ; return (ty', co) } diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index f8c4f3b..7c9c1bf 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -1026,7 +1026,9 @@ zonkQuantifiedTyVar default_kind tv = do { tv' <- skolemiseUnboundMetaTyVar tv ; return (Just tv') } where - -- do not default SigTvs. This would violate the invariants on SigTvs + -- Do not default SigTvs. Doing so would violate the invariants + -- on SigTvs; see Note [Signature skolems] in TcType. + -- Trac #13343 is an example not_sig_tv = case info of SigTv -> False _ -> True diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 69d1f7c..dbde25a 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -439,15 +439,23 @@ why Var.hs shouldn't actually have the definition, but it "belongs" here. Note [Signature skolems] ~~~~~~~~~~~~~~~~~~~~~~~~ +A SigTv is a specialised variant of TauTv, with the following invarints: + + * A SigTv can be unified only with a TyVar, + not with any other type + + * Its MetaDetails, if filled in, will always be another SigTv + or a SkolemTv + +SigTvs are only distinguished to improve error messages. Consider this f :: forall a. [a] -> Int f (x::b : xs) = 3 Here 'b' is a lexically scoped type variable, but it turns out to be -the same as the skolem 'a'. So we have a special kind of skolem -constant, SigTv, which can unify with other SigTvs. They are used -*only* for pattern type signatures. +the same as the skolem 'a'. So we make them both SigTvs, which can unify +with each other. Similarly consider data T (a:k1) = MkT (S a) @@ -455,6 +463,8 @@ Similarly consider When doing kind inference on {S,T} we don't want *skolems* for k1,k2, because they end up unifying; we want those SigTvs again. +SigTvs are used *only* for pattern type signatures. + Note [TyVars and TcTyVars during type checking] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The Var type has constructors TyVar and TcTyVar. They are used @@ -514,10 +524,7 @@ data MetaInfo | SigTv -- A variant of TauTv, except that it should not be -- unified with a type, only with a type variable - -- SigTvs are only distinguished to improve error messages - -- see Note [Signature skolems] - -- The MetaDetails, if filled in, will - -- always be another SigTv or a SkolemTv + -- See Note [Signature skolems] | FlatMetaTv -- A flatten meta-tyvar -- It is a meta-tyvar, but it is always untouchable, with level 0 diff --git a/compiler/typecheck/TcUnify.hs b/compiler/typecheck/TcUnify.hs index acfb0b7..ef0c95a 100644 --- a/compiler/typecheck/TcUnify.hs +++ b/compiler/typecheck/TcUnify.hs @@ -1908,8 +1908,7 @@ metaTyVarUpdateOK :: DynFlags -> TcType -- ty :: k2 -> Maybe TcType -- possibly-expanded ty -- (metaTyFVarUpdateOK tv ty) --- We are about to update the meta-tyvar tv with ty, in --- our on-the-flyh unifier +-- We are about to update the meta-tyvar tv with ty -- Check (a) that tv doesn't occur in ty (occurs check) -- (b) that ty does not have any foralls -- (in the impredicative case), or type functions From git at git.haskell.org Wed Mar 29 23:41:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:41:48 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix error-message suppress on given equalities (c9935f1) Message-ID: <20170329234148.F04823A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/c9935f1578369a8aa8243081873b706f7ff1b336/ghc >--------------------------------------------------------------- commit c9935f1578369a8aa8243081873b706f7ff1b336 Author: Simon Peyton Jones Date: Mon Mar 27 10:32:08 2017 +0100 Fix error-message suppress on given equalities I'd got the logic slightly wrong when reporting type errors for insoluble 'given' equalities. We suppress insoluble givens under some circumstances (see Note [Given errors]), but we then suppressed subsequent 'wanted' errors because the (suppressed) 'given' error "won". Result: no errors at all :-(. This patch fixes it and - Renames TcType.isTyVarUnderDatatype to the more perspicuous TcType.isInsolubleOccursCheck In doing this I realise that I don't understand why we need to keep the insolubles partitioned out separately at all... but that is for another day. (cherry picked from commit e0ad55f894a8d85dcc099c33c63cfe3d4515d464) >--------------------------------------------------------------- c9935f1578369a8aa8243081873b706f7ff1b336 compiler/typecheck/TcCanonical.hs | 9 +-- compiler/typecheck/TcErrors.hs | 77 ++++++++++++++-------- compiler/typecheck/TcType.hs | 45 ++++++++----- testsuite/tests/ghci/scripts/Defer02.stderr | 5 ++ .../tests/indexed-types/should_fail/T2627b.stderr | 10 ++- .../tests/indexed-types/should_fail/T5934.stderr | 18 ++++- .../tests/indexed-types/should_fail/T6123.stderr | 3 +- .../tests/indexed-types/should_fail/T7354.stderr | 5 +- .../tests/typecheck/should_compile/T12427a.stderr | 21 +----- .../tests/typecheck/should_fail/T12589.stderr | 9 +++ testsuite/tests/typecheck/should_fail/T13446.hs | 46 +++++++++++++ .../tests/typecheck/should_fail/T13446.stderr | 10 +++ testsuite/tests/typecheck/should_fail/all.T | 1 + 13 files changed, 184 insertions(+), 75 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 c9935f1578369a8aa8243081873b706f7ff1b336 From git at git.haskell.org Wed Mar 29 23:41:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:41:52 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix explicitly-bidirectional pattern synonyms (8a857f5) Message-ID: <20170329234152.214243A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/8a857f50c5922365c71d07cb403f5c46a75b204e/ghc >--------------------------------------------------------------- commit 8a857f50c5922365c71d07cb403f5c46a75b204e Author: Simon Peyton Jones Date: Mon Mar 27 10:22:22 2017 +0100 Fix explicitly-bidirectional pattern synonyms This partly fixes Trac #13441, at least for the explicitly bidirectional case. See Note [Checking against a pattern signature], the part about "Existential type variables". Alas, the implicitly-bidirectional case is still not quite right, but at least there is a workaround by making it explicitly bidirectional. (cherry picked from commit 7c7479d047113a0cbf237c864d403bb638ca0241) >--------------------------------------------------------------- 8a857f50c5922365c71d07cb403f5c46a75b204e compiler/typecheck/TcPatSyn.hs | 32 ++++++++++++++++--------- testsuite/tests/patsyn/should_compile/T13441.hs | 29 ++++++++++++++++++++++ testsuite/tests/patsyn/should_compile/all.T | 1 + 3 files changed, 51 insertions(+), 11 deletions(-) diff --git a/compiler/typecheck/TcPatSyn.hs b/compiler/typecheck/TcPatSyn.hs index 15895b5..6f7764e 100644 --- a/compiler/typecheck/TcPatSyn.hs +++ b/compiler/typecheck/TcPatSyn.hs @@ -149,13 +149,14 @@ tcCheckPatSynDecl psb at PSB{ psb_id = lname@(L _ name), psb_args = details pushLevelAndCaptureConstraints $ tcExtendTyVarEnv univ_tvs $ tcPat PatSyn lpat (mkCheckExpType pat_ty) $ - do { let new_tv | isUnidirectional dir = newMetaTyVarX - | otherwise = newMetaSigTyVarX + do { let new_tv = case dir of + ImplicitBidirectional -> newMetaSigTyVarX + _ -> newMetaTyVarX + -- new_tv: see the "Existential type variables" + -- part of Note [Checking against a pattern signature] in_scope = mkInScopeSet (mkVarSet univ_tvs) empty_subst = mkEmptyTCvSubst in_scope ; (subst, ex_tvs') <- mapAccumLM new_tv empty_subst ex_tvs - -- See the "Existential type variables" part of - -- Note [Checking against a pattern signature] ; traceTc "tcpatsyn1" (vcat [ ppr v <+> dcolon <+> ppr (tyVarKind v) | v <- ex_tvs]) ; traceTc "tcpatsyn2" (vcat [ ppr v <+> dcolon <+> ppr (tyVarKind v) | v <- ex_tvs']) ; let prov_theta' = substTheta subst prov_theta @@ -240,12 +241,20 @@ unify x := [a] during type checking, and then use the instantiating type dl = $dfunEqList d in k [a] dl ys -This "concealing" story works for /uni-directional/ pattern synonyms, -but obviously not for bidirectional ones. So in the bidirectional case -we use SigTv, rather than a generic TauTv, meta-tyvar so that. And -we should really check that those SigTvs don't get unified with each -other. - +This "concealing" story works for /uni-directional/ pattern synonyms. +It also works for /explicitly-bidirectional/ pattern synonyms, where +the constructor direction is typecheked entirely separately. + +But for /implicitly-bidirecitonal/ ones like + pattern P x = MkS x +we are trying to typecheck both directions at once. So for this we +use SigTv, rather than a generic TauTv. But it's not quite done: + - We should really check that those SigTvs don't get unified + with each other. + - Trac #13441 is rejected if you use an implicitly-bidirectional + pattern. +Maybe it'd be better to treat it like an explicitly-bidirectional +pattern? -} collectPatSynArgInfo :: HsPatSynDetails (Located Name) -> ([Name], [Name], Bool) @@ -519,7 +528,6 @@ tcPatSynBuilderBind (PSB { psb_id = L loc name, psb_def = lpat | Right match_group <- mb_match_group -- Bidirectional = do { patsyn <- tcLookupPatSyn name - ; traceTc "tcPatSynBuilderBind {" $ ppr patsyn ; let Just (builder_id, need_dummy_arg) = patSynBuilder patsyn -- Bidirectional, so patSynBuilder returns Just @@ -534,6 +542,8 @@ tcPatSynBuilderBind (PSB { psb_id = L loc name, psb_def = lpat sig = completeSigFromId (PatSynCtxt name) builder_id + ; traceTc "tcPatSynBuilderBind {" $ + ppr patsyn $$ ppr builder_id <+> dcolon <+> ppr (idType builder_id) ; (builder_binds, _) <- tcPolyCheck emptyPragEnv sig (noLoc bind) ; traceTc "tcPatSynBuilderBind }" $ ppr builder_binds ; return builder_binds } diff --git a/testsuite/tests/patsyn/should_compile/T13441.hs b/testsuite/tests/patsyn/should_compile/T13441.hs new file mode 100644 index 0000000..d7a339f --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T13441.hs @@ -0,0 +1,29 @@ +{-# LANGUAGE ScopedTypeVariables, PatternSynonyms, DataKinds, PolyKinds, + GADTs, TypeOperators, TypeFamilies #-} + +module T13441 where + +import Data.Functor.Identity + +data FList f xs where + FNil :: FList f '[] + (:@) :: f x -> FList f xs -> FList f (x ': xs) + +data Nat = Zero | Succ Nat + +type family Length (xs :: [k]) :: Nat where + Length '[] = Zero + Length (_ ': xs) = Succ (Length xs) + +type family Replicate (n :: Nat) (x :: a) = (r :: [a]) where + Replicate Zero _ = '[] + Replicate (Succ n) x = x ': Replicate n x + +type Vec n a = FList Identity (Replicate n a) + +pattern (:>) :: forall n a. n ~ Length (Replicate n a) + => forall m. n ~ Succ m + => a -> Vec m a -> Vec n a +pattern x :> xs <- Identity x :@ xs + where + x :> xs = Identity x :@ xs diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T index 87de2f0..1f36424 100644 --- a/testsuite/tests/patsyn/should_compile/all.T +++ b/testsuite/tests/patsyn/should_compile/all.T @@ -64,3 +64,4 @@ test('T12698', normal, compile, ['']) test('T12746', normal, multi_compile, ['T12746', [('T12746A.hs', '-c')],'-v0']) test('T12968', normal, compile, ['']) test('T13349b', normal, compile, ['']) +test('T13441', normal, compile, ['']) From git at git.haskell.org Wed Mar 29 23:41:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:41:54 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Remove utterly bogus code (844c5a7) Message-ID: <20170329234154.CBCCA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/844c5a719dc29d755949774f3254c66a3fc3aa5f/ghc >--------------------------------------------------------------- commit 844c5a719dc29d755949774f3254c66a3fc3aa5f Author: Simon Peyton Jones Date: Mon Mar 27 14:33:55 2017 +0100 Remove utterly bogus code The commit 6746549772c5cc0ac66c0fce562f297f4d4b80a2 Author: Richard Eisenberg Date: Fri Dec 11 18:19:53 2015 -0500 Add kind equalities to GHC. added this entirely bogus code to Simplify.simplLam: env' | Coercion co <- arg = extendCvSubst env bndr co | otherwise = env It's bogus because 'co' is an 'InCoercion', but a CvSubst should have only OutCoercions in it. Moreover, completeBind does the job nicely. This led to an ASSERT failure in an experimental branch; but I have not got a repro case that works on HEAD. But still, the patch deletes code and fixes a bug, so it must be good. The only mystery is why Richard added it in the first place :-). I hope I'm not missing anything. But it validates fine. (cherry picked from commit de4723fd6d97b285bb754d8b95531c86d34c4032) >--------------------------------------------------------------- 844c5a719dc29d755949774f3254c66a3fc3aa5f compiler/simplCore/Simplify.hs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 977fa25..944d8de 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -1369,13 +1369,8 @@ simplLam env (bndr:bndrs) body (ApplyToTy { sc_arg_ty = arg_ty, sc_cont = cont } simplLam env (bndr:bndrs) body (ApplyToVal { sc_arg = arg, sc_env = arg_se , sc_cont = cont }) = do { tick (BetaReduction bndr) - ; simplNonRecE env' (zap_unfolding bndr) (arg, arg_se) (bndrs, body) cont } + ; simplNonRecE env (zap_unfolding bndr) (arg, arg_se) (bndrs, body) cont } where - env' | Coercion co <- arg - = extendCvSubst env bndr co - | otherwise - = env - zap_unfolding bndr -- See Note [Zap unfolding when beta-reducing] | isId bndr, isStableUnfolding (realIdUnfolding bndr) = setIdUnfolding bndr NoUnfolding From git at git.haskell.org Wed Mar 29 23:41:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:41:57 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: -fspec-constr-keen docs typos [skip ci] (973de1f) Message-ID: <20170329234157.85AA63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/973de1fb7973d467a72cb2e23b5a5961e3dacb5f/ghc >--------------------------------------------------------------- commit 973de1fb7973d467a72cb2e23b5a5961e3dacb5f Author: Matthew Pickering Date: Mon Mar 27 17:41:41 2017 +0100 -fspec-constr-keen docs typos [skip ci] (cherry picked from commit 5025fe2435d030f0c5ecdc2a933c7bfcb3efcb7c) >--------------------------------------------------------------- 973de1fb7973d467a72cb2e23b5a5961e3dacb5f docs/users_guide/using-optimisation.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/users_guide/using-optimisation.rst b/docs/users_guide/using-optimisation.rst index e56c473..3ca08c9 100644 --- a/docs/users_guide/using-optimisation.rst +++ b/docs/users_guide/using-optimisation.rst @@ -584,8 +584,8 @@ list. :default: off - If this flag is on, call-patten specialision will specialise a call - ``(f (Just x))`` with an explicit constructor agument, even if the argument + If this flag is on, call-pattern specialisation will specialise a call + ``(f (Just x))`` with an explicit constructor argument, even if the argument is not scrutinised in the body of the function. This is sometimes beneficial; e.g. the argument might be given to some other function that can itself be specialised. From git at git.haskell.org Wed Mar 29 23:42:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:42:00 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Various patches to support android cross compilation (56c5738) Message-ID: <20170329234200.461D23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/56c57384ccbf73d6a9594af38ac6c1babd14ad4c/ghc >--------------------------------------------------------------- commit 56c57384ccbf73d6a9594af38ac6c1babd14ad4c Author: Moritz Angermann Date: Wed Mar 29 17:29:58 2017 -0400 Various patches to support android cross compilation - Better test for SHT_INIT_ARRAY than openbsd_HOST_OS This is actually bens patch: https://gist.github.com/bgamari/c846e6a5f2cd988716cd5e36c68d5bef - linux-android defines. - No need for -lpthread on OSAndroid However, I’m confused why we do not use the AC NEED_PTHREAD_LIB value here? - Use mmap on android - Support `none` vendor. Reviewers: austin, hvr, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D3356 (cherry picked from commit 924a65fc27bb2a3e24489f7baea7ad5fb8a556ac) >--------------------------------------------------------------- 56c57384ccbf73d6a9594af38ac6c1babd14ad4c aclocal.m4 | 2 +- compiler/main/DriverPipeline.hs | 2 +- configure.ac | 2 +- rts/linker/Elf.c | 10 +++++++--- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 6341bc9..2062b0d 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -227,7 +227,7 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS], checkVendor() { case [$]1 in - dec|unknown|hp|apple|next|sun|sgi|ibm|montavista|portbld) + dec|none|unknown|hp|apple|next|sun|sgi|ibm|montavista|portbld) ;; *) echo "Unknown vendor [$]1" diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 1549722..2670993 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1895,7 +1895,7 @@ linkBinary' staticLink dflags o_files dep_packages = do let thread_opts | WayThreaded `elem` ways dflags = let os = platformOS (targetPlatform dflags) - in if os `elem` [OSMinGW32, OSFreeBSD, OSOpenBSD, + in if os `elem` [OSMinGW32, OSFreeBSD, OSOpenBSD, OSAndroid, OSNetBSD, OSHaiku, OSQNXNTO, OSiOS, OSDarwin] then [] else ["-lpthread"] diff --git a/configure.ac b/configure.ac index af62bd9..9ae97b8 100644 --- a/configure.ac +++ b/configure.ac @@ -1081,7 +1081,7 @@ dnl ** Use MMAP in the runtime linker? dnl -------------------------------------------------------------- case ${TargetOS} in - linux|freebsd|dragonfly|netbsd|openbsd|kfreebsdgnu|gnu|solaris2) + linux|linux-android|freebsd|dragonfly|netbsd|openbsd|kfreebsdgnu|gnu|solaris2) RtsLinkerUseMmap=1 ;; darwin) diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c index e8f6aab..66b8f71 100644 --- a/rts/linker/Elf.c +++ b/rts/linker/Elf.c @@ -1,6 +1,10 @@ #include "Rts.h" -#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(openbsd_HOST_OS) || defined(gnu_HOST_OS) +#if defined(linux_HOST_OS) || defined(solaris2_HOST_OS) \ +|| defined(linux_android_HOST_OS) \ +|| defined(freebsd_HOST_OS) || defined(kfreebsdgnu_HOST_OS) \ +|| defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) \ +|| defined(openbsd_HOST_OS) || defined(gnu_HOST_OS) #include "RtsUtils.h" #include "RtsSymbolInfo.h" @@ -613,13 +617,13 @@ static int getSectionKind_ELF( Elf_Shdr *hdr, int *is_bss ) /* .rodata-style section */ return SECTIONKIND_CODE_OR_RODATA; } -#ifndef openbsd_HOST_OS +#ifdef SHT_INIT_ARRAY if (hdr->sh_type == SHT_INIT_ARRAY && (hdr->sh_flags & SHF_ALLOC) && (hdr->sh_flags & SHF_WRITE)) { /* .init_array section */ return SECTIONKIND_INIT_ARRAY; } -#endif /* not OpenBSD */ +#endif /* not SHT_INIT_ARRAY */ if (hdr->sh_type == SHT_NOBITS && (hdr->sh_flags & SHF_ALLOC) && (hdr->sh_flags & SHF_WRITE)) { /* .bss-style section */ From git at git.haskell.org Wed Mar 29 23:42:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:42:03 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: unique: fix UNIQUE_BITS crosscompilation (Trac #13491) (3389bb3) Message-ID: <20170329234203.07E623A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/3389bb3454f973f76ed6aac2f0831e1dbfb7ea07/ghc >--------------------------------------------------------------- commit 3389bb3454f973f76ed6aac2f0831e1dbfb7ea07 Author: Sergei Trofimovich Date: Wed Mar 29 17:30:50 2017 -0400 unique: fix UNIQUE_BITS crosscompilation (Trac #13491) The #13491 manifests best when we try to crosscompile from 32-bit (i386-linux) to 64-bit (powerpc64-linux) system: ./configure --target=powerpc64-unknown-linux-gnu The build fails at assembly time: "inplace/bin/ghc-stage1" ... -c rts/StgStartup.cmm /tmp/ghc19687_0/ghc_4.s: Assembler messages: /tmp/ghc19687_0/ghc_4.s:11:0: error: Error: unknown pseudo-op: `.l' | 11 | .L<\x00>4: | ^ That happens because UNIQUE_BITS is defined in terms of WORD_SIZE_IN_BITS macro: #define UNIQUE_BITS (WORD_SIZE_IN_BITS - 8) WORD_SIZE_IN_BITS is 64 bits (equals to target value) while ghc-stage1 is still running on i386-linux The fix is to stop relying on target macros and use host's 'sizeof (HsInt)' and 'finiteBitSize' way to determine unique layout. Signed-off-by: Sergei Trofimovich Test Plan: build i386-to-powerpc64 crosscompiler Reviewers: rwbarton, austin, bgamari Reviewed By: bgamari Subscribers: RyanGlScott, thomie Differential Revision: https://phabricator.haskell.org/D3397 (cherry picked from commit 01b062ec3fa138b92124ce7ca4deca0ddcb474ea) >--------------------------------------------------------------- 3389bb3454f973f76ed6aac2f0831e1dbfb7ea07 compiler/Unique.h | 8 +++++--- compiler/basicTypes/UniqSupply.hs | 2 +- compiler/basicTypes/Unique.hs | 11 ++++++++--- compiler/cbits/genSym.c | 1 + 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/compiler/Unique.h b/compiler/Unique.h index a786d8f..e4cd267 100644 --- a/compiler/Unique.h +++ b/compiler/Unique.h @@ -1,3 +1,5 @@ -#include "../includes/MachDeps.h" - -#define UNIQUE_BITS (WORD_SIZE_IN_BITS - 8) +/* unique has the following structure: + * HsInt unique = + * (unique_tag << (sizeof (HsInt) - UNIQUE_TAG_BITS)) | unique_number + */ +#define UNIQUE_TAG_BITS 8 diff --git a/compiler/basicTypes/UniqSupply.hs b/compiler/basicTypes/UniqSupply.hs index 431c96c..da1a924 100644 --- a/compiler/basicTypes/UniqSupply.hs +++ b/compiler/basicTypes/UniqSupply.hs @@ -77,7 +77,7 @@ takeUniqFromSupply :: UniqSupply -> (Unique, UniqSupply) -- ^ Obtain the 'Unique' from this particular 'UniqSupply', and a new supply mkSplitUniqSupply c - = case ord c `shiftL` UNIQUE_BITS of + = case ord c `shiftL` uNIQUE_BITS of mask -> let -- here comes THE MAGIC: diff --git a/compiler/basicTypes/Unique.hs b/compiler/basicTypes/Unique.hs index 8e0f5e6..a49fa80 100644 --- a/compiler/basicTypes/Unique.hs +++ b/compiler/basicTypes/Unique.hs @@ -22,6 +22,7 @@ Haskell). module Unique ( -- * Main data types Unique, Uniquable(..), + uNIQUE_BITS, -- ** Constructors, destructors and operations on 'Unique's hasKey, @@ -98,6 +99,10 @@ Fast comparison is everything on @Uniques@: -- These are sometimes also referred to as \"keys\" in comments in GHC. newtype Unique = MkUnique Int +{-# INLINE uNIQUE_BITS #-} +uNIQUE_BITS :: Int +uNIQUE_BITS = finiteBitSize (0 :: Int) - UNIQUE_TAG_BITS + {- Now come the functions which construct uniques from their pieces, and vice versa. The stuff about unique *supplies* is handled further down this module. @@ -132,7 +137,7 @@ newTagUnique u c = mkUnique c i where (_,i) = unpkUnique u -- | How many bits are devoted to the unique index (as opposed to the class -- character). uniqueMask :: Int -uniqueMask = (1 `shiftL` UNIQUE_BITS) - 1 +uniqueMask = (1 `shiftL` uNIQUE_BITS) - 1 -- pop the Char in the top 8 bits of the Unique(Supply) @@ -146,14 +151,14 @@ mkUnique :: Char -> Int -> Unique -- Builds a unique from pieces mkUnique c i = MkUnique (tag .|. bits) where - tag = ord c `shiftL` UNIQUE_BITS + tag = ord c `shiftL` uNIQUE_BITS bits = i .&. uniqueMask unpkUnique (MkUnique u) = let -- as long as the Char may have its eighth bit set, we -- really do need the logical right-shift here! - tag = chr (u `shiftR` UNIQUE_BITS) + tag = chr (u `shiftR` uNIQUE_BITS) i = u .&. uniqueMask in (tag, i) diff --git a/compiler/cbits/genSym.c b/compiler/cbits/genSym.c index 4af3940..6943ab1 100644 --- a/compiler/cbits/genSym.c +++ b/compiler/cbits/genSym.c @@ -5,6 +5,7 @@ static HsInt GenSymCounter = 0; static HsInt GenSymInc = 1; +#define UNIQUE_BITS (sizeof (HsInt) * 8 - UNIQUE_TAG_BITS) #define UNIQUE_MASK ((1ULL << UNIQUE_BITS) - 1) STATIC_INLINE void checkUniqueRange(HsInt u STG_UNUSED) { From git at git.haskell.org Wed Mar 29 23:42:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 29 Mar 2017 23:42:05 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Check TargetPlatform instead of HostPlatform for leading underscore (808cd4e) Message-ID: <20170329234205.B14353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/808cd4e8f94306f36363d4d2da21e2e3d861608b/ghc >--------------------------------------------------------------- commit 808cd4e8f94306f36363d4d2da21e2e3d861608b Author: Moritz Angermann Date: Wed Mar 29 17:28:16 2017 -0400 Check TargetPlatform instead of HostPlatform for leading underscore Reviewers: austin, hvr, rwbarton, bgamari Reviewed By: rwbarton, bgamari Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D3348 (cherry picked from commit 81f5b6ecbadec49af53189756dda5e0b199f9703) >--------------------------------------------------------------- 808cd4e8f94306f36363d4d2da21e2e3d861608b aclocal.m4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aclocal.m4 b/aclocal.m4 index 3337215..6341bc9 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -874,12 +874,14 @@ FP_CHECK_ALIGNMENT([$1]) # checking for *no* leading underscore first. Sigh. --SDM # # Similarly on OpenBSD, but this test doesn't help. -- dons +# AC_DEFUN([FP_LEADING_UNDERSCORE], [AC_CHECK_LIB([elf], [nlist], [LIBS="-lelf $LIBS"]) AC_CACHE_CHECK([leading underscore in symbol names], [fptools_cv_leading_underscore], [ # Hack!: nlist() under Digital UNIX insist on there being an _, # but symbol table listings shows none. What is going on here?!? -case $HostPlatform in +case $TargetPlatform in +*linux-android*) fptools_cv_leading_underscore=no;; *openbsd*) # x86 openbsd is ELF from 3.4 >, meaning no leading uscore case $build in i386-*2\.@<:@0-9@:>@ | i386-*3\.@<:@0-3@:>@ ) fptools_cv_leading_underscore=yes ;; From git at git.haskell.org Thu Mar 30 00:38:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 30 Mar 2017 00:38:02 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Complete the fix for #13441 (pattern synonyms) (765219d) Message-ID: <20170330003802.D2AFA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/765219d949abc4afd4d6eb2c13c2dfb35a392249/ghc >--------------------------------------------------------------- commit 765219d949abc4afd4d6eb2c13c2dfb35a392249 Author: Simon Peyton Jones Date: Tue Mar 28 08:23:44 2017 +0100 Complete the fix for #13441 (pattern synonyms) Do not attempt to typecheck both directions of an implicitly-bidirectional pattern synonym simultanously, as we were before. Instead, the builder is typechecked when we typecheck the code for the builder, which was of course happening already, even in both bidirectional cases. See Note [Checking against a pattern signature], under "Existential type variables". (cherry picked from commit b5c81203d047293f54c4e89ac70d505197968cb3) >--------------------------------------------------------------- 765219d949abc4afd4d6eb2c13c2dfb35a392249 compiler/typecheck/TcPatSyn.hs | 45 ++++++++++++---------- testsuite/tests/patsyn/should_compile/T13441.hs | 7 ++++ testsuite/tests/patsyn/should_compile/T13441a.hs | 11 ++++++ testsuite/tests/patsyn/should_compile/T13441b.hs | 12 ++++++ .../tests/patsyn/should_compile/T13441b.stderr | 11 ++++++ testsuite/tests/patsyn/should_compile/all.T | 2 + 6 files changed, 67 insertions(+), 21 deletions(-) diff --git a/compiler/typecheck/TcPatSyn.hs b/compiler/typecheck/TcPatSyn.hs index 6f7764e..01cb542 100644 --- a/compiler/typecheck/TcPatSyn.hs +++ b/compiler/typecheck/TcPatSyn.hs @@ -149,14 +149,11 @@ tcCheckPatSynDecl psb at PSB{ psb_id = lname@(L _ name), psb_args = details pushLevelAndCaptureConstraints $ tcExtendTyVarEnv univ_tvs $ tcPat PatSyn lpat (mkCheckExpType pat_ty) $ - do { let new_tv = case dir of - ImplicitBidirectional -> newMetaSigTyVarX - _ -> newMetaTyVarX - -- new_tv: see the "Existential type variables" - -- part of Note [Checking against a pattern signature] - in_scope = mkInScopeSet (mkVarSet univ_tvs) + do { let in_scope = mkInScopeSet (mkVarSet univ_tvs) empty_subst = mkEmptyTCvSubst in_scope - ; (subst, ex_tvs') <- mapAccumLM new_tv empty_subst ex_tvs + ; (subst, ex_tvs') <- mapAccumLM newMetaTyVarX empty_subst ex_tvs + -- newMetaTyVarX: see the "Existential type variables" + -- part of Note [Checking against a pattern signature] ; traceTc "tcpatsyn1" (vcat [ ppr v <+> dcolon <+> ppr (tyVarKind v) | v <- ex_tvs]) ; traceTc "tcpatsyn2" (vcat [ ppr v <+> dcolon <+> ppr (tyVarKind v) | v <- ex_tvs']) ; let prov_theta' = substTheta subst prov_theta @@ -241,20 +238,26 @@ unify x := [a] during type checking, and then use the instantiating type dl = $dfunEqList d in k [a] dl ys -This "concealing" story works for /uni-directional/ pattern synonyms. -It also works for /explicitly-bidirectional/ pattern synonyms, where -the constructor direction is typecheked entirely separately. - -But for /implicitly-bidirecitonal/ ones like - pattern P x = MkS x -we are trying to typecheck both directions at once. So for this we -use SigTv, rather than a generic TauTv. But it's not quite done: - - We should really check that those SigTvs don't get unified - with each other. - - Trac #13441 is rejected if you use an implicitly-bidirectional - pattern. -Maybe it'd be better to treat it like an explicitly-bidirectional -pattern? +All this applies when type-checking the /matching/ side of +a pattern synonym. What about the /building/ side? + +* For Unidirectional, there is no builder + +* For ExplicitBidirectional, the builder is completely separate + code, typechecked in tcPatSynBuilderBind + +* For ImplicitBidirectional, the builder is still typechecked in + tcPatSynBuilderBind, by converting the pattern to an expression and + typechecking it. + + At one point, for ImplicitBidirectional I used SigTvs (instead of + TauTvs) in tcCheckPatSynDecl. But (a) strengthening the check here + is redundant since tcPatSynBuilderBind does the job, (b) it was + still incomplete (SigTvs can unify with each other), and (c) it + didn't even work (Trac #13441 was accepted with + ExplicitBidirectional, but rejected if expressed in + ImplicitBidirectional form. Conclusion: trying to be too clever is + a bad idea. -} collectPatSynArgInfo :: HsPatSynDetails (Located Name) -> ([Name], [Name], Bool) diff --git a/testsuite/tests/patsyn/should_compile/T13441.hs b/testsuite/tests/patsyn/should_compile/T13441.hs index d7a339f..7380175 100644 --- a/testsuite/tests/patsyn/should_compile/T13441.hs +++ b/testsuite/tests/patsyn/should_compile/T13441.hs @@ -21,9 +21,16 @@ type family Replicate (n :: Nat) (x :: a) = (r :: [a]) where type Vec n a = FList Identity (Replicate n a) +-- Using explicitly-bidirectional pattern pattern (:>) :: forall n a. n ~ Length (Replicate n a) => forall m. n ~ Succ m => a -> Vec m a -> Vec n a pattern x :> xs <- Identity x :@ xs where x :> xs = Identity x :@ xs + +-- Using implicitly-bidirectional pattern +pattern (:>>) :: forall n a. n ~ Length (Replicate n a) + => forall m. n ~ Succ m + => a -> Vec m a -> Vec n a +pattern x :>> xs = Identity x :@ xs diff --git a/testsuite/tests/patsyn/should_compile/T13441a.hs b/testsuite/tests/patsyn/should_compile/T13441a.hs new file mode 100644 index 0000000..7736094 --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T13441a.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE PatternSynonyms, GADTs #-} +module T13441a where + +data S where + MkS :: Eq a => [a] -> S + +-- Unidirectional pattern binding; +-- the existential is more specific than needed +-- c.f. T13441b +pattern P :: () => Eq x => x -> S +pattern P x <- MkS x diff --git a/testsuite/tests/patsyn/should_compile/T13441b.hs b/testsuite/tests/patsyn/should_compile/T13441b.hs new file mode 100644 index 0000000..8f8d2ba --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T13441b.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE PatternSynonyms, GADTs #-} +module T13441a where + +data S where + MkS :: Eq a => [a] -> S + +-- Implicitly-bidirectional pattern binding; +-- the existential is more specific than needed, +-- and hence should be rejected +-- c.f. T13441a +pattern P :: () => Eq x => x -> S +pattern P x = MkS x diff --git a/testsuite/tests/patsyn/should_compile/T13441b.stderr b/testsuite/tests/patsyn/should_compile/T13441b.stderr new file mode 100644 index 0000000..4469086 --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T13441b.stderr @@ -0,0 +1,11 @@ + +T13441b.hs:12:19: error: + • Couldn't match expected type ‘[a0]’ with actual type ‘x’ + ‘x’ is a rigid type variable bound by + the signature for pattern synonym ‘P’ at T13441b.hs:12:1-19 + • In the first argument of ‘MkS’, namely ‘x’ + In the expression: MkS x + In an equation for ‘P’: P x = MkS x + • Relevant bindings include + x :: x (bound at T13441b.hs:12:19) + $bP :: x -> S (bound at T13441b.hs:12:9) diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T index 1f36424..8fce7e9 100644 --- a/testsuite/tests/patsyn/should_compile/all.T +++ b/testsuite/tests/patsyn/should_compile/all.T @@ -65,3 +65,5 @@ test('T12746', normal, multi_compile, ['T12746', [('T12746A.hs', '-c')],'-v0']) test('T12968', normal, compile, ['']) test('T13349b', normal, compile, ['']) test('T13441', normal, compile, ['']) +test('T13441a', normal, compile, ['']) +test('T13441b', normal, compile_fail, ['']) From git at git.haskell.org Thu Mar 30 00:38:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 30 Mar 2017 00:38:06 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Allow unbound Refl binders in a RULE (7087abf) Message-ID: <20170330003806.0C7773A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/7087abfe2ba944d6609eee399c5ad2ca44cd388c/ghc >--------------------------------------------------------------- commit 7087abfe2ba944d6609eee399c5ad2ca44cd388c Author: Simon Peyton Jones Date: Wed Mar 29 09:00:02 2017 +0100 Allow unbound Refl binders in a RULE Trac #13410 was failing because we had a RULE with a binder (c :: t~t) and the /occurrences/ of c on the LHS were being optimised to Refl, leaving a binder that would not be filled in by matching the LHS of the rule. I flirted with trying to ensure that occurrences (c :: t~t) are not optimised to Relf, but that turned out to be fragile; it was being done, for good reasons, in multiple places, including - TyCoRep.substCoVarBndr - Simplify.simplCast - Corecion.mkCoVarCo So I fixed it in one place by making Rules.matchN deal happily with an unbound binder (c :: t~t). Quite easy. See "Coercion variables" in Note [Unbound RULE binders] in Rules. In addition, I needed to make CoreLint be happy with an bound RULE binder that is a Relf coercion variable In debugging this, I was perplexed that occurrences of a variable (c :: t~t) mysteriously turned into Refl. I found out how it was happening, and decided to move it: * In TyCoRep.substCoVarBndr, do not substitute Refl for a binder (c :: t~t). * In mkCoVarCo do not optimise (c :: t~t) to Refl. Instead, we do this optimisation in optCoercion (specifically opt_co4) where, surprisingly, the optimisation was /not/ being done. This has no effect on what programs compile; it just moves a relatively-expensive optimisation to optCoercion, where it seems more properly to belong. It's actually not clear to me which is really "better", but this way round is less surprising. One small simplifying refactoring * Eliminate TyCoRep.substCoVarBndrCallback, which was only called locally. (cherry picked from commit 8674883c137401873fd53a6963acd33af651c2af) >--------------------------------------------------------------- 7087abfe2ba944d6609eee399c5ad2ca44cd388c compiler/coreSyn/CoreLint.hs | 18 ++- compiler/specialise/Rules.hs | 47 +++++-- compiler/types/Coercion.hs | 33 +++-- compiler/types/OptCoercion.hs | 32 ++++- compiler/types/TyCoRep.hs | 22 +-- testsuite/tests/simplCore/should_compile/T13410.hs | 152 +++++++++++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 7 files changed, 260 insertions(+), 45 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 7087abfe2ba944d6609eee399c5ad2ca44cd388c From git at git.haskell.org Thu Mar 30 00:38:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 30 Mar 2017 00:38:08 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix ASSERT failure in TcErrors (95ca115) Message-ID: <20170330003808.B71FC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/95ca115d22ce3dc7f9ad53d8d8a74175121fdda8/ghc >--------------------------------------------------------------- commit 95ca115d22ce3dc7f9ad53d8d8a74175121fdda8 Author: Simon Peyton Jones Date: Wed Mar 29 14:57:21 2017 +0100 Fix ASSERT failure in TcErrors This fixes Trac #13494, by improving commit e0ad55f894a8d85dcc099c33c63cfe3d4515d464 Author: Simon Peyton Jones Date: Mon Mar 27 10:32:08 2017 +0100 Fix error-message suppress on given equalities which in turn was a fix to #13446 (cherry picked from commit f88ac374c5cb150d4f172fb40be338d2112a0600) >--------------------------------------------------------------- 95ca115d22ce3dc7f9ad53d8d8a74175121fdda8 compiler/typecheck/TcErrors.hs | 29 ++++++++++++---------- .../tests/indexed-types/should_fail/T2627b.stderr | 10 +++----- .../tests/indexed-types/should_fail/T6123.stderr | 3 ++- .../tests/indexed-types/should_fail/T7354.stderr | 5 ++-- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 84a28a7..9701637 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -1474,22 +1474,21 @@ mkTyVarEqErr dflags ctxt report ct oriented tv1 ty2 , report ] - -- So tv is a meta tyvar (or started that way before we - -- generalised it). So presumably it is an *untouchable* - -- meta tyvar or a SigTv, else it'd have been unified | OC_Occurs <- occ_check_expand - , insoluble_occurs_check - -- See Note [Occurs check error] in TcCanonical - = do { let occCheckMsg = important $ addArising (ctOrigin ct) $ - hang (text "Occurs check: cannot construct the infinite" <+> what <> colon) + -- We report an "occurs check" even for a ~ F t a, where F is a type + -- function; it's not insouble (because in principle F could reduce) + -- but we have certainly been unable to solve it + -- See Note [Occurs check error] in TcCanonical + = do { let main_msg = addArising (ctOrigin ct) $ + hang (text "Occurs check: cannot construct the infinite" <+> what <> colon) 2 (sep [ppr ty1, char '~', ppr ty2]) + extra2 = important $ mkEqInfoMsg ct ty1 ty2 - interesting_tyvars - = filter (not . noFreeVarsOfType . tyVarKind) $ - filter isTyVar $ - fvVarList $ - tyCoFVsOfType ty1 `unionFV` tyCoFVsOfType ty2 + interesting_tyvars = filter (not . noFreeVarsOfType . tyVarKind) $ + filter isTyVar $ + fvVarList $ + tyCoFVsOfType ty1 `unionFV` tyCoFVsOfType ty2 extra3 = relevant_bindings $ ppWhen (not (null interesting_tyvars)) $ hang (text "Type variable kinds:") 2 $ @@ -1497,7 +1496,8 @@ mkTyVarEqErr dflags ctxt report ct oriented tv1 ty2 interesting_tyvars) tyvar_binding tv = ppr tv <+> dcolon <+> ppr (tyVarKind tv) - ; mkErrorMsgFromCt ctxt ct $ mconcat [occCheckMsg, extra2, extra3, report] } + ; mkErrorMsgFromCt ctxt ct $ + mconcat [important main_msg, extra2, extra3, report] } | OC_Bad <- occ_check_expand = do { let msg = vcat [ text "Cannot instantiate unification variable" @@ -1546,6 +1546,9 @@ mkTyVarEqErr dflags ctxt report ct oriented tv1 ty2 ; mkErrorMsgFromCt ctxt ct (mconcat [msg, tv_extra, report]) } -- Nastiest case: attempt to unify an untouchable variable + -- So tv is a meta tyvar (or started that way before we + -- generalised it). So presumably it is an *untouchable* + -- meta tyvar or a SigTv, else it'd have been unified -- See Note [Error messages for untouchables] | (implic:_) <- cec_encl ctxt -- Get the innermost context , Implic { ic_env = env, ic_given = given diff --git a/testsuite/tests/indexed-types/should_fail/T2627b.stderr b/testsuite/tests/indexed-types/should_fail/T2627b.stderr index 1a09bd8..63f11b9 100644 --- a/testsuite/tests/indexed-types/should_fail/T2627b.stderr +++ b/testsuite/tests/indexed-types/should_fail/T2627b.stderr @@ -1,13 +1,9 @@ T2627b.hs:20:24: error: - • Couldn't match type ‘b0’ with ‘Dual (Dual b0)’ + • Occurs check: cannot construct the infinite type: + b0 ~ Dual (Dual b0) arising from a use of ‘conn’ - ‘b0’ is untouchable - inside the constraints: b ~ W e f - bound by a pattern with constructor: - Wr :: forall e f. e -> Comm f -> Comm (W e f), - in an equation for ‘conn’ - at T2627b.hs:20:14-19 + The type variable ‘b0’ is ambiguous • In the expression: conn undefined undefined In an equation for ‘conn’: conn (Rd k) (Wr a r) = conn undefined undefined diff --git a/testsuite/tests/indexed-types/should_fail/T6123.stderr b/testsuite/tests/indexed-types/should_fail/T6123.stderr index eafd27c..0ae1a5e 100644 --- a/testsuite/tests/indexed-types/should_fail/T6123.stderr +++ b/testsuite/tests/indexed-types/should_fail/T6123.stderr @@ -1,6 +1,7 @@ T6123.hs:10:14: error: - • Couldn't match type ‘a0’ with ‘Id a0’ arising from a use of ‘cid’ + • Occurs check: cannot construct the infinite type: a0 ~ Id a0 + arising from a use of ‘cid’ The type variable ‘a0’ is ambiguous • In the expression: cid undefined In an equation for ‘cundefined’: cundefined = cid undefined diff --git a/testsuite/tests/indexed-types/should_fail/T7354.stderr b/testsuite/tests/indexed-types/should_fail/T7354.stderr index f4c3c0d..b7b70b8 100644 --- a/testsuite/tests/indexed-types/should_fail/T7354.stderr +++ b/testsuite/tests/indexed-types/should_fail/T7354.stderr @@ -1,8 +1,7 @@ T7354.hs:28:11: error: - • Couldn't match type ‘p’ with ‘Base t (Prim [p] p)’ - ‘p’ is a rigid type variable bound by - the inferred type of foo :: Prim [p] p -> t at T7354.hs:28:1-13 + • Occurs check: cannot construct the infinite type: + p ~ Base t (Prim [p] p) Expected type: Prim [p] p -> Base t (Prim [p] p) Actual type: Prim [p] p -> p • In the first argument of ‘ana’, namely ‘alg’ From git at git.haskell.org Thu Mar 30 00:38:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 30 Mar 2017 00:38:12 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix #13458 (662c642) Message-ID: <20170330003812.026953A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/662c64226e302009175abfa7ed196ac905990486/ghc >--------------------------------------------------------------- commit 662c64226e302009175abfa7ed196ac905990486 Author: Richard Eisenberg Date: Wed Mar 22 22:32:04 2017 -0400 Fix #13458 Core Lint shouldn't check representations of types that don't have representations. test case: typecheck/should_compile/T13458 (cherry picked from commit cea7141851ce653cb20207da3591d09e73fa396d) >--------------------------------------------------------------- 662c64226e302009175abfa7ed196ac905990486 compiler/coreSyn/CoreLint.hs | 26 +++++++++++++++------- compiler/simplStg/RepType.hs | 4 ---- testsuite/tests/typecheck/should_compile/T13458.hs | 11 +++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index 1314b28..3029990 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -1636,7 +1636,7 @@ lintCoercion co@(UnivCo prov r ty1 ty2) (checkTypes ty1 ty2) ; return (k1, k2, ty1, ty2, r) } where - report s = hang (text $ "Unsafe coercion between " ++ s) + report s = hang (text $ "Unsafe coercion: " ++ s) 2 (vcat [ text "From:" <+> ppr ty1 , text " To:" <+> ppr ty2]) isUnBoxed :: PrimRep -> Bool @@ -1644,10 +1644,20 @@ lintCoercion co@(UnivCo prov r ty1 ty2) -- see #9122 for discussion of these checks checkTypes t1 t2 - = do { checkWarnL (reps1 `equalLength` reps2) - (report "values with different # of reps") - ; zipWithM_ validateCoercion reps1 reps2 } + = do { checkWarnL lev_poly1 + (report "left-hand type is levity-polymorphic") + ; checkWarnL lev_poly2 + (report "right-hand type is levity-polymorphic") + ; when (not (lev_poly1 || lev_poly2)) $ + do { checkWarnL (reps1 `equalLength` reps2) + (report "between values with different # of reps") + ; zipWithM_ validateCoercion reps1 reps2 }} where + lev_poly1 = isTypeLevPoly t1 + lev_poly2 = isTypeLevPoly t2 + + -- don't look at these unless lev_poly1/2 are False + -- Otherwise, we get #13458 reps1 = typePrimRep t1 reps2 = typePrimRep t2 @@ -1655,15 +1665,15 @@ lintCoercion co@(UnivCo prov r ty1 ty2) validateCoercion rep1 rep2 = do { dflags <- getDynFlags ; checkWarnL (isUnBoxed rep1 == isUnBoxed rep2) - (report "unboxed and boxed value") + (report "between unboxed and boxed value") ; checkWarnL (TyCon.primRepSizeW dflags rep1 == TyCon.primRepSizeW dflags rep2) - (report "unboxed values of different size") + (report "between unboxed values of different size") ; let fl = liftM2 (==) (TyCon.primRepIsFloat rep1) (TyCon.primRepIsFloat rep2) ; case fl of - Nothing -> addWarnL (report "vector types") - Just False -> addWarnL (report "float and integral values") + Nothing -> addWarnL (report "between vector types") + Just False -> addWarnL (report "between float and integral values") _ -> return () } diff --git a/compiler/simplStg/RepType.hs b/compiler/simplStg/RepType.hs index f59a854..be72574 100644 --- a/compiler/simplStg/RepType.hs +++ b/compiler/simplStg/RepType.hs @@ -343,10 +343,6 @@ kindPrimRep doc (TyConApp typ [runtime_rep]) kindPrimRep doc ki = pprPanic "kindPrimRep" (ppr ki $$ doc) - -- TODO (RAE): Remove: - -- WARN( True, text "kindPrimRep defaulting to LiftedRep on" <+> ppr ki $$ doc ) - -- [LiftedRep] -- this can happen legitimately for, e.g., Any - -- | Take a type of kind RuntimeRep and extract the list of 'PrimRep' that -- it encodes. runtimeRepPrimRep :: HasDebugCallStack => SDoc -> Type -> [PrimRep] diff --git a/testsuite/tests/typecheck/should_compile/T13458.hs b/testsuite/tests/typecheck/should_compile/T13458.hs new file mode 100644 index 0000000..9b51378 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T13458.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE MagicHash, TypeInType, ScopedTypeVariables #-} +{-# OPTIONS_GHC -O #-} +module T13458 where +import GHC.Exts +import Data.Kind +import Unsafe.Coerce + +unsafeCoerce' :: forall (r :: RuntimeRep) + (a :: TYPE r) (b :: TYPE r). + a -> b +unsafeCoerce' = unsafeCoerce id diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 9caaf25..97a5350 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -546,3 +546,4 @@ test('T12926', normal, compile, ['']) test('T13381', normal, compile_fail, ['']) test('T13337', normal, compile, ['']) test('T13343', normal, compile, ['']) +test('T13458', normal, compile, ['']) From git at git.haskell.org Thu Mar 30 10:14:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 30 Mar 2017 10:14:46 +0000 (UTC) Subject: [commit: ghc] master: Typos in comments [ci skip] (ff7094e) Message-ID: <20170330101446.24B433A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ff7094e5a80435ff68490c725029e762913a72d3/ghc >--------------------------------------------------------------- commit ff7094e5a80435ff68490c725029e762913a72d3 Author: Gabor Greif Date: Wed Mar 29 15:34:32 2017 +0200 Typos in comments [ci skip] >--------------------------------------------------------------- ff7094e5a80435ff68490c725029e762913a72d3 compiler/backpack/NameShape.hs | 2 +- compiler/deSugar/Match.hs | 2 +- compiler/iface/IfaceEnv.hs | 2 +- compiler/prelude/primops.txt.pp | 2 +- compiler/typecheck/TcErrors.hs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/backpack/NameShape.hs b/compiler/backpack/NameShape.hs index 261fffb..6ec243e 100644 --- a/compiler/backpack/NameShape.hs +++ b/compiler/backpack/NameShape.hs @@ -159,7 +159,7 @@ ns_module = mkHoleModule . ns_mod_name -- | Substitution on @{A.T}@. We enforce the invariant that the -- 'nameModule' of keys of this map have 'moduleUnitId' @hole@ -- (meaning that if we have a hole substitution, the keys of the map --- are never affected.) Alternately, this is isomorphic to +-- are never affected.) Alternatively, this is isomorphic to -- @Map ('ModuleName', 'OccName') 'Name'@. type ShNameSubst = NameEnv Name diff --git a/compiler/deSugar/Match.hs b/compiler/deSugar/Match.hs index 692db8b..33dd799 100644 --- a/compiler/deSugar/Match.hs +++ b/compiler/deSugar/Match.hs @@ -662,7 +662,7 @@ is collected here, in @matchWrapper at . This function takes as arguments: \begin{itemize} \item -Typchecked @Matches@ (of a function definition, or a case or lambda +Typechecked @Matches@ (of a function definition, or a case or lambda expression)---the main input; \item An error message to be inserted into any (runtime) pattern-matching diff --git a/compiler/iface/IfaceEnv.hs b/compiler/iface/IfaceEnv.hs index 46bc0e9..f66ebdc 100644 --- a/compiler/iface/IfaceEnv.hs +++ b/compiler/iface/IfaceEnv.hs @@ -143,7 +143,7 @@ updNameCache upd_fn = do { hsc_env <- getTopEnv -} -- | Look up the 'Name' for a given 'Module' and 'OccName'. --- Consider alternately using 'lookupIfaceTop' if you're in the 'IfL' monad +-- Consider alternatively using 'lookupIfaceTop' if you're in the 'IfL' monad -- and 'Module' is simply that of the 'ModIface' you are typechecking. lookupOrig :: Module -> OccName -> TcRnIf a b Name lookupOrig mod occ diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 41a725f..c16bc74 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -2713,7 +2713,7 @@ primop AddrToAnyOp "addrToAny#" GenPrimOp primop AnyToAddrOp "anyToAddr#" GenPrimOp a -> State# RealWorld -> (# State# RealWorld, Addr# #) - { Retrive the address of any Haskell value. This is + { Retrieve the address of any Haskell value. This is essentially an {\texttt unsafeCoerce\#}, but if implemented as such the core lint pass complains and fails to compile. As a primop, it is opaque to core/stg, and only appears diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 290da2f..360142d 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -1621,7 +1621,7 @@ mkTyVarEqErr dflags ctxt report ct oriented tv1 ty2 | OC_Occurs <- occ_check_expand -- We report an "occurs check" even for a ~ F t a, where F is a type - -- function; it's not insouble (because in principle F could reduce) + -- function; it's not insoluble (because in principle F could reduce) -- but we have certainly been unable to solve it -- See Note [Occurs check error] in TcCanonical = do { let main_msg = addArising (ctOrigin ct) $ From git at git.haskell.org Thu Mar 30 17:35:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 30 Mar 2017 17:35:24 +0000 (UTC) Subject: [commit: ghc] master: Deriving for phantom and empty types (69f070d) Message-ID: <20170330173524.72E173A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/69f070d8e4d6043937e3405675ac911448bfcb44/ghc >--------------------------------------------------------------- commit 69f070d8e4d6043937e3405675ac911448bfcb44 Author: David Feuer Date: Thu Mar 30 13:30:52 2017 -0400 Deriving for phantom and empty types Make `Functor`, `Foldable`, and `Traversable` take advantage of the case where the type parameter is phantom. In this case, * `fmap _ = coerce` * `foldMap _ _ = mempty` * `traverse _ x = pure (coerce x)` For the sake of consistency and especially simplicity, make other types with no data constructors behave the same: * `fmap _ x = case x of` * `foldMap _ _ = mempty` * `traverse _ x = pure (case x of)` Similarly, for `Generic`, * `to x = case x of` * `from x = case x of` Give all derived methods for types without constructors appropriate arities. For example, ``` compare _ _ = error ... ``` rather than ``` compare = error ... ``` Fixes #13117 and #13328 Reviewers: austin, bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: ekmett, RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3374 >--------------------------------------------------------------- 69f070d8e4d6043937e3405675ac911448bfcb44 compiler/typecheck/TcGenDeriv.hs | 114 ++++++----- compiler/typecheck/TcGenFunctor.hs | 216 +++++++++++++++++---- compiler/typecheck/TcGenGenerics.hs | 15 +- docs/users_guide/8.4.1-notes.rst | 78 ++++++++ docs/users_guide/glasgow_exts.rst | 74 ++++++- docs/users_guide/index.rst | 1 + testsuite/tests/deriving/should_compile/all.T | 5 + .../deriving/should_compile/drv-empty-data.hs | 19 ++ .../deriving/should_compile/drv-empty-data.stderr | 68 +++++++ .../tests/deriving/should_compile/drv-phantom.hs | 12 ++ .../deriving/should_compile/drv-phantom.stderr | 18 ++ .../tests/generics/T10604/T10604_deriving.stderr | 128 ++++++------ testsuite/tests/perf/compiler/T13056.hs | 4 + 13 files changed, 584 insertions(+), 168 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 69f070d8e4d6043937e3405675ac911448bfcb44 From git at git.haskell.org Thu Mar 30 19:25:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 30 Mar 2017 19:25:31 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-simplify: Fix space leaks in simplifier (#13426) (c1f25e5) Message-ID: <20170330192531.CAC343A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-simplify Link : http://ghc.haskell.org/trac/ghc/changeset/c1f25e5e9b946a119587765dd57288bfee674d18/ghc >--------------------------------------------------------------- commit c1f25e5e9b946a119587765dd57288bfee674d18 Author: Reid Barton Date: Mon Mar 27 22:15:29 2017 -0400 Fix space leaks in simplifier (#13426) Summary: The Join points commit (8d5cf8bf) introduced a space leak somewhere in the simplifier. The extra strictness added in this commit fixes the leak. Unfortunately I don't really understand the details. Test Plan: harbormaster Reviewers: Subscribers: >--------------------------------------------------------------- c1f25e5e9b946a119587765dd57288bfee674d18 compiler/simplCore/Simplify.hs | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index e78714d..b130339 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -1001,16 +1001,21 @@ simplExprF1 env (Lit lit) cont = rebuild env (Lit lit) cont simplExprF1 env (Tick t expr) cont = simplTick env t expr cont simplExprF1 env (Cast body co) cont = simplCast env body co cont simplExprF1 env (Coercion co) cont = simplCoercionF env co cont -simplExprF1 env (Type ty) cont = ASSERT( contIsRhsOrArg cont ) - rebuild env (Type (substTy env ty)) cont +simplExprF1 env (Type ty) cont + = ASSERT( contIsRhsOrArg cont ) + do { ty' <- simplType env ty + ; rebuild env (Type ty') cont } simplExprF1 env (App fun arg) cont - = simplExprF env fun $ - case arg of - Type ty -> ApplyToTy { sc_arg_ty = substTy env ty - , sc_hole_ty = substTy env (exprType fun) - , sc_cont = cont } - _ -> ApplyToVal { sc_arg = arg, sc_env = env + = case arg of + Type ty -> do { arg' <- simplType env ty + ; hole' <- simplType env (exprType fun) + ; simplExprF env fun $ + ApplyToTy { sc_arg_ty = arg' + , sc_hole_ty = hole' + , sc_cont = cont } } + _ -> simplExprF env fun $ + ApplyToVal { sc_arg = arg, sc_env = env , sc_dup = NoDup, sc_cont = cont } simplExprF1 env expr@(Lam {}) cont @@ -2217,7 +2222,10 @@ reallyRebuildCase env scrut case_bndr alts cont ; dflags <- getDynFlags ; let alts_ty' = contResultType dup_cont - ; case_expr <- mkCase dflags scrut' case_bndr' alts_ty' alts' + -- The seqType below is needed to avoid a space leak (#13426) + -- but I don't know why. + ; case_expr <- seqType alts_ty' `seq` + mkCase dflags scrut' case_bndr' alts_ty' alts' -- Notice that rebuild gets the in-scope set from env', not alt_env -- (which in any case is only build in simplAlts) From git at git.haskell.org Thu Mar 30 19:25:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 30 Mar 2017 19:25:34 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-simplify: Stamp out space leaks from demand analysis (eaa4a3d) Message-ID: <20170330192534.863E33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-simplify Link : http://ghc.haskell.org/trac/ghc/changeset/eaa4a3d1f02f3301ed3a198a2a983566f253c317/ghc >--------------------------------------------------------------- commit eaa4a3d1f02f3301ed3a198a2a983566f253c317 Author: Reid Barton Date: Wed Mar 29 23:39:44 2017 -0400 Stamp out space leaks from demand analysis This reduces peak memory usage by ~30% on my test case (DynFlags), and (probably as a result of reduced GC work) decreases compilation time by a few percent as well. Also fix a bug in seqStrDmd so that demeand info is fully evaluated. >--------------------------------------------------------------- eaa4a3d1f02f3301ed3a198a2a983566f253c317 compiler/basicTypes/Demand.hs | 2 +- compiler/stranal/DmdAnal.hs | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/compiler/basicTypes/Demand.hs b/compiler/basicTypes/Demand.hs index 377fc3d..95c7b79 100644 --- a/compiler/basicTypes/Demand.hs +++ b/compiler/basicTypes/Demand.hs @@ -332,7 +332,7 @@ bothStr (SProd _) (SCall _) = HyperStr -- utility functions to deal with memory leaks seqStrDmd :: StrDmd -> () seqStrDmd (SProd ds) = seqStrDmdList ds -seqStrDmd (SCall s) = s `seq` () +seqStrDmd (SCall s) = seqStrDmd s seqStrDmd _ = () seqStrDmdList :: [ArgStr] -> () diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs index 25a4f8b..2fc33a4 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/stranal/DmdAnal.hs @@ -17,6 +17,7 @@ import DynFlags import WwLib ( findTypeShape, deepSplitProductType_maybe ) import Demand -- All of it import CoreSyn +import CoreSeq ( seqBinds ) import Outputable import VarEnv import BasicTypes @@ -52,7 +53,8 @@ dmdAnalProgram dflags fam_envs binds dumpIfSet_dyn dflags Opt_D_dump_str_signatures "Strictness signatures" $ dumpStrSig binds_plus_dmds ; - return binds_plus_dmds + -- See Note [Stamp out space leaks in demand analysis] + seqBinds binds_plus_dmds `seq` return binds_plus_dmds } where do_prog :: CoreProgram -> CoreProgram @@ -79,6 +81,24 @@ dmdAnalTopBind sigs (Rec pairs) -- We get two iterations automatically -- c.f. the NonRec case above +{- Note [Stamp out space leaks in demand analysis] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The demand analysis pass outputs a new copy of the Core program in +which binders have been annotated with demand and strictness +information. It's tiresome to ensure that this information is fully +evaluated everywhere that we produce it, so we just run a single +seqBinds over the output before returning it, to ensure that there are +no references holding on to the input Core program. + +This is particularly important when we are doing late demand analysis, +since we don't do a seqBinds at any point thereafter. Hence code +generation would hold on to an extra copy of the Core program, via +unforced thunks in demand or strictness information; and it is the +most memory-intensive part of the compilation process, so this added +seqBinds makes a big difference in peak memory usage. +-} + + {- ************************************************************************ * * From git at git.haskell.org Thu Mar 30 23:55:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 30 Mar 2017 23:55:16 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-simplify: Stamp out space leaks from demand analysis (b50aa11) Message-ID: <20170330235516.DAD143A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-simplify Link : http://ghc.haskell.org/trac/ghc/changeset/b50aa114fefea26e7b26063f70bce3af029188cd/ghc >--------------------------------------------------------------- commit b50aa114fefea26e7b26063f70bce3af029188cd Author: Reid Barton Date: Wed Mar 29 23:39:44 2017 -0400 Stamp out space leaks from demand analysis Summary: This reduces peak memory usage by ~30% on my test case (DynFlags), and (probably as a result of reduced GC work) decreases compilation time by a few percent as well. Also fix a bug in seqStrDmd so that demeand info is fully evaluated. Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3400 >--------------------------------------------------------------- b50aa114fefea26e7b26063f70bce3af029188cd compiler/basicTypes/Demand.hs | 2 +- compiler/stranal/DmdAnal.hs | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/compiler/basicTypes/Demand.hs b/compiler/basicTypes/Demand.hs index 377fc3d..95c7b79 100644 --- a/compiler/basicTypes/Demand.hs +++ b/compiler/basicTypes/Demand.hs @@ -332,7 +332,7 @@ bothStr (SProd _) (SCall _) = HyperStr -- utility functions to deal with memory leaks seqStrDmd :: StrDmd -> () seqStrDmd (SProd ds) = seqStrDmdList ds -seqStrDmd (SCall s) = s `seq` () +seqStrDmd (SCall s) = seqStrDmd s seqStrDmd _ = () seqStrDmdList :: [ArgStr] -> () diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs index 25a4f8b..2fc33a4 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/stranal/DmdAnal.hs @@ -17,6 +17,7 @@ import DynFlags import WwLib ( findTypeShape, deepSplitProductType_maybe ) import Demand -- All of it import CoreSyn +import CoreSeq ( seqBinds ) import Outputable import VarEnv import BasicTypes @@ -52,7 +53,8 @@ dmdAnalProgram dflags fam_envs binds dumpIfSet_dyn dflags Opt_D_dump_str_signatures "Strictness signatures" $ dumpStrSig binds_plus_dmds ; - return binds_plus_dmds + -- See Note [Stamp out space leaks in demand analysis] + seqBinds binds_plus_dmds `seq` return binds_plus_dmds } where do_prog :: CoreProgram -> CoreProgram @@ -79,6 +81,24 @@ dmdAnalTopBind sigs (Rec pairs) -- We get two iterations automatically -- c.f. the NonRec case above +{- Note [Stamp out space leaks in demand analysis] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The demand analysis pass outputs a new copy of the Core program in +which binders have been annotated with demand and strictness +information. It's tiresome to ensure that this information is fully +evaluated everywhere that we produce it, so we just run a single +seqBinds over the output before returning it, to ensure that there are +no references holding on to the input Core program. + +This is particularly important when we are doing late demand analysis, +since we don't do a seqBinds at any point thereafter. Hence code +generation would hold on to an extra copy of the Core program, via +unforced thunks in demand or strictness information; and it is the +most memory-intensive part of the compilation process, so this added +seqBinds makes a big difference in peak memory usage. +-} + + {- ************************************************************************ * * From git at git.haskell.org Thu Mar 30 23:55:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 30 Mar 2017 23:55:19 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-simplify: Use strict types and folds in CoreStats (7d993e9) Message-ID: <20170330235519.A8E813A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-simplify Link : http://ghc.haskell.org/trac/ghc/changeset/7d993e9c632a96dfb1750ae88e46824db50fbb4f/ghc >--------------------------------------------------------------- commit 7d993e9c632a96dfb1750ae88e46824db50fbb4f Author: Reid Barton Date: Thu Mar 30 19:41:42 2017 -0400 Use strict types and folds in CoreStats Summary: This only has a significant effect when compiling with -v (or -dshow-passes), but still there's no reason not to do it. Test Plan: harbormaster Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3401 >--------------------------------------------------------------- 7d993e9c632a96dfb1750ae88e46824db50fbb4f compiler/coreSyn/CoreStats.hs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/compiler/coreSyn/CoreStats.hs b/compiler/coreSyn/CoreStats.hs index 4da81fd..dd29be7 100644 --- a/compiler/coreSyn/CoreStats.hs +++ b/compiler/coreSyn/CoreStats.hs @@ -20,11 +20,13 @@ import Type (Type, typeSize, seqType) import Id (idType, isJoinId) import CoreSeq (megaSeqIdInfo) -data CoreStats = CS { cs_tm :: Int -- Terms - , cs_ty :: Int -- Types - , cs_co :: Int -- Coercions - , cs_vb :: Int -- Local value bindings - , cs_jb :: Int } -- Local join bindings +import Data.List (foldl') + +data CoreStats = CS { cs_tm :: !Int -- Terms + , cs_ty :: !Int -- Types + , cs_co :: !Int -- Coercions + , cs_vb :: !Int -- Local value bindings + , cs_jb :: !Int } -- Local join bindings instance Outputable CoreStats where @@ -46,7 +48,7 @@ zeroCS = CS { cs_tm = 0, cs_ty = 0, cs_co = 0, cs_vb = 0, cs_jb = 0 } oneTM = zeroCS { cs_tm = 1 } sumCS :: (a -> CoreStats) -> [a] -> CoreStats -sumCS f = foldr (plusCS . f) zeroCS +sumCS f = foldl' (\s a -> plusCS s (f a)) zeroCS coreBindsStats :: [CoreBind] -> CoreStats coreBindsStats = sumCS (bindStats TopLevel) @@ -99,7 +101,7 @@ coreBindsSize :: [CoreBind] -> Int -- We use coreBindStats for user printout -- but this one is a quick and dirty basis for -- the simplifier's tick limit -coreBindsSize bs = foldr ((+) . bindSize) 0 bs +coreBindsSize bs = sum (map bindSize bs) exprSize :: CoreExpr -> Int -- ^ A measure of the size of the expressions, strictly greater than 0 @@ -111,7 +113,7 @@ exprSize (App f a) = exprSize f + exprSize a exprSize (Lam b e) = bndrSize b + exprSize e exprSize (Let b e) = bindSize b + exprSize e exprSize (Case e b t as) = seqType t `seq` - exprSize e + bndrSize b + 1 + foldr ((+) . altSize) 0 as + exprSize e + bndrSize b + 1 + sum (map altSize as) exprSize (Cast e co) = (seqCo co `seq` 1) + exprSize e exprSize (Tick n e) = tickSize n + exprSize e exprSize (Type t) = seqType t `seq` 1 @@ -132,7 +134,7 @@ bndrsSize = sum . map bndrSize bindSize :: CoreBind -> Int bindSize (NonRec b e) = bndrSize b + exprSize e -bindSize (Rec prs) = foldr ((+) . pairSize) 0 prs +bindSize (Rec prs) = sum (map pairSize prs) pairSize :: (Var, CoreExpr) -> Int pairSize (b,e) = bndrSize b + exprSize e From git at git.haskell.org Fri Mar 31 13:57:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 31 Mar 2017 13:57:37 +0000 (UTC) Subject: [commit: ghc] master: Disable bogus lint checks about levity polimorphic coerions (03c7dd0) Message-ID: <20170331135737.CDF743A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/03c7dd0941fb4974be54026ef3e4bb97451c3b1f/ghc >--------------------------------------------------------------- commit 03c7dd0941fb4974be54026ef3e4bb97451c3b1f Author: Joachim Breitner Date: Fri Mar 31 09:47:06 2017 -0400 Disable bogus lint checks about levity polimorphic coerions These checks, introduced in cea7141851ce653cb20207da3591d09e73fa396d hugely inflated build logs, which incapitated perf.haskell.org. According to Richard, the checks are useless and wrong, and that Ben plans to investigate. (https://phabricator.haskell.org/rGHCcea7141851ce653cb20207da3591d09e73fa396d#64647) Until that happens, I remove them from the code. >--------------------------------------------------------------- 03c7dd0941fb4974be54026ef3e4bb97451c3b1f compiler/coreSyn/CoreLint.hs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index 4c3da43..16edcb8 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -1646,11 +1646,7 @@ lintCoercion co@(UnivCo prov r ty1 ty2) -- see #9122 for discussion of these checks checkTypes t1 t2 - = do { checkWarnL lev_poly1 - (report "left-hand type is levity-polymorphic") - ; checkWarnL lev_poly2 - (report "right-hand type is levity-polymorphic") - ; when (not (lev_poly1 || lev_poly2)) $ + = do { when (not (lev_poly1 || lev_poly2)) $ do { checkWarnL (reps1 `equalLength` reps2) (report "between values with different # of reps") ; zipWithM_ validateCoercion reps1 reps2 }} From git at git.haskell.org Fri Mar 31 16:53:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 31 Mar 2017 16:53:00 +0000 (UTC) Subject: [commit: ghc] master: Refactor simplExpr (Type ty) (2964527) Message-ID: <20170331165300.247683A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/29645274a3c97a904759aa245dc8f8c03a58c601/ghc >--------------------------------------------------------------- commit 29645274a3c97a904759aa245dc8f8c03a58c601 Author: Simon Peyton Jones Date: Fri Mar 31 17:48:10 2017 +0100 Refactor simplExpr (Type ty) This small refactoring, provoked by comment:18 on Trac #13426, makes it so that simplExprF never gets a (Type ty) expression to simplify, which in turn means that calls to exprType on its argument will always succeed. No change in behaviour. >--------------------------------------------------------------- 29645274a3c97a904759aa245dc8f8c03a58c601 compiler/simplCore/Simplify.hs | 54 +++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 2e814b6..fdee2ce 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -355,10 +355,12 @@ simplBind :: SimplEnv -> TopLevelFlag -> RecFlag -> Maybe SimplCont -> InId -> OutId -- Binder, both pre-and post simpl -- The OutId has IdInfo, except arity, unfolding + -- Ids only, no TyVars -> InExpr -> SimplEnv -- The RHS and its environment -> SimplM SimplEnv simplBind env top_lvl is_rec mb_cont bndr bndr1 rhs rhs_se - | isJoinId bndr1 + | ASSERT( isId bndr1 ) + isJoinId bndr1 = ASSERT(isNotTopLevel top_lvl && isJust mb_cont) simplJoinBind env is_rec (fromJust mb_cont) bndr bndr1 rhs rhs_se | otherwise @@ -368,12 +370,14 @@ simplLazyBind :: SimplEnv -> TopLevelFlag -> RecFlag -> InId -> OutId -- Binder, both pre-and post simpl -- The OutId has IdInfo, except arity, unfolding + -- Ids only, no TyVars -> InExpr -> SimplEnv -- The RHS and its environment -> SimplM SimplEnv -- Precondition: rhs obeys the let/app invariant -- NOT used for JoinIds simplLazyBind env top_lvl is_rec bndr bndr1 rhs rhs_se - = ASSERT2( not (isJoinId bndr), ppr bndr ) + = ASSERT( isId bndr ) + ASSERT2( not (isJoinId bndr), ppr bndr ) -- pprTrace "simplLazyBind" ((ppr bndr <+> ppr bndr1) $$ ppr rhs $$ ppr (seIdSubst rhs_se)) $ do { let rhs_env = rhs_se `setInScopeAndZapFloats` env (tvs, body) = case collectTyAndValBinders rhs of @@ -969,12 +973,22 @@ might do the same again. -} simplExpr :: SimplEnv -> CoreExpr -> SimplM CoreExpr -simplExpr env expr = simplExprC env expr (mkBoringStop expr_out_ty) +simplExpr env (Type ty) + = do { ty' <- simplType env ty + ; return (Type ty') } + +simplExpr env expr + = simplExprC env expr (mkBoringStop expr_out_ty) where expr_out_ty :: OutType expr_out_ty = substTy env (exprType expr) + -- NB: Since 'expr' is term-valued, not (Type ty), this call + -- to exprType will succeed. exprType fails on (Type ty). -simplExprC :: SimplEnv -> CoreExpr -> SimplCont -> SimplM CoreExpr +simplExprC :: SimplEnv + -> InExpr -- A term-valued expression, never (Type ty) + -> SimplCont + -> SimplM OutExpr -- Simplify an expression, given a continuation simplExprC env expr cont = -- pprTrace "simplExprC" (ppr expr $$ ppr cont {- $$ ppr (seIdSubst env) -} $$ ppr (seFloats env) ) $ @@ -985,7 +999,9 @@ simplExprC env expr cont return (wrapFloats env' expr') } -------------------------------------------------- -simplExprF :: SimplEnv -> InExpr -> SimplCont +simplExprF :: SimplEnv + -> InExpr -- A term-valued expression, never (Type ty) + -> SimplCont -> SimplM (SimplEnv, OutExpr) simplExprF env e cont @@ -1002,13 +1018,19 @@ simplExprF env e cont simplExprF1 :: SimplEnv -> InExpr -> SimplCont -> SimplM (SimplEnv, OutExpr) + +simplExprF1 _ (Type ty) _ + = pprPanic "simplExprF: type" (ppr ty) + -- simplExprF does only with term-valued expressions + -- The (Type ty) case is handled separately by simplExpr + -- and by the other callers of simplExprF + simplExprF1 env (Var v) cont = simplIdF env v cont simplExprF1 env (Lit lit) cont = rebuild env (Lit lit) cont simplExprF1 env (Tick t expr) cont = simplTick env t expr cont simplExprF1 env (Cast body co) cont = simplCast env body co cont simplExprF1 env (Coercion co) cont = simplCoercionF env co cont -simplExprF1 env (Type ty) cont = ASSERT( contIsRhsOrArg cont ) - rebuild env (Type (substTy env ty)) cont + simplExprF1 env (App fun arg) cont = simplExprF env fun $ @@ -1050,6 +1072,12 @@ simplExprF1 env (Let (Rec pairs) body) cont = simplRecE env pairs body cont simplExprF1 env (Let (NonRec bndr rhs) body) cont + | Type ty <- rhs -- First deal with type lets (let a = Type ty in e) + = ASSERT( isTyVar bndr ) + do { ty' <- simplType env ty + ; simplExprF (extendTvSubst env bndr ty') body cont } + + | otherwise = simplNonRecE env bndr (rhs, env) ([], body) cont --------------------------------- @@ -1423,7 +1451,7 @@ simplLamBndr env bndr ------------------ simplNonRecE :: SimplEnv - -> InBndr -- The binder + -> InId -- The binder, always an Id for simplNonRecE -> (InExpr, SimplEnv) -- Rhs of binding (or arg of lambda) -> ([InBndr], InExpr) -- Body of the let/lambda -- \xs.e @@ -1445,15 +1473,9 @@ simplNonRecE :: SimplEnv -- Why? Because of the binder-occ-info-zapping done before -- the call to simplLam in simplExprF (Lam ...) - -- First deal with type applications and type lets - -- (/\a. e) (Type ty) and (let a = Type ty in e) -simplNonRecE env bndr (Type ty_arg, rhs_se) (bndrs, body) cont - = ASSERT( isTyVar bndr ) - do { ty_arg' <- simplType (rhs_se `setInScopeAndZapFloats` env) ty_arg - ; simplLam (extendTvSubst env bndr ty_arg') bndrs body cont } - simplNonRecE env bndr (rhs, rhs_se) (bndrs, body) cont - = do dflags <- getDynFlags + = ASSERT( isId bndr ) + do dflags <- getDynFlags case () of _ | preInlineUnconditionally dflags env NotTopLevel bndr rhs -> do { tick (PreInlineUnconditionally bndr) From git at git.haskell.org Fri Mar 31 22:18:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 31 Mar 2017 22:18:30 +0000 (UTC) Subject: [commit: ghc] master: Clean up coreView/tcView. (6575f4b) Message-ID: <20170331221830.B9A6E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6575f4b635a393775295798ca86c7c3ba00819be/ghc >--------------------------------------------------------------- commit 6575f4b635a393775295798ca86c7c3ba00819be Author: Ben Gamari Date: Mon Mar 27 13:17:00 2017 -0400 Clean up coreView/tcView. In Core, Constraint should be considered fully equal to TYPE LiftedRep, in all ways. Accordingly, coreView should unwrap Constraint to become TYPE LiftedRep. Of course, this would be a disaster in the type checker. So, where previously we used coreView in both the type checker and in Core, we now have coreView and tcView, which differ only in their treatment of Constraint. Historical note: once upon a past, we had tcView distinct from coreView. Back then, it was because newtypes were unwrapped in Core but not in the type checker. The distinction is back, but for a different reason than before. This had a few knock-on effects: * The Typeable solver must explicitly handle Constraint to ensure that we produce the correct evidence. * TypeMap now respects the Constraint/Type distinction Finished by: bgamari Test Plan: ./validate Reviewers: simonpj, austin, bgamari Reviewed By: simonpj Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3316 >--------------------------------------------------------------- 6575f4b635a393775295798ca86c7c3ba00819be compiler/coreSyn/TrieMap.hs | 23 +++++-- compiler/simplStg/RepType.hs | 2 +- compiler/typecheck/TcCanonical.hs | 12 ++-- compiler/typecheck/TcErrors.hs | 2 +- compiler/typecheck/TcForeign.hs | 2 +- compiler/typecheck/TcGenFunctor.hs | 2 +- compiler/typecheck/TcHsType.hs | 2 +- compiler/typecheck/TcInteract.hs | 4 +- compiler/typecheck/TcType.hs | 65 ++++++------------ compiler/typecheck/TcTypeable.hs | 4 +- compiler/typecheck/TcUnify.hs | 22 +++---- compiler/typecheck/TcValidity.hs | 8 +-- compiler/types/Kind.hs | 17 +++-- compiler/types/Type.hs | 77 ++++++++++++++++++---- compiler/types/Type.hs-boot | 3 +- compiler/types/Unify.hs | 13 ++-- .../tests/roles/should_compile/Roles14.stderr | 5 +- testsuite/tests/roles/should_compile/Roles3.stderr | 12 ++-- testsuite/tests/roles/should_compile/Roles4.stderr | 7 +- testsuite/tests/roles/should_compile/T8958.stderr | 8 ++- testsuite/tests/typecheck/should_run/T11715.hs | 21 ++++++ testsuite/tests/typecheck/should_run/T11715.stderr | 3 + testsuite/tests/typecheck/should_run/TypeOf.stdout | 12 ++-- .../tests/typecheck/should_run/TypeRep.stdout | 10 +-- testsuite/tests/typecheck/should_run/all.T | 1 + 25 files changed, 212 insertions(+), 125 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 6575f4b635a393775295798ca86c7c3ba00819be From git at git.haskell.org Fri Mar 31 22:18:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 31 Mar 2017 22:18:33 +0000 (UTC) Subject: [commit: ghc] master: Fix space leaks in simplifier (#13426) (e13419c) Message-ID: <20170331221833.7A9613A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e13419c5562ed0aa587516255d1dbb48a8165457/ghc >--------------------------------------------------------------- commit e13419c5562ed0aa587516255d1dbb48a8165457 Author: Reid Barton Date: Fri Mar 31 11:37:38 2017 -0400 Fix space leaks in simplifier (#13426) The Join points commit (8d5cf8bf) introduced a space leak somewhere in the simplifier. The extra strictness added in this commit fixes the leak. Unfortunately I don't really understand the details. Unfortunately, the extra strictness appears to result in more overall allocations in some cases, even while the peak heap size decreases in others. Test Plan: harbormaster Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3399 >--------------------------------------------------------------- e13419c5562ed0aa587516255d1dbb48a8165457 compiler/simplCore/Simplify.hs | 5 ++++- testsuite/tests/perf/compiler/all.T | 15 ++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index fdee2ce..a518618 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -2251,7 +2251,10 @@ reallyRebuildCase env scrut case_bndr alts cont ; dflags <- getDynFlags ; let alts_ty' = contResultType dup_cont - ; case_expr <- mkCase dflags scrut' case_bndr' alts_ty' alts' + -- The seqType below is needed to avoid a space leak (#13426) + -- but I don't know why. + ; case_expr <- seqType alts_ty' `seq` + mkCase dflags scrut' case_bndr' alts_ty' alts' -- Notice that rebuild gets the in-scope set from env', not alt_env -- (which in any case is only build in simplAlts) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index a390830..595fb59 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -39,7 +39,7 @@ test('T1969', # 2013-11-13 17 (x86/Windows, 64bit machine) # 2015-07-11 21 (x86/Linux, 64bit machine) use +RTS -G1 # 2016-04-06 30 (x86/Linux, 64bit machine) - (wordsize(64), 83, 20)]), + (wordsize(64), 61, 20)]), # 28 (amd64/Linux) # 34 (amd64/Linux) # 2012-09-20 23 (amd64/Linux) @@ -54,6 +54,7 @@ test('T1969', # 2016-10-20 68, (amd64/Linux) allow top-level string literals # See the comment 16 on #8472. # 2017-02-17 83 (amd64/Linux) Type-indexed Typeable + # 2017-03-31 61 (amd64/Linux) Fix memory leak in simplifier compiler_stats_num_field('max_bytes_used', [(platform('i386-unknown-mingw32'), 5719436, 20), # 2010-05-17 5717704 (x86/Windows) @@ -70,7 +71,7 @@ test('T1969', # 2016-04-06 9093608 (x86/Linux, 64bit machine) # 2017-03-24 9261052 (x86/Linux, 64-bit machine) - (wordsize(64), 19924328, 15)]), + (wordsize(64), 16679176, 15)]), # 2014-09-10 10463640, 10 # post-AMP-update (somewhat stabelish) # looks like the peak is around ~10M, but we're # unlikely to GC exactly on the peak. @@ -84,6 +85,7 @@ test('T1969', # 2016-10-12 17285216 (amd64/Linux) it's not entirely clear why # 2017-02-01 19924328 (amd64/Linux) Join points (#12988) # 2017-02-14 16393848 Early inline patch + # 2017-03-31 16679176 Fix memory leak in simplifier compiler_stats_num_field('bytes allocated', [(platform('i386-unknown-mingw32'), 301784492, 5), @@ -325,7 +327,7 @@ test('T3064', # 2016-04-06: 153261024 (x86/Linux) probably wildcard refactor # 2017-03-24: 134044092 (x86/Linux, 64-bit machine) Update - (wordsize(64), 259815560, 5)]), + (wordsize(64), 265950920, 5)]), # (amd64/Linux) (2011-06-28): 73259544 # (amd64/Linux) (2013-02-07): 224798696 # (amd64/Linux) (2013-08-02): 236404384, increase from roles @@ -350,6 +352,7 @@ test('T3064', # of zonkTcType (Trac #11882) # (amd64/Darwin) (2017-01-23): 306222424 Presumably creep from recent changes (Typeable?) # (amd64/Linux) (2017-02-14): 259815560 Early inline patch: 9% improvement + # (amd64/Linux) (2017-03-31): 265950920 Fix memory leak in simplifier ################################### # deactivated for now, as this metric became too volatile recently @@ -434,7 +437,7 @@ test('T5631', # 2014-04-04: 346389856 (x86 Windows, 64 bit machine) # 2014-12-01: 390199244 (Windows laptop) # 2016-04-06: 570137436 (amd64/Linux) many reasons - (wordsize(64), 1065147968, 5)]), + (wordsize(64), 1037482512, 5)]), # expected value: 774595008 (amd64/Linux): # expected value: 735486328 (amd64/Linux) 2012/12/12: # expected value: 690742040 (amd64/Linux) Call Arity improvements @@ -448,6 +451,7 @@ test('T5631', # 2016-11-10: 1077429456 (amd64/Linux) Stop -dno-debug-output suppressing -ddump-tc-trace # 2017-02-17: 1517484488 (amd64/Linux) Type-indexed Typeable # 2017-03-03: 1065147968 (amd64/Linux) Share Typeable KindReps + # 2017-03-31: 1037482512 (amd64/Linux) Fix memory leak in simplifier only_ways(['normal']) ], compile, @@ -713,7 +717,7 @@ test('T9020', # Original: 381360728 # 2014-07-31: 343005716 (Windows) (general round of updates) # 2017-03-24: 249904136 (x86/Linux, 64-bit machine) - (wordsize(64), 500707080, 10)]) + (wordsize(64), 493596312, 10)]) # prev: 795469104 # 2014-07-17: 728263536 (general round of updates) # 2014-09-10: 785871680 post-AMP-cleanup @@ -725,6 +729,7 @@ test('T9020', # 2017-02-03: 764866144 Join points # 2017-02-14: 500707080 Early inline patch; 35% decrease! # Program size collapses in first simplification + # 2017-03-31: 493596312 Fix memory leak in simplifier ], compile,['']) From git at git.haskell.org Fri Mar 31 23:01:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 31 Mar 2017 23:01:04 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Refactor simplExpr (Type ty) (4d72429) Message-ID: <20170331230104.BAD6E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/4d724299a3aedfaec99b7d14187736fe5886de1a/ghc >--------------------------------------------------------------- commit 4d724299a3aedfaec99b7d14187736fe5886de1a Author: Simon Peyton Jones Date: Fri Mar 31 17:48:10 2017 +0100 Refactor simplExpr (Type ty) This small refactoring, provoked by comment:18 on Trac #13426, makes it so that simplExprF never gets a (Type ty) expression to simplify, which in turn means that calls to exprType on its argument will always succeed. No change in behaviour. (cherry picked from commit 29645274a3c97a904759aa245dc8f8c03a58c601) >--------------------------------------------------------------- 4d724299a3aedfaec99b7d14187736fe5886de1a compiler/simplCore/Simplify.hs | 54 +++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 944d8de..2cb063d 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -354,10 +354,12 @@ simplBind :: SimplEnv -> TopLevelFlag -> RecFlag -> Maybe SimplCont -> InId -> OutId -- Binder, both pre-and post simpl -- The OutId has IdInfo, except arity, unfolding + -- Ids only, no TyVars -> InExpr -> SimplEnv -- The RHS and its environment -> SimplM SimplEnv simplBind env top_lvl is_rec mb_cont bndr bndr1 rhs rhs_se - | isJoinId bndr1 + | ASSERT( isId bndr1 ) + isJoinId bndr1 = ASSERT(isNotTopLevel top_lvl && isJust mb_cont) simplJoinBind env is_rec (fromJust mb_cont) bndr bndr1 rhs rhs_se | otherwise @@ -367,12 +369,14 @@ simplLazyBind :: SimplEnv -> TopLevelFlag -> RecFlag -> InId -> OutId -- Binder, both pre-and post simpl -- The OutId has IdInfo, except arity, unfolding + -- Ids only, no TyVars -> InExpr -> SimplEnv -- The RHS and its environment -> SimplM SimplEnv -- Precondition: rhs obeys the let/app invariant -- NOT used for JoinIds simplLazyBind env top_lvl is_rec bndr bndr1 rhs rhs_se - = ASSERT2( not (isJoinId bndr), ppr bndr ) + = ASSERT( isId bndr ) + ASSERT2( not (isJoinId bndr), ppr bndr ) -- pprTrace "simplLazyBind" ((ppr bndr <+> ppr bndr1) $$ ppr rhs $$ ppr (seIdSubst rhs_se)) $ do { let rhs_env = rhs_se `setInScopeAndZapFloats` env (tvs, body) = case collectTyAndValBinders rhs of @@ -962,12 +966,22 @@ might do the same again. -} simplExpr :: SimplEnv -> CoreExpr -> SimplM CoreExpr -simplExpr env expr = simplExprC env expr (mkBoringStop expr_out_ty) +simplExpr env (Type ty) + = do { ty' <- simplType env ty + ; return (Type ty') } + +simplExpr env expr + = simplExprC env expr (mkBoringStop expr_out_ty) where expr_out_ty :: OutType expr_out_ty = substTy env (exprType expr) + -- NB: Since 'expr' is term-valued, not (Type ty), this call + -- to exprType will succeed. exprType fails on (Type ty). -simplExprC :: SimplEnv -> CoreExpr -> SimplCont -> SimplM CoreExpr +simplExprC :: SimplEnv + -> InExpr -- A term-valued expression, never (Type ty) + -> SimplCont + -> SimplM OutExpr -- Simplify an expression, given a continuation simplExprC env expr cont = -- pprTrace "simplExprC" (ppr expr $$ ppr cont {- $$ ppr (seIdSubst env) -} $$ ppr (seFloats env) ) $ @@ -978,7 +992,9 @@ simplExprC env expr cont return (wrapFloats env' expr') } -------------------------------------------------- -simplExprF :: SimplEnv -> InExpr -> SimplCont +simplExprF :: SimplEnv + -> InExpr -- A term-valued expression, never (Type ty) + -> SimplCont -> SimplM (SimplEnv, OutExpr) simplExprF env e cont @@ -995,13 +1011,19 @@ simplExprF env e cont simplExprF1 :: SimplEnv -> InExpr -> SimplCont -> SimplM (SimplEnv, OutExpr) + +simplExprF1 _ (Type ty) _ + = pprPanic "simplExprF: type" (ppr ty) + -- simplExprF does only with term-valued expressions + -- The (Type ty) case is handled separately by simplExpr + -- and by the other callers of simplExprF + simplExprF1 env (Var v) cont = simplIdF env v cont simplExprF1 env (Lit lit) cont = rebuild env (Lit lit) cont simplExprF1 env (Tick t expr) cont = simplTick env t expr cont simplExprF1 env (Cast body co) cont = simplCast env body co cont simplExprF1 env (Coercion co) cont = simplCoercionF env co cont -simplExprF1 env (Type ty) cont = ASSERT( contIsRhsOrArg cont ) - rebuild env (Type (substTy env ty)) cont + simplExprF1 env (App fun arg) cont = simplExprF env fun $ @@ -1043,6 +1065,12 @@ simplExprF1 env (Let (Rec pairs) body) cont = simplRecE env pairs body cont simplExprF1 env (Let (NonRec bndr rhs) body) cont + | Type ty <- rhs -- First deal with type lets (let a = Type ty in e) + = ASSERT( isTyVar bndr ) + do { ty' <- simplType env ty + ; simplExprF (extendTvSubst env bndr ty') body cont } + + | otherwise = simplNonRecE env bndr (rhs, env) ([], body) cont --------------------------------- @@ -1416,7 +1444,7 @@ simplLamBndr env bndr ------------------ simplNonRecE :: SimplEnv - -> InBndr -- The binder + -> InId -- The binder, always an Id for simplNonRecE -> (InExpr, SimplEnv) -- Rhs of binding (or arg of lambda) -> ([InBndr], InExpr) -- Body of the let/lambda -- \xs.e @@ -1438,15 +1466,9 @@ simplNonRecE :: SimplEnv -- Why? Because of the binder-occ-info-zapping done before -- the call to simplLam in simplExprF (Lam ...) - -- First deal with type applications and type lets - -- (/\a. e) (Type ty) and (let a = Type ty in e) -simplNonRecE env bndr (Type ty_arg, rhs_se) (bndrs, body) cont - = ASSERT( isTyVar bndr ) - do { ty_arg' <- simplType (rhs_se `setInScopeAndZapFloats` env) ty_arg - ; simplLam (extendTvSubst env bndr ty_arg') bndrs body cont } - simplNonRecE env bndr (rhs, rhs_se) (bndrs, body) cont - = do dflags <- getDynFlags + = ASSERT( isId bndr ) + do dflags <- getDynFlags case () of _ | preInlineUnconditionally dflags env NotTopLevel bndr rhs -> do { tick (PreInlineUnconditionally bndr) From git at git.haskell.org Fri Mar 31 23:01:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 31 Mar 2017 23:01:07 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Disable bogus lint checks about levity polimorphic coerions (8189295) Message-ID: <20170331230107.7AA053A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/81892956341b0915b8a6928bc3382fab7ce58608/ghc >--------------------------------------------------------------- commit 81892956341b0915b8a6928bc3382fab7ce58608 Author: Joachim Breitner Date: Fri Mar 31 09:47:06 2017 -0400 Disable bogus lint checks about levity polimorphic coerions These checks, introduced in cea7141851ce653cb20207da3591d09e73fa396d hugely inflated build logs, which incapitated perf.haskell.org. According to Richard, the checks are useless and wrong, and that Ben plans to investigate. (https://phabricator.haskell.org/rGHCcea7141851ce653cb20207da3591d09e73fa396d#64647) Until that happens, I remove them from the code. (cherry picked from commit 03c7dd0941fb4974be54026ef3e4bb97451c3b1f) >--------------------------------------------------------------- 81892956341b0915b8a6928bc3382fab7ce58608 compiler/coreSyn/CoreLint.hs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index 3029990..c1db52b 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -1644,11 +1644,7 @@ lintCoercion co@(UnivCo prov r ty1 ty2) -- see #9122 for discussion of these checks checkTypes t1 t2 - = do { checkWarnL lev_poly1 - (report "left-hand type is levity-polymorphic") - ; checkWarnL lev_poly2 - (report "right-hand type is levity-polymorphic") - ; when (not (lev_poly1 || lev_poly2)) $ + = do { when (not (lev_poly1 || lev_poly2)) $ do { checkWarnL (reps1 `equalLength` reps2) (report "between values with different # of reps") ; zipWithM_ validateCoercion reps1 reps2 }} From git at git.haskell.org Fri Mar 31 23:01:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 31 Mar 2017 23:01:11 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Clean up coreView/tcView. (6a1331c) Message-ID: <20170331230111.62D243A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/6a1331ca25fcf1b20de1b44d9f2d50cbab5056f9/ghc >--------------------------------------------------------------- commit 6a1331ca25fcf1b20de1b44d9f2d50cbab5056f9 Author: Ben Gamari Date: Mon Mar 27 13:17:00 2017 -0400 Clean up coreView/tcView. In Core, Constraint should be considered fully equal to TYPE LiftedRep, in all ways. Accordingly, coreView should unwrap Constraint to become TYPE LiftedRep. Of course, this would be a disaster in the type checker. So, where previously we used coreView in both the type checker and in Core, we now have coreView and tcView, which differ only in their treatment of Constraint. Historical note: once upon a past, we had tcView distinct from coreView. Back then, it was because newtypes were unwrapped in Core but not in the type checker. The distinction is back, but for a different reason than before. This had a few knock-on effects: * The Typeable solver must explicitly handle Constraint to ensure that we produce the correct evidence. * TypeMap now respects the Constraint/Type distinction Finished by: bgamari Test Plan: ./validate Reviewers: simonpj, austin, bgamari Reviewed By: simonpj Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3316 (cherry picked from commit 6575f4b635a393775295798ca86c7c3ba00819be) >--------------------------------------------------------------- 6a1331ca25fcf1b20de1b44d9f2d50cbab5056f9 compiler/coreSyn/TrieMap.hs | 23 +++++-- compiler/simplStg/RepType.hs | 2 +- compiler/typecheck/TcCanonical.hs | 12 ++-- compiler/typecheck/TcErrors.hs | 2 +- compiler/typecheck/TcForeign.hs | 2 +- compiler/typecheck/TcGenFunctor.hs | 2 +- compiler/typecheck/TcHsType.hs | 2 +- compiler/typecheck/TcInteract.hs | 4 +- compiler/typecheck/TcType.hs | 65 ++++++------------ compiler/typecheck/TcTypeable.hs | 4 +- compiler/typecheck/TcUnify.hs | 22 +++---- compiler/typecheck/TcValidity.hs | 8 +-- compiler/types/Kind.hs | 17 +++-- compiler/types/Type.hs | 77 ++++++++++++++++++---- compiler/types/Type.hs-boot | 3 +- compiler/types/Unify.hs | 13 ++-- .../tests/roles/should_compile/Roles14.stderr | 5 +- testsuite/tests/roles/should_compile/Roles3.stderr | 12 ++-- testsuite/tests/roles/should_compile/Roles4.stderr | 7 +- testsuite/tests/roles/should_compile/T8958.stderr | 8 ++- testsuite/tests/typecheck/should_run/T11715.hs | 21 ++++++ testsuite/tests/typecheck/should_run/T11715.stderr | 3 + testsuite/tests/typecheck/should_run/TypeOf.stdout | 12 ++-- .../tests/typecheck/should_run/TypeRep.stdout | 10 +-- testsuite/tests/typecheck/should_run/all.T | 1 + 25 files changed, 212 insertions(+), 125 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 6a1331ca25fcf1b20de1b44d9f2d50cbab5056f9 From git at git.haskell.org Fri Mar 31 23:01:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 31 Mar 2017 23:01:14 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix space leaks in simplifier (#13426) (0d20cc1) Message-ID: <20170331230114.2BE933A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/0d20cc11c95de33b8a125555c16d2b0860030227/ghc >--------------------------------------------------------------- commit 0d20cc11c95de33b8a125555c16d2b0860030227 Author: Reid Barton Date: Fri Mar 31 11:37:38 2017 -0400 Fix space leaks in simplifier (#13426) The Join points commit (8d5cf8bf) introduced a space leak somewhere in the simplifier. The extra strictness added in this commit fixes the leak. Unfortunately I don't really understand the details. Unfortunately, the extra strictness appears to result in more overall allocations in some cases, even while the peak heap size decreases in others. Test Plan: harbormaster Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3399 (cherry picked from commit e13419c5562ed0aa587516255d1dbb48a8165457) >--------------------------------------------------------------- 0d20cc11c95de33b8a125555c16d2b0860030227 compiler/simplCore/Simplify.hs | 5 ++++- testsuite/tests/perf/compiler/all.T | 37 ++++++++++++++++++++++--------------- 2 files changed, 26 insertions(+), 16 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 0d20cc11c95de33b8a125555c16d2b0860030227 From git at git.haskell.org Fri Mar 31 23:28:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 31 Mar 2017 23:28:53 +0000 (UTC) Subject: [commit: packages/array] master: Fix expected output for T229 on 32-bit machines (3a77ef5) Message-ID: <20170331232853.6FD923A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array On branch : master Link : http://git.haskell.org/packages/array.git/commitdiff/3a77ef51f0f3292a9a0bea25c5954e2e3f61521d >--------------------------------------------------------------- commit 3a77ef51f0f3292a9a0bea25c5954e2e3f61521d Author: Ben Gamari Date: Fri Mar 31 19:24:51 2017 -0400 Fix expected output for T229 on 32-bit machines >--------------------------------------------------------------- 3a77ef51f0f3292a9a0bea25c5954e2e3f61521d tests/{T229.stderr => T229.stderr-ws-32} | 2 +- tests/{T229.stderr => T229.stderr-ws-64} | 0 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/T229.stderr b/tests/T229.stderr-ws-32 similarity index 62% copy from tests/T229.stderr copy to tests/T229.stderr-ws-32 index 6a5c456..75f3313 100644 --- a/tests/T229.stderr +++ b/tests/T229.stderr-ws-32 @@ -1,3 +1,3 @@ -T229: Data.Array.Base.safe_scale: Overflow; scale: 4, n: 4611686018427387904 +T229: Data.Array.Base.safe_scale: Overflow; scale: 4, n: 1073741824 CallStack (from HasCallStack): error, called at libraries/array/Data/Array/Base.hs:1356:20 in array-0.5.1.2:Data.Array.Base diff --git a/tests/T229.stderr b/tests/T229.stderr-ws-64 similarity index 100% rename from tests/T229.stderr rename to tests/T229.stderr-ws-64 From git at git.haskell.org Fri Mar 31 23:29:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 31 Mar 2017 23:29:24 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: More 32-bit performance changes (aa295c3) Message-ID: <20170331232924.45FCD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/aa295c31f0bfbdb34e039099cdbb249818cb996d/ghc >--------------------------------------------------------------- commit aa295c31f0bfbdb34e039099cdbb249818cb996d Author: Ben Gamari Date: Mon Mar 27 08:16:18 2017 -0400 testsuite: More 32-bit performance changes (cherry picked from commit fb7e5bd350407888d6638e15d16aad311d7d9006) >--------------------------------------------------------------- aa295c31f0bfbdb34e039099cdbb249818cb996d testsuite/tests/perf/compiler/all.T | 4 ++-- testsuite/tests/perf/haddock/all.T | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 747e295..4b89906 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -820,10 +820,10 @@ test('T9872b', # 2016-09-15: 4069522928 Fix #12422 # 2017-02-14 3730686224 Early inlining: 5% improvement - (wordsize(32), 1740903516, 5) + (wordsize(32), 1894037608, 5) # was 1700000000 # 2016-04-06 2422750696 x86/Linux - # 2017-03-24 1740903516 x86/Linux, 64-bit machine + # 2017-03-24 1894037608 x86/Linux, 64-bit machine ]), ], compile_fail, diff --git a/testsuite/tests/perf/haddock/all.T b/testsuite/tests/perf/haddock/all.T index 461a3a5..65e1644 100644 --- a/testsuite/tests/perf/haddock/all.T +++ b/testsuite/tests/perf/haddock/all.T @@ -47,14 +47,14 @@ test('haddock.base', # 2014-12-01: 4202377432 (x86/Windows, 64bit machine) # 2015-01-20: 4434804940 (x86/Windows, 64bit machine) - ,(wordsize(32), 3623926468, 5)]) + ,(wordsize(32), 3819657568, 5)]) # 2012-08-14: 3046487920 (x86/OSX) # 2012-10-30: 2955470952 (x86/Windows) # 2013-02-10: 3146596848 (x86/OSX) # 2014-02-22: 3554624600 (x86/Linux - new haddock) # 2014-06-29: 3799130400 (x86/Linux) # 2016-04-06: 5509757068 (x86/Linux) - # 2017-03-24: 3623926468 (x86/Linux) + # 2017-03-24: 3819657568 (x86/Linux) ], stats, ['haddock.t']) @@ -157,12 +157,12 @@ test('haddock.compiler', # 2014-12-01: 104140852 (x86/Windows, sudden shrinkage!) # 2014-12-10: 217933548 increased again - ,(wordsize(32), 3872262112, 5)]) + ,(wordsize(32), 118738876, 5)]) # 2012-08-14: 13471797488 (x86/OSX) # 2014-01-22: 14581475024 (x86/Linux - new haddock) # 2014-06-29: 15110426000 (x86/Linux) # 2016-04-06: 16222702892 (x86/Linux) - # 2017-03-24: 3872262112 (x86/Linux) + # 2017-03-24: 118738876 (x86/Linux) ], stats, ['haddock.t']) From git at git.haskell.org Fri Mar 31 23:29:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 31 Mar 2017 23:29:29 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump array submodule (67cafbf) Message-ID: <20170331232929.ADCA03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/67cafbf592f9fb6ab0cc8eeed87fde9d39f36e8c/ghc >--------------------------------------------------------------- commit 67cafbf592f9fb6ab0cc8eeed87fde9d39f36e8c Author: Ben Gamari Date: Fri Mar 31 19:29:00 2017 -0400 Bump array submodule >--------------------------------------------------------------- 67cafbf592f9fb6ab0cc8eeed87fde9d39f36e8c libraries/array | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/array b/libraries/array index c58ecfa..3a77ef5 160000 --- a/libraries/array +++ b/libraries/array @@ -1 +1 @@ -Subproject commit c58ecfadbe68486e9eab925c9c44d667316b2d14 +Subproject commit 3a77ef51f0f3292a9a0bea25c5954e2e3f61521d From git at git.haskell.org Fri Mar 31 23:29:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 31 Mar 2017 23:29:27 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Bump haddock.compiler allocations (172d722) Message-ID: <20170331232927.04AD83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/172d7228f11d64732dd80d62d2194f7325b8636c/ghc >--------------------------------------------------------------- commit 172d7228f11d64732dd80d62d2194f7325b8636c Author: Ben Gamari Date: Fri Mar 31 19:19:24 2017 -0400 testsuite: Bump haddock.compiler allocations >--------------------------------------------------------------- 172d7228f11d64732dd80d62d2194f7325b8636c testsuite/tests/perf/haddock/all.T | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/perf/haddock/all.T b/testsuite/tests/perf/haddock/all.T index 65e1644..0ad07ec 100644 --- a/testsuite/tests/perf/haddock/all.T +++ b/testsuite/tests/perf/haddock/all.T @@ -157,12 +157,13 @@ test('haddock.compiler', # 2014-12-01: 104140852 (x86/Windows, sudden shrinkage!) # 2014-12-10: 217933548 increased again - ,(wordsize(32), 118738876, 5)]) + ,(wordsize(32), 137383060, 5)]) # 2012-08-14: 13471797488 (x86/OSX) # 2014-01-22: 14581475024 (x86/Linux - new haddock) # 2014-06-29: 15110426000 (x86/Linux) # 2016-04-06: 16222702892 (x86/Linux) # 2017-03-24: 118738876 (x86/Linux) + # 2017-03-31: 137383060 (x86/Linux) ], stats, ['haddock.t'])